Add missing code

This commit is contained in:
PCoder 2019-04-29 00:53:06 +02:00
parent 0352096fa7
commit 51100fd627

View file

@ -70,7 +70,8 @@ class Command(BaseCommand):
c = stripe.Customer.retrieve(
stripe_customer.stripe_id
)
if c.delete():
cus_delete_obj = c.delete()
if cus_delete_obj.deleted:
logger.debug(
"StripeCustomer {} associated with {} deleted"
"".format(stripe_customer.stripe_id, email)
@ -87,10 +88,8 @@ class Command(BaseCommand):
vm_ids.append(order.vm_id)
# Delete Billing Address
order.billing_address.delete()
# Delete Order Detail
order.order_detail.delete()
# Delete order
order.delete()
@ -105,17 +104,19 @@ class Command(BaseCommand):
# delete VMDetail
for vm_id in vm_ids:
VMDetail.objects.get(vm_id=vm_id)
vm_detail = VMDetail.objects.get(vm_id=vm_id)
vm_detail.delete()
# delete UserCardDetail
ucd = UserCardDetail.objects.filter(
customer=stripe_customer.id
ucds = UserCardDetail.objects.filter(
stripe_customer=stripe_customer
)
for ucd in ucds:
ucd.delete()
# delete UserHostingKey
uhks = UserHostingKey.objects.filter(
user=cus_user.id
user=cus_user
)
for uhk in uhks:
uhk.delete()