diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2023-08-25 13:24:30 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2023-08-25 13:24:30 +0200 |
commit | a58f73ecdb995e02a770338aa8a8aa529ccfdfaa (patch) | |
tree | e1f329bb59ffd1fa4419241cf3bc849738103b54 /packages/taler-harness/src/integrationtests/test-denom-unoffered.ts | |
parent | 5ab3070b3a63c2e8fed0e413dea06cf03fb48f1e (diff) | |
parent | 896841aec5dc3594d83cc300349d20ec2270f88e (diff) |
Merge branch 'master' into age-withdraw
Diffstat (limited to 'packages/taler-harness/src/integrationtests/test-denom-unoffered.ts')
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-denom-unoffered.ts | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index 27c336ea6..5a471b9aa 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -18,22 +18,29 @@ * Imports. */ import { PreparePayResultType, TalerErrorCode } from "@gnu-taler/taler-util"; -import { Wallet, WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState, MerchantPrivateApi } from "../harness/harness.js"; import { - createSimpleTestkudosEnvironment, - withdrawViaBank, + createSimpleTestkudosEnvironmentV2, + withdrawViaBankV2, } from "../harness/helpers.js"; export async function runDenomUnofferedTest(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" }); + const wres = await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:20", + }); + + await wres.withdrawalFinishedCond; // Make the exchange forget the denomination. // Effectively we completely reset the exchange, @@ -67,7 +74,7 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { // Make wallet pay for the order - const preparePayResult = await wallet.client.call( + const preparePayResult = await walletClient.call( WalletApiOperation.PreparePayForUri, { talerPayUri: orderStatus.taler_pay_uri, @@ -78,11 +85,11 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { preparePayResult.status === PreparePayResultType.PaymentPossible, ); - const confirmResp = await wallet.client.call(WalletApiOperation.ConfirmPay, { + const confirmResp = await walletClient.call(WalletApiOperation.ConfirmPay, { proposalId: preparePayResult.proposalId, }); - const tx = await wallet.client.call(WalletApiOperation.GetTransactionById, { + const tx = await walletClient.call(WalletApiOperation.GetTransactionById, { transactionId: confirmResp.transactionId, }); @@ -96,21 +103,26 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { TalerErrorCode.MERCHANT_POST_ORDERS_ID_PAY_DENOMINATION_KEY_NOT_FOUND, ); - await wallet.client.call(WalletApiOperation.AddExchange, { + await walletClient.call(WalletApiOperation.AddExchange, { exchangeBaseUrl: exchange.baseUrl, forceUpdate: true, }); - await wallet.client.call(WalletApiOperation.DeleteTransaction, { + await walletClient.call(WalletApiOperation.DeleteTransaction, { transactionId: confirmResp.transactionId, }); // Now withdrawal should work again. - await withdrawViaBank(t, { wallet, bank, exchange, amount: "TESTKUDOS:20" }); + await withdrawViaBankV2(t, { + walletClient, + bank, + exchange, + amount: "TESTKUDOS:20", + }); - await wallet.runUntilDone(); + await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const txs = await wallet.client.call(WalletApiOperation.GetTransactions, {}); + const txs = await walletClient.call(WalletApiOperation.GetTransactions, {}); console.log(JSON.stringify(txs, undefined, 2)); } |