Avoid Sandbox (deprecated) POST /admin/payments/ API.

This commit is contained in:
ms 2021-09-01 17:38:54 +02:00
parent 2cecdccb49
commit 79c14e77ec
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
5 changed files with 47 additions and 66 deletions

@ -1 +1 @@
Subproject commit 38c168b11eeeab93562ffa74b3e2aff4b596c77a
Subproject commit c76fb9b3af6ec43f2d2a83e6b4f523dcc5ac6a54

View File

@ -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,

View File

@ -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");
}

View File

@ -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"];

View File

@ -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,