Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds vertex_transaction_type to Plans #705

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading