aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorMS <ms@taler.net>2021-05-14 12:50:44 +0200
committerMS <ms@taler.net>2021-05-14 12:50:44 +0200
commitdcef82d677f8b79b0a7b78f485f08fcd0f7d8c96 (patch)
tree9408138f0aba1e8161a133222c805adf768b7016 /packages
parenta931d48a84264f7819ee4abf78dbf7173b14f858 (diff)
Libeufin, testing scheduling API
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/libeufin.ts60
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/testrunner.ts2
2 files changed, 62 insertions, 0 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
index 709148817..7dd0b98f0 100644
--- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts
@@ -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,
diff --git a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
index 173ca2442..9d4fb5575 100644
--- a/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/testrunner.ts
@@ -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,