Handle invoice for no stripe error
This commit is contained in:
parent
d0455fbafb
commit
e25ed77538
|
@ -1297,9 +1297,12 @@ class InvoiceListView(LoginRequiredMixin, TemplateView):
|
|||
except CustomUser.DoesNotExist as dne:
|
||||
logger.debug("User does not exist")
|
||||
cu = self.request.user
|
||||
invs = stripe.Invoice.list(customer=cu.stripecustomer.stripe_id,
|
||||
count=100)
|
||||
paginator = Paginator(invs.data, 10)
|
||||
if cu.stripecustomer:
|
||||
invs = stripe.Invoice.list(customer=cu.stripecustomer.stripe_id,
|
||||
count=100)
|
||||
else:
|
||||
invs = []
|
||||
paginator = Paginator(invs.data if len(invs) > 0 else [], 10)
|
||||
try:
|
||||
invs_page = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
|
@ -1308,11 +1311,14 @@ class InvoiceListView(LoginRequiredMixin, TemplateView):
|
|||
invs_page = paginator.page(paginator.num_pages)
|
||||
else:
|
||||
try:
|
||||
invs = stripe.Invoice.list(
|
||||
customer=self.request.user.stripecustomer.stripe_id,
|
||||
count=100
|
||||
)
|
||||
paginator = Paginator(invs.data, 10)
|
||||
if self.request.user.stripecustomer:
|
||||
invs = stripe.Invoice.list(
|
||||
customer=self.request.user.stripecustomer.stripe_id,
|
||||
count=100
|
||||
)
|
||||
else:
|
||||
invs = []
|
||||
paginator = Paginator(invs.data if len(invs) > 0 else [], 10)
|
||||
try:
|
||||
invs_page = paginator.page(page)
|
||||
except PageNotAnInteger:
|
||||
|
|
Loading…
Reference in New Issue