diff options
Diffstat (limited to 'packages/taler-wallet-cli/src')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/libeufin.ts | 58 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts | 31 |
2 files changed, 87 insertions, 2 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts index cb739f52d..703f1522e 100644 --- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts +++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts @@ -273,6 +273,22 @@ export interface CreateTalerWireGatewayFacadeRequest { reserveTransferLevel: "report" | "statement" | "notification"; } +export interface CreateNexusUserRequest { + username: string; + password: string; +} + +export interface PostNexusPermissionRequest { + action: "revoke" | "grant"; + permission: { + subjectType: string; + subjectId: string; + resourceType: string; + resourceId: string; + permissionName: string; + } +} + export namespace LibeufinNexusApi { export async function createEbicsBankConnection( libeufinNexusService: LibeufinNexusServiceInterface, @@ -392,6 +408,48 @@ export namespace LibeufinNexusApi { ); } + export async function createUser( + libeufinNexusService: LibeufinNexusServiceInterface, + req: CreateNexusUserRequest, + ) { + const baseUrl = libeufinNexusService.baseUrl; + let url = new URL( + `/users`, + baseUrl, + ); + await axios.post( + url.href, + req, + { + auth: { + username: "admin", + password: "test", + }, + }, + ); + } + + export async function postPermission( + libeufinNexusService: LibeufinNexusServiceInterface, + req: PostNexusPermissionRequest, + ) { + const baseUrl = libeufinNexusService.baseUrl; + let url = new URL( + `/permissions`, + baseUrl, + ); + 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/test-libeufin-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts index 39980dac9..67ee513b2 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts @@ -142,6 +142,33 @@ export async function createLibeufinTestEnvironment( reserveTransferLevel: "report", }); + await LibeufinNexusApi.createUser(libeufinNexus, { + username: "twguser", + password: "twgpw", + }); + + await LibeufinNexusApi.postPermission(libeufinNexus, { + action: "grant", + permission: { + subjectType: "user", + subjectId: "twguser", + resourceType: "facade", + resourceId: "twg1", + permissionName: "facade.talerWireGateway.history" + } + }); + + await LibeufinNexusApi.postPermission(libeufinNexus, { + action: "grant", + permission: { + subjectType: "user", + subjectId: "twguser", + resourceType: "facade", + resourceId: "twg1", + permissionName: "facade.talerWireGateway.transfer" + } + }); + const exchange = ExchangeService.create(t, { name: "testexchange-1", currency: "EUR", @@ -157,8 +184,8 @@ export async function createLibeufinTestEnvironment( }); const exchangeBankAccount: ExchangeBankAccount = { - accountName: "twg-user", - accountPassword: "123", + accountName: "twguser", + accountPassword: "twgpw", accountPaytoUri: `payto://iban/${exchangeIban}?receiver-name=Exchange`, wireGatewayApiBaseUrl: "http://localhost:5011/facades/twg1/taler-wire-gateway/", |