diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts index e959e813b..08c9d4bb2 100644 --- a/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts +++ b/packages/taler-harness/src/integrationtests/test-merchant-spec-public-orders.ts @@ -35,8 +35,9 @@ import { harnessHttpLib, } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironment, - withdrawViaBank, + createSimpleTestkudosEnvironmentV2, + createWalletDaemonWithClient, + withdrawViaBankV2, } from "../harness/helpers.js"; interface Context { @@ -52,10 +53,18 @@ async function testWithClaimToken( t: GlobalTestState, c: Context, ): Promise<void> { - const wallet = new WalletCli(t, "withclaimtoken"); + const { walletClient } = await createWalletDaemonWithClient(t, { + name: "wct", + }); const { bank, exchange } = c; const { merchant, merchantBaseUrl } = c; - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" }); + const wres = await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:20", + }); + await wres.withdrawalFinishedCond; const sessionId = "mysession"; const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { order: { @@ -104,7 +113,7 @@ async function testWithClaimToken( console.log(r); } - const preparePayResp = await wallet.client.call( + const preparePayResp = await walletClient.call( WalletApiOperation.PreparePayForUri, { talerPayUri, @@ -166,12 +175,9 @@ async function testWithClaimToken( t.assertDeepEqual(httpResp.status, 202); } - const confirmPayRes = await wallet.client.call( - WalletApiOperation.ConfirmPay, - { - proposalId: proposalId, - }, - ); + const confirmPayRes = await walletClient.call(WalletApiOperation.ConfirmPay, { + proposalId: proposalId, + }); t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); @@ -238,7 +244,7 @@ async function testWithClaimToken( t.assertDeepEqual(httpResp.status, 200); } - const confirmPayRes2 = await wallet.client.call( + const confirmPayRes2 = await walletClient.call( WalletApiOperation.ConfirmPay, { proposalId: proposalId, @@ -307,11 +313,19 @@ async function testWithoutClaimToken( t: GlobalTestState, c: Context, ): Promise<void> { - const wallet = new WalletCli(t, "withoutct"); + const { walletClient } = await createWalletDaemonWithClient(t, { + name: "wnoct", + }); const sessionId = "mysession2"; const { bank, exchange } = c; const { merchant, merchantBaseUrl } = c; - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" }); + const wres = await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:20", + }); + await wres.withdrawalFinishedCond; const orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { order: { summary: "Buy me!", @@ -356,7 +370,7 @@ async function testWithoutClaimToken( console.log(r); } - const preparePayResp = await wallet.client.call( + const preparePayResp = await walletClient.call( WalletApiOperation.PreparePayForUri, { talerPayUri, @@ -422,12 +436,9 @@ async function testWithoutClaimToken( t.assertDeepEqual(httpResp.status, 402); } - const confirmPayRes = await wallet.client.call( - WalletApiOperation.ConfirmPay, - { - proposalId: proposalId, - }, - ); + const confirmPayRes = await walletClient.call(WalletApiOperation.ConfirmPay, { + proposalId: proposalId, + }); t.assertTrue(confirmPayRes.type === ConfirmPayResultType.Done); @@ -492,7 +503,7 @@ async function testWithoutClaimToken( t.assertDeepEqual(httpResp.status, 200); } - const confirmPayRes2 = await wallet.client.call( + const confirmPayRes2 = await walletClient.call( WalletApiOperation.ConfirmPay, { proposalId: proposalId, @@ -564,7 +575,7 @@ async function testWithoutClaimToken( * specification of the endpoint. */ export async function runMerchantSpecPublicOrdersTest(t: GlobalTestState) { - const { bank, exchange, merchant } = await createSimpleTestkudosEnvironment( + const { bank, exchange, merchant } = await createSimpleTestkudosEnvironmentV2( t, ); @@ -572,7 +583,9 @@ export async function runMerchantSpecPublicOrdersTest(t: GlobalTestState) { const merchantBaseUrl = merchant.makeInstanceBaseUrl(); { - const httpResp = await httpLib.fetch(new URL("config", merchantBaseUrl).href); + const httpResp = await httpLib.fetch( + new URL("config", merchantBaseUrl).href, + ); const r = await httpResp.json(); console.log(r); t.assertDeepEqual(r.currency, "TESTKUDOS"); |