diff --git a/apps/edr-passenger-api/src/modules/notifications/sms-client.service.ts b/apps/edr-passenger-api/src/modules/notifications/sms-client.service.ts index 6ef0a99ac..a71ee882d 100644 --- a/apps/edr-passenger-api/src/modules/notifications/sms-client.service.ts +++ b/apps/edr-passenger-api/src/modules/notifications/sms-client.service.ts @@ -35,12 +35,14 @@ export class SmsClientService implements OnApplicationBootstrap { this.logger.warn(`RABBITMQ disabled — skipped SMS to ${dto.to}`); return {}; } + // The external send-sms consumer reads the content from `sms`, not `message`. this.smsClient.emit("send-sms", { - ...dto, + to: dto.to, + sms: dto.message, appKey: "IFHCRS-LICENSE-MANAGEMENT", }); this.logger.log( - `SMS emitted to RabbitMQ [${process.env.SMS_QUEUE ?? "sms_queue"}] pattern='send-sms' to=${dto.to} message="${dto.message}"`, + `SMS emitted to RabbitMQ [${process.env.SMS_QUEUE ?? "sms_queue"}] pattern='send-sms' to=${dto.to} sms="${dto.message}"`, ); return {}; } diff --git a/apps/edr-passenger-api/src/modules/payments/payments.service.ts b/apps/edr-passenger-api/src/modules/payments/payments.service.ts index c8d0580bf..871105b31 100644 --- a/apps/edr-passenger-api/src/modules/payments/payments.service.ts +++ b/apps/edr-passenger-api/src/modules/payments/payments.service.ts @@ -137,7 +137,9 @@ export class PaymentsService { referenceType: PaymentReferenceType.BOOKING, referenceId: booking.id, orderRef: booking.bookingRef, - amountMinor: booking.totalMinor, + // Send the REAL (major) price, not minor units. The payment API no longer divides by 100 + // (freight already passes the real price), so the providers charge this value as-is. + amountMinor: booking.totalMinor / 100, currency: booking.currency, provider: method as unknown as ProviderMethod, platform: dto.platform, @@ -634,11 +636,15 @@ export class PaymentsService { return { processed: false, reason: "booking-not-found" }; } - if (booking.totalMinor !== event.amountMinor) { + // The event carries the REAL (major) price the provider charged (passenger now sends + // booking.totalMinor/100 on initiate), so convert it back to minor units before comparing + // with booking.totalMinor (which is in minor units). + const eventAmountMinor = Math.round(event.amountMinor * 100); + if (booking.totalMinor !== eventAmountMinor) { // Refuse to confirm: a 4xx makes the relay retry and eventually flag the row FAILED, // which is the alertable signal for an asserted-vs-paid amount divergence. this.logger.error( - `mark-paid: amount mismatch for booking ${booking.id}: booking=${booking.totalMinor} event=${event.amountMinor}`, + `mark-paid: amount mismatch for booking ${booking.id}: booking=${booking.totalMinor} event=${event.amountMinor} (=${eventAmountMinor} minor)`, ); throw new BadRequestException( "Event amount does not match booking total",