aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-tipping.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-tipping.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-tipping.ts47
1 files changed, 21 insertions, 26 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-tipping.ts b/packages/taler-harness/src/integrationtests/test-tipping.ts
index 53d7f08c8..4140311ab 100644
--- a/packages/taler-harness/src/integrationtests/test-tipping.ts
+++ b/packages/taler-harness/src/integrationtests/test-tipping.ts
@@ -19,17 +19,15 @@
*/
import {
BankAccessApiClient,
- WalletApiOperation,
+ MerchantApiClient,
+ TransactionMajorState,
WireGatewayApiClient,
-} from "@gnu-taler/taler-wallet-core";
+} from "@gnu-taler/taler-util";
import {
- GlobalTestState,
- MerchantApiClient,
- MerchantPrivateApi,
- getWireMethodForTest,
-} from "../harness/harness.js";
+ WalletApiOperation,
+} from "@gnu-taler/taler-wallet-core";
+import { GlobalTestState, getWireMethodForTest } from "../harness/harness.js";
import { createSimpleTestkudosEnvironmentV2 } from "../harness/helpers.js";
-import { TransactionMajorState } from "@gnu-taler/taler-util";
/**
* Run test for basic, bank-integrated withdrawal.
@@ -40,18 +38,12 @@ export async function runTippingTest(t: GlobalTestState) {
const { walletClient, bank, exchange, merchant, exchangeBankAccount } =
await createSimpleTestkudosEnvironmentV2(t);
- const bankAccessApiClient = new BankAccessApiClient({
- allowHttp: true,
- baseUrl: bank.bankAccessApiBaseUrl,
- });
+ const bankAccessApiClient = new BankAccessApiClient(
+ bank.bankAccessApiBaseUrl,
+ );
const mbu = await bankAccessApiClient.createRandomBankUser();
- const merchantClient = new MerchantApiClient(
- merchant.makeInstanceBaseUrl("default"),
- {
- method: "external",
- },
- );
+ const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
const tipReserveResp = await merchantClient.createTippingReserve({
exchange_url: exchange.baseUrl,
@@ -66,12 +58,15 @@ export async function runTippingTest(t: GlobalTestState) {
exchangeBankAccount.accountPaytoUri,
);
- 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:10",
@@ -85,7 +80,7 @@ export async function runTippingTest(t: GlobalTestState) {
await merchant.start();
await merchant.pingUntilAvailable();
- const r = await MerchantPrivateApi.queryTippingReserves(merchant, "default");
+ const r = await merchantClient.queryTippingReserves();
console.log("tipping reserves:", JSON.stringify(r, undefined, 2));
t.assertTrue(r.reserves.length === 1);
@@ -94,7 +89,7 @@ export async function runTippingTest(t: GlobalTestState) {
r.reserves[0].merchant_initial_amount,
);
- const tip = await MerchantPrivateApi.giveTip(merchant, "default", {
+ const tip = await merchantClient.giveTip({
amount: "TESTKUDOS:5",
justification: "why not?",
next_url: "https://example.com/after-tip",