diff options
author | Florian Dold <florian@dold.me> | 2024-05-16 13:19:17 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-05-16 13:19:23 +0200 |
commit | f0decd3521440d6119ad9333949ce67653d8b2c2 (patch) | |
tree | 7e14203552b811448136802fb00eeccadc04071e /packages/taler-harness | |
parent | 98c188c1b14f73a6b81f41a0cacd6195bb53208e (diff) | |
download | wallet-core-f0decd3521440d6119ad9333949ce67653d8b2c2.tar.xz |
wallet-core: query templates, refactor API declarations
Diffstat (limited to 'packages/taler-harness')
26 files changed, 131 insertions, 93 deletions
diff --git a/packages/taler-harness/src/harness/harness.ts b/packages/taler-harness/src/harness/harness.ts index fd34fe241..136ec3d15 100644 --- a/packages/taler-harness/src/harness/harness.ts +++ b/packages/taler-harness/src/harness/harness.ts @@ -25,7 +25,6 @@ * Imports */ import { - AccountAddDetails, AccountRestriction, AmountJson, Amounts, @@ -36,8 +35,10 @@ import { Logger, MerchantInstanceConfig, PartialMerchantInstanceConfig, + PaytoString, TalerCorebankApiClient, TalerError, + TalerMerchantApi, WalletNotification, createEddsaKeyPair, eddsaGetPublic, @@ -780,8 +781,16 @@ export class LibeufinBankService config.setString("libeufin-bank", "port", `${bc.httpPort}`); config.setString("libeufin-bank", "serve", "tcp"); config.setString("libeufin-bank", "wire_type", "x-taler-bank"); - config.setString("libeufin-bank", "x_taler_bank_payto_hostname", "localhost"); - config.setString("libeufin-bank", "default_debt_limit", bc.maxDebt ?? `${bc.currency}:100`); + config.setString( + "libeufin-bank", + "x_taler_bank_payto_hostname", + "localhost", + ); + config.setString( + "libeufin-bank", + "default_debt_limit", + bc.maxDebt ?? `${bc.currency}:100`, + ); config.setString( "libeufin-bank", "DEFAULT_DEBT_LIMIT", @@ -896,9 +905,9 @@ export interface BankServiceHandle { readonly corebankApiBaseUrl: string; readonly http: HttpRequestLibrary; - setSuggestedExchange(exchange: ExchangeService, exchangePayto: string): void - start(): Promise<void> - pingUntilAvailable(): Promise<void> + setSuggestedExchange(exchange: ExchangeService, exchangePayto: string): void; + start(): Promise<void>; + pingUntilAvailable(): Promise<void>; } export type BankService = BankServiceHandle; @@ -1779,8 +1788,8 @@ export class MerchantService implements MerchantServiceInterface { const accountCreateUrl = `http://localhost:${this.merchantConfig.httpPort}/instances/${instanceConfig.id}/private/accounts`; for (const paytoUri of instanceConfig.paytoUris) { - const accountReq: AccountAddDetails = { - payto_uri: paytoUri, + const accountReq: TalerMerchantApi.AccountAddDetails = { + payto_uri: paytoUri as PaytoString, }; const acctResp = await harnessHttpLib.fetch(accountCreateUrl, { method: "POST", diff --git a/packages/taler-harness/src/harness/helpers.ts b/packages/taler-harness/src/harness/helpers.ts index efcef8706..4e3ce66b9 100644 --- a/packages/taler-harness/src/harness/helpers.ts +++ b/packages/taler-harness/src/harness/helpers.ts @@ -29,11 +29,11 @@ import { Duration, Logger, MerchantApiClient, - MerchantContractTerms, NotificationType, PartialWalletRunConfig, PreparePayResultType, TalerCorebankApiClient, + TalerMerchantApi, TransactionMajorState, WalletNotification, } from "@gnu-taler/taler-util"; @@ -100,7 +100,7 @@ export interface SimpleTestEnvironmentNg { */ export interface SimpleTestEnvironmentNg3 { commonDb: DbInfo; - bankClient: TalerCorebankApiClient, + bankClient: TalerCorebankApiClient; exchange: ExchangeService; exchangeBankAccount: HarnessExchangeBankAccount; merchant: MerchantService; @@ -808,7 +808,7 @@ export async function withdrawViaBankV3( t: GlobalTestState, p: { walletClient: WalletClient; - bankClient: TalerCorebankApiClient, + bankClient: TalerCorebankApiClient; exchange: ExchangeServiceInterface; amount: AmountString | string; restrictAge?: number; @@ -823,7 +823,10 @@ export async function withdrawViaBankV3( password: user.password, }); - const wop = await bankClient2.createWithdrawalOperation(user.username, amount); + const wop = await bankClient2.createWithdrawalOperation( + user.username, + amount, + ); // Hand it to the wallet @@ -898,7 +901,7 @@ export async function makeTestPaymentV2( args: { merchant: MerchantServiceInterface; walletClient: WalletClient; - order: Partial<MerchantContractTerms>; + order: TalerMerchantApi.Order; instance?: string; }, auth: WithAuthorization = {}, diff --git a/packages/taler-harness/src/index.ts b/packages/taler-harness/src/index.ts index 315173b7f..99b5502d8 100644 --- a/packages/taler-harness/src/index.ts +++ b/packages/taler-harness/src/index.ts @@ -900,6 +900,9 @@ deploymentCli currency, summary: "Pay me!", }, + editable_defaults: { + amount: currency, + }, }, ); if (resp.type === "fail") { @@ -915,9 +918,6 @@ deploymentCli templateURI = stringifyPayTemplateUri({ merchantBaseUrl: instanceURL, templateId: "default", - templateParams: { - amount: currency, - }, }); } diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts index 89f285ae2..85bd96034 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-merchant.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { AmountString, MerchantApiClient } from "@gnu-taler/taler-util"; +import { AmountString, TalerMerchantApi } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; @@ -75,7 +75,7 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { }); await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -100,12 +100,12 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { walletClient, bankClient, exchange, - amount: "TESTKUDOS:20" as AmountString, + amount: "TESTKUDOS:20", restrictAge: 13, }); await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -131,7 +131,7 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { }); await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -155,7 +155,7 @@ export async function runAgeRestrictionsMerchantTest(t: GlobalTestState) { }); await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts index 898c7b3f7..e822b15d8 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-mixed-merchant.ts @@ -17,6 +17,7 @@ /** * Imports. */ +import { AmountString, TalerMerchantApi } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; @@ -26,7 +27,6 @@ import { makeTestPaymentV2, withdrawViaBankV3, } from "../harness/helpers.js"; -import { AmountString } from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal and payment. @@ -92,7 +92,6 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { restrictAge: 13, }); - await wres.withdrawalFinishedCond; const order = { @@ -110,13 +109,12 @@ export async function runAgeRestrictionsMixedMerchantTest(t: GlobalTestState) { walletClient: walletThree, bankClient, exchange, - amount: "TESTKUDOS:20" as AmountString, + amount: "TESTKUDOS:20", }); - await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts index b10ecac24..c9faa586a 100644 --- a/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts +++ b/packages/taler-harness/src/integrationtests/test-age-restrictions-peer.ts @@ -22,7 +22,6 @@ import { AmountString, Duration, NotificationType, - TalerUriAction, TransactionMajorState, TransactionMinorState, TransactionType, diff --git a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts index adab764ef..c104edc85 100644 --- a/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts +++ b/packages/taler-harness/src/integrationtests/test-clause-schnorr.ts @@ -17,6 +17,7 @@ /** * Imports. */ +import { TalerMerchantApi } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { GlobalTestState } from "../harness/harness.js"; @@ -67,7 +68,7 @@ export async function runClauseSchnorrTest(t: GlobalTestState) { }); await wres.withdrawalFinishedCond; - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -78,7 +79,7 @@ export async function runClauseSchnorrTest(t: GlobalTestState) { // Test JSON normalization of contract terms: Does the wallet // agree with the merchant? - const order2 = { + const order2: TalerMerchantApi.Order = { summary: "Testing “unicode” characters", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -89,7 +90,7 @@ export async function runClauseSchnorrTest(t: GlobalTestState) { // Test JSON normalization of contract terms: Does the wallet // agree with the merchant? - const order3 = { + const order3: TalerMerchantApi.Order = { summary: "Testing\nNewlines\rAnd\tStuff\nHere\b", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts index 9581f9876..8042c0817 100644 --- a/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts +++ b/packages/taler-harness/src/integrationtests/test-denom-unoffered.ts @@ -21,6 +21,7 @@ import { MerchantApiClient, PreparePayResultType, TalerErrorCode, + TalerMerchantApi, TransactionType, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -62,7 +63,7 @@ export async function runDenomUnofferedTest(t: GlobalTestState) { await merchant.start(); await merchant.pingUntilAvailable(); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-fee-regression.ts b/packages/taler-harness/src/integrationtests/test-fee-regression.ts index 14eb3d147..6ae7b5de8 100644 --- a/packages/taler-harness/src/integrationtests/test-fee-regression.ts +++ b/packages/taler-harness/src/integrationtests/test-fee-regression.ts @@ -17,9 +17,13 @@ /** * Imports. */ +import { + TalerCorebankApiClient, + TalerMerchantApi, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { - BankService, + BankService, ExchangeService, GlobalTestState, MerchantService, @@ -32,7 +36,6 @@ import { makeTestPaymentV2, withdrawViaBankV3, } from "../harness/helpers.js"; -import { TalerCorebankApiClient } from "@gnu-taler/taler-util"; /** * Run a test case with a simple TESTKUDOS Taler environment, consisting @@ -72,7 +75,10 @@ export async function createMyTestkudosEnvironment( await exchange.addBankAccount("1", { accountName: exchangeBankUsername, accountPassword: exchangeBankPassword, - wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + wireGatewayApiBaseUrl: new URL( + "accounts/exchange/taler-wire-gateway/", + bank.baseUrl, + ).href, accountPaytoUri: exchangePaytoUri, }); @@ -184,10 +190,10 @@ export async function createMyTestkudosEnvironment( walletService, bankClient, exchangeBankAccount: { - accountName: '', - accountPassword: '', - accountPaytoUri: '', - wireGatewayApiBaseUrl: '', + accountName: "", + accountPassword: "", + accountPaytoUri: "", + wireGatewayApiBaseUrl: "", }, }; } @@ -217,7 +223,7 @@ export async function runFeeRegressionTest(t: GlobalTestState) { // Make sure we really withdraw one 0.64 and one 1.28 coin. t.assertTrue(coins.coins.length === 2); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:1.30", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-multiexchange.ts b/packages/taler-harness/src/integrationtests/test-multiexchange.ts index 86fe0fb5f..b5cf0770f 100644 --- a/packages/taler-harness/src/integrationtests/test-multiexchange.ts +++ b/packages/taler-harness/src/integrationtests/test-multiexchange.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { Duration } from "@gnu-taler/taler-util"; +import { Duration, TalerMerchantApi } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { @@ -157,7 +157,7 @@ export async function runMultiExchangeTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:10", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-payment-expired.ts b/packages/taler-harness/src/integrationtests/test-payment-expired.ts index 73da165d8..3f1f7f2dd 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-expired.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-expired.ts @@ -22,8 +22,8 @@ import { ConfirmPayResultType, Duration, MerchantApiClient, - MerchantContractTerms, PreparePayResultType, + TalerMerchantApi, j2s, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; @@ -64,7 +64,7 @@ export async function runPaymentExpiredTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); // Order that can only be paid within five minutes. - const order: Partial<MerchantContractTerms> = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-payment-fault.ts b/packages/taler-harness/src/integrationtests/test-payment-fault.ts index abb589477..dabe42a6b 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-fault.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-fault.ts @@ -21,7 +21,11 @@ /** * Imports. */ -import { ConfirmPayResultType, MerchantApiClient, TalerCorebankApiClient } from "@gnu-taler/taler-util"; +import { + ConfirmPayResultType, + MerchantApiClient, + TalerCorebankApiClient, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { defaultCoinConfig } from "../harness/denomStructures.js"; import { @@ -30,7 +34,7 @@ import { FaultInjectionResponseContext, } from "../harness/faultInjection.js"; import { - BankService, + BankService, ExchangeService, GlobalTestState, MerchantService, @@ -72,7 +76,10 @@ export async function runPaymentFaultTest(t: GlobalTestState) { await exchange.addBankAccount("1", { accountName: exchangeBankUsername, accountPassword: exchangeBankPassword, - wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + wireGatewayApiBaseUrl: new URL( + "accounts/exchange/taler-wire-gateway/", + bank.baseUrl, + ).href, accountPaytoUri: exchangePaytoUri, }); @@ -82,10 +89,7 @@ export async function runPaymentFaultTest(t: GlobalTestState) { config.setString("exchange", "base_url", "http://localhost:8091/"); }); - bank.setSuggestedExchange( - faultyExchange, - exchangePaytoUri, - ); + bank.setSuggestedExchange(faultyExchange, exchangePaytoUri); await bank.start(); diff --git a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts index e47cfe7cd..827c299a4 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-forgettable.ts @@ -24,6 +24,7 @@ import { makeTestPaymentV2, withdrawViaBankV3, } from "../harness/helpers.js"; +import { TalerMerchantApi } from "@gnu-taler/taler-util"; /** * Run test for payment with a contract that has forgettable fields. @@ -46,7 +47,7 @@ export async function runPaymentForgettableTest(t: GlobalTestState) { await wres.withdrawalFinishedCond; { - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", @@ -64,7 +65,7 @@ export async function runPaymentForgettableTest(t: GlobalTestState) { console.log("testing with forgettable field without hash"); { - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-payment-share.ts b/packages/taler-harness/src/integrationtests/test-payment-share.ts index 90d4a6fbb..25cfb50c6 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-share.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-share.ts @@ -18,6 +18,7 @@ * Imports. */ import { + AmountString, ConfirmPayResultType, MerchantApiClient, NotificationType, @@ -80,7 +81,7 @@ export async function runPaymentShareTest(t: GlobalTestState) { async function createOrder(amount: string) { const order = { summary: "Buy me!", - amount, + amount: amount as AmountString, fulfillment_url: "taler://fulfillment-success/thx", }; diff --git a/packages/taler-harness/src/integrationtests/test-payment-template.ts b/packages/taler-harness/src/integrationtests/test-payment-template.ts index 96e4de119..fb69f2571 100644 --- a/packages/taler-harness/src/integrationtests/test-payment-template.ts +++ b/packages/taler-harness/src/integrationtests/test-payment-template.ts @@ -18,6 +18,7 @@ * Imports. */ import { + AmountString, ConfirmPayResultType, Duration, MerchantApiClient, @@ -54,6 +55,9 @@ export async function runPaymentTemplateTest(t: GlobalTestState) { ), summary: "hello, I'm a summary", }, + editable_defaults: { + amount: "TESTKUDOS:1" as AmountString, + }, }); narrowOpSuccessOrThrow("createTemplate", createTemplateRes); @@ -72,7 +76,7 @@ export async function runPaymentTemplateTest(t: GlobalTestState) { const preparePayResult = await walletClient.call( WalletApiOperation.PreparePayForTemplate, { - talerPayTemplateUri: `taler+http://pay-template/localhost:${merchant.port}/template1?amount=TESTKUDOS:1`, + talerPayTemplateUri: `taler+http://pay-template/localhost:${merchant.port}/template1`, templateParams: {}, }, ); diff --git a/packages/taler-harness/src/integrationtests/test-payment.ts b/packages/taler-harness/src/integrationtests/test-payment.ts index 6037c3be2..5da6d608d 100644 --- a/packages/taler-harness/src/integrationtests/test-payment.ts +++ b/packages/taler-harness/src/integrationtests/test-payment.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { j2s } from "@gnu-taler/taler-util"; +import { TalerMerchantApi, j2s } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { @@ -51,7 +51,7 @@ export async function runPaymentTest(t: GlobalTestState) { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); @@ -62,7 +62,7 @@ export async function runPaymentTest(t: GlobalTestState) { summary: "Testing “unicode” characters: 😁😱😇🥺🫦", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order: order2 }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); @@ -73,7 +73,7 @@ export async function runPaymentTest(t: GlobalTestState) { summary: "Testing\nNewlines\rAnd\tStuff\nHere\b", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order: order3 }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); diff --git a/packages/taler-harness/src/integrationtests/test-revocation.ts b/packages/taler-harness/src/integrationtests/test-revocation.ts index e0f77a445..65aa86f98 100644 --- a/packages/taler-harness/src/integrationtests/test-revocation.ts +++ b/packages/taler-harness/src/integrationtests/test-revocation.ts @@ -17,27 +17,29 @@ /** * Imports. */ +import { + TalerCorebankApiClient, + TalerMerchantApi, +} from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig } from "../harness/denomStructures.js"; import { - GlobalTestState, + BankService, ExchangeService, + GlobalTestState, MerchantService, WalletCli, - setupDb, + WalletClient, delayMs, generateRandomPayto, - WalletClient, - BankService, + setupDb, } from "../harness/harness.js"; import { - SimpleTestEnvironmentNg, SimpleTestEnvironmentNg3, createWalletDaemonWithClient, makeTestPaymentV2, withdrawViaBankV3, } from "../harness/helpers.js"; -import { TalerCorebankApiClient } from "@gnu-taler/taler-util"; async function revokeAllWalletCoins(req: { walletClient: WalletClient; @@ -96,7 +98,10 @@ async function createTestEnvironment( await exchange.addBankAccount("1", { accountName: exchangeBankUsername, accountPassword: exchangeBankPassword, - wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + wireGatewayApiBaseUrl: new URL( + "accounts/exchange/taler-wire-gateway/", + bank.baseUrl, + ).href, accountPaytoUri: exchangePaytoUri, }); @@ -176,10 +181,10 @@ async function createTestEnvironment( walletService, bankClient, exchangeBankAccount: { - accountName: '', - accountPassword: '', - accountPaytoUri: '', - wireGatewayApiBaseUrl: '', + accountName: "", + accountPassword: "", + accountPaytoUri: "", + wireGatewayApiBaseUrl: "", }, }; } @@ -219,7 +224,7 @@ export async function runRevocationTest(t: GlobalTestState) { summary: "Buy me!", amount: "TESTKUDOS:10", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order }); diff --git a/packages/taler-harness/src/integrationtests/test-simple-payment.ts b/packages/taler-harness/src/integrationtests/test-simple-payment.ts index 58ab61435..846b8c8e1 100644 --- a/packages/taler-harness/src/integrationtests/test-simple-payment.ts +++ b/packages/taler-harness/src/integrationtests/test-simple-payment.ts @@ -24,6 +24,7 @@ import { makeTestPaymentV2, useSharedTestkudosEnvironment, } from "../harness/helpers.js"; +import { TalerMerchantApi } from "@gnu-taler/taler-util"; /** * Run test for basic, bank-integrated withdrawal and payment. @@ -49,7 +50,7 @@ export async function runSimplePaymentTest(t: GlobalTestState) { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); diff --git a/packages/taler-harness/src/integrationtests/test-stored-backups.ts b/packages/taler-harness/src/integrationtests/test-stored-backups.ts index a3a5e6ca3..732ac0aed 100644 --- a/packages/taler-harness/src/integrationtests/test-stored-backups.ts +++ b/packages/taler-harness/src/integrationtests/test-stored-backups.ts @@ -24,6 +24,7 @@ import { makeTestPaymentV2, useSharedTestkudosEnvironment, } from "../harness/helpers.js"; +import { TalerMerchantApi } from "@gnu-taler/taler-util"; /** * Test stored backup wallet-core API. @@ -62,7 +63,7 @@ export async function runStoredBackupsTest(t: GlobalTestState) { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", - }; + } satisfies TalerMerchantApi.Order; await makeTestPaymentV2(t, { walletClient, merchant, order }); await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); diff --git a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts index 365d9495e..c37a6e482 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-balance.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-balance.ts @@ -23,6 +23,7 @@ import { MerchantApiClient, MerchantContractTerms, PreparePayResultType, + TalerMerchantApi, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; @@ -71,7 +72,7 @@ export async function runWalletBalanceTest(t: GlobalTestState) { console.log("withdrawal finished"); - const order: Partial<MerchantContractTerms> = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts b/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts index 0c0180181..778f36432 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-gendb.ts @@ -17,22 +17,22 @@ /** * Imports. */ -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { GlobalTestState } from "../harness/harness.js"; -import { - createSimpleTestkudosEnvironmentV3, - withdrawViaBankV3, - makeTestPaymentV2, -} from "../harness/helpers.js"; import { AbsoluteTime, AmountString, Duration, NotificationType, + TalerMerchantApi, TransactionMajorState, TransactionMinorState, - j2s, } from "@gnu-taler/taler-util"; +import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; +import { GlobalTestState } from "../harness/harness.js"; +import { + createSimpleTestkudosEnvironmentV3, + makeTestPaymentV2, + withdrawViaBankV3, +} from "../harness/helpers.js"; /** * Test that creates various transactions and exports the resulting @@ -56,7 +56,7 @@ export async function runWalletGenDbTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:10", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts index fbf6fe8b6..93fe94270 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-refresh.ts @@ -20,6 +20,7 @@ import { AmountString, NotificationType, + TalerMerchantApi, TransactionIdStr, TransactionMajorState, TransactionType, @@ -56,7 +57,7 @@ export async function runWalletRefreshTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts b/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts index 3be4088cc..c5a0fd363 100644 --- a/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts +++ b/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts @@ -20,15 +20,15 @@ import { Duration, MerchantApiClient, - MerchantContractTerms, PreparePayResultType, TalerCorebankApiClient, + TalerMerchantApi, TransactionMajorState, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js"; import { - BankService, + BankService, ExchangeService, GlobalTestState, MerchantService, @@ -79,7 +79,10 @@ export async function runWalletWirefeesTest(t: GlobalTestState) { await exchange.addBankAccount("1", { accountName: exchangeBankUsername, accountPassword: exchangeBankPassword, - wireGatewayApiBaseUrl: new URL("accounts/exchange/taler-wire-gateway/", bank.baseUrl).href, + wireGatewayApiBaseUrl: new URL( + "accounts/exchange/taler-wire-gateway/", + bank.baseUrl, + ).href, accountPaytoUri: exchangePaytoUri, }); @@ -151,13 +154,13 @@ export async function runWalletWirefeesTest(t: GlobalTestState) { await walletClient.call(WalletApiOperation.TestingWaitTransactionsFinal, {}); - const order = { + const order: TalerMerchantApi.Order = { summary: "Buy me!", amount: "TESTKUDOS:1", fulfillment_url: "taler://fulfillment-success/thx", //max_wire_fee: "TESTKUDOS:0.1", max_fee: "TESTKUDOS:0.1", - } satisfies Partial<MerchantContractTerms>; + }; const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl()); diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts index 5ae53b69d..b87e67a68 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-abort-bank.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { TalerCorebankApiClient, TalerErrorCode } from "@gnu-taler/taler-util"; +import { TalerErrorCode } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; import { createSimpleTestkudosEnvironmentV3 } from "../harness/helpers.js"; diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts index fffc6def6..a13095883 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-bank-integrated.ts @@ -18,13 +18,12 @@ * Imports. */ import { - TalerCorebankApiClient, - j2s, NotificationType, TransactionMajorState, TransactionMinorState, TransactionType, WithdrawalType, + j2s, } from "@gnu-taler/taler-util"; import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; import { GlobalTestState } from "../harness/harness.js"; diff --git a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts index a0757e357..615feafa7 100644 --- a/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts +++ b/packages/taler-harness/src/integrationtests/test-withdrawal-conversion.ts @@ -101,7 +101,7 @@ async function runTestfakeConversionService(): Promise<TestfakeConversionService cashout_ratio: "1", cashout_rounding_mode: "zero", cashout_tiny_amount: "A:1" as AmountString, - } + }, } satisfies TalerBankConversionApi.IntegrationConfig), ); } else if (path === "/cashin-rate") { |