diff options
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/bank-api-client.ts | 4 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/testing.ts | 27 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/withdraw.ts | 3 |
3 files changed, 21 insertions, 13 deletions
diff --git a/packages/taler-wallet-core/src/bank-api-client.ts b/packages/taler-wallet-core/src/bank-api-client.ts index c2de65982..8f82d7e7f 100644 --- a/packages/taler-wallet-core/src/bank-api-client.ts +++ b/packages/taler-wallet-core/src/bank-api-client.ts @@ -106,7 +106,7 @@ export namespace BankApi { const url = new URL("testing/register", bank.bankAccessApiBaseUrl); const resp = await bank.http.postJson(url.href, { username, password }); let paytoUri = `payto://x-taler-bank/localhost/${username}`; - if (resp.status !== 200 && resp.status !== 202) { + if (resp.status !== 200 && resp.status !== 202 && resp.status !== 204) { logger.error(`${j2s(await resp.json())}`); throw TalerError.fromDetail( TalerErrorCode.GENERIC_UNEXPECTED_REQUEST_ERROR, @@ -209,7 +209,7 @@ export namespace BankApi { ): Promise<void> { const url = new URL( `accounts/${bankUser.username}/withdrawals/${wopi.withdrawal_id}/abort`, - bank.baseUrl, + bank.bankAccessApiBaseUrl, ); const resp = await bank.http.postJson( url.href, diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index 8d28c62f7..a5aa1106f 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -90,16 +90,21 @@ export async function withdrawTestBalance( ws: InternalWalletState, req: WithdrawTestBalanceRequest, ): Promise<void> { - const bankBaseUrl = req.bankBaseUrl; const amount = req.amount; const exchangeBaseUrl = req.exchangeBaseUrl; - const bankUser = await registerRandomBankUser(ws.http, bankBaseUrl); + logger.trace( + `Registered bank user, bank access base url ${req.bankAccessApiBaseUrl}`, + ); + const bankUser = await registerRandomBankUser( + ws.http, + req.bankAccessApiBaseUrl, + ); logger.trace(`Registered bank user ${JSON.stringify(bankUser)}`); const wresp = await createDemoBankWithdrawalUri( ws.http, - bankBaseUrl, + req.bankAccessApiBaseUrl, bankUser, amount, ); @@ -112,7 +117,7 @@ export async function withdrawTestBalance( await confirmBankWithdrawalUri( ws.http, - bankBaseUrl, + req.bankAccessApiBaseUrl, bankUser, wresp.withdrawal_id, ); @@ -133,13 +138,13 @@ function getMerchantAuthHeader(m: MerchantBackendInfo): Record<string, string> { */ export async function createDemoBankWithdrawalUri( http: HttpRequestLibrary, - bankBaseUrl: string, + bankAccessApiBaseUrl: string, bankUser: BankUser, amount: AmountString, ): Promise<BankWithdrawalResponse> { const reqUrl = new URL( `accounts/${bankUser.username}/withdrawals`, - bankBaseUrl, + bankAccessApiBaseUrl, ).href; const resp = await http.postJson( reqUrl, @@ -161,13 +166,13 @@ export async function createDemoBankWithdrawalUri( async function confirmBankWithdrawalUri( http: HttpRequestLibrary, - bankBaseUrl: string, + bankAccessApiBaseUrl: string, bankUser: BankUser, withdrawalId: string, ): Promise<void> { const reqUrl = new URL( `accounts/${bankUser.username}/withdrawals/${withdrawalId}/confirm`, - bankBaseUrl, + bankAccessApiBaseUrl, ).href; const resp = await http.postJson( reqUrl, @@ -187,9 +192,9 @@ async function confirmBankWithdrawalUri( async function registerRandomBankUser( http: HttpRequestLibrary, - bankBaseUrl: string, + bankAccessApiBaseUrl: string, ): Promise<BankUser> { - const reqUrl = new URL("testing/register", bankBaseUrl).href; + const reqUrl = new URL("testing/register", bankAccessApiBaseUrl).href; const randId = makeId(8); const bankUser: BankUser = { // euFin doesn't allow resource names to have upper case letters. @@ -377,7 +382,7 @@ export async function runIntegrationTest( await withdrawTestBalance(ws, { amount: Amounts.stringify(withdrawAmountTwo), bankBaseUrl: args.bankBaseUrl, - bankAccessApiBaseUrl: args.bankBaseUrl, + bankAccessApiBaseUrl: args.bankAccessApiBaseUrl, exchangeBaseUrl: args.exchangeBaseUrl, }); diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts index 03ec9b61b..a33f59162 100644 --- a/packages/taler-wallet-core/src/operations/withdraw.ts +++ b/packages/taler-wallet-core/src/operations/withdraw.ts @@ -376,6 +376,9 @@ export async function getBankWithdrawalInfo( `withdrawal-operation/${uriResult.withdrawalOperationId}`, uriResult.bankIntegrationApiBaseUrl, ); + + logger.info(`bank withdrawal status URL: ${reqUrl.href}}`); + const resp = await http.get(reqUrl.href); const status = await readSuccessResponseJsonOrThrow( resp, |