diff options
Diffstat (limited to 'packages/taler-wallet-cli/src/integrationtests')
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/libeufin.ts | 175 | ||||
-rw-r--r-- | packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts | 37 |
2 files changed, 209 insertions, 3 deletions
diff --git a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts index a7aeb0a73..582c23795 100644 --- a/packages/taler-wallet-cli/src/integrationtests/libeufin.ts +++ b/packages/taler-wallet-cli/src/integrationtests/libeufin.ts @@ -51,6 +51,43 @@ export interface LibeufinCliDetails { sandboxUrl: string; nexusDatabaseUri: string; sandboxDatabaseUri: string; + user: LibeufinNexusUser; +} + +export interface LibeufinEbicsSubscriberDetails { + hostId: string; + partnerId: string; + userId: string; +} + +export interface LibeufinEbicsConnectionDetails { + subscriberDetails: LibeufinEbicsSubscriberDetails; + ebicsUrl: string; + connectionName: string; +} + +export interface LibeufinBankAccountDetails { + currency: string; + iban: string; + bic: string; + personName: string; + accountName: string; +} + +export interface LibeufinNexusUser { + username: string; + password: string; +} + +export interface LibeufinBackupFileDetails { + passphrase: string; + outputFile: string; + connectionName: string; +} + +export interface LibeufinKeyLetterDetails { + outputFile: string; + connectionName: string; } export class LibeufinSandboxService implements LibeufinSandboxServiceInterface { @@ -136,6 +173,20 @@ export class LibeufinNexusService { const url = `${this.baseUrl}config`; await pingProc(this.nexusProc, url, "libeufin-nexus"); } + + async createNexusSuperuser( + details: LibeufinNexusUser, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-nexus", + `libeufin-nexus superuser ${details.username} --password=${details.password}`, + extendEnv({ LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri }), + ); + console.log(stdout); + } + } export interface CreateEbicsSubscriberRequest { @@ -207,6 +258,130 @@ export class LibeufinCli { ); console.log(stdout); } + + async createEbicsSubscriber( + details: LibeufinEbicsSubscriberDetails, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-createebicssubscriber", + "libeufin-cli sandbox ebicssubscriber create" + + ` --host-id=${details.hostId}` + + ` --partner-id=${details.partnerId}` + + ` --user-id=${details.userId}`, + extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), + ); + console.log(stdout); + } + + async createEbicsBankAccount( + sd: LibeufinEbicsSubscriberDetails, + bankAccountDetails: LibeufinBankAccountDetails, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-createebicsbankaccount", + "libeufin-cli sandbox ebicsbankaccount create" + + ` --currency=${bankAccountDetails.currency}` + + ` --iban=${bankAccountDetails.iban}` + + ` --bic=${bankAccountDetails.bic}` + + ` --person-name='${bankAccountDetails.personName}'` + + ` --account-name=${bankAccountDetails.accountName}` + + ` --ebics-host-id=${sd.hostId}` + + ` --ebics-partner-id=${sd.partnerId}` + + ` --ebics-user-id=${sd.userId}`, + extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), + ); + console.log(stdout); + } + + async generateTransactions( + accountName: string, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-generatetransactions", + `libeufin-cli sandbox bankaccount generate-transactions ${accountName}`, + extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), + ); + console.log(stdout); + } + + async showSandboxTransactions( + accountName: string, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-showsandboxtransactions", + `libeufin-cli sandbox bankaccount transactions ${accountName}`, + extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), + ); + console.log(stdout); + } + + async createEbicsConnection( + connectionDetails: LibeufinEbicsConnectionDetails, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-createebicsconnection", + `libeufin-cli connections new-ebics-connection` + + ` --ebics-url=${connectionDetails.ebicsUrl}` + + ` --host-id=${connectionDetails.subscriberDetails.hostId}` + + ` --partner-id=${connectionDetails.subscriberDetails.partnerId}` + + ` --ebics-user-id=${connectionDetails.subscriberDetails.partnerId}` + + ` ${connectionDetails.connectionName}`, + extendEnv({ + LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, + LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, + LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, + }), + ); + console.log(stdout); + } + + async createBackupFile( + details: LibeufinBackupFileDetails, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-createbackupfile", + `libeufin-cli connections export-backup` + + ` --passphrase=${details.passphrase}` + + ` --output-file=${details.outputFile}` + + ` ${details.connectionName}`, + extendEnv({ + LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, + LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, + LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, + }), + ); + console.log(stdout); + } + + async createKeyLetter( + details: LibeufinKeyLetterDetails, + ): Promise<void> { + + const stdout = await sh( + this.globalTestState, + "libeufin-cli-createkeyletter", + `libeufin-cli connections get-key-letter` + + ` ${details.connectionName} ${details.outputFile}`, + extendEnv({ + LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, + LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, + LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, + }), + ); + console.log(stdout); + } } export namespace LibeufinSandboxApi { diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts index 58cee512a..6c84fd999 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-tutorial.ts @@ -47,16 +47,47 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) { databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`, }); - await libeufinNexus.start(); - await libeufinNexus.pingUntilAvailable(); - + const nexusUser = {username: "foo", password: "secret"}; const libeufinCli = new LibeufinCli(t, { sandboxUrl: libeufinSandbox.baseUrl, nexusUrl: libeufinNexus.baseUrl, sandboxDatabaseUri: `jdbc:sqlite:${t.testDir}/libeufin-sandbox.sqlite3`, nexusDatabaseUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`, + user: nexusUser, }); + const ebicsDetails = { + hostId: "testhost", partnerId: "partner01", userId: "user01" + } + const bankAccountDetails = { + currency: "EUR", iban: "DE18500105172929531888", bic: "INGDDEFFXXX", + personName: "Jane Normal", accountName: "testacct01" + } + + await libeufinCli.checkSandbox(); await libeufinCli.createEbicsHost("testhost"); + await libeufinCli.createEbicsSubscriber(ebicsDetails); + await libeufinCli.createEbicsBankAccount(ebicsDetails, bankAccountDetails); + await libeufinCli.generateTransactions(bankAccountDetails.accountName); + + await libeufinNexus.start(); + await libeufinNexus.pingUntilAvailable(); + + await libeufinNexus.createNexusSuperuser(nexusUser); + const connectionDetails = { + subscriberDetails: ebicsDetails, + ebicsUrl: `${libeufinSandbox.baseUrl}ebicsweb`, // FIXME: need appropriate URL concatenation + connectionName: "my-ebics-conn", + } + await libeufinCli.createEbicsConnection(connectionDetails); + await libeufinCli.createBackupFile({ + passphrase: "secret", + outputFile: `${t.testDir}/connection-backup.json`, + connectionName: connectionDetails.connectionName, + }) + await libeufinCli.createKeyLetter({ + outputFile: `${t.testDir}/letter.pdf`, + connectionName: connectionDetails.connectionName, + }); } |