aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2024-11-14 18:43:23 +0100
committerFlorian Dold <florian@dold.me>2024-11-14 18:43:34 +0100
commitfe9f782315ed0fa7c9bb04c78c1e69c1a4295ed6 (patch)
tree72f96e17a89b4911782bcc1f37d50e44256b4fd3
parent02cb1c3179df5e789188773b815c1c82ac9b4831 (diff)
wallet-core: handle Gone status from merchant when paying
-rw-r--r--packages/taler-harness/src/integrationtests/test-payment-expired.ts4
-rw-r--r--packages/taler-wallet-core/src/pay-merchant.ts8
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
index 1878a5644..21bc5730b 100644
--- 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
index f48a2f2fe..41d25f65b 100644
--- 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);