formatting code

This commit is contained in:
MS 2021-02-04 14:41:01 +01:00
parent 39723f6f97
commit c0904936e4
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 44 additions and 57 deletions

View File

@ -174,19 +174,17 @@ export class LibeufinNexusService {
await pingProc(this.nexusProc, url, "libeufin-nexus"); await pingProc(this.nexusProc, url, "libeufin-nexus");
} }
async createNexusSuperuser( async createNexusSuperuser(details: LibeufinNexusUser): Promise<void> {
details: LibeufinNexusUser,
): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-nexus", "libeufin-nexus",
`libeufin-nexus superuser ${details.username} --password=${details.password}`, `libeufin-nexus superuser ${details.username} --password=${details.password}`,
extendEnv({ LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri }), extendEnv({
LIBEUFIN_NEXUS_DB_CONNECTION: this.nexusConfig.databaseJdbcUri,
}),
); );
console.log(stdout); console.log(stdout);
} }
} }
export interface CreateEbicsSubscriberRequest { export interface CreateEbicsSubscriberRequest {
@ -262,14 +260,13 @@ export class LibeufinCli {
async createEbicsSubscriber( async createEbicsSubscriber(
details: LibeufinEbicsSubscriberDetails, details: LibeufinEbicsSubscriberDetails,
): Promise<void> { ): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-createebicssubscriber", "libeufin-cli-createebicssubscriber",
"libeufin-cli sandbox ebicssubscriber create" + "libeufin-cli sandbox ebicssubscriber create" +
` --host-id=${details.hostId}` + ` --host-id=${details.hostId}` +
` --partner-id=${details.partnerId}` + ` --partner-id=${details.partnerId}` +
` --user-id=${details.userId}`, ` --user-id=${details.userId}`,
extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }),
); );
console.log(stdout); console.log(stdout);
@ -279,28 +276,24 @@ export class LibeufinCli {
sd: LibeufinEbicsSubscriberDetails, sd: LibeufinEbicsSubscriberDetails,
bankAccountDetails: LibeufinBankAccountDetails, bankAccountDetails: LibeufinBankAccountDetails,
): Promise<void> { ): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-createebicsbankaccount", "libeufin-cli-createebicsbankaccount",
"libeufin-cli sandbox ebicsbankaccount create" + "libeufin-cli sandbox ebicsbankaccount create" +
` --currency=${bankAccountDetails.currency}` + ` --currency=${bankAccountDetails.currency}` +
` --iban=${bankAccountDetails.iban}` + ` --iban=${bankAccountDetails.iban}` +
` --bic=${bankAccountDetails.bic}` + ` --bic=${bankAccountDetails.bic}` +
` --person-name='${bankAccountDetails.personName}'` + ` --person-name='${bankAccountDetails.personName}'` +
` --account-name=${bankAccountDetails.accountName}` + ` --account-name=${bankAccountDetails.accountName}` +
` --ebics-host-id=${sd.hostId}` + ` --ebics-host-id=${sd.hostId}` +
` --ebics-partner-id=${sd.partnerId}` + ` --ebics-partner-id=${sd.partnerId}` +
` --ebics-user-id=${sd.userId}`, ` --ebics-user-id=${sd.userId}`,
extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }), extendEnv({ LIBEUFIN_SANDBOX_URL: this.cliDetails.sandboxUrl }),
); );
console.log(stdout); console.log(stdout);
} }
async generateTransactions( async generateTransactions(accountName: string): Promise<void> {
accountName: string,
): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-generatetransactions", "libeufin-cli-generatetransactions",
@ -310,10 +303,7 @@ export class LibeufinCli {
console.log(stdout); console.log(stdout);
} }
async showSandboxTransactions( async showSandboxTransactions(accountName: string): Promise<void> {
accountName: string,
): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-showsandboxtransactions", "libeufin-cli-showsandboxtransactions",
@ -326,58 +316,51 @@ export class LibeufinCli {
async createEbicsConnection( async createEbicsConnection(
connectionDetails: LibeufinEbicsConnectionDetails, connectionDetails: LibeufinEbicsConnectionDetails,
): Promise<void> { ): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-createebicsconnection", "libeufin-cli-createebicsconnection",
`libeufin-cli connections new-ebics-connection` + `libeufin-cli connections new-ebics-connection` +
` --ebics-url=${connectionDetails.ebicsUrl}` + ` --ebics-url=${connectionDetails.ebicsUrl}` +
` --host-id=${connectionDetails.subscriberDetails.hostId}` + ` --host-id=${connectionDetails.subscriberDetails.hostId}` +
` --partner-id=${connectionDetails.subscriberDetails.partnerId}` + ` --partner-id=${connectionDetails.subscriberDetails.partnerId}` +
` --ebics-user-id=${connectionDetails.subscriberDetails.partnerId}` + ` --ebics-user-id=${connectionDetails.subscriberDetails.partnerId}` +
` ${connectionDetails.connectionName}`, ` ${connectionDetails.connectionName}`,
extendEnv({ extendEnv({
LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl,
LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username,
LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password,
}), }),
); );
console.log(stdout); console.log(stdout);
} }
async createBackupFile( async createBackupFile(details: LibeufinBackupFileDetails): Promise<void> {
details: LibeufinBackupFileDetails,
): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-createbackupfile", "libeufin-cli-createbackupfile",
`libeufin-cli connections export-backup` + `libeufin-cli connections export-backup` +
` --passphrase=${details.passphrase}` + ` --passphrase=${details.passphrase}` +
` --output-file=${details.outputFile}` + ` --output-file=${details.outputFile}` +
` ${details.connectionName}`, ` ${details.connectionName}`,
extendEnv({ extendEnv({
LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl,
LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username,
LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password,
}), }),
); );
console.log(stdout); console.log(stdout);
} }
async createKeyLetter( async createKeyLetter(details: LibeufinKeyLetterDetails): Promise<void> {
details: LibeufinKeyLetterDetails,
): Promise<void> {
const stdout = await sh( const stdout = await sh(
this.globalTestState, this.globalTestState,
"libeufin-cli-createkeyletter", "libeufin-cli-createkeyletter",
`libeufin-cli connections get-key-letter` + `libeufin-cli connections get-key-letter` +
` ${details.connectionName} ${details.outputFile}`, ` ${details.connectionName} ${details.outputFile}`,
extendEnv({ extendEnv({
LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl, LIBEUFIN_NEXUS_URL: this.cliDetails.nexusUrl,
LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username, LIBEUFIN_NEXUS_USERNAME: this.cliDetails.user.username,
LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password, LIBEUFIN_NEXUS_PASSWORD: this.cliDetails.user.password,
}), }),
); );
console.log(stdout); console.log(stdout);

View File

@ -47,7 +47,7 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) {
databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`, databaseJdbcUri: `jdbc:sqlite:${t.testDir}/libeufin-nexus.sqlite3`,
}); });
const nexusUser = {username: "foo", password: "secret"}; const nexusUser = { username: "foo", password: "secret" };
const libeufinCli = new LibeufinCli(t, { const libeufinCli = new LibeufinCli(t, {
sandboxUrl: libeufinSandbox.baseUrl, sandboxUrl: libeufinSandbox.baseUrl,
nexusUrl: libeufinNexus.baseUrl, nexusUrl: libeufinNexus.baseUrl,
@ -57,13 +57,17 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) {
}); });
const ebicsDetails = { const ebicsDetails = {
hostId: "testhost", partnerId: "partner01", userId: "user01" hostId: "testhost",
} partnerId: "partner01",
userId: "user01",
};
const bankAccountDetails = { const bankAccountDetails = {
currency: "EUR", iban: "DE18500105172929531888", bic: "INGDDEFFXXX", currency: "EUR",
personName: "Jane Normal", accountName: "testacct01" iban: "DE18500105172929531888",
} bic: "INGDDEFFXXX",
personName: "Jane Normal",
accountName: "testacct01",
};
await libeufinCli.checkSandbox(); await libeufinCli.checkSandbox();
await libeufinCli.createEbicsHost("testhost"); await libeufinCli.createEbicsHost("testhost");
@ -79,13 +83,13 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) {
subscriberDetails: ebicsDetails, subscriberDetails: ebicsDetails,
ebicsUrl: `${libeufinSandbox.baseUrl}ebicsweb`, // FIXME: need appropriate URL concatenation ebicsUrl: `${libeufinSandbox.baseUrl}ebicsweb`, // FIXME: need appropriate URL concatenation
connectionName: "my-ebics-conn", connectionName: "my-ebics-conn",
} };
await libeufinCli.createEbicsConnection(connectionDetails); await libeufinCli.createEbicsConnection(connectionDetails);
await libeufinCli.createBackupFile({ await libeufinCli.createBackupFile({
passphrase: "secret", passphrase: "secret",
outputFile: `${t.testDir}/connection-backup.json`, outputFile: `${t.testDir}/connection-backup.json`,
connectionName: connectionDetails.connectionName, connectionName: connectionDetails.connectionName,
}) });
await libeufinCli.createKeyLetter({ await libeufinCli.createKeyLetter({
outputFile: `${t.testDir}/letter.pdf`, outputFile: `${t.testDir}/letter.pdf`,
connectionName: connectionDetails.connectionName, connectionName: connectionDetails.connectionName,