aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/withdraw.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-core/src/withdraw.ts')
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts14
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
index ef04f8737..fa1066f0f 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -26,6 +26,7 @@ import {
AbsoluteTime,
AcceptManualWithdrawalResult,
AcceptWithdrawalResponse,
+ AccountKycStatus,
AgeRestriction,
Amount,
AmountJson,
@@ -229,6 +230,7 @@ function buildTransactionForBankIntegratedWithdraw(
wg.status === WithdrawalGroupStatus.PendingReady,
},
kycUrl: wg.kycUrl,
+ kycAccessToken: wg.kycAccessToken,
kycPaytoHash: wg.kycPending?.paytoHash,
timestamp: timestampPreciseFromDb(wg.timestampStart),
transactionId: constructTransactionIdentifier({
@@ -1210,7 +1212,7 @@ async function handleKycRequired(
["Account-Owner-Signature"]: sigResp.sig,
},
});
- let kycUrl: string;
+ let kycStatus: AccountKycStatus;
if (
kycStatusRes.status === HttpStatusCode.Ok ||
// FIXME: NoContent is not expected https://docs.taler.net/core/api-exchange.html#post--purses-$PURSE_PUB-merge
@@ -1220,12 +1222,11 @@ async function handleKycRequired(
logger.warn("kyc requested, but already fulfilled");
return;
} else if (kycStatusRes.status === HttpStatusCode.Accepted) {
- const kycStatus = await readSuccessResponseJsonOrThrow(
+ kycStatus = await readSuccessResponseJsonOrThrow(
kycStatusRes,
codecForAccountKycStatus(),
);
logger.info(`kyc status: ${j2s(kycStatus)}`);
- kycUrl = new URL(`kyc-spa/${kycStatus.access_token}`, exchangeUrl).href;
} else {
throwUnexpectedRequestError(
kycStatusRes,
@@ -1255,11 +1256,16 @@ async function handleKycRequired(
if (wg2.status !== WithdrawalGroupStatus.PendingReady) {
return TransitionResult.stay();
}
+ // FIXME: Why not just store the whole kycState?!
wg2.kycPending = {
paytoHash: uuidResp.h_payto,
requirementRow: uuidResp.requirement_row,
};
- wg2.kycUrl = kycUrl;
+ wg2.kycUrl = new URL(
+ `kyc-spa/${kycStatus.access_token}`,
+ exchangeUrl,
+ ).href;
+ wg2.kycAccessToken = kycStatus.access_token;
wg2.status = WithdrawalGroupStatus.PendingKyc;
return TransitionResult.transition(wg2);
},