Skip to content
Snippets Groups Projects
Commit e3cc96fe authored by Aaron Dötsch's avatar Aaron Dötsch
Browse files

Alter RefundNotificationType

parent ed47bfee
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ export type User = {name: string, id: number} ...@@ -5,7 +5,7 @@ export type User = {name: string, id: number}
export type NotificationType<T extends PossibleNotificationType> = {key: number, name: T}; export type NotificationType<T extends PossibleNotificationType> = {key: number, name: T};
export type BuyNotificationData = {total: number, items: Item[], balanceBefore: number, balanceAfter: number}; export type BuyNotificationData = {total: number, items: Item[], balanceBefore: number, balanceAfter: number};
export type RefundNotificationData = {refund: number, item: Item, balanceBefore: number, balanceAfter: number, timeBought: Date}; export type RefundNotificationData = {refund: {price: number, premium: number, total: number}, item: Item, balanceBefore: number, balanceAfter: number, timeBought: Date};
export type DepositNotificationData = {amount: number, balanceBefore: number, balanceAfter: number}; export type DepositNotificationData = {amount: number, balanceBefore: number, balanceAfter: number};
export type WithdrawNotificationData = {amount: number, balanceBefore: number, balanceAfter: number}; export type WithdrawNotificationData = {amount: number, balanceBefore: number, balanceAfter: number};
export type UseVoucherNotificationData = {voucher: {code: string, value: number}, balanceBefore: number, balanceAfter: number}; export type UseVoucherNotificationData = {voucher: {code: string, value: number}, balanceBefore: number, balanceAfter: number};
......
...@@ -41,7 +41,8 @@ Gesamt: ${(total/100).toFixed(2)}€` + (premiums > 0 ? ` (davon ${(premiums/100 ...@@ -41,7 +41,8 @@ Gesamt: ${(total/100).toFixed(2)}€` + (premiums > 0 ? ` (davon ${(premiums/100
} }
case "refund": { case "refund": {
const {refund, item, balanceBefore, balanceAfter, timeBought} = data as NotificationData<"refund">; const {refund, item, balanceBefore, balanceAfter, timeBought} = data as NotificationData<"refund">;
return `Dir wurden ${(refund/100).toFixed(2)}€ für ${item.name} (${item.code}) erstattet, gekauft am ${timeBought.toLocaleString()}. const premiumMessage = refund.premium && refund.premium > 0 ? ` (+${(refund.premium/100).toFixed(2)}€)` : "";
return `Dir wurden ${(refund.price/100).toFixed(2)}${premiumMessage} für ${item.name} (${item.code}) erstattet, gekauft am ${timeBought.toLocaleString()}.
Dein neuer Kontostand beträgt ${(balanceAfter/100).toFixed(2)}€.`; Dein neuer Kontostand beträgt ${(balanceAfter/100).toFixed(2)}€.`;
} }
case "deposit": { case "deposit": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment