diff options
author | ms <ms@taler.net> | 2021-09-01 17:51:52 +0200 |
---|---|---|
committer | ms <ms@taler.net> | 2021-09-01 17:51:52 +0200 |
commit | 8b73c30b1f5223ea1c64a9164b43b7ba3b5168a1 (patch) | |
tree | 4f5eeb1a371e1053ab23170ad11bb3a15542bd20 | |
parent | 79c14e77ecdb0fcf11c109cd53ce8d065d47c611 (diff) |
Avoid Sandbox (deprecated) POST /admin/payments/ API.
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts | 34 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts | 24 |
2 files changed, 27 insertions, 31 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts index d15a2d653..1159ddf48 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund-multiple-users.ts @@ -68,39 +68,37 @@ export async function runLibeufinRefundMultipleUsersTest(t: GlobalTestState) { ["twg"], ); - /** - * user01 pays user02 using a invalid subject. At the end, - * 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, + // user 01 gets the payment + await libeufinServices.libeufinSandbox.makeTransaction( + user02sandbox.ebicsBankAccount.label, // debit + user01sandbox.ebicsBankAccount.label, // credit + "EUR:1", "not a public key", - "1", - "EUR", ); + // user 01 fetches the payments await LibeufinNexusApi.fetchAllTransactions( libeufinServices.libeufinNexus, - user02nexus.localAccountName, + user01nexus.localAccountName, ); - delayMs(2000); // time to ingest. + // user 01 tries to submit the reimbursement, as + // the payment didn't have a valid public key in + // the subject. await LibeufinNexusApi.submitInitiatedPayment( libeufinServices.libeufinNexus, - user02nexus.localAccountName, + user01nexus.localAccountName, "1", // so far the only one that can exist. ); - // Counterpart checks whether the reimbursement shows up. + // user 02 checks whether a reimbursement arrived. let history = await LibeufinSandboxApi.getAccountTransactions( libeufinServices.libeufinSandbox, - user01sandbox.ebicsBankAccount["label"], + user02sandbox.ebicsBankAccount["label"], ); - - t.assertTrue(history["payments"].length == 1); + // reimbursement arrived IFF the total payments are 2: + // 1 the original (faulty) transaction + 1 the reimbursement. + t.assertTrue(history["payments"].length == 2); } runLibeufinRefundMultipleUsersTest.suites = ["libeufin"]; 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 cd488fcf5..5f6619de5 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-refund.ts @@ -58,11 +58,7 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { ["twg"], ); - /** - * user01 pays user02 using a invalid subject. At the end, - * user01 checks whether one incoming payment exists in the - * history. This one incoming payment will be the refund. - */ + // user 02 pays user 01 with a faulty (non Taler) subject. await libeufinServices.libeufinSandbox.makeTransaction( user02sandbox.ebicsBankAccount.label, // debit user01sandbox.ebicsBankAccount.label, // credit @@ -70,34 +66,36 @@ export async function runLibeufinRefundTest(t: GlobalTestState) { "not a public key", ); - // Gets the faulty payment in the (ingested) history. + // The bad payment should be now ingested and prepared as + // a reimbursement. await LibeufinNexusApi.fetchAllTransactions( libeufinServices.libeufinNexus, user01nexus.localAccountName, ); - // Check payment shows up in Nexus history. + // Check that the payment arrived at the Nexus. const nexusTxs = await LibeufinNexusApi.getAccountTransactions( libeufinServices.libeufinNexus, user01nexus.localAccountName, ); t.assertTrue(nexusTxs.data["transactions"].length == 1); - // This should pay the faulty payment back. + // Submit the reimbursement await LibeufinNexusApi.submitInitiatedPayment( libeufinServices.libeufinNexus, user01nexus.localAccountName, - // The initiated payment ID below got set by the Taler - // facade; at this point only one can / must exist. + // The initiated payment (= the reimbursement) ID below + // got set by the Taler facade; at this point only one must + // exist. If "1" is not found, a 404 will make this test fail. "1", ); - // Counterpart checks whether the reimbursement shows up. + // user 02 checks whether the reimbursement arrived. let history = await LibeufinSandboxApi.getAccountTransactions( libeufinServices.libeufinSandbox, user02sandbox.ebicsBankAccount["label"], ); - - // 2 is total: 1 the original payment + 1 the reimbursement. + // 2 payments must exist: 1 the original (faulty) payment + + // 1 the reimbursement. t.assertTrue(history["payments"].length == 2); } runLibeufinRefundTest.suites = ["libeufin"]; |