From c176b9e7d653a958ff7937ebf619b7f92d4f925f Mon Sep 17 00:00:00 2001 From: Nathnael Date: Fri, 31 Jul 2026 09:02:27 +0000 Subject: [PATCH] fix(payment): give the payment-service client a 60s budget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CAC Bank's initiate SMSes an OTP before it answers and routinely takes more than the 10s this client allowed, so every CAC charge came back as a 502 while the bank was still working — and if the bank had answered, the payer would have been texted a code for an intent the freight side never recorded. Matches the passenger API, which already budgets 60s and reads the same PAYMENT_API_HTTP_TIMEOUT_MS override. Co-Authored-By: Claude Opus 5 (1M context) --- .../edr-freight-api/src/modules/payment/payment.module.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/edr-freight-api/src/modules/payment/payment.module.ts b/apps/edr-freight-api/src/modules/payment/payment.module.ts index 05267746d..961aa32bd 100644 --- a/apps/edr-freight-api/src/modules/payment/payment.module.ts +++ b/apps/edr-freight-api/src/modules/payment/payment.module.ts @@ -56,7 +56,13 @@ function rabbitMQImport(): DynamicModule[] { @Module({ imports: [ - HttpModule.register({ timeout: 10_000 }), + // CAC Bank's initiate SMSes an OTP and routinely takes >10s, so the old + // 10s cap 502'd every CAC charge while the bank was still working — + // orphaning an intent the payer had already been texted about. Matches + // the passenger API's budget. + HttpModule.register({ + timeout: Number(process.env.PAYMENT_API_HTTP_TIMEOUT_MS) || 60_000, + }), ConfigModule, forwardRef(() => BillingModule), // forwardRef(() => TrainSchedulingModule),