From 1a37b62f2476501db019d6f8ab86b43db3adeaa8 Mon Sep 17 00:00:00 2001 From: Marshal Date: Wed, 5 Aug 2026 15:14:41 +0000 Subject: [PATCH] clarify replayed CBE payment failure msg --- .../src/modules/cbe-bill/cbe-bill.service.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts b/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts index 9389280c5..1e4c70d17 100644 --- a/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts +++ b/apps/edr-payment-api/src/modules/cbe-bill/cbe-bill.service.ts @@ -191,13 +191,12 @@ export class CbeBillService { return mapPaymentFailure(dto, "Payment is being processed."); } if (prior.failureClass === "BUSINESS") { - // Final — retrying cannot change the answer. Replay what we told CBE last time. - return ( - (prior.responsePayload as unknown as CbePaymentResponseDto) ?? - mapPaymentFailure( - dto, - prior.responseDescription ?? "Payment already failed.", - ) + // Final — retrying cannot change the answer. Same End_To_End_Txn_Id was already + // resolved (possibly against a different Bill_Id/amount); say so instead of + // echoing the original reason, which no longer describes this request. + return mapPaymentFailure( + dto, + `End_To_End_Txn_Id ${dto.End_To_End_Txn_Id} was already processed and failed: ${prior.responseDescription ?? "unknown reason"}.`, ); } // FAILED + TRANSIENT: allowed retry — fall through and re-run the settlement.