diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 5c9854c0f..28754c77e 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -1250,12 +1250,7 @@ export async function processWithdrawalGroup( if (numKycRequired > 0) { if (kycInfo) { - await checkKycStatus( - ws, - withdrawalGroup.exchangeBaseUrl, - kycInfo, - "individual", - ); + await checkWithdrawalKycStatus(ws, withdrawalGroup, kycInfo, "individual"); return { type: OperationAttemptResultType.Pending, result: undefined, @@ -1293,12 +1288,13 @@ export async function processWithdrawalGroup( }; } -export async function checkKycStatus( +export async function checkWithdrawalKycStatus( ws: InternalWalletState, - exchangeUrl: string, + wg: WithdrawalGroupRecord, kycInfo: KycPendingInfo, userType: KycUserType, ): Promise<void> { + const exchangeUrl = wg.exchangeBaseUrl; const url = new URL( `kyc-check/${kycInfo.requirementRow}/${kycInfo.paytoHash}/${userType}`, exchangeUrl, @@ -1307,12 +1303,20 @@ export async function checkKycStatus( const kycStatusReq = await ws.http.fetch(url.href, { method: "GET", }); - logger.warn("kyc requested, but already fulfilled"); if (kycStatusReq.status === HttpStatusCode.Ok) { + logger.warn("kyc requested, but already fulfilled"); return; } else if (kycStatusReq.status === HttpStatusCode.Accepted) { const kycStatus = await kycStatusReq.json(); logger.info(`kyc status: ${j2s(kycStatus)}`); + ws.notify({ + type: NotificationType.WithdrawalKycRequested, + kycUrl: kycStatus.kyc_url, + transactionId: makeTransactionId( + TransactionType.Withdrawal, + wg.withdrawalGroupId, + ), + }); throw TalerError.fromDetail( TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED, { |