diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts | 8 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/pending.ts | 21 |
2 files changed, 20 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts index 6b7b62393..36606e732 100644 --- a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts +++ b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts @@ -599,14 +599,18 @@ export async function processPeerPushCredit( await tx.peerPushCredit.put(peerInc); }); - checkDbInvariant(!!contractTerms); - if (!peerInc) { throw Error( `can't accept unknown incoming p2p push payment (${peerPushCreditId})`, ); } + logger.info( + `processing peerPushCredit in state ${peerInc.status.toString(16)}`, + ); + + checkDbInvariant(!!contractTerms); + switch (peerInc.status) { case PeerPushCreditStatus.PendingMergeKycRequired: { if (!peerInc.kycInfo) { diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 8f9506331..20359624d 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -38,6 +38,7 @@ import { PeerPullCreditRecord, PeerPullDebitRecordStatus, PeerPullPaymentIncomingRecord, + PeerPushCreditStatus, PeerPushDebitRecord, PeerPushPaymentIncomingRecord, PurchaseRecord, @@ -722,13 +723,19 @@ async function gatherPeerPushCreditPending( */ const userNeedToCompleteKYC = pi.kycUrl !== undefined; - resp.pendingOperations.push({ - type: PendingTaskType.PeerPushCredit, - ...getPendingCommon(ws, opId, timestampDue), - givesLifeness: !userNeedToCompleteKYC, - retryInfo: retryRecord?.retryInfo, - peerPushCreditId: pi.peerPushCreditId, - }); + switch (pi.status) { + // Status is nonfinal but no processing needs to be done + case PeerPushCreditStatus.DialogProposed: + return; + default: + resp.pendingOperations.push({ + type: PendingTaskType.PeerPushCredit, + ...getPendingCommon(ws, opId, timestampDue), + givesLifeness: !userNeedToCompleteKYC, + retryInfo: retryRecord?.retryInfo, + peerPushCreditId: pi.peerPushCreditId, + }); + } }, ); } |