diff options
Diffstat (limited to 'packages/taler-wallet-core/src/operations/withdraw.ts')
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 145a2d9c7..700c4620c 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -69,6 +69,7 @@ import { CoinStatus, DenominationRecord, DenominationVerificationStatus, + ExchangeTosRecord, PlanchetRecord, PlanchetStatus, WalletStoresV1, @@ -1278,12 +1279,8 @@ export async function getExchangeWithdrawalInfo( } let tosAccepted = false; - - if (exchangeDetails.termsOfServiceLastEtag) { - if ( - exchangeDetails.termsOfServiceAcceptedEtag === - exchangeDetails.termsOfServiceLastEtag - ) { + if (exchangeDetails.tosAccepted?.timestamp) { + if (exchangeDetails.tosAccepted.etag === exchangeDetails.tosCurrentEtag) { tosAccepted = true; } } @@ -1357,7 +1354,12 @@ export async function getWithdrawalDetailsForUri( const exchanges: ExchangeListItem[] = []; await ws.db - .mktx((x) => [x.exchanges, x.exchangeDetails, x.denominations]) + .mktx((x) => [ + x.exchanges, + x.exchangeDetails, + x.exchangeTos, + x.denominations, + ]) .runReadOnly(async (tx) => { const exchangeRecords = await tx.exchanges.iter().toArray(); for (const r of exchangeRecords) { @@ -1366,14 +1368,19 @@ export async function getWithdrawalDetailsForUri( .iter(r.baseUrl) .toArray(); if (details && denominations) { + const tosRecord = await tx.exchangeTos.get([ + details.exchangeBaseUrl, + details.tosCurrentEtag, + ]); exchanges.push({ exchangeBaseUrl: details.exchangeBaseUrl, currency: details.currency, + // FIXME: We probably don't want to include the full ToS here! tos: { - acceptedVersion: details.termsOfServiceAcceptedEtag, - currentVersion: details.termsOfServiceLastEtag, - contentType: details.termsOfServiceContentType, - content: details.termsOfServiceText, + acceptedVersion: details.tosAccepted?.etag, + currentVersion: details.tosCurrentEtag, + contentType: tosRecord?.termsOfServiceContentType ?? "", + content: tosRecord?.termsOfServiceText ?? "", }, paytoUris: details.wireInfo.accounts.map((x) => x.payto_uri), }); |