In case of error, log it and return empty result
This commit is contained in:
parent
73cb003353
commit
52362cd0ea
1 changed files with 22 additions and 18 deletions
|
@ -72,25 +72,29 @@ def get_line_item_from_hosting_order_charge(hosting_order_id):
|
||||||
:param hosting_order_id: the HostingOrder id
|
:param hosting_order_id: the HostingOrder id
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
hosting_order = HostingOrder.objects.get(id = hosting_order_id)
|
try:
|
||||||
if hosting_order.stripe_charge_id:
|
hosting_order = HostingOrder.objects.get(id = hosting_order_id)
|
||||||
return mark_safe("""
|
if hosting_order.stripe_charge_id:
|
||||||
<td class="xs-td-inline">{product_name}</td>
|
return mark_safe("""
|
||||||
<td class="xs-td-inline">{created_at}</td>
|
<td class="xs-td-inline">{product_name}</td>
|
||||||
<td class="xs-td-inline">{total}</td>
|
<td class="xs-td-inline">{created_at}</td>
|
||||||
<td class="text-right last-td">
|
<td class="xs-td-inline">{total}</td>
|
||||||
<a class="btn btn-order-detail" href="{receipt_url}" target="_blank">{see_invoice_text}</a>
|
<td class="text-right last-td">
|
||||||
</td>
|
<a class="btn btn-order-detail" href="{receipt_url}" target="_blank">{see_invoice_text}</a>
|
||||||
""".format(
|
</td>
|
||||||
product_name=hosting_order.generic_product.product_name.capitalize(),
|
""".format(
|
||||||
created_at=hosting_order.created_at.strftime('%Y-%m-%d'),
|
product_name=hosting_order.generic_product.product_name.capitalize(),
|
||||||
total='%.2f' % (hosting_order.price),
|
created_at=hosting_order.created_at.strftime('%Y-%m-%d'),
|
||||||
receipt_url=reverse('hosting:orders',
|
total='%.2f' % (hosting_order.price),
|
||||||
kwargs={'pk': hosting_order.id}),
|
receipt_url=reverse('hosting:orders',
|
||||||
|
kwargs={'pk': hosting_order.id}),
|
||||||
|
|
||||||
see_invoice_text=_("See Invoice")
|
see_invoice_text=_("See Invoice")
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
|
return ""
|
||||||
|
except Exception as ex:
|
||||||
|
logger.error("Error %s" % str(ex))
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue