From 7d562e7ee1172f14e4d304d0fbf39b1f9a524550 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 28 Nov 2023 11:24:31 +0100 Subject: always return WithdrawalAccountInfo instead of using two separate types for the same purpose --- packages/taler-util/src/wallet-types.ts | 25 +++++++++++++++++----- .../taler-wallet-core/src/operations/withdraw.ts | 12 ++--------- 2 files changed, 22 insertions(+), 15 deletions(-) (limited to 'packages') diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index d8e62dca0..d4d6119fb 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -1463,11 +1463,6 @@ export interface DenomSelectionState { }[]; } -export interface WireAccountDetails { - paytoUri: string; - creditRestrictions?: AccountRestriction[]; -} - /** * Information about what will happen doing a withdrawal. * @@ -2770,6 +2765,26 @@ export interface TestingWaitTransactionRequest { } export interface WithdrawalAccountInfo { + /** + * Payto URI to credit the exchange. + * + * Depending on whether the (manual!) withdrawal is accepted or just + * being checked, this already includes the subject with the + * reserve public key. + */ paytoUri: string; + + /** + * Transfer amount. Might be in a different currency than the requested + * amount for withdrawal. + * + * Redundant with the amount in paytoUri, just included to avoid parsing. + */ transferAmount: AmountString; + + /** + * Further restrictions for sending money to the + * exchange. + */ + creditRestrictions?: AccountRestriction[]; } diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 4673e1f0b..9dd0f0a3f 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -43,7 +43,6 @@ import { LibtoolVersion, Logger, NotificationType, - PaytoUri, TalerError, TalerErrorCode, TalerErrorDetail, @@ -56,7 +55,6 @@ import { TransactionType, URL, UnblindedSignature, - WireAccountDetails, WithdrawUriInfoResponse, WithdrawalAccountInfo, addPaytoQueryParams, @@ -68,7 +66,6 @@ import { codecForReserveStatus, codecForWalletKycUuid, codecForWithdrawOperationStatusResponse, - createEddsaKeyPair, encodeCrock, getErrorDetailFromException, getRandomBytes, @@ -1796,13 +1793,7 @@ export async function getExchangeWithdrawalInfo( const exchangeWireAccounts: string[] = []; for (const account of exchangeDetails.wireInfo.accounts) { - const details: WireAccountDetails = { - paytoUri: account.payto_uri, - }; - if (account.credit_restrictions) { - details.creditRestrictions = account.credit_restrictions; - } - exchangeWireAccounts.push(details.paytoUri); + exchangeWireAccounts.push(account.payto_uri); } let hasDenomWithAgeRestriction = false; @@ -2629,6 +2620,7 @@ async function fetchWithdrawalAccountInfo( const acctInfo: WithdrawalAccountInfo = { paytoUri, transferAmount, + creditRestrictions: acct.credit_restrictions, }; withdrawalAccounts.push(acctInfo); } -- cgit v1.2.3