- fetch_stripe_bills:
    - fix wrong assigment of strign to num_invoice_created variable
    - return None (do not handle the case) if we don't have an order
This commit is contained in:
PCoder 2019-11-04 12:05:55 +05:30
commit c29193f6c8
2 changed files with 10 additions and 2 deletions

View file

@ -50,7 +50,12 @@ class Command(BaseCommand):
logger.debug("Invoice %s exists already. Not importing." % invoice['invoice_id'])
except MonthlyHostingBill.DoesNotExist as dne:
logger.debug("Invoice id %s does not exist" % invoice['invoice_id'])
num_invoice_created += 1 if MonthlyHostingBill.create(invoice) is not None else logger.error("Did not import invoice for %s" % str(invoice))
if MonthlyHostingBill.create(invoice) is not None:
num_invoice_created += 1
else:
logger.error("Did not import invoice for %s"
"" % str(invoice))
self.stdout.write(
self.style.SUCCESS("Number of invoices imported = %s" % num_invoice_created)
)