Update get_stripe_plan_id to make it compatible with excl_vat
This commit is contained in:
parent
399f9ed6c9
commit
ec00785068
1 changed files with 10 additions and 5 deletions
|
@ -1,7 +1,9 @@
|
|||
import logging
|
||||
import re
|
||||
|
||||
import stripe
|
||||
from django.conf import settings
|
||||
|
||||
from datacenterlight.models import StripePlan
|
||||
|
||||
stripe.api_key = settings.STRIPE_API_PRIVATE_KEY
|
||||
|
@ -351,7 +353,7 @@ class StripeUtils(object):
|
|||
|
||||
@staticmethod
|
||||
def get_stripe_plan_id(cpu, ram, ssd, version, app='dcl', hdd=None,
|
||||
price=None):
|
||||
price=None, excl_vat=True):
|
||||
"""
|
||||
Returns the Stripe plan id string of the form
|
||||
`dcl-v1-cpu-2-ram-5gb-ssd-10gb` based on the input parameters
|
||||
|
@ -378,12 +380,15 @@ class StripeUtils(object):
|
|||
plan=dcl_plan_string
|
||||
)
|
||||
if price is not None:
|
||||
stripe_plan_id_string_with_price = '{}-{}chf'.format(
|
||||
stripe_plan_id_string = '{}-{}chf'.format(
|
||||
stripe_plan_id_string,
|
||||
round(price, 2)
|
||||
)
|
||||
return stripe_plan_id_string_with_price
|
||||
else:
|
||||
if excl_vat:
|
||||
stripe_plan_id_string = '{}-{}'.format(
|
||||
stripe_plan_id_string,
|
||||
"excl_vat"
|
||||
)
|
||||
return stripe_plan_id_string
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in a new issue