Skip to content

Commit

Permalink
adds_vertex_transaction_type_to_plans
Browse files Browse the repository at this point in the history
  • Loading branch information
8eth committed Oct 31, 2024
1 parent 4c3f944 commit 8b5e590
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions recurly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,7 @@ class Plan(Resource):
'updated_at',
'tax_exempt',
'tax_code',
'vertex_transaction_type',
'unit_amount_in_cents',
'setup_fee_in_cents',
'total_billing_cycles',
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/plan/created.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Content-Type: application/xml; charset=utf-8
<unit_amount_in_cents>
<USD type="integer">1000</USD>
</unit_amount_in_cents>
<vertex_transaction_type>rental</vertex_transaction_type>
</plan>

HTTP/1.1 201 Created
Expand All @@ -48,6 +49,7 @@ Location: https://api.recurly.com/v2/plans/planmock
<trial_interval_unit>days</trial_interval_unit>
<total_billing_cycles type="integer">10</total_billing_cycles>
<created_at type="datetime">2011-10-03T22:23:12Z</created_at>
<vertex_transaction_type>rental</vertex_transaction_type>
<unit_amount_in_cents>
<USD type="integer">1000</USD>
</unit_amount_in_cents>
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/plan/show-taxed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Content-Type: application/xml; charset=utf-8
<trial_interval_unit>days</trial_interval_unit>
<created_at type="datetime">2011-10-03T22:23:12Z</created_at>
<tax_exempt type="boolean">true</tax_exempt>
<vertex_transaction_type>sale</vertex_transaction_type>
<unit_amount_in_cents>
</unit_amount_in_cents>
<setup_fee_in_cents>
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/plan/updated.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Content-Type: application/xml; charset=utf-8
<unit_amount_in_cents>
<USD type="integer">2000</USD>
</unit_amount_in_cents>
<vertex_transaction_type>sale</vertex_transaction_type>
</plan>

HTTP/1.1 200 OK
Expand All @@ -41,6 +42,7 @@ Content-Type: application/xml; charset=utf-8
<trial_interval_unit>days</trial_interval_unit>
<setup_fee_accounting_code>Setup Fee AC</setup_fee_accounting_code>
<created_at type="datetime">2011-10-03T22:23:12Z</created_at>
<vertex_transaction_type>sale</vertex_transaction_type>
<unit_amount_in_cents>
<USD type="integer">2000</USD>
</unit_amount_in_cents>
Expand Down
6 changes: 5 additions & 1 deletion tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,7 @@ def test_plan(self):
unit_amount_in_cents=Money(1000),
total_billing_cycles=10,
custom_fields=[CustomField(name='food', value='pizza')],
vertex_transaction_type='rental'
)
with self.mock_request('plan/created.xml'):
plan.save()
Expand All @@ -2082,6 +2083,7 @@ def test_plan(self):
self.assertIsInstance(plan.custom_fields[0], CustomField)
self.assertEqual(plan.custom_fields[0].name, 'food')
self.assertEqual(plan.custom_fields[0].value, 'pizza')
self.assertEqual(plan.vertex_transaction_type, 'rental')

with self.mock_request('plan/exists.xml'):
same_plan = Plan.get(plan_code)
Expand All @@ -2094,6 +2096,7 @@ def test_plan(self):
plan.unit_amount_in_cents = Money(USD=2000)
plan.setup_fee_in_cents = Money(USD=200)
plan.setup_fee_accounting_code = 'Setup Fee AC'
plan.vertex_transaction_type = 'sale'
with self.mock_request('plan/updated.xml'):
plan.save()
finally:
Expand All @@ -2104,6 +2107,7 @@ def test_plan(self):
with self.mock_request('plan/show-taxed.xml'):
plan = Plan.get(plan_code)
self.assertTrue(plan.tax_exempt)
self.assertEqual(plan.vertex_transaction_type, 'sale')

def test_plan_with_ramps(self):
plan_code = 'plan%s' % self.test_id
Expand Down Expand Up @@ -2290,7 +2294,7 @@ def test_subscription_change_proration(self):

assert isinstance(manualsub.proration_settings, ProrationSettings)
ElementTree.tostring(account.to_element(), encoding='UTF-8')


def test_subscription_with_plan_ramp(self):
plan_code = 'plan%s' % self.test_id
Expand Down

0 comments on commit 8b5e590

Please sign in to comment.