diff options
author | Florian Dold <florian@dold.me> | 2023-01-13 00:31:29 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-01-13 00:31:29 +0100 |
commit | cbf848dd2a1b24bb30ab10155c235c13edea575d (patch) | |
tree | 7cbb3ac38b24cb33265dc57b09dd25e54b1ad057 /packages/taler-wallet-core/src/operations | |
parent | 72ca5ee8dda247c1567b5f8d3878cd8371a9983f (diff) | |
download | wallet-core-cbf848dd2a1b24bb30ab10155c235c13edea575d.tar.xz |
wallet-core: return pending status instead of error
This allows clients to get the transaction ID of the confirmed payment.
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-merchant.ts | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index cb17f16eb..83c6b74d3 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -1625,28 +1625,11 @@ export async function runPayForConfirmPay( .runReadOnly(async (tx) => tx.operationRetries.get(RetryTags.byPaymentProposalId(proposalId)), ); - const maxRetry = 3; - const numRetry = opRetry?.retryInfo.retryCounter ?? 0; - if ( - res.errorDetail.code === - TalerErrorCode.WALLET_PAY_MERCHANT_SERVER_ERROR && - numRetry < maxRetry - ) { - logger.trace("hiding transient error from caller"); - // Pretend the operation is pending instead of reporting - // an error, but only up to maxRetry attempts. - await storeOperationPending( - ws, - RetryTags.byPaymentProposalId(proposalId), - ); - return { - type: ConfirmPayResultType.Pending, - lastError: opRetry?.lastError, - transactionId: makeTransactionId(TransactionType.Payment, proposalId), - }; - } else { - throw Error("payment failed"); - } + return { + type: ConfirmPayResultType.Pending, + lastError: opRetry?.lastError, + transactionId: makeTransactionId(TransactionType.Payment, proposalId), + }; } case OperationAttemptResultType.Pending: logger.trace("reporting pending as confirmPay response"); |