wallet-core: use PeerContractTerms
This commit is contained in:
parent
2f6225f6e7
commit
dab739a63e
@ -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()))
|
||||
|
@ -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;
|
||||
|
@ -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 = {},
|
||||
|
@ -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[];
|
||||
|
@ -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",
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
|
@ -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(
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user