./manage.py sync_plans throws an error when attempting to convert a plan that uses Stripe's Metered Billing feature (docs).
Steps to Reproduce
Setup a tiered metered usage plan with metered billing in Stripe (see docs) and then run ./manage.py sync_plans
What were you expecting to happen?
New plan gets synced to Django.
What actually happened?
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/site-packages/pinax/stripe/management/commands/sync_plans.py", line 11, in handle
plans.sync_plans()
File "/usr/local/lib/python2.7/site-packages/pinax/stripe/actions/plans.py", line 12, in sync_plans
sync_plan(plan)
File "/usr/local/lib/python2.7/site-packages/pinax/stripe/actions/plans.py", line 25, in sync_plan
"amount": utils.convert_amount_for_db(plan["amount"], plan["currency"]),
File "/usr/local/lib/python2.7/site-packages/pinax/stripe/utils.py", line 36, in convert_amount_for_db
return (amount / decimal.Decimal("100")) if currency.lower() not in ZERO_DECIMAL_CURRENCIES else decimal.Decimal(amount)
TypeError: unsupported operand type(s) for /: 'NoneType' and 'Decimal'
Updates
The error likely comes from tiered plans having amount: null
Issue Summary
./manage.py sync_plans
throws an error when attempting to convert a plan that uses Stripe's Metered Billing feature (docs).Steps to Reproduce
Setup a tiered metered usage plan with metered billing in Stripe (see docs) and then run
./manage.py sync_plans
What were you expecting to happen?
New plan gets synced to Django.
What actually happened?
Updates
amount: null