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-timetravel-autorefresh.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-timetravel-autorefresh.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts | 58 |
1 files changed, 35 insertions, 23 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts index 602b6629a..420e4fddc 100644 --- a/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts +++ b/packages/taler-harness/src/integrationtests/test-timetravel-autorefresh.ts @@ -32,14 +32,16 @@ import { BankService, ExchangeService, GlobalTestState, - MerchantPrivateApi, MerchantService, setupDb, - WalletCli, getPayto, + MerchantApiClient, } from "../harness/harness.js"; -import { applyTimeTravelV2, createWalletDaemonWithClient, withdrawViaBankV2 } from "../harness/helpers.js"; - +import { + applyTimeTravelV2, + createWalletDaemonWithClient, + withdrawViaBankV2, +} from "../harness/helpers.js"; /** * Basic time travel test. @@ -110,19 +112,29 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { name: "w1", }); + const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); + // Withdraw digital cash into the wallet. - const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:15" }); + const wres = await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:15", + }); await wres.withdrawalFinishedCond; // Travel into the future, the deposit expiration is two years // into the future. console.log("applying first time travel"); - await applyTimeTravelV2(Duration.toMilliseconds(durationFromSpec({ days: 400 })), { - walletClient, - exchange, - merchant, - }); + await applyTimeTravelV2( + Duration.toMilliseconds(durationFromSpec({ days: 400 })), + { + walletClient, + exchange, + merchant, + }, + ); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); @@ -144,11 +156,14 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { // Travel into the future, the deposit expiration is two years // into the future. console.log("applying second time travel"); - await applyTimeTravelV2(Duration.toMilliseconds(durationFromSpec({ years: 2, months: 6 })), { - walletClient, - exchange, - merchant, - }); + await applyTimeTravelV2( + Duration.toMilliseconds(durationFromSpec({ years: 2, months: 6 })), + { + walletClient, + exchange, + merchant, + }, + ); // At this point, the original coins should've been refreshed. // It would be too late to refresh them now, as we're past @@ -156,7 +171,7 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { + const orderResp = await merchantClient.createOrder({ order: { fulfillment_url: "http://example.com", summary: "foo", @@ -164,13 +179,10 @@ export async function runTimetravelAutorefreshTest(t: GlobalTestState) { }, }); - const orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus( - merchant, - { - orderId: orderResp.order_id, - instance: "default", - }, - ); + const orderStatus = await merchantClient.queryPrivateOrderStatus({ + orderId: orderResp.order_id, + instance: "default", + }); t.assertTrue(orderStatus.order_status === "unpaid"); |