Do not create paymentintent for subscription

This commit is contained in:
PCoder 2021-01-01 00:34:35 +05:30
parent ba3c5ddd1d
commit e024a3a7a6

View file

@ -694,8 +694,15 @@ class OrderConfirmationView(DetailView, FormView):
'keys': get_all_public_keys(self.request.user)
})
# Obtain PaymentIntent so that we can initiate and charge/subscribe
is_subscription = False
if ('generic_payment_type' not in request.session or
(request.session['generic_payment_details']['recurring'])):
# Obtain PaymentIntent so that we can initiate and charge
# the customer
is_subscription = True
logger.debug("CASE: Subscription")
else:
logger.debug("CASE: One time payment")
stripe_utils = StripeUtils()
payment_intent_response = stripe_utils.get_payment_intent(
int(amount_to_charge * 100),
@ -730,10 +737,7 @@ class OrderConfirmationView(DetailView, FormView):
reverse('datacenterlight:index')
},
'stripe_key': settings.STRIPE_API_PUBLIC_KEY,
'is_subscription': 'true' if (
'generic_payment_type' not in request.session or
(request.session['generic_payment_details']['recurring'])
) else 'false'
'is_subscription': str(is_subscription).lower()
})
logger.debug("Request %s" % create_incomplete_intent_request(
self.request))