diff options
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, |
