diff options
author | Florian Dold <florian@dold.me> | 2023-09-06 11:23:33 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-06 11:23:33 +0200 |
commit | 9a1a3b350d4147243dbe2ecfcdcb846c0f3c6dcb (patch) | |
tree | f9b01f5748edf391146d2bbaec62aad285d261ec /packages/taler-harness/src/integrationtests/test-merchant-longpolling.ts | |
parent | c9a0d2eb968133b1ad156e1dc86e6c06dad09c7a (diff) | |
download | wallet-core-9a1a3b350d4147243dbe2ecfcdcb846c0f3c6dcb.tar.xz |
harness: get rid of deprecated merchant API client
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); |