Skip to content

Commit

Permalink
Fixed email footer and returned sum of base amount, discounted amount…
Browse files Browse the repository at this point in the history
… and final amount to the template
  • Loading branch information
anishTP committed Apr 10, 2024
1 parent 2612128 commit 8107da0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 1 addition & 5 deletions boxoffice/templates/layout_email.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,7 @@
<tr>
<td class="footer">
<b>{% trans %}Hasgeek Learning Private Limited{% endtrans %}</b><br/>
{% trans %}Need help?{% endtrans %} <a href="mailto:{{ config['SITE_SUPPORT_EMAIL'] }}">{{ config['SITE_SUPPORT_EMAIL'] }}</a> &bull; <a href="tel:{{ config['SITE_SUPPORT_PHONE'] }}">{{ config['SITE_SUPPORT_PHONE_FORMATTED'] }}</a>
{%- if view %}{# Notification view #}
<br/><br/>
{% if view.reason_email %} {{ view.reason_email }} &bull; {% endif %}<a class="unsubscribe" href="{{ view.unsubscribe_url_email }}">{% trans %}Unsubscribe or manage preferences{% endtrans %}</a>
{%- endif %}
{% trans %}Need help?{% endtrans %} <a href="mailto:{{ config['SITE_SUPPORT_EMAIL'] }}">{{ config['SITE_SUPPORT_EMAIL'] }}</a> &bull; <a href="tel:{{ config['SITE_SUPPORT_PHONE'] }}">{{ config['SITE_SUPPORT_PHONE'] }}</a>
</td>
</tr>
{% endblock footer %}</table>
Expand Down
8 changes: 4 additions & 4 deletions boxoffice/templates/payment_receipt.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
<tr class="item-description-container">
<td class="item-description" colspan="3">{{ line_item.ticket.description| safe}}</td>
</tr>
{%- endfor %}
{{ line_break(gettext('linebreak')) }}
<tr align="right">
<td colspan="4">
Expand All @@ -208,7 +209,7 @@
</p>
</td>
<td>
<p>{{ currency_symbol }} {{ line_item.base_amount }}</p>
<p>{{ currency_symbol }} {{ total_base_amount }}</p>
</td>
</tr>
<tr align="right">
Expand All @@ -218,7 +219,7 @@
</p>
</td>
<td>
<p>{{ currency_symbol }} {{ line_item.discounted_amount }}</p>
<p>{{ currency_symbol }} {{ total_discount_amount }}</p>
</td>
</tr>
<tr align="right">
Expand All @@ -228,13 +229,12 @@
</p>
</td>
<td class="total-price">
<p>{{ currency_symbol }} {{ line_item.final_amount }}</p>
<p>{{ currency_symbol }} {{ final_amount }}</p>
</td>
</tr>
</table>
</td>
</tr>
{%- endfor %}

{%- if order.refunded_amount %}
{{ line_break(gettext('double_linebreak')) }}
Expand Down
6 changes: 6 additions & 0 deletions boxoffice/views/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,14 @@ def receipt(order: Order):
line_items = LineItem.query.filter(
LineItem.order == order, LineItem.status == LineItemStatus.CONFIRMED
).all()
total_base_amount = sum([line_item.base_amount for line_item in line_items])
total_item_discount = sum([line_item.discounted_amount for line_item in line_items])
final_amount = sum([line_item.final_amount for line_item in line_items])

This comment has been minimized.

Copy link
@anishTP

anishTP Apr 10, 2024

Author Contributor

For purchases with more than one item-id the total_base_amount,discount_amount needs to be grouped by item-id to prevent duplication of line_item inside the receipt template

This comment has been minimized.

Copy link
@anishTP

anishTP Apr 10, 2024

Author Contributor

Additionally for partial refunds the line-item details of the refunded item needs to be sent to the template.

return render_template(
'payment_receipt.html.jinja2',
total_base_amount=total_base_amount,
total_item_discount = total_item_discount,
final_amount=final_amount,
order=order,
org=order.organization,
line_items=line_items,
Expand Down

0 comments on commit 8107da0

Please sign in to comment.