aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2021-06-14 11:45:05 +0200
committerFlorian Dold <florian@dold.me>2021-06-14 11:45:19 +0200
commitcc795f350a8827b97b792e09a031f950e84e426a (patch)
tree937ca8e363a3c07c1cb9ddce9033a5f360b3801e /packages
parent6e11b69cf5beb25fec1dfdff281877a76bf195a4 (diff)
store ToS acceptance timestamp, remove unused backup attributes
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-util/src/backupTypes.ts14
-rw-r--r--packages/taler-wallet-core/src/db.ts9
-rw-r--r--packages/taler-wallet-core/src/operations/backup/export.ts4
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts6
-rw-r--r--packages/taler-wallet-core/src/operations/exchanges.ts1
5 files changed, 18 insertions, 16 deletions
diff --git a/packages/taler-util/src/backupTypes.ts b/packages/taler-util/src/backupTypes.ts
index dc344ee23..97fbcebcc 100644
--- a/packages/taler-util/src/backupTypes.ts
+++ b/packages/taler-util/src/backupTypes.ts
@@ -807,12 +807,6 @@ export interface BackupPurchase {
refunds: BackupRefundItem[];
/**
- * Is the purchase considered defunct (either during payment
- * or during abort if abort_status is set).
- */
- defunct?: boolean;
-
- /**
* Abort status of the payment.
*/
abort_status?: "abort-refund" | "abort-finished";
@@ -1006,8 +1000,6 @@ export interface BackupReserve {
* Groups of withdrawal operations for this reserve. Typically just one.
*/
withdrawal_groups: BackupWithdrawalGroup[];
-
- defective?: boolean;
}
/**
@@ -1179,12 +1171,12 @@ export interface BackupExchangeDetails {
/**
* ETag for last terms of service download.
*/
- tos_etag_last: string | undefined;
+ tos_accepted_etag: string | undefined;
/**
- * ETag for last terms of service download.
+ * Timestamp when the ToS has been accepted.
*/
- tos_etag_accepted: string | undefined;
+ tos_accepted_timestamp: Timestamp | undefined;
}
export enum BackupProposalStatus {
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts
index 349a40427..62b0e2283 100644
--- a/packages/taler-wallet-core/src/db.ts
+++ b/packages/taler-wallet-core/src/db.ts
@@ -570,10 +570,17 @@ export interface ExchangeDetailsRecord {
termsOfServiceLastEtag: string | undefined;
/**
- * ETag for last terms of service download.
+ * ETag for last terms of service accepted.
*/
termsOfServiceAcceptedEtag: string | undefined;
+ /**
+ * Timestamp when the ToS was accepted.
+ *
+ * Used during backup merging.
+ */
+ termsOfServiceAcceptedTimestamp: Timestamp | undefined;
+
wireInfo: WireInfo;
}
diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts
index 8d57ecd80..a62c26d68 100644
--- a/packages/taler-wallet-core/src/operations/backup/export.ts
+++ b/packages/taler-wallet-core/src/operations/backup/export.ts
@@ -311,8 +311,8 @@ export async function exportBackup(
stamp_expire: x.stamp_expire,
stamp_start: x.stamp_start,
})),
- tos_etag_accepted: ex.termsOfServiceAcceptedEtag,
- tos_etag_last: ex.termsOfServiceLastEtag,
+ tos_accepted_etag: ex.termsOfServiceAcceptedEtag,
+ tos_accepted_timestamp: ex.termsOfServiceAcceptedTimestamp,
denominations:
backupDenominationsByExchange[ex.exchangeBaseUrl] ?? [],
reserves: backupReservesByExchange[ex.exchangeBaseUrl] ?? [],
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 146fd5109..b29491948 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -297,9 +297,11 @@ export async function importBackup(
}
await tx.exchangeDetails.put({
exchangeBaseUrl: backupExchangeDetails.base_url,
- termsOfServiceAcceptedEtag: backupExchangeDetails.tos_etag_accepted,
+ termsOfServiceAcceptedEtag: backupExchangeDetails.tos_accepted_etag,
termsOfServiceText: undefined,
- termsOfServiceLastEtag: backupExchangeDetails.tos_etag_last,
+ termsOfServiceLastEtag: undefined,
+ termsOfServiceAcceptedTimestamp:
+ backupExchangeDetails.tos_accepted_timestamp,
wireInfo,
currency: backupExchangeDetails.currency,
auditors: backupExchangeDetails.auditors.map((x) => ({
diff --git a/packages/taler-wallet-core/src/operations/exchanges.ts b/packages/taler-wallet-core/src/operations/exchanges.ts
index ff85372ec..1f9a2ea6a 100644
--- a/packages/taler-wallet-core/src/operations/exchanges.ts
+++ b/packages/taler-wallet-core/src/operations/exchanges.ts
@@ -496,6 +496,7 @@ async function updateExchangeFromUrlImpl(
termsOfServiceText: tosDownload.tosText,
termsOfServiceAcceptedEtag: undefined,
termsOfServiceLastEtag: tosDownload.tosEtag,
+ termsOfServiceAcceptedTimestamp: getTimestampNow(),
};
// FIXME: only update if pointer got updated
r.lastError = undefined;