diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts index 8d271c5d1..d7ffa28d5 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts @@ -24,12 +24,15 @@ import { codecForMerchantOrderStatusUnpaid, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; +import { + GlobalTestState, + MerchantApiClient, + harnessHttpLib, +} from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, withdrawViaBankV2, } from "../harness/helpers.js"; -import { createPlatformHttpLib } from "@gnu-taler/taler-util/http"; /** * Run test for basic, bank-integrated withdrawal. @@ -50,6 +53,8 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { await wres.withdrawalFinishedCond; + const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); + /** * ========================================================================= * Create an order and let the wallet pay under a session ID @@ -59,7 +64,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { * ========================================================================= */ - let orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { + let orderResp = await merchantClient.createOrder({ order: { summary: "Buy me!", amount: "TESTKUDOS:5", @@ -68,7 +73,7 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { create_token: false, }); - let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { + let orderStatus = await merchantClient.queryPrivateOrderStatus({ orderId: orderResp.order_id, sessionId: "mysession-one", }); @@ -81,7 +86,9 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { // First, request order status without longpolling { console.log("requesting", publicOrderStatusUrl.href); - let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); + let publicOrderStatusResp = await harnessHttpLib.fetch( + publicOrderStatusUrl.href, + ); if (publicOrderStatusResp.status != 402) { throw Error( @@ -94,7 +101,9 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { publicOrderStatusUrl.searchParams.set("timeout_ms", "500"); console.log("requesting", publicOrderStatusUrl.href); - let publicOrderStatusResp = await harnessHttpLib.fetch(publicOrderStatusUrl.href); + let publicOrderStatusResp = await harnessHttpLib.fetch( + publicOrderStatusUrl.href, + ); if (publicOrderStatusResp.status != 402) { throw Error( @@ -129,7 +138,9 @@ export async function runMerchantLongpollingTest(t: GlobalTestState) { preparePayResp.contractTermsHash, ); - let publicOrderStatusPromise = harnessHttpLib.fetch(publicOrderStatusUrl.href); + let publicOrderStatusPromise = harnessHttpLib.fetch( + publicOrderStatusUrl.href, + ); t.assertTrue(preparePayResp.status === PreparePayResultType.PaymentPossible); |