diff options
Diffstat (limited to 'packages')
10 files changed, 29 insertions, 33 deletions
diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts index e6223ca76..134f59836 100644 --- a/packages/taler-util/src/taler-types.ts +++ b/packages/taler-util/src/taler-types.ts @@ -413,8 +413,9 @@ export interface InternationalizedString { /** * Contract terms from a merchant. + * FIXME: Add type field! */ -export interface ContractTerms { +export interface MerchantContractTerms { /** * Hash of the merchant's wire details. */ @@ -1310,8 +1311,8 @@ export const codecForProduct = (): Codec<Product> => .property("price", codecOptional(codecForString())) .build("Tax"); -export const codecForContractTerms = (): Codec<ContractTerms> => - buildCodecForObject<ContractTerms>() +export const codecForContractTerms = (): Codec<MerchantContractTerms> => + buildCodecForObject<MerchantContractTerms>() .property("order_id", codecForString()) .property("fulfillment_url", codecOptional(codecForString())) .property("fulfillment_message", codecOptional(codecForString())) diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index 614610bb1..fc69fd9cb 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -55,7 +55,7 @@ import { AuditorDenomSig, codecForContractTerms, CoinEnvelope, - ContractTerms, + MerchantContractTerms, DenominationPubKey, DenomKeyType, ExchangeAuditor, @@ -229,7 +229,7 @@ export enum ConfirmPayResultType { */ export interface ConfirmPayResultDone { type: ConfirmPayResultType.Done; - contractTerms: ContractTerms; + contractTerms: MerchantContractTerms; transactionId: string; } @@ -529,7 +529,7 @@ export type PreparePayResult = export interface PreparePayResultPaymentPossible { status: PreparePayResultType.PaymentPossible; proposalId: string; - contractTerms: ContractTerms; + contractTerms: MerchantContractTerms; contractTermsHash: string; amountRaw: string; amountEffective: string; @@ -539,14 +539,14 @@ export interface PreparePayResultPaymentPossible { export interface PreparePayResultInsufficientBalance { status: PreparePayResultType.InsufficientBalance; proposalId: string; - contractTerms: ContractTerms; + contractTerms: MerchantContractTerms; amountRaw: string; noncePriv: string; } export interface PreparePayResultAlreadyConfirmed { status: PreparePayResultType.AlreadyConfirmed; - contractTerms: ContractTerms; + contractTerms: MerchantContractTerms; paid: boolean; amountRaw: string; amountEffective: string; diff --git a/packages/taler-wallet-cli/src/harness/helpers.ts b/packages/taler-wallet-cli/src/harness/helpers.ts index aa970f76b..affaccd61 100644 --- a/packages/taler-wallet-cli/src/harness/helpers.ts +++ b/packages/taler-wallet-cli/src/harness/helpers.ts @@ -26,7 +26,7 @@ import { AmountString, ConfirmPayResultType, - ContractTerms, + MerchantContractTerms, Duration, PreparePayResultType, } from "@gnu-taler/taler-util"; @@ -381,7 +381,7 @@ export async function makeTestPayment( args: { merchant: MerchantServiceInterface; wallet: WalletCli; - order: Partial<ContractTerms>; + order: Partial<MerchantContractTerms>; instance?: string; }, auth: WithAuthorization = {}, diff --git a/packages/taler-wallet-cli/src/harness/merchantApiTypes.ts b/packages/taler-wallet-cli/src/harness/merchantApiTypes.ts index 8b10bb749..dc9132b3e 100644 --- a/packages/taler-wallet-cli/src/harness/merchantApiTypes.ts +++ b/packages/taler-wallet-cli/src/harness/merchantApiTypes.ts @@ -25,7 +25,7 @@ * Imports. */ import { - ContractTerms, + MerchantContractTerms, Duration, Codec, buildCodecForObject, @@ -50,7 +50,7 @@ import { export interface PostOrderRequest { // The order must at least contain the minimal // order detail, but can override all - order: Partial<ContractTerms>; + order: Partial<MerchantContractTerms>; // if set, the backend will then set the refund deadline to the current // time plus the specified delay. @@ -143,7 +143,7 @@ export interface CheckPaymentClaimedResponse { // Wallet claimed the order, but didn't pay yet. order_status: "claimed"; - contract_terms: ContractTerms; + contract_terms: MerchantContractTerms; } export interface CheckPaymentPaidResponse { @@ -175,7 +175,7 @@ export interface CheckPaymentPaidResponse { refund_amount: AmountString; // Contract terms - contract_terms: ContractTerms; + contract_terms: MerchantContractTerms; // Ihe wire transfer status from the exchange for this order if available, otherwise empty array wire_details: TransactionWireTransfer[]; diff --git a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts index 300967c7a..8002f093f 100644 --- a/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts +++ b/packages/taler-wallet-cli/src/integrationtests/test-libeufin-basic.ts @@ -17,7 +17,7 @@ /** * Imports. */ -import { AbsoluteTime, ContractTerms, Duration } from "@gnu-taler/taler-util"; +import { AbsoluteTime, MerchantContractTerms, Duration } from "@gnu-taler/taler-util"; import { WalletApiOperation, HarnessExchangeBankAccount, @@ -271,7 +271,7 @@ export async function runLibeufinBasicTest(t: GlobalTestState) { console.log("balances", JSON.stringify(bal, undefined, 2)); t.assertAmountEquals(bal.balances[0].available, "EUR:14.7"); - const order: Partial<ContractTerms> = { + const order: Partial<MerchantContractTerms> = { summary: "Buy me!", amount: "EUR:5", fulfillment_url: "taler://fulfillment-success/thx", diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index c3fce6404..3abb76d60 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -25,7 +25,7 @@ import { CoinEnvelope, CoinRefreshRequest, CoinStatus, - ContractTerms, + MerchantContractTerms, DenominationInfo, DenominationPubKey, DenomSelectionState, @@ -1572,7 +1572,7 @@ export interface DepositGroupRecord { /** * Verbatim contract terms. */ - contractTermsRaw: ContractTerms; + contractTermsRaw: MerchantContractTerms; contractTermsHash: string; @@ -1707,10 +1707,9 @@ export interface PeerPullPaymentInitiationRecord { /** * Contract terms for the other party. * - * FIXME: Nail down type! - * FIXME: Put in contractTerms store + * FIXME: Put into contract terms store. */ - contractTerms: any; + contractTerms: PeerContractTerms; } /** diff --git a/packages/taler-wallet-core/src/operations/deposits.ts b/packages/taler-wallet-core/src/operations/deposits.ts index 4d617ee13..b2bd18260 100644 --- a/packages/taler-wallet-core/src/operations/deposits.ts +++ b/packages/taler-wallet-core/src/operations/deposits.ts @@ -24,7 +24,7 @@ import { CancellationToken, canonicalJson, codecForDepositSuccess, - ContractTerms, + MerchantContractTerms, CreateDepositGroupRequest, CreateDepositGroupResponse, DepositGroupFees, @@ -310,7 +310,7 @@ export async function prepareDepositGroup( const now = AbsoluteTime.now(); const nowRounded = AbsoluteTime.toTimestamp(now); - const contractTerms: ContractTerms = { + const contractTerms: MerchantContractTerms = { auditors: [], exchanges: exchangeInfos, amount: req.amount, @@ -407,7 +407,7 @@ export async function createDepositGroup( const merchantPair = await ws.cryptoApi.createEddsaKeypair({}); const wireSalt = encodeCrock(getRandomBytes(16)); const wireHash = hashWire(req.depositPaytoUri, wireSalt); - const contractTerms: ContractTerms = { + const contractTerms: MerchantContractTerms = { auditors: [], exchanges: exchangeInfos, amount: req.amount, diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index b085e3f53..2eb5b18e9 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -44,7 +44,7 @@ import { CoinStatus, ConfirmPayResult, ConfirmPayResultType, - ContractTerms, + MerchantContractTerms, ContractTermsUtil, DenominationInfo, Duration, @@ -298,7 +298,7 @@ export async function expectProposalDownload( } export function extractContractData( - parsedContractTerms: ContractTerms, + parsedContractTerms: MerchantContractTerms, contractTermsHash: string, merchantSig: string, ): WalletContractData { @@ -453,7 +453,7 @@ export async function processDownloadProposal( logger.info(`Contract terms hash: ${contractTermsHash}`); - let parsedContractTerms: ContractTerms; + let parsedContractTerms: MerchantContractTerms; try { parsedContractTerms = codecForContractTerms().decode( diff --git a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx index c499dc285..7d5a7694e 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx @@ -21,8 +21,7 @@ import { Amounts, - ConfirmPayResultType, - ContractTerms, + MerchantContractTerms as ContractTerms, PreparePayResultType, } from "@gnu-taler/taler-util"; import merchantIcon from "../../../static-dev/merchant-icon.jpeg"; diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx index 7646e4bf1..d9b6eaa02 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx @@ -18,17 +18,14 @@ import { AbsoluteTime, AmountJson, Amounts, - ConfirmPayResultType, - ContractTerms, + MerchantContractTerms as ContractTerms, PreparePayResult, - PreparePayResultPaymentPossible, PreparePayResultType, Product, } from "@gnu-taler/taler-util"; import { Fragment, h, VNode } from "preact"; import { useState } from "preact/hooks"; import { Amount } from "../../components/Amount.js"; -import { ErrorTalerOperation } from "../../components/ErrorTalerOperation.js"; import { LoadingError } from "../../components/LoadingError.js"; import { LogoHeader } from "../../components/LogoHeader.js"; import { Part } from "../../components/Part.js"; |