diff options
author | Florian Dold <florian@dold.me> | 2023-02-12 19:30:59 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-02-12 19:31:37 +0100 |
commit | 13f0442736479fb6ea8d1ecc7311cdac354a4de5 (patch) | |
tree | a39badc56b57a5039ec04267adb4df42b84cee7a /packages/taler-wallet-core/src/operations/withdraw.ts | |
parent | 04ab9f37801f6a42b85581cc79667239d3fc79e5 (diff) | |
download | wallet-core-13f0442736479fb6ea8d1ecc7311cdac354a4de5.tar.xz |
harness: finish kyc test
We mock the KYC gateway now, use the new notification-based wallet API
and the test is not experimental anymore.
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, { |