aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-bank-api.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-bank-api.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-bank-api.ts49
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