From 22accdd0d07ffac0ac0a16383a167198b16d6e3b Mon Sep 17 00:00:00 2001 From: PCoder Date: Tue, 16 Apr 2019 00:02:44 +0200 Subject: [PATCH] Fallback to vm_id from order if its not set in metadata --- webhook/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webhook/views.py b/webhook/views.py index 0542448a..aabbf9c4 100644 --- a/webhook/views.py +++ b/webhook/views.py @@ -88,6 +88,9 @@ def handle_invoice_webhook(request): mbli = HostingBillLineItem.objects.filter(monthly_hosting_bill=mhb).first() vm_id = mbli.get_vm_id() + if vm_id is None: + vm_id = mhb.order.vm_id + # Send an email to admin admin_msg_sub = "Invoice payment success for user {} and VM {}".format( stripe_customer.user.email,