diff options
author | Florian Dold <florian@dold.me> | 2024-06-17 11:34:32 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-06-17 11:34:32 +0200 |
commit | b59e472465440d95525e7e3d1225234525948b67 (patch) | |
tree | dfbbda8378bcef48f543eaed9fd6f3168c203ee5 /packages/taler-wallet-core/src | |
parent | 61dbe85eec8856e2b0cc50873e0f0bb1fc59754b (diff) | |
download | wallet-core-b59e472465440d95525e7e3d1225234525948b67.tar.xz |
wallet-core: fix auto-refund state machine
Properly use the new finalizing state
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/pay-merchant.ts | 5 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/testing.ts | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts index 5a0decd5c..118a338cc 100644 --- a/packages/taler-wallet-core/src/pay-merchant.ts +++ b/packages/taler-wallet-core/src/pay-merchant.ts @@ -1060,7 +1060,7 @@ async function storeFirstPaySuccess( if (protoAr) { const ar = Duration.fromTalerProtocolDuration(protoAr); logger.info("auto_refund present"); - purchase.purchaseStatus = PurchaseStatus.PendingQueryingAutoRefund; + purchase.purchaseStatus = PurchaseStatus.FinalizingQueryingAutoRefund; purchase.autoRefundDeadline = timestampProtocolToDb( AbsoluteTime.toProtocolTimestamp( AbsoluteTime.addDuration(AbsoluteTime.now(), ar), @@ -1460,6 +1460,7 @@ async function checkPaymentByProposalId( const paid = purchase.purchaseStatus === PurchaseStatus.Done || purchase.purchaseStatus === PurchaseStatus.PendingQueryingRefund || + purchase.purchaseStatus === PurchaseStatus.FinalizingQueryingAutoRefund || purchase.purchaseStatus === PurchaseStatus.PendingQueryingAutoRefund; const download = await expectProposalDownload(wex, purchase); return { @@ -2113,8 +2114,8 @@ export async function processPurchase( case PurchaseStatus.PendingPayingReplay: return processPurchasePay(wex, proposalId); case PurchaseStatus.PendingQueryingRefund: - case PurchaseStatus.FinalizingQueryingAutoRefund: return processPurchaseQueryRefund(wex, purchase); + case PurchaseStatus.FinalizingQueryingAutoRefund: case PurchaseStatus.PendingQueryingAutoRefund: return processPurchaseAutoRefund(wex, purchase); case PurchaseStatus.AbortingWithRefund: diff --git a/packages/taler-wallet-core/src/testing.ts b/packages/taler-wallet-core/src/testing.ts index 899c4a8b2..057ac50cd 100644 --- a/packages/taler-wallet-core/src/testing.ts +++ b/packages/taler-wallet-core/src/testing.ts @@ -410,6 +410,7 @@ export async function waitUntilAllTransactionsFinal( switch (notif.newTxState.major) { case TransactionMajorState.Pending: case TransactionMajorState.Aborting: + case TransactionMajorState.Finalizing: return false; default: return true; @@ -424,6 +425,7 @@ export async function waitUntilAllTransactionsFinal( switch (tx.txState.major) { case TransactionMajorState.Pending: case TransactionMajorState.Aborting: + case TransactionMajorState.Finalizing: case TransactionMajorState.Suspended: case TransactionMajorState.SuspendedAborting: logger.info( @@ -497,6 +499,7 @@ export async function waitUntilGivenTransactionsFinal( } switch (tx.txState.major) { case TransactionMajorState.Pending: + case TransactionMajorState.Finalizing: case TransactionMajorState.Aborting: case TransactionMajorState.Suspended: case TransactionMajorState.SuspendedAborting: @@ -542,6 +545,7 @@ export async function waitUntilRefreshesDone( } switch (tx.txState.major) { case TransactionMajorState.Pending: + case TransactionMajorState.Finalizing: case TransactionMajorState.Aborting: case TransactionMajorState.Suspended: case TransactionMajorState.SuspendedAborting: |