taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit fe9f782315ed0fa7c9bb04c78c1e69c1a4295ed6
parent 02cb1c3179df5e789188773b815c1c82ac9b4831
Author: Florian Dold <florian@dold.me>
Date:   Thu, 14 Nov 2024 18:43:23 +0100

wallet-core: handle Gone status from merchant when paying

Diffstat:
Mpackages/taler-harness/src/integrationtests/test-payment-expired.ts | 4----
Mpackages/taler-wallet-core/src/pay-merchant.ts | 8++++++++
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -111,10 +111,6 @@ export async function runPaymentExpiredTest(t: GlobalTestState) { ); console.log("confirm pay result:"); console.log(j2s(confirmPayResult)); - t.assertDeepEqual(confirmPayResult.type, ConfirmPayResultType.Pending); - await walletClient.call(WalletApiOperation.AbortTransaction, { - transactionId: preparePayResult.transactionId, - }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); const txns = await walletClient.call(WalletApiOperation.GetTransactions, { diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -2662,6 +2662,14 @@ async function processPurchasePay( return TaskRunResult.progress(); } + if (resp.status === HttpStatusCode.Gone) { + logger.warn(`pay transaction aborted, order expired`); + await ctx.abortTransaction( + makeTalerErrorDetail(TalerErrorCode.WALLET_PAY_MERCHANT_ORDER_GONE, {}), + ); + return TaskRunResult.progress(); + } + if (resp.status >= 400 && resp.status <= 499) { logger.trace("got generic 4xx from merchant"); const err = await readTalerErrorResponse(resp);