From f73cbe71cdb4c490a4d8bd495d159e1f56488988 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 10 Nov 2023 11:51:03 -0300 Subject: kyc operation don't give lifeness --- .../taler-wallet-core/src/operations/pending.ts | 41 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) (limited to 'packages') diff --git a/packages/taler-wallet-core/src/operations/pending.ts b/packages/taler-wallet-core/src/operations/pending.ts index 49dcbd5a6..7641dcf33 100644 --- a/packages/taler-wallet-core/src/operations/pending.ts +++ b/packages/taler-wallet-core/src/operations/pending.ts @@ -234,6 +234,11 @@ async function gatherWithdrawalPending( await iterRecordsForWithdrawal(tx, { onlyState: "nonfinal" }, async (wsr) => { const opTag = TaskIdentifiers.forWithdrawal(wsr); let opr = await tx.operationRetries.get(opTag); + /** + * kyc pending operation don't give lifeness + * since the user need to complete kyc procedure + */ + const userNeedToCompleteKYC = wsr.kycUrl !== undefined const now = AbsoluteTime.now(); if (!opr) { opr = { @@ -251,9 +256,9 @@ async function gatherWithdrawalPending( ws, opTag, timestampOptionalAbsoluteFromDb(opr.retryInfo?.nextRetry) ?? - AbsoluteTime.now(), + AbsoluteTime.now(), ), - givesLifeness: true, + givesLifeness: !userNeedToCompleteKYC, withdrawalGroupId: wsr.withdrawalGroupId, lastError: opr.lastError, retryInfo: opr.retryInfo, @@ -301,6 +306,11 @@ async function gatherDepositPending( deposited = false; } } + /** + * kyc pending operation don't give lifeness + * since the user need to complete kyc procedure + */ + const userNeedToCompleteKYC = dg.kycInfo !== undefined const opId = TaskIdentifiers.forDeposit(dg); const retryRecord = await tx.operationRetries.get(opId); const timestampDue = @@ -312,7 +322,7 @@ async function gatherDepositPending( // Fully deposited operations don't give lifeness, // because there is no reason to wait on the // deposit tracking status. - givesLifeness: !deposited, + givesLifeness: !deposited && !userNeedToCompleteKYC, depositGroupId: dg.depositGroupId, lastError: retryRecord?.lastError, retryInfo: retryRecord?.retryInfo, @@ -353,6 +363,13 @@ async function gatherRewardPending( const timestampDue = timestampOptionalAbsoluteFromDb(retryRecord?.retryInfo.nextRetry) ?? AbsoluteTime.now(); + + /** + * kyc pending operation don't give lifeness + * since the user need to complete kyc procedure + */ + // const userNeedToCompleteKYC = tip. + if (tip.acceptedTimestamp) { resp.pendingOperations.push({ type: PendingTaskType.RewardPickup, @@ -532,10 +549,17 @@ async function gatherPeerPullInitiationPending( const timestampDue = timestampOptionalAbsoluteFromDb(retryRecord?.retryInfo.nextRetry) ?? AbsoluteTime.now(); + + /** + * kyc pending operation don't give lifeness + * since the user need to complete kyc procedure + */ + const userNeedToCompleteKYC = pi.kycUrl !== undefined + resp.pendingOperations.push({ type: PendingTaskType.PeerPullCredit, ...getPendingCommon(ws, opId, timestampDue), - givesLifeness: true, + givesLifeness: !userNeedToCompleteKYC, retryInfo: retryRecord?.retryInfo, pursePub: pi.pursePub, internalOperationStatus: `0x${pi.status.toString(16)}`, @@ -683,10 +707,17 @@ async function gatherPeerPushCreditPending( const timestampDue = timestampOptionalAbsoluteFromDb(retryRecord?.retryInfo.nextRetry) ?? AbsoluteTime.now(); + + /** + * kyc pending operation don't give lifeness + * since the user need to complete kyc procedure + */ + const userNeedToCompleteKYC = pi.kycUrl !== undefined + resp.pendingOperations.push({ type: PendingTaskType.PeerPushCredit, ...getPendingCommon(ws, opId, timestampDue), - givesLifeness: true, + givesLifeness: !userNeedToCompleteKYC, retryInfo: retryRecord?.retryInfo, peerPushCreditId: pi.peerPushCreditId, }); -- cgit v1.2.3