diff options
author | Florian Dold <florian@dold.me> | 2023-09-06 14:19:24 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-09-06 14:19:24 +0200 |
commit | 6affe04fe6919767181274891fd948688dedd700 (patch) | |
tree | 3cf4b60261b3c50682d40585b672fa02b3666be1 /packages | |
parent | 3ee3ab3cedf64ea643055a5b99ae5d35385ea037 (diff) |
harness: wait for withdrawal, configure instance properly
Diffstat (limited to 'packages')
6 files changed, 39 insertions, 21 deletions
diff --git a/packages/taler-harness/src/integrationtests/test-bank-api.ts b/packages/taler-harness/src/integrationtests/test-bank-api.ts index 1c359732e..a13ff63c7 100644 --- a/packages/taler-harness/src/integrationtests/test-bank-api.ts +++ b/packages/taler-harness/src/integrationtests/test-bank-api.ts @@ -106,7 +106,7 @@ export async function runBankApiTest(t: GlobalTestState) { // Make sure that registering twice results in a 409 Conflict { const e = await t.assertThrowsTalerErrorAsync(async () => { - await bankClient.registerAccount("user1", "pw1"); + await bankClient.registerAccount("user1", "pw2"); }); t.assertTrue(e.errorDetail.httpStatusCode === 409); } diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index afd0c901b..b4268ee42 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -50,13 +50,14 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { // Effectively we completely reset the exchange, // but keep the exchange master public key. + await merchant.stop(); + await exchange.stop(); await exchange.purgeDatabase(); await exchange.purgeSecmodKeys(); await exchange.start(); await exchange.pingUntilAvailable(); - await merchant.stop(); await merchant.start(); await merchant.pingUntilAvailable(); diff --git a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts index 23972ed63..4ef5e3bff 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-multiple.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-multiple.ts @@ -123,13 +123,15 @@ export async function runPaymentMultipleTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:100", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await merchantClient.createOrder({ diff --git a/packages/taler-harness/src/integrationtests/test-refund-gone.ts b/packages/taler-harness/src/integrationtests/test-refund-gone.ts index 9ba078a6d..d50919934 100644 --- a/packages/taler-harness/src/integrationtests/test-refund-gone.ts +++ b/packages/taler-harness/src/integrationtests/test-refund-gone.ts @@ -44,13 +44,15 @@ export async function runRefundGoneTest(t: GlobalTestState) { // Withdraw digital cash into the wallet. - await withdrawViaBankV2(t, { + const wres = await withdrawViaBankV2(t, { walletClient, bank, exchange, amount: "TESTKUDOS:20", }); + await wres.withdrawalFinishedCond; + // Set up order. const orderResp = await merchantClient.createOrder({ diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts index 243c90e2e..fc2774adf 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts @@ -19,7 +19,9 @@ */ import { Amounts, + Duration, MerchantApiClient, + MerchantContractTerms, PreparePayResultType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -41,7 +43,18 @@ export async function runWalletBalanceTest(t: GlobalTestState) { const { merchant, walletClient, exchange, bank } = await createSimpleTestkudosEnvironmentV2(t); - const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); + await merchant.addInstanceWithWireAccount({ + id: "myinst", + name: "My Instance", + paytoUris: ["payto://void/foo"], + defaultWireTransferDelay: Duration.toTalerProtocolDuration( + Duration.fromSpec({ minutes: 1 }), + ), + }); + + const merchantClient = new MerchantApiClient( + merchant.makeInstanceBaseUrl("myinst"), + ); // Withdraw digital cash into the wallet. @@ -54,7 +67,7 @@ export async function runWalletBalanceTest(t: GlobalTestState) { await wres.withdrawalFinishedCond; - const order = { + const order: Partial<MerchantContractTerms> = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-wallet-core/src/util/coinSelection.ts b/packages/taler-wallet-core/src/util/coinSelection.ts index daba2ead5..abf0bbc02 100644 --- a/packages/taler-wallet-core/src/util/coinSelection.ts +++ b/packages/taler-wallet-core/src/util/coinSelection.ts @@ -588,22 +588,22 @@ async function selectPayMerchantCandidates( for (const acc of exchangeDetails.wireInfo.accounts) { const pp = parsePaytoUri(acc.payto_uri); checkLogicInvariant(!!pp); - if (pp.targetType === req.wireMethod) { - // also check that wire method is supported now - const wireFeeStr = exchangeDetails.wireInfo.feesForType[ - req.wireMethod - ]?.find((x) => { - return AbsoluteTime.isBetween( - AbsoluteTime.now(), - AbsoluteTime.fromProtocolTimestamp(x.startStamp), - AbsoluteTime.fromProtocolTimestamp(x.endStamp), - ); - })?.wireFee; - if (wireFeeStr) { - wireMethodFee = wireFeeStr; - } - break; + if (pp.targetType !== req.wireMethod) { + continue; } + const wireFeeStr = exchangeDetails.wireInfo.feesForType[ + req.wireMethod + ]?.find((x) => { + return AbsoluteTime.isBetween( + AbsoluteTime.now(), + AbsoluteTime.fromProtocolTimestamp(x.startStamp), + AbsoluteTime.fromProtocolTimestamp(x.endStamp), + ); + })?.wireFee; + if (wireFeeStr) { + wireMethodFee = wireFeeStr; + } + break; } if (!wireMethodFee) { break; |