mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
also add mail when user cancels
This commit is contained in:
@@ -64,10 +64,11 @@ einsehen und stornieren.
|
||||
${footer}
|
||||
`
|
||||
}
|
||||
|
||||
function getBookingRejectedText(booking: Booking): string {
|
||||
return `Hallo liebe/r ${booking.name},
|
||||
|
||||
es tut uns leid aber deine Buchungsanfrage zum ${daysFormatFrontend(
|
||||
es tut uns leid, aber deine Buchungsanfrage zum ${daysFormatFrontend(
|
||||
booking.days
|
||||
)} konnten wir leider nicht bestätigen.
|
||||
|
||||
@@ -78,6 +79,18 @@ ${footer}
|
||||
`
|
||||
}
|
||||
|
||||
function getBookingCanceledText(booking: Booking): string {
|
||||
return `Hallo liebe/r ${booking.name},
|
||||
|
||||
deine Buchungsanfrage zum ${daysFormatFrontend(booking.days)} wurde storniert.
|
||||
|
||||
Willst du das Bussle an einem anderen Termin buchen? Dann stelle bitte nochmal
|
||||
eine Buchungsanfrage auf ${getBaseURL()}.
|
||||
|
||||
${footer}
|
||||
`
|
||||
}
|
||||
|
||||
function getReceivedBookingAdminText(booking: { uuid: string }): string {
|
||||
return `Hallo lieber Admin,
|
||||
|
||||
@@ -163,6 +176,22 @@ export async function sendBookingRejected(booking: Booking): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendBookingCanceled(booking: Booking): Promise<void> {
|
||||
try {
|
||||
await sendMail({
|
||||
to: [{ email: booking.email, name: booking.name }],
|
||||
from: { email: FROM_EMAIL, name: 'Pfadi-Bussle Wart' },
|
||||
subject: `Deine Pfadi-Bussle Buchung wurde storniert!`,
|
||||
textPlainContent: getBookingCanceledText(booking),
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed in sendBookingCanceledMail for ${booking.uuid}`,
|
||||
error
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
async function sendMail({
|
||||
to,
|
||||
from,
|
||||
|
||||
Reference in New Issue
Block a user