diff options
author | ms <ms@taler.net> | 2021-09-01 17:38:54 +0200 |
---|---|---|
committer | ms <ms@taler.net> | 2021-09-01 17:38:54 +0200 |
commit | 79c14e77ecdb0fcf11c109cd53ce8d065d47c611 (patch) | |
tree | ef16c825509e88c375af5c5432a921e85df4daf1 /packages/taler-wallet-cli | |
parent | 2cecdccb49dc91f75eb81fcb9d7a213ee96b8b5a (diff) | |
download | wallet-core-79c14e77ecdb0fcf11c109cd53ce8d065d47c611.tar.xz |
Avoid Sandbox (deprecated) POST /admin/payments/ API.
Diffstat (limited to 'packages/taler-wallet-cli')
4 files changed, 46 insertions, 65 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts index 2fbc952e7..d51694026 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-bankaccount.ts @@ -88,20 +88,17 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) { "mock", "local-mock", ); - - await LibeufinSandboxApi.bookPayment2(sandbox, { - creditorIban: "DE71500105179674997361", - creditorBic: "BELADEBEXXX", - creditorName: "mock", - debtorIban: "DE84500105176881385584", - debtorBic: "BELADEBEXXX", - debtorName: "mock2", - subject: "mock subject", - currency: "EUR", - amount: "1", - uid: "mock", - direction: "CRDT", - }); + await LibeufinSandboxApi.simulateIncomingTransaction( + sandbox, + "mock", // creditor bankaccount label + { + debtorIban: "DE84500105176881385584", + debtorBic: "BELADEBEXXX", + debtorName: "mock2", + amount: "1", + subject: "mock subject", + } + ); await LibeufinNexusApi.fetchAllTransactions(nexus, "local-mock"); let transactions = await LibeufinNexusApi.getAccountTransactions( nexus, diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts index fc558af14..f9676c58c 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-api-sandbox-transactions.ts @@ -42,32 +42,30 @@ export async function runLibeufinApiSandboxTransactionsTest(t: GlobalTestState) label: "mock-account", currency: "EUR" }); - await LibeufinSandboxApi.bookPayment2(sandbox, { - creditorIban: "DE71500105179674997361", - creditorBic: "BELADEBEXXX", - creditorName: "mock", - debtorIban: "DE84500105176881385584", - debtorBic: "BELADEBEXXX", - debtorName: "mock2", - subject: "mock subject", - currency: "EUR", - amount: "1", - uid: "mock", - direction: "CRDT", - }); - await LibeufinSandboxApi.bookPayment2(sandbox, { - creditorIban: "DE71500105179674997361", - creditorBic: "BELADEBEXXX", - creditorName: "mock", - debtorIban: "DE84500105176881385584", - debtorBic: "BELADEBEXXX", - debtorName: "mock2", - subject: "mock subject 2", - currency: "EUR", - amount: "1.1", - uid: "mock2", - direction: "CRDT", - }); + await LibeufinSandboxApi.simulateIncomingTransaction( + sandbox, + "mock-account", + { + + debtorIban: "DE84500105176881385584", + debtorBic: "BELADEBEXXX", + debtorName: "mock2", + subject: "mock subject", + amount: "1" // EUR is default. + } + ) + await LibeufinSandboxApi.simulateIncomingTransaction( + sandbox, + "mock-account", + { + + debtorIban: "DE84500105176881385584", + debtorBic: "BELADEBEXXX", + debtorName: "mock2", + subject: "mock subject 2", + amount: "1.1" // EUR is default. + } + ) let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, "mock-account"); t.assertAmountEquals(ret.data.balance, "EUR:2.1"); } diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts index 843a35d88..cd488fcf5 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts @@ -63,43 +63,29 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { * user01 checks whether one incoming payment exists in the * history. This one incoming payment will be the refund. */ - await LibeufinSandboxApi.bookPayment( - libeufinServices.libeufinSandbox, - user02sandbox, - user01sandbox, + await libeufinServices.libeufinSandbox.makeTransaction( + user02sandbox.ebicsBankAccount.label, // debit + user01sandbox.ebicsBankAccount.label, // credit + "EUR:1", "not a public key", - "1", - "EUR", ); - // check payment shows up in the Sandbox' history. - // NOTE: the debitor account has no entry so far, because - // the call above is a mere test method that books only one - // CRDT transaction. - const txsCredit = await LibeufinSandboxApi.getAccountTransactions( - libeufinServices.libeufinSandbox, - user02sandbox.ebicsBankAccount["label"]); - t.assertTrue(txsCredit["payments"].length == 1); - // Gets the faulty payment in the (ingested) history. await LibeufinNexusApi.fetchAllTransactions( libeufinServices.libeufinNexus, - user02nexus.localAccountName, + user01nexus.localAccountName, ); - // Give time to ingest. - delayMs(2000); - // Check payment shows up in Nexus history. const nexusTxs = await LibeufinNexusApi.getAccountTransactions( libeufinServices.libeufinNexus, - user02nexus.localAccountName, + user01nexus.localAccountName, ); t.assertTrue(nexusTxs.data["transactions"].length == 1); // This should pay the faulty payment back. await LibeufinNexusApi.submitInitiatedPayment( libeufinServices.libeufinNexus, - user02nexus.localAccountName, + user01nexus.localAccountName, // The initiated payment ID below got set by the Taler // facade; at this point only one can / must exist. "1", @@ -108,8 +94,10 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { // Counterpart checks whether the reimbursement shows up. let history = await LibeufinSandboxApi.getAccountTransactions( libeufinServices.libeufinSandbox, - user01sandbox.ebicsBankAccount["label"], + user02sandbox.ebicsBankAccount["label"], ); - t.assertTrue(history["payments"].length == 1); + + // 2 is total: 1 the original payment + 1 the reimbursement. + t.assertTrue(history["payments"].length == 2); } runLibeufinRefundTest.suites = ["libeufin"]; diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts index 32d369fc1..71f92095a 100644 --- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts +++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts @@ -71,7 +71,6 @@ import { runLibeufinApiUsersTest } from "./test-libeufin-api-users"; import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount"; import { runLibeufinApiSandboxTransactionsTest } from "./test-libeufin-api-sandbox-transactions"; import { runLibeufinApiSandboxCamtTest } from "./test-libeufin-api-sandbox-camt"; -import { runLibeufinSandboxCamtStatementTest } from "./test-libeufin-sandbox-camt-statement"; import { runLibeufinSandboxWireTransferCliTest } from "./test-libeufin-sandbox-wire-transfer-cli"; import { runDepositTest } from "./test-deposit"; import CancellationToken from "cancellationtoken"; @@ -123,7 +122,6 @@ const allTests: TestMainFunction[] = [ runLibeufinApiBankconnectionTest, runLibeufinApiSandboxTransactionsTest, runLibeufinApiSandboxCamtTest, - runLibeufinSandboxCamtStatementTest, runLibeufinSandboxWireTransferCliTest, runMerchantExchangeConfusionTest, runMerchantInstancesTest, |