diff options
| author | Özgür Kesim <oec-taler@kesim.org> | 2023-09-09 07:34:11 +0200 |
|---|---|---|
| committer | Özgür Kesim <oec-taler@kesim.org> | 2023-09-09 07:34:11 +0200 |
| commit | 5495551071a3fdc36c38deb4c1cf6f4aa5b98bd4 (patch) | |
| tree | adf7730b190618a0499e50a2d43cf1b850cddd16 /packages/taler-harness/src/integrationtests/test-bank-api.ts | |
| parent | 94cfcc875065f988815c31aaf8ebf36f75ac5983 (diff) | |
| parent | 6c3cfa9be7a332c2cc8490f25ebd6c73c8244842 (diff) | |
Merge branch 'master' into age-withdraw
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-bank-api.ts')
| -rw-r--r-- | packages/taler-harness/src/integrationtests/test-bank-api.ts | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index 9ac16980b..a13ff63c7 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -17,13 +17,13 @@ /** * Imports. */ -import { createEddsaKeyPair, encodeCrock } from "@gnu-taler/taler-util"; import { - BankAccessApi, - BankApi, + BankAccessApiClient, CreditDebitIndicator, WireGatewayApiClient, -} from "@gnu-taler/taler-wallet-core"; + createEddsaKeyPair, + encodeCrock, +} from "@gnu-taler/taler-util"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { BankService, @@ -84,32 +84,34 @@ export async function runBankApiTest(t: GlobalTestState) { await merchant.start(); await merchant.pingUntilAvailable(); - await merchant.addDefaultInstance(); - await merchant.addInstance({ - id: "minst1", - name: "minst1", - paytoUris: [getPayto("minst1")], - }); - await merchant.addInstance({ + await merchant.addInstanceWithWireAccount({ id: "default", name: "Default Instance", paytoUris: [getPayto("merchant-default")], }); + await merchant.addInstanceWithWireAccount({ + id: "minst1", + name: "minst1", + paytoUris: [getPayto("minst1")], + }); + console.log("setup done!"); - const bankUser = await BankApi.registerAccount(bank, "user1", "pw1", {}); + const bankClient = new BankAccessApiClient(bank.bankAccessApiBaseUrl); + + const bankUser = await bankClient.registerAccount("user1", "pw1"); // Make sure that registering twice results in a 409 Conflict { const e = await t.assertThrowsTalerErrorAsync(async () => { - await BankApi.registerAccount(bank, "user1", "pw2", {}); + await bankClient.registerAccount("user1", "pw2"); }); t.assertTrue(e.errorDetail.httpStatusCode === 409); } - let balResp = await BankAccessApi.getAccountBalance(bank, bankUser); + let balResp = await bankClient.getAccountBalance(bankUser.username); console.log(balResp); @@ -121,12 +123,15 @@ export async function runBankApiTest(t: GlobalTestState) { const res = createEddsaKeyPair(); - const wireGatewayApiClient = new WireGatewayApiClient({ - wireGatewayApiBaseUrl: exchangeBankAccount.wireGatewayApiBaseUrl, - accountName: exchangeBankAccount.accountName, - accountPassword: exchangeBankAccount.accountPassword, - allowHttp: true, - }); + const wireGatewayApiClient = new WireGatewayApiClient( + exchangeBankAccount.wireGatewayApiBaseUrl, + { + auth: { + username: exchangeBankAccount.accountName, + password: exchangeBankAccount.accountPassword, + }, + }, + ); await wireGatewayApiClient.adminAddIncoming({ amount: "TESTKUDOS:115", @@ -134,9 +139,11 @@ export async function runBankApiTest(t: GlobalTestState) { reservePub: encodeCrock(res.eddsaPub), }); - balResp = await BankAccessApi.getAccountBalance(bank, bankUser); + balResp = await bankClient.getAccountBalance(bankUser.username); t.assertAmountEquals(balResp.balance.amount, "TESTKUDOS:15"); t.assertTrue( balResp.balance.credit_debit_indicator === CreditDebitIndicator.Debit, ); } + +runBankApiTest.suites = ["fakebank"]
\ No newline at end of file |
