aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2022-10-12 15:58:10 -0300
committerSebastian <sebasjm@gmail.com>2022-10-12 15:58:10 -0300
commit610df1c9cf8ec91815130ac2a426f8f5b7d1ed0c (patch)
tree826f37de26f433c0842f6e5a793c454b60824fa8 /packages/taler-util
parentcb44202440313ea4405fbc74f4588144134a0821 (diff)
create a fee description timeline for global fee and wire fees
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/backupTypes.ts26
-rw-r--r--packages/taler-util/src/walletTypes.ts54
2 files changed, 56 insertions, 24 deletions
diff --git a/packages/taler-util/src/backupTypes.ts b/packages/taler-util/src/backupTypes.ts
index 8222bdeab..a1506e90f 100644
--- a/packages/taler-util/src/backupTypes.ts
+++ b/packages/taler-util/src/backupTypes.ts
@@ -1091,17 +1091,21 @@ export interface BackupExchangeWireFee {
*
*/
export interface BackupExchangeGlobalFees {
- start_date: TalerProtocolTimestamp;
- end_date: TalerProtocolTimestamp;
- kyc_fee: BackupAmountString;
- history_fee: BackupAmountString;
- account_fee: BackupAmountString;
- purse_fee: BackupAmountString;
- history_expiration: TalerProtocolDuration;
- account_kyc_timeout: TalerProtocolDuration;
- purse_account_limit: number;
- purse_timeout: TalerProtocolDuration;
- master_sig: string;
+ startDate: TalerProtocolTimestamp;
+ endDate: TalerProtocolTimestamp;
+
+ kycFee: BackupAmountString;
+ historyFee: BackupAmountString;
+ accountFee: BackupAmountString;
+ purseFee: BackupAmountString;
+
+ historyTimeout: TalerProtocolDuration;
+ kycTimeout: TalerProtocolDuration;
+ purseTimeout: TalerProtocolDuration;
+
+ purseLimit: number;
+
+ signature: string;
}
/**
* Structure of one exchange signing key in the /keys response.
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts
index bb5d4b3a4..7495e02d6 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -36,6 +36,7 @@ import {
AbsoluteTime,
codecForAbsoluteTime,
codecForTimestamp,
+ TalerProtocolDuration,
TalerProtocolTimestamp,
} from "./time.js";
import {
@@ -673,6 +674,23 @@ export interface WireInfo {
accounts: ExchangeAccount[];
}
+export interface ExchangeGlobalFees {
+ startDate: TalerProtocolTimestamp;
+ endDate: TalerProtocolTimestamp;
+
+ kycFee: AmountJson;
+ historyFee: AmountJson;
+ accountFee: AmountJson;
+ purseFee: AmountJson;
+
+ historyTimeout: TalerProtocolDuration;
+ kycTimeout: TalerProtocolDuration;
+ purseTimeout: TalerProtocolDuration;
+
+ purseLimit: number;
+
+ signature: string;
+}
const codecForExchangeAccount = (): Codec<ExchangeAccount> =>
buildCodecForObject<ExchangeAccount>()
.property("payto_uri", codecForString())
@@ -752,28 +770,31 @@ export interface DenominationInfo {
exchangeBaseUrl: string;
}
-export type Operation = "deposit" | "withdraw" | "refresh" | "refund";
-export type OperationMap<T> = { [op in Operation]: T };
+export type DenomOperation = "deposit" | "withdraw" | "refresh" | "refund";
+export type DenomOperationMap<T> = { [op in DenomOperation]: T };
export interface FeeDescription {
- value: AmountJson;
+ group: string;
from: AbsoluteTime;
until: AbsoluteTime;
fee?: AmountJson;
}
export interface FeeDescriptionPair {
- value: AmountJson;
+ group: string;
from: AbsoluteTime;
until: AbsoluteTime;
left?: AmountJson;
right?: AmountJson;
}
-export interface TimePoint {
+export interface TimePoint<T> {
+ id: string;
+ group: string;
+ fee: AmountJson;
type: "start" | "end";
moment: AbsoluteTime;
- denom: DenominationInfo;
+ denom: T;
}
export interface ExchangeFullDetails {
@@ -783,7 +804,9 @@ export interface ExchangeFullDetails {
tos: ExchangeTos;
auditors: ExchangeAuditor[];
wireInfo: WireInfo;
- feesDescription: OperationMap<FeeDescription[]>;
+ denomFees: DenomOperationMap<FeeDescription[]>;
+ transferFees: Record<string, FeeDescription[]>;
+ globalFees: FeeDescription[];
}
export interface ExchangeListItem {
@@ -816,7 +839,7 @@ const codecForExchangeTos = (): Codec<ExchangeTos> =>
export const codecForFeeDescriptionPair = (): Codec<FeeDescriptionPair> =>
buildCodecForObject<FeeDescriptionPair>()
- .property("value", codecForAmountJson())
+ .property("group", codecForString())
.property("from", codecForAbsoluteTime)
.property("until", codecForAbsoluteTime)
.property("left", codecOptional(codecForAmountJson()))
@@ -825,21 +848,21 @@ export const codecForFeeDescriptionPair = (): Codec<FeeDescriptionPair> =>
export const codecForFeeDescription = (): Codec<FeeDescription> =>
buildCodecForObject<FeeDescription>()
- .property("value", codecForAmountJson())
+ .property("group", codecForString())
.property("from", codecForAbsoluteTime)
.property("until", codecForAbsoluteTime)
.property("fee", codecOptional(codecForAmountJson()))
.build("FeeDescription");
export const codecForFeesByOperations = (): Codec<
- OperationMap<FeeDescription[]>
+ DenomOperationMap<FeeDescription[]>
> =>
- buildCodecForObject<OperationMap<FeeDescription[]>>()
+ buildCodecForObject<DenomOperationMap<FeeDescription[]>>()
.property("deposit", codecForList(codecForFeeDescription()))
.property("withdraw", codecForList(codecForFeeDescription()))
.property("refresh", codecForList(codecForFeeDescription()))
.property("refund", codecForList(codecForFeeDescription()))
- .build("FeesByOperations");
+ .build("DenomOperationMap");
export const codecForExchangeFullDetails = (): Codec<ExchangeFullDetails> =>
buildCodecForObject<ExchangeFullDetails>()
@@ -849,7 +872,12 @@ export const codecForExchangeFullDetails = (): Codec<ExchangeFullDetails> =>
.property("tos", codecForExchangeTos())
.property("auditors", codecForList(codecForExchangeAuditor()))
.property("wireInfo", codecForWireInfo())
- .property("feesDescription", codecForFeesByOperations())
+ .property("denomFees", codecForFeesByOperations())
+ .property(
+ "transferFees",
+ codecForMap(codecForList(codecForFeeDescription())),
+ )
+ .property("globalFees", codecForList(codecForFeeDescription()))
.build("ExchangeFullDetails");
export const codecForExchangeListItem = (): Codec<ExchangeListItem> =>