Libeufin, testing scheduling API
This commit is contained in:
parent
a931d48a84
commit
dcef82d677
@ -828,6 +828,16 @@ export interface CreateNexusUserRequest {
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface PostNexusTaskRequest {
|
||||
name: string;
|
||||
cronspec: string;
|
||||
type: string; // fetch | submit
|
||||
params: {
|
||||
level: string; // report | statement | all
|
||||
rangeType: string; // all | since-last | previous-days | latest
|
||||
} | {}
|
||||
}
|
||||
|
||||
export interface PostNexusPermissionRequest {
|
||||
action: "revoke" | "grant";
|
||||
permission: {
|
||||
@ -1138,6 +1148,56 @@ export namespace LibeufinNexusApi {
|
||||
});
|
||||
}
|
||||
|
||||
export async function getTasks(
|
||||
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||
bankAccountName: string,
|
||||
// When void, the request returns the list of all the
|
||||
// tasks under this bank account.
|
||||
taskName: string | void,
|
||||
): Promise<any> {
|
||||
const baseUrl = libeufinNexusService.baseUrl;
|
||||
let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl);
|
||||
if (taskName) url = new URL(taskName, `${url}/`);
|
||||
|
||||
// It's caller's responsibility to interpret the response.
|
||||
return await axios.get(url.href, {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "test",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteTask(
|
||||
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||
bankAccountName: string,
|
||||
taskName: string,
|
||||
) {
|
||||
const baseUrl = libeufinNexusService.baseUrl;
|
||||
let url = new URL(`/bank-accounts/${bankAccountName}/schedule/${taskName}`, baseUrl);
|
||||
await axios.delete(url.href, {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "test",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function postTask(
|
||||
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||
bankAccountName: string,
|
||||
req: PostNexusTaskRequest,
|
||||
): Promise<any> {
|
||||
const baseUrl = libeufinNexusService.baseUrl;
|
||||
let url = new URL(`/bank-accounts/${bankAccountName}/schedule`, baseUrl);
|
||||
return await axios.post(url.href, req, {
|
||||
auth: {
|
||||
username: "admin",
|
||||
password: "test",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function createTwgFacade(
|
||||
libeufinNexusService: LibeufinNexusServiceInterface,
|
||||
req: CreateTalerWireGatewayFacadeRequest,
|
||||
|
@ -59,6 +59,7 @@ import { runLibeufinRefundTest } from "./test-libeufin-refund";
|
||||
import { runLibeufinRefundMultipleUsersTest } from "./test-libeufin-refund-multiple-users";
|
||||
import { runLibeufinTutorialTest } from "./test-libeufin-tutorial";
|
||||
import { runLibeufinApiPermissionsTest } from "./test-libeufin-api-permissions";
|
||||
import { runLibeufinApiSchedulingTest } from "./test-libeufin-api-scheduling";
|
||||
import { runLibeufinApiBankconnectionTest } from "./test-libeufin-api-bankconnection";
|
||||
import { runLibeufinApiUsersTest } from "./test-libeufin-api-users";
|
||||
import { runLibeufinApiBankaccountTest } from "./test-libeufin-api-bankaccount";
|
||||
@ -94,6 +95,7 @@ const allTests: TestMainFunction[] = [
|
||||
runLibeufinRefundTest,
|
||||
runLibeufinRefundMultipleUsersTest,
|
||||
runLibeufinApiPermissionsTest,
|
||||
runLibeufinApiSchedulingTest,
|
||||
runLibeufinApiUsersTest,
|
||||
runLibeufinApiBankaccountTest,
|
||||
runLibeufinApiBankconnectionTest,
|
||||
|
Loading…
Reference in New Issue
Block a user