Merge branch 'bugfix/8654/500-error-on-invoices' into 'master'

Bugfix/8654/500 error on invoices

See merge request ungleich-public/dynamicweb!742
This commit is contained in:
pcoder116 2020-12-01 12:48:05 +01:00
commit 555e13e631
2 changed files with 25 additions and 20 deletions

View file

@ -72,6 +72,7 @@ def get_line_item_from_hosting_order_charge(hosting_order_id):
:param hosting_order_id: the HostingOrder id
:return:
"""
try:
hosting_order = HostingOrder.objects.get(id = hosting_order_id)
if hosting_order.stripe_charge_id:
return mark_safe("""
@ -92,6 +93,9 @@ def get_line_item_from_hosting_order_charge(hosting_order_id):
))
else:
return ""
except Exception as ex:
logger.error("Error %s" % str(ex))
return ""
@register.filter('get_line_item_from_stripe_invoice')
@ -110,7 +114,7 @@ def get_line_item_from_stripe_invoice(invoice):
plan_name = ""
for line_data in invoice["lines"]["data"]:
if is_first:
plan_name = line_data.plan.name
plan_name = line_data.plan.name if line_data.plan is not None else ""
start_date = line_data.period.start
end_date = line_data.period.end
is_first = False

View file

@ -1,6 +1,7 @@
import logging
import uuid
from datetime import datetime
from urllib.parse import quote
from time import sleep
import stripe
@ -1292,7 +1293,7 @@ class InvoiceListView(LoginRequiredMixin, TemplateView):
if ('user_email' in self.request.GET
and self.request.user.email == settings.ADMIN_EMAIL):
user_email = self.request.GET['user_email']
context['user_email'] = user_email
context['user_email'] = '%s' % quote(user_email)
logger.debug(
"user_email = {}".format(user_email)
)