diff options
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-refund-incremental.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-refund-incremental.ts | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts index c8fcfc831..8e7e38b71 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-incremental.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-incremental.ts @@ -18,21 +18,21 @@ * Imports. */ import { + Amounts, + Duration, + TransactionType, + durationFromSpec, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState, - delayMs, MerchantPrivateApi, + delayMs, } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironment, - withdrawViaBank, + createSimpleTestkudosEnvironmentV2, + withdrawViaBankV2, } from "../harness/helpers.js"; -import { - TransactionType, - Amounts, - durationFromSpec, - Duration, -} from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; /** * Run test for basic, bank-integrated withdrawal. @@ -40,12 +40,17 @@ import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; export async function runRefundIncrementalTest(t: GlobalTestState) { // Set up test environment - const { wallet, bank, exchange, merchant } = - await createSimpleTestkudosEnvironment(t); + const { walletClient, bank, exchange, merchant } = + await createSimpleTestkudosEnvironmentV2(t); // Withdraw digital cash into the wallet. - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" }); + await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:20", + }); // Set up order. @@ -68,11 +73,11 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { // Make wallet pay for the order - const r1 = await wallet.client.call(WalletApiOperation.PreparePayForUri, { + const r1 = await walletClient.call(WalletApiOperation.PreparePayForUri, { talerPayUri: orderStatus.taler_pay_uri, }); - await wallet.client.call(WalletApiOperation.ConfirmPay, { + await walletClient.call(WalletApiOperation.ConfirmPay, { proposalId: r1.proposalId, }); @@ -94,15 +99,15 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { console.log("first refund increase response", ref); { - let wr = await wallet.client.call(WalletApiOperation.StartRefundQuery, { + let wr = await walletClient.call(WalletApiOperation.StartRefundQuery, { transactionId: r1.transactionId, }); - await wallet.runUntilDone(); - console.log(wr); - const txs = await wallet.client.call( - WalletApiOperation.GetTransactions, + await walletClient.call( + WalletApiOperation.TestingWaitTransactionsFinal, {}, ); + console.log(wr); + const txs = await walletClient.call(WalletApiOperation.GetTransactions, {}); console.log( "transactions after applying first refund:", JSON.stringify(txs, undefined, 2), @@ -136,10 +141,13 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { console.log("third refund increase response", ref); { - let wr = await wallet.client.call(WalletApiOperation.StartRefundQuery, { + let wr = await walletClient.call(WalletApiOperation.StartRefundQuery, { transactionId: r1.transactionId, }); - await wallet.runUntilDone(); + await walletClient.call( + WalletApiOperation.TestingWaitTransactionsFinal, + {}, + ); console.log(wr); } @@ -153,25 +161,17 @@ export async function runRefundIncrementalTest(t: GlobalTestState) { console.log(JSON.stringify(orderStatus, undefined, 2)); - await wallet.runUntilDone(); + await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const bal = await wallet.client.call(WalletApiOperation.GetBalances, {}); + const bal = await walletClient.call(WalletApiOperation.GetBalances, {}); console.log(JSON.stringify(bal, undefined, 2)); { - const txs = await wallet.client.call( - WalletApiOperation.GetTransactions, - {}, - ); + const txs = await walletClient.call(WalletApiOperation.GetTransactions, {}); console.log(JSON.stringify(txs, undefined, 2)); const txTypes = txs.transactions.map((x) => x.type); - t.assertDeepEqual(txTypes, [ - "withdrawal", - "payment", - "refund", - "refund", - ]); + t.assertDeepEqual(txTypes, ["withdrawal", "payment", "refund", "refund"]); for (const tx of txs.transactions) { if (tx.type !== TransactionType.Refund) { |