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: allow treating b


From: gnunet
Subject: [taler-wallet-core] branch master updated: wallet-core: allow treating bank accounts as foreign in withdrawal
Date: Wed, 27 Nov 2024 14:45:13 +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 bdc056ba3 wallet-core: allow treating bank accounts as foreign in 
withdrawal
bdc056ba3 is described below

commit bdc056ba3428846b024a010edf25bd6a60fe6ae7
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Nov 27 14:41:49 2024 +0100

    wallet-core: allow treating bank accounts as foreign in withdrawal
    
    Foreign bank accounts won't be added to the known bank accounts.
---
 .../src/integrationtests/test-wallettesting.ts       |  2 +-
 packages/taler-util/src/types-taler-wallet.ts        | 20 ++++++++++++++++++++
 packages/taler-wallet-core/src/db.ts                 |  9 +++++++++
 packages/taler-wallet-core/src/testing.ts            |  1 +
 packages/taler-wallet-core/src/withdraw.ts           |  9 ++++++++-
 5 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-wallettesting.ts 
b/packages/taler-harness/src/integrationtests/test-wallettesting.ts
index fa3456ac0..5e2459a4d 100644
--- a/packages/taler-harness/src/integrationtests/test-wallettesting.ts
+++ b/packages/taler-harness/src/integrationtests/test-wallettesting.ts
@@ -25,12 +25,12 @@
 import { AmountString, Amounts, CoinStatus } from "@gnu-taler/taler-util";
 import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
 import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import { GlobalTestState, setupDb } from "../harness/harness.js";
 import {
   SimpleTestEnvironmentNg3,
   createSimpleTestkudosEnvironmentV3,
   createWalletDaemonWithClient,
 } from "../harness/environments.js";
+import { GlobalTestState, setupDb } from "../harness/harness.js";
 
 const merchantAuthToken = "secret-token:sandbox";
 
diff --git a/packages/taler-util/src/types-taler-wallet.ts 
b/packages/taler-util/src/types-taler-wallet.ts
index e8f6d3963..14b1dce0e 100644
--- a/packages/taler-util/src/types-taler-wallet.ts
+++ b/packages/taler-util/src/types-taler-wallet.ts
@@ -2152,13 +2152,33 @@ export interface CoreApiResponseError {
 }
 
 export interface WithdrawTestBalanceRequest {
+  /**
+   * Amount to withdraw.
+   */
   amount: AmountString;
+
   /**
    * Corebank API base URL.
    */
   corebankApiBaseUrl: string;
+
+  /**
+   * Exchange to use for withdrawal.
+   */
   exchangeBaseUrl: string;
+
+  /**
+   * Force the usage of a particular denomination selection.
+   *
+   * Only useful for testing.
+   */
   forcedDenomSel?: ForcedDenomSel;
+
+  /**
+   * If set to true, treat the account created during
+   * the withdrawal as a foreign withdrawal account.
+   */
+  useForeignAccount?: boolean;
 }
 
 /**
diff --git a/packages/taler-wallet-core/src/db.ts 
b/packages/taler-wallet-core/src/db.ts
index 7e402a35e..b44aec507 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -1498,6 +1498,15 @@ export interface WithdrawalGroupRecord {
 
   wgInfo: WgInfo;
 
+  /**
+   * If set to true, the account used during withdrawal is treated as an
+   * account that does not belong to the user. It won't be shown in
+   * the list of know bank accounts.
+   *
+   * Defaults to false.
+   */
+  isForeignAccount?: boolean;
+
   kycPaytoHash?: string;
 
   kycAccessToken?: string;
diff --git a/packages/taler-wallet-core/src/testing.ts 
b/packages/taler-wallet-core/src/testing.ts
index 0394dae53..ecbe1e6df 100644
--- a/packages/taler-wallet-core/src/testing.ts
+++ b/packages/taler-wallet-core/src/testing.ts
@@ -138,6 +138,7 @@ export async function withdrawTestBalance(
     talerWithdrawUri: wresp.taler_withdraw_uri,
     selectedExchange: exchangeBaseUrl,
     forcedDenomSel: req.forcedDenomSel,
+    isForeignAccount: req.useForeignAccount,
   });
 
   await corebankClient.confirmWithdrawalOperation(bankUser.username, {
diff --git a/packages/taler-wallet-core/src/withdraw.ts 
b/packages/taler-wallet-core/src/withdraw.ts
index 536ef63f7..44f9ae531 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -3071,6 +3071,7 @@ export async function 
internalPrepareCreateWithdrawalGroup(
     reserveKeyPair?: EddsaKeyPairStrings;
     restrictAge?: number;
     wgInfo: WgInfo;
+    isForeignAccount?: boolean;
   },
 ): Promise<PrepareCreateWithdrawalGroupResult> {
   const reserveKeyPair =
@@ -3134,6 +3135,7 @@ export async function 
internalPrepareCreateWithdrawalGroup(
     restrictAge: args.restrictAge,
     timestampFinish: undefined,
     wgInfo: args.wgInfo,
+    isForeignAccount: args.isForeignAccount,
   };
 
   if (exchangeBaseUrl !== undefined) {
@@ -3266,6 +3268,7 @@ export async function internalCreateWithdrawalGroup(
     reserveKeyPair?: EddsaKeyPairStrings;
     restrictAge?: number;
     wgInfo: WgInfo;
+    isForeignAccount?: boolean;
   },
 ): Promise<WithdrawalGroupRecord> {
   const prep = await internalPrepareCreateWithdrawalGroup(wex, args);
@@ -3305,6 +3308,7 @@ export async function prepareBankIntegratedWithdrawal(
   wex: WalletExecutionContext,
   req: {
     talerWithdrawUri: string;
+    isForeignAccount?: boolean;
   },
 ): Promise<PrepareBankIntegratedWithdrawalResponse> {
   const existingWithdrawalGroup = await wex.db.runReadOnlyTx(
@@ -3366,6 +3370,7 @@ export async function prepareBankIntegratedWithdrawal(
         externalConfirmation,
       },
     },
+    isForeignAccount: req.isForeignAccount,
     reserveStatus: WithdrawalGroupStatus.DialogProposed,
   });
 
@@ -3460,7 +3465,7 @@ export async function confirmWithdrawal(
 
   const senderWire = withdrawalGroup.wgInfo.bankInfo.senderWire;
 
-  if (senderWire) {
+  if (senderWire && !withdrawalGroup.isForeignAccount) {
     logger.info(`sender wire is ${senderWire}`);
     const parsedSenderWire = parsePaytoUri(senderWire);
     if (!parsedSenderWire) {
@@ -3623,6 +3628,7 @@ export async function acceptBankIntegratedWithdrawal(
     forcedDenomSel?: ForcedDenomSel;
     restrictAge?: number;
     amount?: AmountLike;
+    isForeignAccount?: boolean;
   },
 ): Promise<AcceptWithdrawalResponse> {
   wex.oc.observe({
@@ -3637,6 +3643,7 @@ export async function acceptBankIntegratedWithdrawal(
 
   const p = await prepareBankIntegratedWithdrawal(wex, {
     talerWithdrawUri: req.talerWithdrawUri,
+    isForeignAccount: req.isForeignAccount,
   });
 
   wex.oc.observe({

-- 
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]