mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 17:38:12 +00:00
Update fare display based on currency and fix seat allocation
This commit is contained in:
@@ -295,20 +295,34 @@ export class NotificationsService {
|
||||
{ category: 'PAYMENT', deepLink: `edr://tickets/${ref}` },
|
||||
);
|
||||
|
||||
// Resolve SMS phone: prefer the IAM user's stored number, fall back to the phone
|
||||
// the passenger entered on the booking form (contactPhone).
|
||||
const contactPhone: string | null = (booking as any)?.contactPhone ?? (payload.booking as any)?.contactPhone ?? null;
|
||||
const iamPhone = passengerId ? await this.getRecipientAddress(passengerId, 'SMS').catch(() => null) : null;
|
||||
const smsPhone = iamPhone ?? contactPhone;
|
||||
|
||||
// Ticket not ready (generation failed/raced) — fall back to a payment-only confirmation.
|
||||
if (!ticket || !booking) {
|
||||
this.logger.warn(`payment.succeeded: ticket not ready for booking ${ref}; sending payment-only confirmation`);
|
||||
const text = `EDR: Payment of ${amount} ${currency} received for booking ${ref}. Your ticket is being prepared.`;
|
||||
await this.deliverEmail(passengerId, `Payment received — ${ref}`, text);
|
||||
await this.deliverSms(passengerId, text);
|
||||
if (smsPhone) {
|
||||
await this.smsClient.sendSms({ to: smsPhone, message: text }).catch(() => null);
|
||||
} else {
|
||||
this.logger.warn(`No SMS phone for booking ${ref}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// SMS — short pointer (no HTML/QR over SMS).
|
||||
await this.deliverSms(
|
||||
passengerId,
|
||||
`EDR: Booking ${ref} confirmed, ${amount} ${currency} paid. Show ref ${ref} at the gate or view your ticket: ${ticketUrl}`,
|
||||
);
|
||||
if (smsPhone) {
|
||||
await this.smsClient.sendSms({
|
||||
to: smsPhone,
|
||||
message: `EDR: Booking ${ref} confirmed, ${amount} ${currency} paid. Show ref ${ref} at the gate or view your ticket: ${ticketUrl}`,
|
||||
}).catch(() => null);
|
||||
} else {
|
||||
this.logger.warn(`No SMS phone for booking ${ref}`);
|
||||
}
|
||||
|
||||
// EMAIL — rich HTML ticket with plain-text fallback.
|
||||
await this.deliverEmail(
|
||||
|
||||
Reference in New Issue
Block a user