aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/harness/libeufin.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-08-29 09:02:16 +0200
committerFlorian Dold <florian@dold.me>2023-08-29 09:03:19 +0200
commitb13bd85215ad64e7a2764ac7e7fee5945ffa1c07 (patch)
tree70643c7e76baeb9f61857add603dc381b6f03766 /packages/taler-harness/src/harness/libeufin.ts
parent8941f29cb457f86235b73f125e77a88cb762f353 (diff)
downloadwallet-core-b13bd85215ad64e7a2764ac7e7fee5945ffa1c07.tar.xz
taler-harness: remove axios usage, renovate some tests
Diffstat (limited to 'packages/taler-harness/src/harness/libeufin.ts')
-rw-r--r--packages/taler-harness/src/harness/libeufin.ts177
1 files changed, 155 insertions, 22 deletions
diff --git a/packages/taler-harness/src/harness/libeufin.ts b/packages/taler-harness/src/harness/libeufin.ts
index 8fd276fad..9f3e7a5a0 100644
--- a/packages/taler-harness/src/harness/libeufin.ts
+++ b/packages/taler-harness/src/harness/libeufin.ts
@@ -26,39 +26,32 @@
/**
* Imports.
*/
-import axios from "axios";
-import { URL, Logger } from "@gnu-taler/taler-util";
+import { AmountString, Logger } from "@gnu-taler/taler-util";
import {
- GlobalTestState,
DbInfo,
- pingProc,
+ GlobalTestState,
ProcessWrapper,
+ getRandomIban,
+ pingProc,
runCommand,
setupDb,
sh,
- getRandomIban,
} from "../harness/harness.js";
import {
- LibeufinSandboxApi,
- LibeufinNexusApi,
+ CreateAnastasisFacadeRequest,
CreateEbicsBankAccountRequest,
- LibeufinSandboxServiceInterface,
- CreateTalerWireGatewayFacadeRequest,
- SimulateIncomingTransactionRequest,
- SandboxAccountTransactions,
- DeleteBankConnectionRequest,
CreateEbicsBankConnectionRequest,
- UpdateNexusUserRequest,
- NexusAuth,
- CreateAnastasisFacadeRequest,
- PostNexusTaskRequest,
- PostNexusPermissionRequest,
CreateNexusUserRequest,
+ CreateTalerWireGatewayFacadeRequest,
+ LibeufinNexusApi,
+ LibeufinSandboxApi,
+ LibeufinSandboxServiceInterface,
+ PostNexusPermissionRequest,
} from "../harness/libeufin-apis.js";
const logger = new Logger("libeufin.ts");
-export { LibeufinSandboxApi, LibeufinNexusApi };
+export { LibeufinNexusApi, LibeufinSandboxApi };
export interface LibeufinServices {
libeufinSandbox: LibeufinSandboxService;
@@ -76,7 +69,7 @@ export interface LibeufinNexusConfig {
databaseJdbcUri: string;
}
-interface LibeufinNexusMoneyMovement {
+export interface LibeufinNexusMoneyMovement {
amount: string;
creditDebitIndicator: string;
details: {
@@ -103,11 +96,11 @@ interface LibeufinNexusMoneyMovement {
};
}
-interface LibeufinNexusBatches {
+export interface LibeufinNexusBatches {
batchTransactions: Array<LibeufinNexusMoneyMovement>;
}
-interface LibeufinNexusTransaction {
+export interface LibeufinNexusTransaction {
amount: string;
creditDebitIndicator: string;
status: string;
@@ -118,7 +111,7 @@ interface LibeufinNexusTransaction {
batches: Array<LibeufinNexusBatches>;
}
-interface LibeufinNexusTransactions {
+export interface LibeufinNexusTransactions {
transactions: Array<LibeufinNexusTransaction>;
}
@@ -182,6 +175,146 @@ export interface LibeufinPreparedPaymentDetails {
nexusBankAccountName: string;
}
+export interface NexusBankConnection {
+ // connection type. For example "ebics".
+ type: string;
+
+ // connection name as given by the user at
+ // the moment of creation.
+ name: string;
+}
+
+export interface NexusBankConnections {
+ bankConnections: NexusBankConnection[];
+}
+
+export interface FacadeShowInfo {
+ // Name of the facade, same as the "fcid" parameter.
+ name: string;
+
+ // Type of the facade.
+ // For example, "taler-wire-gateway".
+ type: string;
+
+ // Bas URL of the facade.
+ baseUrl: string;
+
+ // details depending on the facade type.
+ config: any;
+}
+
+export interface FetchParams {
+ // Because transactions are delivered by banks in "batches",
+ // then every batch can have different qualities. This value
+ // lets the request specify which type of batch ought to be
+ // returned. Currently, the following two type are supported:
+ //
+ // 'report': typically includes only non booked transactions.
+ // 'statement': typically includes only booked transactions.
+ level: "report" | "statement" | "all";
+
+ // This type indicates the time range of the query.
+ // It allows the following values:
+ //
+ // 'latest': retrieves the last transactions from the bank.
+ // If there are older unread transactions, those will *not*
+ // be downloaded.
+ //
+ // 'all': retrieves all the transactions from the bank,
+ // until the oldest.
+ //
+ // 'previous-days': currently *not* implemented, it will allow
+ // the request to download transactions from
+ // today until N days before.
+ //
+ // 'since-last': retrieves all the transactions since the last
+ // time one was downloaded.
+ //
+ rangeType: "latest" | "all" | "previous-days" | "since-last";
+}
+
+export interface NexusTask {
+ // The resource being impacted by this operation.
+ // Typically a (Nexus) bank account being fetched
+ // or whose payments are submitted. In this cases,
+ // this value is the "bank-account" constant.
+ resourceType: string;
+ // Name of the resource. In case of "bank-account", that
+ // is the name under which the bank account was imported
+ // from the bank.
+ resourceId: string;
+ // Task name, equals 'taskId'
+ taskName: string;
+ // Values allowed are "fetch" or "submit".
+ taskType: string;
+ // FIXME: describe.
+ taskCronSpec: string;
+ // Only meaningful for "fetch" types.
+ taskParams: FetchParams;
+ // Timestamp in secons when the next iteration will run.
+ nextScheduledExecutionSec: number;
+ // Timestamp in seconds when the previous iteration ran.
+ prevScheduledExecutionSec: number;
+}
+
+export interface NexusNewTransactionsInfo {
+ // How many transactions are new to Nexus.
+ newTransactions: number;
+ // How many transactions got downloaded by the request.
+ // Note that a transaction can be downloaded multiple
+ // times but only counts as new once.
+ downloadedTransactions: number;
+}
+
+
+export interface NexusUserResponse {
+ // User name
+ username: string;
+
+ // Is this a super user?
+ superuser: boolean;
+}
+
+export interface NexusTaskShortInfo {
+ cronspec: string;
+ type: "fetch" | "submit";
+ params: FetchParams;
+}
+
+export interface NexusTaskCollection {
+ // This field can contain *multiple* objects of the type sampled below.
+ schedule: {
+ [taskName: string]: NexusTaskShortInfo;
+ };
+}
+
+export interface NexusFacadeListResponse {
+ facades: FacadeShowInfo[];
+}
+
+export interface LibeufinSandboxAdminBankAccountBalance {
+ // Balance in the $currency:$amount format.
+ balance: AmountString;
+ // IBAN of the bank account identified by $accountLabel
+ iban: string;
+ // BIC of the bank account identified by $accountLabel
+ bic: string;
+ // Mentions $accountLabel
+ label: string;
+}
+
+export interface LibeufinPermission {
+ subjectType: string;
+ subjectId: string;
+ resourceType: string;
+ resourceId: string;
+ permissionName: string;
+}
+
+export interface NexusGetPermissionsResponse {
+ permissions: LibeufinPermission[];
+}
+
export class LibeufinSandboxService implements LibeufinSandboxServiceInterface {
static async create(
gc: GlobalTestState,