commit dbdc6247859f4f13f93e06f8263b30e433eaa20b
parent 1cdd1641c317933b2c935fd8540e06befd492395
Author: Florian Dold <florian@dold.me>
Date: Sun, 4 May 2025 00:42:52 +0200
wallet-core: use actual withdrawal amount (not instructed!) for balance KYC
Diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
@@ -1009,7 +1009,12 @@ async function processWithdrawalGroupBalanceKyc(
withdrawalGroup: WithdrawalGroupRecord,
): Promise<TaskRunResult> {
const exchangeBaseUrl = withdrawalGroup.exchangeBaseUrl;
- const amount = withdrawalGroup.effectiveWithdrawalAmount;
+ if (!withdrawalGroup.denomsSel) {
+ throw Error(
+ "invalid state: expected withdrawal group to have denom selection",
+ );
+ }
+ const amount = withdrawalGroup.denomsSel.totalCoinValue;
if (!exchangeBaseUrl) {
throw Error(
"invalid state (expected withdrawal group to have exchange base URL)",
@@ -1021,6 +1026,9 @@ async function processWithdrawalGroupBalanceKyc(
);
}
+ // Wait until either:
+ // (a) Withdrawing became legal w.r.t. the balance threshold
+ // (b) We received an access token for the KYC process
const ret = await genericWaitForStateVal(ctx.wex, {
async checkState(): Promise<BalanceThresholdCheckResult | undefined> {
const checkRes = await checkIncomingAmountLegalUnderKycBalanceThreshold(
@@ -2561,7 +2569,7 @@ async function processWithdrawalGroupPendingReady(
const kycCheckRes = await checkIncomingAmountLegalUnderKycBalanceThreshold(
wex,
withdrawalGroup.exchangeBaseUrl,
- withdrawalGroup.effectiveWithdrawalAmount,
+ withdrawalGroup.denomsSel.totalCoinValue,
);
logger.info(`balance-kyc check result: ${j2s(kycCheckRes)}`);