wallet-core: iban workaround

This commit is contained in:
Florian Dold 2023-05-11 13:04:09 +02:00
parent 55a1e8c6e1
commit 07bf3d5b8f
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -29,6 +29,7 @@ import {
codecForAny,
codecForString,
encodeCrock,
generateIban,
getRandomBytes,
j2s,
Logger,
@ -107,9 +108,16 @@ export namespace BankApi {
bank: BankServiceHandle,
username: string,
password: string,
options: {
iban?: string;
},
): Promise<BankUser> {
const url = new URL("testing/register", bank.bankAccessApiBaseUrl);
const resp = await bank.http.postJson(url.href, { username, password });
const resp = await bank.http.postJson(url.href, {
username,
password,
iban: options.iban,
});
let paytoUri = `payto://x-taler-bank/localhost/${username}`;
if (resp.status !== 200 && resp.status !== 202 && resp.status !== 204) {
logger.error(`${j2s(await resp.json())}`);
@ -143,7 +151,11 @@ export namespace BankApi {
): Promise<BankUser> {
const username = "user-" + encodeCrock(getRandomBytes(10)).toLowerCase();
const password = "pw-" + encodeCrock(getRandomBytes(10)).toLowerCase();
return await registerAccount(bank, username, password);
// FIXME: This is just a temporary workaround, because demobank is running out of short IBANs
const iban = generateIban("DE", 15);
return await registerAccount(bank, username, password, {
iban,
});
}
export async function confirmWithdrawalOperation(