diff options
author | Florian Dold <florian@dold.me> | 2023-09-21 17:56:29 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-21 17:56:29 +0200 |
commit | 58debefbe0456ce203877f1cc417c42f4abb0685 (patch) | |
tree | da8e0ffdca8825eb2a59c81b699fd3e6b2913037 /packages/taler-wallet-core | |
parent | 0388d31d364139d0a3999126b06d8ac850117ab9 (diff) | |
download | wallet-core-58debefbe0456ce203877f1cc417c42f4abb0685.tar.gz wallet-core-58debefbe0456ce203877f1cc417c42f4abb0685.tar.bz2 wallet-core-58debefbe0456ce203877f1cc417c42f4abb0685.zip |
wallet-core,harness: towards corebank API instead of fakebank/nexus API
Diffstat (limited to 'packages/taler-wallet-core')
-rw-r--r-- | packages/taler-wallet-core/src/dbless.ts | 4 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/testing.ts | 21 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/wallet.ts | 18 |
3 files changed, 29 insertions, 14 deletions
diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts index 4d2fa5cd4..1684977d5 100644 --- a/packages/taler-wallet-core/src/dbless.ts +++ b/packages/taler-wallet-core/src/dbless.ts @@ -31,7 +31,7 @@ import { AmountJson, Amounts, AmountString, - BankAccessApiClient, + TalerCorebankApiClient, codecForAny, codecForBankWithdrawalOperationPostResponse, codecForBatchDepositSuccess, @@ -118,7 +118,7 @@ export async function topupReserveWithDemobank( args: TopupReserveWithDemobankArgs, ) { const { http, bankAccessApiBaseUrl, amount, exchangeInfo, reservePub } = args; - const bankClient = new BankAccessApiClient(bankAccessApiBaseUrl); + const bankClient = new TalerCorebankApiClient(bankAccessApiBaseUrl); const bankUser = await bankClient.createRandomBankUser(); const wopi = await bankClient.createWithdrawalOperation( bankUser.username, diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts index f71d842c7..b5840c3a6 100644 --- a/packages/taler-wallet-core/src/operations/testing.ts +++ b/packages/taler-wallet-core/src/operations/testing.ts @@ -25,6 +25,7 @@ import { IntegrationTestV2Args, Logger, NotificationType, + RegisterAccountRequest, stringToBytes, TestPayResult, TransactionMajorState, @@ -216,17 +217,25 @@ async function confirmBankWithdrawalUri( async function registerRandomBankUser( http: HttpRequestLibrary, - bankAccessApiBaseUrl: string, + corebankApiBaseUrl: string, ): Promise<BankUser> { - const reqUrl = new URL("testing/register", bankAccessApiBaseUrl).href; + const reqUrl = new URL("accounts", corebankApiBaseUrl).href; const randId = makeId(8); + const username = `testuser-${randId.toLowerCase()}`; + const password = `testpw-${randId}`; + const bankUser: BankUser = { - // euFin doesn't allow resource names to have upper case letters. - username: `testuser-${randId.toLowerCase()}`, - password: `testpw-${randId}`, + username, + password, + }; + + const userReq: RegisterAccountRequest = { + username, + password, + name: username, }; - const resp = await http.postJson(reqUrl, bankUser); + const resp = await http.fetch(reqUrl, { method: "POST", body: userReq }); await checkSuccessResponseOrThrow(resp); return bankUser; } diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 9091a92bf..2c4f1ba6f 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -1513,13 +1513,19 @@ async function dispatchRequestInternal<Op extends WalletApiOperation>( const components = pt.targetPath.split("/"); const creditorAcct = components[components.length - 1]; logger.info(`making testbank transfer to '${creditorAcct}'`); - const fbReq = await ws.http.postJson( - new URL(`${creditorAcct}/admin/add-incoming`, req.bank).href, + const fbReq = await ws.http.fetch( + new URL( + `accounts/${creditorAcct}/taler-wire-gateway/admin/add-incoming`, + req.bank, + ).href, { - amount: Amounts.stringify(amount), - reserve_pub: wres.reservePub, - debit_account: - "payto://x-taler-bank/localhost/testdebtor?receiver-name=Foo", + method: "POST", + body: { + amount: Amounts.stringify(amount), + reserve_pub: wres.reservePub, + debit_account: + "payto://x-taler-bank/localhost/testdebtor?receiver-name=Foo", + }, }, ); const fbResp = await readSuccessResponseJsonOrThrow(fbReq, codecForAny()); |