gnunet-svn
[Top][All Lists]
Advanced

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

[taler-wallet-core] branch master updated: -missing file


From: gnunet
Subject: [taler-wallet-core] branch master updated: -missing file
Date: Tue, 07 Jan 2025 19:31:47 +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 70bd1230b -missing file
70bd1230b is described below

commit 70bd1230b3d0538f0bdb4965bf2d92730b44a808
Author: Florian Dold <florian@dold.me>
AuthorDate: Tue Jan 7 19:31:45 2025 +0100

    -missing file
---
 .../test-withdrawal-cashacceptor.ts                | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git 
a/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts 
b/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts
new file mode 100644
index 000000000..a92cdd919
--- /dev/null
+++ 
b/packages/taler-harness/src/integrationtests/test-withdrawal-cashacceptor.ts
@@ -0,0 +1,98 @@
+/*
+ This file is part of GNU Taler
+ (C) 2020 Taler Systems S.A.
+
+ GNU Taler is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 3, or (at your option) any later version.
+
+ GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ GNU Taler; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
+ */
+
+/**
+ * Imports.
+ */
+import {
+  j2s,
+  narrowOpSuccessOrThrow,
+  TalerCoreBankHttpClient,
+} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import {
+  createSimpleTestkudosEnvironmentV3,
+  registerHarnessBankTestUser,
+} from "../harness/environments.js";
+import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
+
+/**
+ * Test a cash-acceptor-style withdrawal where the amount
+ * is not known upfront but also can't be chosen by the wallet.
+ */
+export async function runWithdrawalCashacceptorTest(t: GlobalTestState) {
+  // Set up test environment
+
+  const { walletClient, exchange, bank } =
+    await createSimpleTestkudosEnvironmentV3(t, undefined, {
+      forceLibeufin: true,
+    });
+
+  const bankClientNg = new TalerCoreBankHttpClient(
+    bank.corebankApiBaseUrl,
+    harnessHttpLib,
+  );
+
+  const bankUser = await registerHarnessBankTestUser(bankClientNg);
+
+  const withdrawalRes = await bankClientNg.createWithdrawal(bankUser, {
+    no_amount_to_wallet: true,
+  });
+
+  narrowOpSuccessOrThrow("createWithdrawal", withdrawalRes);
+
+  const wop = withdrawalRes.body;
+
+  const r1 = await walletClient.call(
+    WalletApiOperation.GetWithdrawalDetailsForUri,
+    {
+      talerWithdrawUri: wop.taler_withdraw_uri,
+    },
+  );
+
+  console.log(j2s(r1));
+
+  t.assertTrue(!r1.amount);
+
+  // Withdraw
+
+  await walletClient.call(WalletApiOperation.AcceptBankIntegratedWithdrawal, {
+    exchangeBaseUrl: exchange.baseUrl,
+    talerWithdrawUri: wop.taler_withdraw_uri,
+  });
+
+  const txns = await walletClient.call(
+    WalletApiOperation.GetTransactionsV2,
+    {},
+  );
+  console.log(`transactions: ${j2s(txns)}`);
+
+  const bankConfirmResp = await bankClientNg.confirmWithdrawalById(
+    bankUser,
+    {
+      amount: "TESTKUDOS:10",
+    },
+    wop.withdrawal_id,
+  );
+  narrowOpSuccessOrThrow("confirmWithdrawalById", bankConfirmResp);
+  await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});
+
+  const bal = await walletClient.call(WalletApiOperation.GetBalances, {});
+
+  t.assertAmountEquals(bal.balances[0].available, "TESTKUDOS:9.72");
+}
+
+runWithdrawalCashacceptorTest.suites = ["wallet"];

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