diff options
-rw-r--r-- | packages/taler-harness/src/integrationtests/test-payment-claim.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-payment-claim.ts b/packages/taler-harness/src/integrationtests/test-payment-claim.ts index b5ed89ec3..3595a1750 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-claim.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-claim.ts @@ -23,14 +23,15 @@ import { TalerErrorCode, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState, WalletCli } from "../harness/harness.js"; +import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV2, + createWalletDaemonWithClient, withdrawViaBankV2, } from "../harness/helpers.js"; /** - * Run test for basic, bank-integrated withdrawal. + * Run test where a wallet tries to claim an already claimed order. */ export async function runPaymentClaimTest(t: GlobalTestState) { // Set up test environment @@ -40,7 +41,7 @@ export async function runPaymentClaimTest(t: GlobalTestState) { const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); - const walletTwo = new WalletCli(t, "two"); + const w2 = await createWalletDaemonWithClient(t, { name: "w2" }); // Withdraw digital cash into the wallet. @@ -84,14 +85,16 @@ export async function runPaymentClaimTest(t: GlobalTestState) { preparePayResult.status === PreparePayResultType.PaymentPossible, ); - t.assertThrowsTalerErrorAsync(async () => { - await walletTwo.client.call(WalletApiOperation.PreparePayForUri, { + const errOne = t.assertThrowsTalerErrorAsync(async () => { + await w2.walletClient.call(WalletApiOperation.PreparePayForUri, { talerPayUri, }); }); + console.log(errOne); + await walletClient.call(WalletApiOperation.ConfirmPay, { - proposalId: preparePayResult.proposalId, + transactionId: preparePayResult.transactionId, }); // Check if payment was successful. @@ -102,10 +105,10 @@ export async function runPaymentClaimTest(t: GlobalTestState) { t.assertTrue(orderStatus.order_status === "paid"); - walletTwo.deleteDatabase(); + await w2.walletClient.call(WalletApiOperation.ClearDb, {}); const err = await t.assertThrowsTalerErrorAsync(async () => { - await walletTwo.client.call(WalletApiOperation.PreparePayForUri, { + await w2.walletClient.call(WalletApiOperation.PreparePayForUri, { talerPayUri, }); }); |