libeufin tutorial: testing up to payment preparation

This commit is contained in:
MS 2021-02-05 16:24:06 +01:00
parent 7601973362
commit 48fa2ccea1
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 42 additions and 0 deletions

View File

@ -95,6 +95,16 @@ export interface LibeufinBankAccountImportDetails {
connectionName: string; connectionName: string;
} }
export interface LibeufinPreparedPaymentDetails {
creditorIban: string;
creditorBic: string;
creditorName: string;
subject: string;
amount: string;
currency: string;
nexusBankAccountName: string;
}
export class LibeufinSandboxService implements LibeufinSandboxServiceInterface { export class LibeufinSandboxService implements LibeufinSandboxServiceInterface {
static async create( static async create(
gc: GlobalTestState, gc: GlobalTestState,
@ -472,6 +482,27 @@ export class LibeufinCli {
); );
console.log(stdout); console.log(stdout);
} }
async preparePayment(details: LibeufinPreparedPaymentDetails): Promise<void> {
const stdout = await sh(
this.globalTestState,
"libeufin-cli-preparepayment",
`libeufin-cli accounts prepare-payment` +
` --creditor-iban=${details.creditorIban}` +
` --creditor-bic=${details.creditorBic}` +
` --creditor-name='${details.creditorName}'` +
` --payment-subject='${details.subject}'` +
` --payment-amount=${details.currency}:${details.amount}` +
` ${details.nexusBankAccountName}`,
{
...process.env,
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 { export namespace LibeufinSandboxApi {

View File

@ -109,4 +109,15 @@ export async function runLibeufinTutorialTest(t: GlobalTestState) {
bankAccountImportDetails.nexusBankAccountName, bankAccountImportDetails.nexusBankAccountName,
); );
await libeufinCli.transactions(bankAccountImportDetails.nexusBankAccountName); await libeufinCli.transactions(bankAccountImportDetails.nexusBankAccountName);
const paymentDetails = {
creditorIban: "DE42500105171245624648",
creditorBic: "BELADEBEXXX",
creditorName: "Mina Musterfrau",
subject: "Purchase 01234",
amount: "1.0",
currency: "EUR",
nexusBankAccountName: bankAccountImportDetails.nexusBankAccountName,
};
await libeufinCli.preparePayment(paymentDetails);
} }