comments
This commit is contained in:
parent
539b161a3f
commit
7523dcab95
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
This file is part of GNU Taler
|
This file is part of GNU Taler
|
||||||
(C) Taler Systems S.A.
|
(C) 2019 Taler Systems S.A.
|
||||||
|
|
||||||
GNU Taler is free software; you can redistribute it and/or modify it under the
|
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
|
terms of the GNU General Public License as published by the Free Software
|
||||||
@ -62,6 +62,11 @@ import { InternalWalletState } from "./state";
|
|||||||
import { getTimestampNow, timestampAddDuration } from "../util/time";
|
import { getTimestampNow, timestampAddDuration } from "../util/time";
|
||||||
import { strcmp, canonicalJson } from "../util/helpers";
|
import { strcmp, canonicalJson } from "../util/helpers";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logger.
|
||||||
|
*/
|
||||||
|
const logger = new Logger("pay.ts");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Result of selecting coins, contains the exchange, and selected
|
* Result of selecting coins, contains the exchange, and selected
|
||||||
* coins with their denomination.
|
* coins with their denomination.
|
||||||
@ -93,17 +98,39 @@ export interface PayCoinSelection {
|
|||||||
customerDepositFees: AmountJson;
|
customerDepositFees: AmountJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Structure to describe a coin that is available to be
|
||||||
|
* used in a payment.
|
||||||
|
*/
|
||||||
export interface AvailableCoinInfo {
|
export interface AvailableCoinInfo {
|
||||||
|
/**
|
||||||
|
* Public key of the coin.
|
||||||
|
*/
|
||||||
coinPub: string;
|
coinPub: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Coin's denomination public key.
|
||||||
|
*/
|
||||||
denomPub: string;
|
denomPub: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Amount still remaining (typically the full amount,
|
||||||
|
* as coins are always refreshed after use.)
|
||||||
|
*/
|
||||||
availableAmount: AmountJson;
|
availableAmount: AmountJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deposit fee for the coin.
|
||||||
|
*/
|
||||||
feeDeposit: AmountJson;
|
feeDeposit: AmountJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
const logger = new Logger("pay.ts");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute the total cost of a payment to the customer.
|
* Compute the total cost of a payment to the customer.
|
||||||
|
*
|
||||||
|
* This includes the amount taken by the merchant, fees (wire/deposit) contributed
|
||||||
|
* by the customer, refreshing fees, fees for withdraw-after-refresh and "trimmings"
|
||||||
|
* of coins that are too small to spend.
|
||||||
*/
|
*/
|
||||||
export async function getTotalPaymentCost(
|
export async function getTotalPaymentCost(
|
||||||
ws: InternalWalletState,
|
ws: InternalWalletState,
|
||||||
@ -147,8 +174,6 @@ export async function getTotalPaymentCost(
|
|||||||
* constraints.
|
* constraints.
|
||||||
*
|
*
|
||||||
* This function is only exported for the sake of unit tests.
|
* This function is only exported for the sake of unit tests.
|
||||||
*
|
|
||||||
* @param denoms all available denoms, used to compute refresh fees
|
|
||||||
*/
|
*/
|
||||||
export function selectPayCoins(
|
export function selectPayCoins(
|
||||||
acis: AvailableCoinInfo[],
|
acis: AvailableCoinInfo[],
|
||||||
|
Loading…
Reference in New Issue
Block a user