Catch error from stripe call
This commit is contained in:
parent
033db01810
commit
c85a4f3796
1 changed files with 4 additions and 1 deletions
|
@ -37,8 +37,11 @@ class Command(BaseCommand):
|
||||||
user.stripecustomer.stripe_id,
|
user.stripecustomer.stripe_id,
|
||||||
created=created_gt
|
created=created_gt
|
||||||
)
|
)
|
||||||
|
if all_invoices_response['error'] is not None:
|
||||||
|
self.stdout.write(self.style.ERROR(all_invoices_response['error']))
|
||||||
|
exit(1)
|
||||||
all_invoices = all_invoices_response['response_object']
|
all_invoices = all_invoices_response['response_object']
|
||||||
self.stdout.write(self.style.SUCCESS("Obtained {} invoices".format(len(all_invoices))))
|
self.stdout.write(self.style.SUCCESS("Obtained {} invoices".format(len(all_invoices) if all_invoices is not None else 0)))
|
||||||
for invoice in all_invoices:
|
for invoice in all_invoices:
|
||||||
MonthlyHostingBill.create(
|
MonthlyHostingBill.create(
|
||||||
invoice, stripe_customer=user.stripecustomer
|
invoice, stripe_customer=user.stripecustomer
|
||||||
|
|
Loading…
Reference in a new issue