aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-harness/src/integrationtests/test-payment-template.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-payment-template.ts')
-rw-r--r--packages/taler-harness/src/integrationtests/test-payment-template.ts32
1 files changed, 20 insertions, 12 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-template.ts b/packages/taler-harness/src/integrationtests/test-payment-template.ts
index 707be52e1..2058991d0 100644
--- a/packages/taler-harness/src/integrationtests/test-payment-template.ts
+++ b/packages/taler-harness/src/integrationtests/test-payment-template.ts
@@ -17,12 +17,16 @@
/**
* Imports.
*/
-import { ConfirmPayResultType, Duration, PreparePayResultType } from "@gnu-taler/taler-util";
+import {
+ ConfirmPayResultType,
+ Duration,
+ PreparePayResultType,
+} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
-import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js";
+import { GlobalTestState, MerchantApiClient } from "../harness/harness.js";
import {
createSimpleTestkudosEnvironmentV2,
- withdrawViaBankV2
+ withdrawViaBankV2,
} from "../harness/helpers.js";
/**
@@ -34,7 +38,9 @@ export async function runPaymentTemplateTest(t: GlobalTestState) {
const { walletClient, bank, exchange, merchant } =
await createSimpleTestkudosEnvironmentV2(t);
- await MerchantPrivateApi.createTemplate(merchant, "default", {
+ const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
+
+ await merchantClient.createTemplate({
template_id: "template1",
template_description: "my test template",
template_contract: {
@@ -50,7 +56,12 @@ export async function runPaymentTemplateTest(t: GlobalTestState) {
// Withdraw digital cash into the wallet.
- const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20" });
+ const wres = await withdrawViaBankV2(t, {
+ walletClient,
+ bank,
+ exchange,
+ amount: "TESTKUDOS:20",
+ });
await wres.withdrawalFinishedCond;
// Request a template payment
@@ -79,13 +90,10 @@ export async function runPaymentTemplateTest(t: GlobalTestState) {
// Check if payment was successful.
- const orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(
- merchant,
- {
- orderId: preparePayResult.contractTerms.order_id,
- instance: "default",
- },
- );
+ const orderStatus = await merchantClient.queryPrivateOrderStatus({
+ orderId: preparePayResult.contractTerms.order_id,
+ instance: "default",
+ });
t.assertTrue(orderStatus.order_status === "paid");
await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {});