Accept subscription status = trialing because that is what we will be

if we are using the trial period
This commit is contained in:
PCoder 2019-07-18 10:13:03 +05:30
parent ee90ee5624
commit ceff7964e9
3 changed files with 11 additions and 5 deletions

View file

@ -123,8 +123,10 @@ class CeleryTaskTestCase(TestCase):
int(datetime.datetime.now().timestamp()) + 300 if settings.ADD_TRIAL_PERIOD_TO_SUBSCRIPTION else None)
stripe_subscription_obj = subscription_result.get('response_object')
# Check if the subscription was approved and is active
if stripe_subscription_obj is None \
or stripe_subscription_obj.status != 'active':
if (stripe_subscription_obj is None or
(stripe_subscription_obj.status != 'active' and
stripe_subscription_obj.status != 'trialing')
):
msg = subscription_result.get('error')
raise Exception("Creating subscription failed: {}".format(msg))

View file

@ -791,8 +791,10 @@ class OrderConfirmationView(DetailView, FormView):
)
stripe_subscription_obj = subscription_result.get('response_object')
# Check if the subscription was approved and is active
if (stripe_subscription_obj is None
or stripe_subscription_obj.status != 'active'):
if (stripe_subscription_obj is None or
(stripe_subscription_obj.status != 'active' and
stripe_subscription_obj.status != 'trialing')
):
# At this point, we have created a Stripe API card and
# associated it with the customer; but the transaction failed
# due to some reason. So, we would want to dissociate this card

View file

@ -1039,7 +1039,9 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView, FormView):
stripe_subscription_obj = subscription_result.get('response_object')
# Check if the subscription was approved and is active
if (stripe_subscription_obj is None or
stripe_subscription_obj.status != 'active'):
(stripe_subscription_obj.status != 'active' and
stripe_subscription_obj.status != 'trialing')
):
# At this point, we have created a Stripe API card and
# associated it with the customer; but the transaction failed
# due to some reason. So, we would want to dissociate this card