From b214934b75418d0d01c9556577d9594f1db5a319 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Tue, 21 Jun 2022 12:40:12 +0200 Subject: wallet-core: P2P push payments (still incomplete) --- packages/taler-wallet-cli/src/harness/harness.ts | 30 ++++++++++++ .../src/integrationtests/test-peer-to-peer.ts | 53 ++++++++++++++++++++++ .../src/integrationtests/testrunner.ts | 2 + 3 files changed, 85 insertions(+) create mode 100644 packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer.ts (limited to 'packages/taler-wallet-cli') diff --git a/packages/taler-wallet-cli/src/harness/harness.ts b/packages/taler-wallet-cli/src/harness/harness.ts index 74a523343..3b58219bb 100644 --- a/packages/taler-wallet-cli/src/harness/harness.ts +++ b/packages/taler-wallet-cli/src/harness/harness.ts @@ -1296,6 +1296,36 @@ export class ExchangeService implements ExchangeServiceInterface { ); } } + + await runCommand( + this.globalState, + "exchange-offline", + "taler-exchange-offline", + [ + "-c", + this.configFilename, + "global-fee", + // year + "now", + // history fee + `${this.exchangeConfig.currency}:0.01`, + // kyc fee + `${this.exchangeConfig.currency}:0.01`, + // account fee + `${this.exchangeConfig.currency}:0.01`, + // purse fee + `${this.exchangeConfig.currency}:0.01`, + // purse timeout + "1h", + // kyc timeout + "1h", + // history expiration + "1year", + // free purses per account + "5", + "upload", + ], + ); } async revokeDenomination(denomPubHash: string) { 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.ts new file mode 100644 index 000000000..4d27f45d7 --- /dev/null +++ b/packages/taler-wallet-cli/src/integrationtests/test-peer-to-peer.ts @@ -0,0 +1,53 @@ +/* + 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 + */ + +/** + * Imports. + */ +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { + createSimpleTestkudosEnvironment, + withdrawViaBank, + makeTestPayment, +} from "../harness/helpers.js"; + +/** + * Run test for basic, bank-integrated withdrawal and payment. + */ +export async function runPeerToPeerTest(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.InitiatePeerPushPayment, + { + amount: "TESTKUDOS:5", + }, + ); + + console.log(resp); +} + +runPeerToPeerTest.suites = ["wallet"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts index e8aef5136..cafcce79e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts +++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts @@ -73,6 +73,7 @@ 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 { runRefundTest } from "./test-refund"; import { runRefundAutoTest } from "./test-refund-auto"; import { runRefundGoneTest } from "./test-refund-gone"; @@ -153,6 +154,7 @@ const allTests: TestMainFunction[] = [ runPaymentZeroTest, runPayPaidTest, runPaywallFlowTest, + runPeerToPeerTest, runRefundAutoTest, runRefundGoneTest, runRefundIncrementalTest, -- cgit v1.2.3