gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: wallet-core: pass extended ba


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: pass extended bank account info to UI
Date: Mon, 25 Mar 2024 12:07:02 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new e9bdeb71b wallet-core: pass extended bank account info to UI
e9bdeb71b is described below

commit e9bdeb71b7e66d2fbbeab869b3115de88b626890
Author: Florian Dold <florian@dold.me>
AuthorDate: Mon Mar 25 12:06:57 2024 +0100

    wallet-core: pass extended bank account info to UI
    
    Also pre-sort accounts by priority
---
 packages/taler-util/src/taler-types.ts     |  9 ++++++++-
 packages/taler-util/src/wallet-types.ts    | 10 ++++++++++
 packages/taler-wallet-core/src/withdraw.ts |  8 ++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/packages/taler-util/src/taler-types.ts 
b/packages/taler-util/src/taler-types.ts
index 419aeb159..5c0b3d0c1 100644
--- a/packages/taler-util/src/taler-types.ts
+++ b/packages/taler-util/src/taler-types.ts
@@ -32,7 +32,6 @@ import {
   buildCodecForUnion,
   codecForAny,
   codecForBoolean,
-  codecForConstNumber,
   codecForConstString,
   codecForList,
   codecForMap,
@@ -2305,6 +2304,12 @@ export interface ExchangeWireAccount {
   // a TALER_MasterWireDetailsPS
   // with purpose TALER_SIGNATURE_MASTER_WIRE_DETAILS.
   master_sig: EddsaSignatureString;
+
+  // Display label wallets should use to show this
+  // bank account.
+  // Since protocol **v19**.
+  bank_label?: string;
+  priority?: number;
 }
 
 export const codecForExchangeWireAccount = (): Codec<ExchangeWireAccount> =>
@@ -2314,6 +2319,8 @@ export const codecForExchangeWireAccount = (): 
Codec<ExchangeWireAccount> =>
     .property("debit_restrictions", codecForList(codecForAny()))
     .property("master_sig", codecForString())
     .property("payto_uri", codecForString())
+    .property("bank_label", codecOptional(codecForString()))
+    .property("priority", codecOptional(codecForNumber()))
     .build("WireAccount");
 
 export type Integer = number;
diff --git a/packages/taler-util/src/wallet-types.ts 
b/packages/taler-util/src/wallet-types.ts
index 5916eb968..0b09b0dbf 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -3019,6 +3019,16 @@ export interface WithdrawalExchangeAccountDetails {
    */
   creditRestrictions?: AccountRestriction[];
 
+  /**
+   * Label given to the account or the account's bank by the exchange.
+   */
+  bankLabel?: string;
+
+  /*
+   * Display priority assigned to this bank account by the exchange.
+   */
+  priority?: number;
+
   /**
    * Error that happened when attempting to request the conversion rate.
    */
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;
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]