diff options
| author | Özgür Kesim <oec-taler@kesim.org> | 2023-09-09 07:34:11 +0200 |
|---|---|---|
| committer | Özgür Kesim <oec-taler@kesim.org> | 2023-09-09 07:34:11 +0200 |
| commit | 5495551071a3fdc36c38deb4c1cf6f4aa5b98bd4 (patch) | |
| tree | adf7730b190618a0499e50a2d43cf1b850cddd16 /packages/taler-harness/src/integrationtests/test-payment-transient.ts | |
| parent | 94cfcc875065f988815c31aaf8ebf36f75ac5983 (diff) | |
| parent | 6c3cfa9be7a332c2cc8490f25ebd6c73c8244842 (diff) | |
Merge branch 'master' into age-withdraw
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-payment-transient.ts')
| -rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-transient.ts | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-transient.ts b/packages/taler-harness/src/integrationtests/test-payment-transient.ts index c2a8e37c5..1911b5e92 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-transient.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-transient.ts @@ -19,6 +19,7 @@ */ import { ConfirmPayResultType, + MerchantApiClient, PreparePayResultType, TalerErrorCode, TalerErrorDetail, @@ -27,13 +28,12 @@ import { } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { FaultInjectionResponseContext } from "../harness/faultInjection.js"; -import { GlobalTestState, MerchantPrivateApi, harnessHttpLib } from "../harness/harness.js"; +import { GlobalTestState, harnessHttpLib } from "../harness/harness.js"; import { createFaultInjectedMerchantTestkudosEnvironment, - withdrawViaBank, + withdrawViaBankV2, } from "../harness/helpers.js"; - /** * Run test for a payment where the merchant has a transient * failure in /pay @@ -41,21 +41,25 @@ import { export async function runPaymentTransientTest(t: GlobalTestState) { // Set up test environment - const { wallet, bank, exchange, faultyMerchant, faultyExchange } = + const { walletClient, bank, faultyMerchant, faultyExchange } = await createFaultInjectedMerchantTestkudosEnvironment(t); + const merchantClient = new MerchantApiClient( + faultyMerchant.makeInstanceBaseUrl(), + ); + // Withdraw digital cash into the wallet. - await withdrawViaBank(t, { - wallet, + const wres = await withdrawViaBankV2(t, { + walletClient, bank, exchange: faultyExchange, amount: "TESTKUDOS:20", }); - const merchant = faultyMerchant; + await wres.withdrawalFinishedCond; - let orderResp = await MerchantPrivateApi.createOrder(merchant, "default", { + let orderResp = await merchantClient.createOrder({ order: { summary: "Buy me!", amount: "TESTKUDOS:5", @@ -64,7 +68,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { }, }); - let orderStatus = await MerchantPrivateApi.queryPrivateOrderStatus(merchant, { + let orderStatus = await merchantClient.queryPrivateOrderStatus({ orderId: orderResp.order_id, sessionId: "mysession-one", }); @@ -88,7 +92,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { console.log(pubUnpaidStatus); - let preparePayResp = await wallet.client.call( + let preparePayResp = await walletClient.call( WalletApiOperation.PreparePayForUri, { talerPayUri: pubUnpaidStatus.taler_pay_uri, @@ -136,7 +140,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { }, }); - const confirmPayResp = await wallet.client.call( + const confirmPayResp = await walletClient.call( WalletApiOperation.ConfirmPay, { proposalId, @@ -148,7 +152,7 @@ export async function runPaymentTransientTest(t: GlobalTestState) { t.assertTrue(confirmPayResp.type === ConfirmPayResultType.Pending); t.assertTrue(faultInjected); - const confirmPayRespTwo = await wallet.client.call( + const confirmPayRespTwo = await walletClient.call( WalletApiOperation.ConfirmPay, { proposalId, |
