taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit d072cf6369a355627a97f0fff8ba3fade947eca0
parent 743bc448acaaf2a98ae0ea9bfd2a414231aeb5b9
Author: Sebastian <sebasjm@taler-systems.com>
Date:   Thu, 22 Jan 2026 20:53:27 -0300

fix #10907: add integration test

Diffstat:
Apackages/taler-harness/src/integrationtests/test-merchant-bank-bad-wire-target.ts | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpackages/taler-harness/src/integrationtests/testrunner.ts | 2++
2 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/packages/taler-harness/src/integrationtests/test-merchant-bank-bad-wire-target.ts b/packages/taler-harness/src/integrationtests/test-merchant-bank-bad-wire-target.ts @@ -0,0 +1,100 @@ +/* + This file is part of GNU Taler + (C) 2020 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> + */ + +/** + * Imports. + */ +import { + AbsoluteTime, + AmountString, + Duration, + PreparePayResultType, + TalerMerchantApi, + TalerMerchantInstanceHttpClient, + j2s, + succeedOrThrow, +} from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { + applyTimeTravelV2, + createSimpleTestkudosEnvironmentV3, + withdrawViaBankV3, +} from "../harness/environments.js"; +import { GlobalTestState } from "../harness/harness.js"; + +/** + * Test APIs related to merchant wire transfers. + */ +export async function runMerchantBankBadWireTargetTest(t: GlobalTestState) { + // Set up test environment + + const { exchange, merchant, merchantAdminAccessToken } = + await createSimpleTestkudosEnvironmentV3(t); + + // Create instance with bad wire target. + // x-taler-bank will work but iban doesn't since + // exchange only allows x-taler-bank + const { accessToken } = await merchant.addInstanceWithWireAccount( + { + id: "minst2", + name: "minst2", + // paytoUris: [`payto://x-taler-bank/localhost/2?receiver-name=random`], + paytoUris: [`payto://iban/DE1231231231?receiver-name=random`], + defaultWireTransferDelay: Duration.toTalerProtocolDuration( + Duration.fromSpec({ minutes: 1 }), + ), + }, + { adminAccessToken: merchantAdminAccessToken }, + ); + + // Order that can only be paid within five minutes. + const order: TalerMerchantApi.Order = { + summary: "Buy me!", + amount: "TESTKUDOS:5", + fulfillment_url: "taler://fulfillment-success/thx", + pay_deadline: AbsoluteTime.toProtocolTimestamp( + AbsoluteTime.addDuration( + AbsoluteTime.now(), + Duration.fromSpec({ minutes: 5 }), + ), + ), + refund_deadline: AbsoluteTime.toProtocolTimestamp(AbsoluteTime.zero()), + wire_transfer_deadline: AbsoluteTime.toProtocolTimestamp( + AbsoluteTime.addDuration( + AbsoluteTime.now(), + Duration.fromSpec({ minutes: 10 }), + ), + ), + }; + + const merchantClient = new TalerMerchantInstanceHttpClient( + merchant.makeInstanceBaseUrl("minst2"), + ); + + const orderResp = succeedOrThrow( + await merchantClient.createOrder(accessToken, { + order, + }), + ); + + let orderStatus = succeedOrThrow( + await merchantClient.getOrderDetails(accessToken, orderResp.order_id), + ); + + t.assertTrue(orderStatus.order_status === "unpaid"); +} + +runMerchantBankBadWireTargetTest.suites = ["merchant"]; diff --git a/packages/taler-harness/src/integrationtests/testrunner.ts b/packages/taler-harness/src/integrationtests/testrunner.ts @@ -216,6 +216,7 @@ import { runWithdrawalHugeTest } from "./test-withdrawal-huge.js"; import { runWithdrawalIdempotentTest } from "./test-withdrawal-idempotent.js"; import { runWithdrawalManualTest } from "./test-withdrawal-manual.js"; import { runWithdrawalPrepareTest } from "./test-withdrawal-prepare.js"; +import { runMerchantBankBadWireTargetTest } from "./test-merchant-bank-bad-wire-target.js"; /** * Test runner. @@ -413,6 +414,7 @@ const allTests: TestMainFunction[] = [ runMerchantWireTest, runWalletExchangeFeaturesTest, runRepurchaseV1Test, + runMerchantBankBadWireTargetTest, runWalletBbanTest, runCurrencyScopeSeparationTest, ];