diff options
author | Florian Dold <florian@dold.me> | 2024-03-25 12:06:57 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-03-25 12:06:57 +0100 |
commit | e9bdeb71b7e66d2fbbeab869b3115de88b626890 (patch) | |
tree | 879791d46fe7dbcd710840d7319a760143c3af8f /packages/taler-wallet-core/src/withdraw.ts | |
parent | bc29fc73aed60c83b4e508754a40c1deed798cbd (diff) | |
download | wallet-core-e9bdeb71b7e66d2fbbeab869b3115de88b626890.tar.xz |
wallet-core: pass extended bank account info to UI
Also pre-sort accounts by priority
Diffstat (limited to 'packages/taler-wallet-core/src/withdraw.ts')
-rw-r--r-- | packages/taler-wallet-core/src/withdraw.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts index f27e9e132..9132d2b09 100644 --- a/packages/taler-wallet-core/src/withdraw.ts +++ b/packages/taler-wallet-core/src/withdraw.ts @@ -2799,6 +2799,8 @@ async function fetchAccount( status: "ok", paytoUri, transferAmount, + bankLabel: acct.bank_label, + priority: acct.priority, currencySpecification, creditRestrictions: acct.credit_restrictions, }; @@ -2834,6 +2836,12 @@ async function fetchWithdrawalAccountInfo( ); withdrawalAccounts.push(acctInfo); } + withdrawalAccounts.sort((x1, x2) => { + // Accounts without priority come last. + const n1 = x1.priority ?? Number.MAX_SAFE_INTEGER; + const n2 = x2.priority ?? Number.MAX_SAFE_INTEGER; + return Math.sign(n1 - n2); + }); return withdrawalAccounts; } |