Add missing code
This commit is contained in:
parent
0352096fa7
commit
51100fd627
1 changed files with 9 additions and 8 deletions
|
@ -70,7 +70,8 @@ class Command(BaseCommand):
|
||||||
c = stripe.Customer.retrieve(
|
c = stripe.Customer.retrieve(
|
||||||
stripe_customer.stripe_id
|
stripe_customer.stripe_id
|
||||||
)
|
)
|
||||||
if c.delete():
|
cus_delete_obj = c.delete()
|
||||||
|
if cus_delete_obj.deleted:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"StripeCustomer {} associated with {} deleted"
|
"StripeCustomer {} associated with {} deleted"
|
||||||
"".format(stripe_customer.stripe_id, email)
|
"".format(stripe_customer.stripe_id, email)
|
||||||
|
@ -87,10 +88,8 @@ class Command(BaseCommand):
|
||||||
vm_ids.append(order.vm_id)
|
vm_ids.append(order.vm_id)
|
||||||
# Delete Billing Address
|
# Delete Billing Address
|
||||||
order.billing_address.delete()
|
order.billing_address.delete()
|
||||||
|
|
||||||
# Delete Order Detail
|
# Delete Order Detail
|
||||||
order.order_detail.delete()
|
order.order_detail.delete()
|
||||||
|
|
||||||
# Delete order
|
# Delete order
|
||||||
order.delete()
|
order.delete()
|
||||||
|
|
||||||
|
@ -105,17 +104,19 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
# delete VMDetail
|
# delete VMDetail
|
||||||
for vm_id in vm_ids:
|
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
|
# delete UserCardDetail
|
||||||
ucd = UserCardDetail.objects.filter(
|
ucds = UserCardDetail.objects.filter(
|
||||||
customer=stripe_customer.id
|
stripe_customer=stripe_customer
|
||||||
)
|
)
|
||||||
|
for ucd in ucds:
|
||||||
ucd.delete()
|
ucd.delete()
|
||||||
|
|
||||||
# delete UserHostingKey
|
# delete UserHostingKey
|
||||||
uhks = UserHostingKey.objects.filter(
|
uhks = UserHostingKey.objects.filter(
|
||||||
user=cus_user.id
|
user=cus_user
|
||||||
)
|
)
|
||||||
for uhk in uhks:
|
for uhk in uhks:
|
||||||
uhk.delete()
|
uhk.delete()
|
||||||
|
|
Loading…
Reference in a new issue