From 138291050888ae3e94bc3ed4e7e2b5fb0ec69ee6 Mon Sep 17 00:00:00 2001 From: Abubeker Yasin Date: Wed, 22 Jul 2026 15:41:34 +0300 Subject: [PATCH] fix: ( payment ) stop re-finalizing already-completed payments on intent read --- .../src/modules/payments/payments.service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 b3befbaea..e5846b48f 100644 --- a/apps/edr-passenger-api/src/modules/payments/payments.service.ts +++ b/apps/edr-passenger-api/src/modules/payments/payments.service.ts @@ -598,6 +598,17 @@ export class PaymentsService { where: { bookingId }, }); + + if (local?.status === PaymentIntentStatus.SUCCEEDED) { + const booking = await this.prisma.booking.findUnique({ + where: { id: bookingId }, + select: { status: true }, + }); + if (booking?.status === "CONFIRMED") { + return this.formatIntentStatus(local); + } + } + // WALLET payments never leave this app — no remote intent exists for them. if (local?.method === PaymentMethodType.WALLET) { return this.formatIntentStatus(local);