Anastasis API helper function.
This commit is contained in:
parent
1f255b7f4e
commit
93b455a28a
@ -1157,6 +1157,24 @@ export namespace LibeufinNexusApi {
|
||||
let response = await axios.get(url.href);
|
||||
}
|
||||
|
||||
// Uses the Anastasis API to get a list of transactions.
|
||||
export async function getAnastasisTransactions(
|
||||
libeufinNexusService: LibeufinNexusService,
|
||||
anastasisBaseUrl: string,
|
||||
params: {}, // of the request: {delta: 5, ..}
|
||||
username: string = "admin",
|
||||
password: string = "test",
|
||||
): Promise<any> {
|
||||
let url = new URL("/history/incoming", anastasisBaseUrl);
|
||||
let response = await axios.get(url.href, { params: params,
|
||||
auth: {
|
||||
username: username,
|
||||
password: password,
|
||||
},
|
||||
});
|
||||
return response;
|
||||
}
|
||||
|
||||
// FIXME: this function should return some structured
|
||||
// object that represents a history.
|
||||
export async function getAccountTransactions(
|
||||
|
@ -23,6 +23,7 @@ import {
|
||||
NexusUserBundle,
|
||||
launchLibeufinServices,
|
||||
LibeufinNexusApi,
|
||||
LibeufinSandboxApi,
|
||||
} from "./libeufin";
|
||||
|
||||
/**
|
||||
@ -58,6 +59,18 @@ export async function runLibeufinApiFacadeTest(t: GlobalTestState) {
|
||||
t.assertTrue(anastasisBaseUrl.startsWith("http://"));
|
||||
t.assertTrue(anastasisBaseUrl.endsWith("/"));
|
||||
|
||||
LibeufinSandboxApi.simulateIncomingTransaction(
|
||||
libeufinServices.libeufinSandbox,
|
||||
user01nexus.localAccountName,
|
||||
{
|
||||
debtorIban: "ES3314655813489414469157",
|
||||
debtorBic: "BCMAESM1XXX",
|
||||
debtorName: "Mock Donor",
|
||||
subject: "Anastasis donation",
|
||||
amount: "EUR:3",
|
||||
},
|
||||
)
|
||||
|
||||
//***************************************//
|
||||
// Here payments need to be generated //
|
||||
// and checked via the Anastasis facade. //
|
||||
|
Loading…
Reference in New Issue
Block a user