Add debugging messages

This commit is contained in:
PCoder 2020-12-23 14:12:30 +05:30
parent 259c509113
commit 70c8ed6825
2 changed files with 78 additions and 73 deletions

View file

@ -1144,12 +1144,14 @@ def do_create_vm(request, user, stripe_api_cus_id, card_details_response,
) )
# Save billing address # Save billing address
logger.debug('billing_address_data is {}'.format(billing_address_data))
billing_address_data.update({ billing_address_data.update({
'user': custom_user.id 'user': custom_user.id
}) })
logger.debug('billing_address_data is {}'.format(billing_address_data))
if 'generic_payment_type' in request: generic_payment_type = request.get('generic_payment_type', None)
if generic_payment_type:
logger.debug("generic_payment_type case")
stripe_cus = StripeCustomer.objects.filter( stripe_cus = StripeCustomer.objects.filter(
stripe_id=stripe_api_cus_id stripe_id=stripe_api_cus_id
).first() ).first()
@ -1185,12 +1187,15 @@ def do_create_vm(request, user, stripe_api_cus_id, card_details_response,
billing_address_user_form.is_valid() billing_address_user_form.is_valid()
billing_address_user_form.save() billing_address_user_form.save()
if request['generic_payment_details']['recurring']: recurring = request['generic_payment_details'].get('recurring')
if recurring:
logger.debug("recurring case")
# Associate the given stripe subscription with the order # Associate the given stripe subscription with the order
order.set_subscription_id( order.set_subscription_id(
stripe_subscription_obj.id, card_details_dict stripe_subscription_obj.id, card_details_dict
) )
else: else:
logger.debug("one time charge case")
# Associate the given stripe charge id with the order # Associate the given stripe charge id with the order
order.set_stripe_charge(stripe_onetime_charge) order.set_stripe_charge(stripe_onetime_charge)

View file

@ -136,7 +136,7 @@ def handle_webhook(request):
if (invoice_obj.paid and if (invoice_obj.paid and
invoice_obj.billing_reason == "subscription_update"): invoice_obj.billing_reason == "subscription_update"):
logger.debug("Start provisioning") logger.debug("Start provisioning")
# try: try:
stripe_subscription_obj = stripe.Subscription.retrieve( stripe_subscription_obj = stripe.Subscription.retrieve(
invoice_obj.subscription) invoice_obj.subscription)
try: try:
@ -205,15 +205,15 @@ def handle_webhook(request):
'body': "Response = %s" % str(ex), 'body': "Response = %s" % str(ex),
} }
send_plain_email_task.delay(email_data) send_plain_email_task.delay(email_data)
# except Exception as ex: except Exception as ex:
# logger.error(str(ex)) logger.error(str(ex))
# email_data = { email_data = {
# 'subject': "invoice.paid Webhook error", 'subject': "invoice.paid Webhook error",
# 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS, 'from_email': settings.DCL_SUPPORT_FROM_ADDRESS,
# 'to': settings.DCL_ERROR_EMAILS_TO_LIST, 'to': settings.DCL_ERROR_EMAILS_TO_LIST,
# 'body': "Response = %s" % str(ex), 'body': "Response = %s" % str(ex),
# } }
# send_plain_email_task.delay(email_data) send_plain_email_task.delay(email_data)
else: else:
logger.error("Unhandled event : " + event.type) logger.error("Unhandled event : " + event.type)
return HttpResponse(status=200) return HttpResponse(status=200)