aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src/operations
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-wallet-core/src/operations
parentcb44202440313ea4405fbc74f4588144134a0821 (diff)
downloadwallet-core-610df1c9cf8ec91815130ac2a426f8f5b7d1ed0c.tar.xz
create a fee description timeline for global fee and wire fees
Diffstat (limited to 'packages/taler-wallet-core/src/operations')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts14
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts15
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts19
3 files changed, 44 insertions, 4 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index f611a2380..a3c4c8d99 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -345,7 +345,19 @@ export async function exportBackup(
stamp_expire: x.stamp_expire,
stamp_start: x.stamp_start,
})),
- global_fees: ex.globalFees,
+ global_fees: ex.globalFees.map((x) => ({
+ accountFee: Amounts.stringify(x.accountFee),
+ historyFee: Amounts.stringify(x.historyFee),
+ kycFee: Amounts.stringify(x.kycFee),
+ purseFee: Amounts.stringify(x.purseFee),
+ kycTimeout: x.kycTimeout,
+ endDate: x.endDate,
+ historyTimeout: x.historyTimeout,
+ signature: x.signature,
+ purseLimit: x.purseLimit,
+ purseTimeout: x.purseTimeout,
+ startDate: x.startDate,
+ })),
tos_accepted_etag: ex.termsOfServiceAcceptedEtag,
tos_accepted_timestamp: ex.termsOfServiceAcceptedTimestamp,
denominations:
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index ee8cb6f6c..e631845f6 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -405,7 +405,20 @@ export async function importBackup(
masterPublicKey: backupExchangeDetails.master_public_key,
protocolVersion: backupExchangeDetails.protocol_version,
reserveClosingDelay: backupExchangeDetails.reserve_closing_delay,
- globalFees: backupExchangeDetails.global_fees,
+ globalFees: backupExchangeDetails.global_fees.map((x) => ({
+ accountFee: Amounts.parseOrThrow(x.accountFee),
+ historyFee: Amounts.parseOrThrow(x.historyFee),
+ kycFee: Amounts.parseOrThrow(x.kycFee),
+ purseFee: Amounts.parseOrThrow(x.purseFee),
+ kycTimeout: x.kycTimeout,
+ endDate: x.endDate,
+ historyTimeout: x.historyTimeout,
+ signature: x.signature,
+ purseLimit: x.purseLimit,
+ purseTimeout: x.purseTimeout,
+ startDate: x.startDate,
+ })),
+
signingKeys: backupExchangeDetails.signing_keys.map((x) => ({
key: x.key,
master_sig: x.master_sig,
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index a26c14fcc..3da16e303 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -30,6 +30,7 @@ import {
encodeCrock,
ExchangeAuditor,
ExchangeDenomination,
+ ExchangeGlobalFees,
ExchangeSignKeyJson,
ExchangeWireJson,
GlobalFees,
@@ -274,7 +275,8 @@ async function validateGlobalFees(
ws: InternalWalletState,
fees: GlobalFees[],
masterPub: string,
-): Promise<GlobalFees[]> {
+): Promise<ExchangeGlobalFees[]> {
+ const egf: ExchangeGlobalFees[] = [];
for (const gf of fees) {
logger.trace("validating exchange global fees");
let isValid = false;
@@ -291,9 +293,22 @@ async function validateGlobalFees(
if (!isValid) {
throw Error("exchange global fees signature invalid: " + gf.master_sig);
}
+ egf.push({
+ accountFee: Amounts.parseOrThrow(gf.account_fee),
+ historyFee: Amounts.parseOrThrow(gf.history_fee),
+ purseFee: Amounts.parseOrThrow(gf.purse_fee),
+ kycFee: Amounts.parseOrThrow(gf.kyc_fee),
+ startDate: gf.start_date,
+ endDate: gf.end_date,
+ signature: gf.master_sig,
+ historyTimeout: gf.history_expiration,
+ kycTimeout: gf.account_kyc_timeout,
+ purseLimit: gf.purse_account_limit,
+ purseTimeout: gf.purse_timeout,
+ });
}
- return fees;
+ return egf;
}
export interface ExchangeInfo {