aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-08-23 11:29:45 +0200
committerFlorian Dold <florian@dold.me>2022-08-23 20:35:11 +0200
commitf3ff5a72257dda27cab555f8b8d921d45bfc3e4b (patch)
tree708494a3aa2346fead51931fe4bfc41cc0249659 /packages/taler-wallet-cli
parent4ca38113abee2c0ca17b26aa55cf6a0ecafe49c9 (diff)
peer-to-peer pull payments MVP
p2p pull wip
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r--packages/taler-wallet-cli/src/harness/harness.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-pull.ts70
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-push.ts (renamed from packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer.ts)4
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/testrunner.ts6
4 files changed, 77 insertions, 5 deletions
diff --git a/packages/taler-wallet-cli/src/harness/harness.ts b/packages/taler-wallet-cli/src/harness/harness.ts
index c735c9956..33f677d94 100644
--- a/packages/taler-wallet-cli/src/harness/harness.ts
+++ b/packages/taler-wallet-cli/src/harness/harness.ts
@@ -1284,7 +1284,7 @@ export class ExchangeService implements ExchangeServiceInterface {
// account fee
`${this.exchangeConfig.currency}:0.01`,
// purse fee
- `${this.exchangeConfig.currency}:0.01`,
+ `${this.exchangeConfig.currency}:0.00`,
// purse timeout
"1h",
// kyc timeout
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-pull.ts b/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-pull.ts
new file mode 100644
index 000000000..e78bd5a29
--- /dev/null
+++ b/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-pull.ts
@@ -0,0 +1,70 @@
+/*
+ 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 { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
+import { GlobalTestState } from "../harness/harness.js";
+import {
+ createSimpleTestkudosEnvironment,
+ withdrawViaBank,
+} from "../harness/helpers.js";
+
+/**
+ * Run test for basic, bank-integrated withdrawal and payment.
+ */
+export async function runPeerToPeerPullTest(t: GlobalTestState) {
+ // Set up test environment
+
+ const { wallet, bank, exchange, merchant } =
+ await createSimpleTestkudosEnvironment(t);
+
+ // Withdraw digital cash into the wallet.
+
+ await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" });
+
+ await wallet.runUntilDone();
+
+ const resp = await wallet.client.call(
+ WalletApiOperation.InitiatePeerPullPayment,
+ {
+ exchangeBaseUrl: exchange.baseUrl,
+ amount: "TESTKUDOS:5",
+ partialContractTerms: {
+ summary: "Hello World",
+ },
+ },
+ );
+
+ const checkResp = await wallet.client.call(
+ WalletApiOperation.CheckPeerPullPayment,
+ {
+ talerUri: resp.talerUri,
+ },
+ );
+
+ const acceptResp = await wallet.client.call(
+ WalletApiOperation.AcceptPeerPullPayment,
+ {
+ peerPullPaymentIncomingId: checkResp.peerPullPaymentIncomingId,
+ },
+ );
+
+ await wallet.runUntilDone();
+}
+
+runPeerToPeerPullTest.suites = ["wallet"];
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer.ts b/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-push.ts
index c22258bc8..11360f6e9 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer-push.ts
@@ -27,7 +27,7 @@ import {
/**
* Run test for basic, bank-integrated withdrawal and payment.
*/
-export async function runPeerToPeerTest(t: GlobalTestState) {
+export async function runPeerToPeerPushTest(t: GlobalTestState) {
// Set up test environment
const { wallet, bank, exchange, merchant } =
@@ -72,4 +72,4 @@ export async function runPeerToPeerTest(t: GlobalTestState) {
await wallet.runUntilDone();
}
-runPeerToPeerTest.suites = ["wallet"];
+runPeerToPeerPushTest.suites = ["wallet"];
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index cafcce79e..88e67a8bb 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -73,7 +73,8 @@ import { runPaymentDemoTest } from "./test-payment-on-demo";
import { runPaymentTransientTest } from "./test-payment-transient";
import { runPaymentZeroTest } from "./test-payment-zero.js";
import { runPaywallFlowTest } from "./test-paywall-flow";
-import { runPeerToPeerTest } from "./test-peer-to-peer.js";
+import { runPeerToPeerPullTest } from "./test-peer-to-peer-pull.js";
+import { runPeerToPeerPushTest } from "./test-peer-to-peer-push.js";
import { runRefundTest } from "./test-refund";
import { runRefundAutoTest } from "./test-refund-auto";
import { runRefundGoneTest } from "./test-refund-gone";
@@ -154,7 +155,8 @@ const allTests: TestMainFunction[] = [
runPaymentZeroTest,
runPayPaidTest,
runPaywallFlowTest,
- runPeerToPeerTest,
+ runPeerToPeerPushTest,
+ runPeerToPeerPullTest,
runRefundAutoTest,
runRefundGoneTest,
runRefundIncrementalTest,