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);
|
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
|
// FIXME: this function should return some structured
|
||||||
// object that represents a history.
|
// object that represents a history.
|
||||||
export async function getAccountTransactions(
|
export async function getAccountTransactions(
|
||||||
|
@ -23,6 +23,7 @@ import {
|
|||||||
NexusUserBundle,
|
NexusUserBundle,
|
||||||
launchLibeufinServices,
|
launchLibeufinServices,
|
||||||
LibeufinNexusApi,
|
LibeufinNexusApi,
|
||||||
|
LibeufinSandboxApi,
|
||||||
} from "./libeufin";
|
} from "./libeufin";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,6 +59,18 @@ export async function runLibeufinApiFacadeTest(t: GlobalTestState) {
|
|||||||
t.assertTrue(anastasisBaseUrl.startsWith("http://"));
|
t.assertTrue(anastasisBaseUrl.startsWith("http://"));
|
||||||
t.assertTrue(anastasisBaseUrl.endsWith("/"));
|
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 //
|
// Here payments need to be generated //
|
||||||
// and checked via the Anastasis facade. //
|
// and checked via the Anastasis facade. //
|
||||||
|
Loading…
Reference in New Issue
Block a user