Avoid Sandbox (deprecated) POST /admin/payments/ API.
This commit is contained in:
parent
2cecdccb49
commit
79c14e77ec
@ -1 +1 @@
|
|||||||
Subproject commit 38c168b11eeeab93562ffa74b3e2aff4b596c77a
|
Subproject commit c76fb9b3af6ec43f2d2a83e6b4f523dcc5ac6a54
|
@ -88,20 +88,17 @@ export async function runLibeufinApiBankaccountTest(t: GlobalTestState) {
|
|||||||
"mock",
|
"mock",
|
||||||
"local-mock",
|
"local-mock",
|
||||||
);
|
);
|
||||||
|
await LibeufinSandboxApi.simulateIncomingTransaction(
|
||||||
await LibeufinSandboxApi.bookPayment2(sandbox, {
|
sandbox,
|
||||||
creditorIban: "DE71500105179674997361",
|
"mock", // creditor bankaccount label
|
||||||
creditorBic: "BELADEBEXXX",
|
{
|
||||||
creditorName: "mock",
|
|
||||||
debtorIban: "DE84500105176881385584",
|
debtorIban: "DE84500105176881385584",
|
||||||
debtorBic: "BELADEBEXXX",
|
debtorBic: "BELADEBEXXX",
|
||||||
debtorName: "mock2",
|
debtorName: "mock2",
|
||||||
subject: "mock subject",
|
|
||||||
currency: "EUR",
|
|
||||||
amount: "1",
|
amount: "1",
|
||||||
uid: "mock",
|
subject: "mock subject",
|
||||||
direction: "CRDT",
|
}
|
||||||
});
|
);
|
||||||
await LibeufinNexusApi.fetchAllTransactions(nexus, "local-mock");
|
await LibeufinNexusApi.fetchAllTransactions(nexus, "local-mock");
|
||||||
let transactions = await LibeufinNexusApi.getAccountTransactions(
|
let transactions = await LibeufinNexusApi.getAccountTransactions(
|
||||||
nexus,
|
nexus,
|
||||||
|
@ -42,32 +42,30 @@ export async function runLibeufinApiSandboxTransactionsTest(t: GlobalTestState)
|
|||||||
label: "mock-account",
|
label: "mock-account",
|
||||||
currency: "EUR"
|
currency: "EUR"
|
||||||
});
|
});
|
||||||
await LibeufinSandboxApi.bookPayment2(sandbox, {
|
await LibeufinSandboxApi.simulateIncomingTransaction(
|
||||||
creditorIban: "DE71500105179674997361",
|
sandbox,
|
||||||
creditorBic: "BELADEBEXXX",
|
"mock-account",
|
||||||
creditorName: "mock",
|
{
|
||||||
|
|
||||||
debtorIban: "DE84500105176881385584",
|
debtorIban: "DE84500105176881385584",
|
||||||
debtorBic: "BELADEBEXXX",
|
debtorBic: "BELADEBEXXX",
|
||||||
debtorName: "mock2",
|
debtorName: "mock2",
|
||||||
subject: "mock subject",
|
subject: "mock subject",
|
||||||
currency: "EUR",
|
amount: "1" // EUR is default.
|
||||||
amount: "1",
|
}
|
||||||
uid: "mock",
|
)
|
||||||
direction: "CRDT",
|
await LibeufinSandboxApi.simulateIncomingTransaction(
|
||||||
});
|
sandbox,
|
||||||
await LibeufinSandboxApi.bookPayment2(sandbox, {
|
"mock-account",
|
||||||
creditorIban: "DE71500105179674997361",
|
{
|
||||||
creditorBic: "BELADEBEXXX",
|
|
||||||
creditorName: "mock",
|
|
||||||
debtorIban: "DE84500105176881385584",
|
debtorIban: "DE84500105176881385584",
|
||||||
debtorBic: "BELADEBEXXX",
|
debtorBic: "BELADEBEXXX",
|
||||||
debtorName: "mock2",
|
debtorName: "mock2",
|
||||||
subject: "mock subject 2",
|
subject: "mock subject 2",
|
||||||
currency: "EUR",
|
amount: "1.1" // EUR is default.
|
||||||
amount: "1.1",
|
}
|
||||||
uid: "mock2",
|
)
|
||||||
direction: "CRDT",
|
|
||||||
});
|
|
||||||
let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, "mock-account");
|
let ret = await LibeufinSandboxApi.getAccountInfoWithBalance(sandbox, "mock-account");
|
||||||
t.assertAmountEquals(ret.data.balance, "EUR:2.1");
|
t.assertAmountEquals(ret.data.balance, "EUR:2.1");
|
||||||
}
|
}
|
||||||
|
@ -63,43 +63,29 @@ export async function runLibeufinRefundTest(t: GlobalTestState) {
|
|||||||
* user01 checks whether one incoming payment exists in the
|
* user01 checks whether one incoming payment exists in the
|
||||||
* history. This one incoming payment will be the refund.
|
* history. This one incoming payment will be the refund.
|
||||||
*/
|
*/
|
||||||
await LibeufinSandboxApi.bookPayment(
|
await libeufinServices.libeufinSandbox.makeTransaction(
|
||||||
libeufinServices.libeufinSandbox,
|
user02sandbox.ebicsBankAccount.label, // debit
|
||||||
user02sandbox,
|
user01sandbox.ebicsBankAccount.label, // credit
|
||||||
user01sandbox,
|
"EUR:1",
|
||||||
"not a public key",
|
"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.
|
// Gets the faulty payment in the (ingested) history.
|
||||||
await LibeufinNexusApi.fetchAllTransactions(
|
await LibeufinNexusApi.fetchAllTransactions(
|
||||||
libeufinServices.libeufinNexus,
|
libeufinServices.libeufinNexus,
|
||||||
user02nexus.localAccountName,
|
user01nexus.localAccountName,
|
||||||
);
|
);
|
||||||
// Give time to ingest.
|
|
||||||
delayMs(2000);
|
|
||||||
|
|
||||||
// Check payment shows up in Nexus history.
|
// Check payment shows up in Nexus history.
|
||||||
const nexusTxs = await LibeufinNexusApi.getAccountTransactions(
|
const nexusTxs = await LibeufinNexusApi.getAccountTransactions(
|
||||||
libeufinServices.libeufinNexus,
|
libeufinServices.libeufinNexus,
|
||||||
user02nexus.localAccountName,
|
user01nexus.localAccountName,
|
||||||
);
|
);
|
||||||
t.assertTrue(nexusTxs.data["transactions"].length == 1);
|
t.assertTrue(nexusTxs.data["transactions"].length == 1);
|
||||||
|
|
||||||
// This should pay the faulty payment back.
|
// This should pay the faulty payment back.
|
||||||
await LibeufinNexusApi.submitInitiatedPayment(
|
await LibeufinNexusApi.submitInitiatedPayment(
|
||||||
libeufinServices.libeufinNexus,
|
libeufinServices.libeufinNexus,
|
||||||
user02nexus.localAccountName,
|
user01nexus.localAccountName,
|
||||||
// The initiated payment ID below got set by the Taler
|
// The initiated payment ID below got set by the Taler
|
||||||
// facade; at this point only one can / must exist.
|
// facade; at this point only one can / must exist.
|
||||||
"1",
|
"1",
|
||||||
@ -108,8 +94,10 @@ export async function runLibeufinRefundTest(t: GlobalTestState) {
|
|||||||
// Counterpart checks whether the reimbursement shows up.
|
// Counterpart checks whether the reimbursement shows up.
|
||||||
let history = await LibeufinSandboxApi.getAccountTransactions(
|
let history = await LibeufinSandboxApi.getAccountTransactions(
|
||||||
libeufinServices.libeufinSandbox,
|
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"];
|
runLibeufinRefundTest.suites = ["libeufin"];
|
||||||
|
@ -71,7 +71,6 @@ import { runLibeufinApiUsersTest } from "./test-libeufin-api-users";
|
|||||||
import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount";
|
import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount";
|
||||||
import { runLibeufinApiSandboxTransactionsTest } from "./test-libeufin-api-sandbox-transactions";
|
import { runLibeufinApiSandboxTransactionsTest } from "./test-libeufin-api-sandbox-transactions";
|
||||||
import { runLibeufinApiSandboxCamtTest } from "./test-libeufin-api-sandbox-camt";
|
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 { runLibeufinSandboxWireTransferCliTest } from "./test-libeufin-sandbox-wire-transfer-cli";
|
||||||
import { runDepositTest } from "./test-deposit";
|
import { runDepositTest } from "./test-deposit";
|
||||||
import CancellationToken from "cancellationtoken";
|
import CancellationToken from "cancellationtoken";
|
||||||
@ -123,7 +122,6 @@ const allTests: TestMainFunction[] = [
|
|||||||
runLibeufinApiBankconnectionTest,
|
runLibeufinApiBankconnectionTest,
|
||||||
runLibeufinApiSandboxTransactionsTest,
|
runLibeufinApiSandboxTransactionsTest,
|
||||||
runLibeufinApiSandboxCamtTest,
|
runLibeufinApiSandboxCamtTest,
|
||||||
runLibeufinSandboxCamtStatementTest,
|
|
||||||
runLibeufinSandboxWireTransferCliTest,
|
runLibeufinSandboxWireTransferCliTest,
|
||||||
runMerchantExchangeConfusionTest,
|
runMerchantExchangeConfusionTest,
|
||||||
runMerchantInstancesTest,
|
runMerchantInstancesTest,
|
||||||
|
Loading…
Reference in New Issue
Block a user