Open rinkp opened 7 months ago
People do get notifications exactly when they go in debt, however this might still be a nice idea to implement.
Clarification:
Do you propose that the user receives a "transaction" overview as a receipt? Don't people already get balance notifications when dropping down to <0?
Do you propose that the user receives a "transaction" overview as a receipt?
Yes, if they enable this. This allows users to immediately notice something has been charged to their account while they were not aware of it. I propose a 3-state selector.
Do you want to receive notifications for transactions:
Don't people already get balance notifications when dropping down to <0?
@CodeNamedRobin told me they do, but the point is that you will only find out your account has been erroneously charged once you have a debt which I think is not nice.
@JustSamuel, the example you asked for
# GEWIS Newsletter
---
# All mailings require some settings. These can be set here. Don't forget to set the title ("Algemene mededeling; tekst zelf invoeren")
version: 1.1
settings:
title: "Your SudoSOS transaction on January 1st"
email: "sudosos@removed-for-spam-reasons"
#unsubscribe: https://lists.gewis.nl/postorius/lists/gewis.lists.gewis.nl/
lang: en-UK
#lang: nl-NL
#url: "https://secr.personal.gewis.nl/newsletter/2022/newsletter-8.html"
follow: false
# A mailing consists of a series of messageblocks, each with their own type
# The available types are "header", "topblock", "activities", "activityfooter", "extramessage" and "tinyfooter"
messageblocks:
# Each mailing must have a header to make the template shine! It contains the title and the date.
- type: "header"
title: "SudoSOS update"
date: 2024-01-01
# This is the first block which is shown on top of the message. Recommended for most messages
- type: topblock
title: "Transaction notification"
contentHTML: >
<p>Dear {{FIRSTNAME}},<br/><br/>
We love to inform you that {{you just made a purchase|a purchase was entered on behalf}} in SudoSOS. Below are the details:
</p>
<table style='width:100%;'>
<tr><th style='width:20%;'>Quantity</th><th style='width:60%;'>Product</th><th style='width:20%;'>Price</th></tr>
<tr><td>1</td><td>Kitkat (€0,60)</td><td>€0,60</td></tr>
<tr><td>12</td><td>Grolsch Premium Pilsener (€1,00)</td><td>€12,00</td></tr>
</table>
<p>We have debited your account for the total amount <strong>€12,34</strong> which leaves you with a total {{balance|debt}} of €432,10.</p>
<p>{{if negative: Please note that late fees are charged each Thursday after the social drink.}}
You can increase your balance at any time on <a href="https://sudosos.gewis.nl">https://sudosos.gewis.nl</a>.</p>
<p>If you have any questions about this transaction, please reach out to the email address in the footer of this email.
# You probably want to include this each newsletter
- type: tinyfooter
contentHTML: >
You are receiving this email because you are registered as a SudoSOS user and have opted in to receiving notifications for transactions. Learn more about how we treat your personal data on <a href="https://gew.is/privacy">https://gew.is/privacy</a>.
Picking this up in the following branch: https://github.com/GEWIS/sudosos-backend/tree/feature/notifications
However, this will most likely be superseded by implementing the DB sync once I have the API key.
also @rinkp any chance there could be an easy to generate emails in that template? might be a nice feature to move most of our e-mailing over to that system to keep it GEWIS consistent
There is for php in GEWIS/GEWISDB? The YAML to HTML generator is pure JS, so maybe you can include that.
I would suggest to not make an external dependency like for pdfs where the service could be unavailable since you don't want email messages to become unavailable at any point in time.
Perhaps we may want to consider: sending receipts / notifications
Currently people discover their balance is negative when they receive a notification that they will be fined, not when they actually did a transaction. While this works for users that maintain a close-to-negative balance, this does not work for all users.
My proposal is to: