diff options
author | Florian Dold <florian@dold.me> | 2023-05-26 12:19:32 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-05-26 12:19:32 +0200 |
commit | cd8f76db61f4a1ab1a8a8a4d29b2f3e863b59854 (patch) | |
tree | 423ed7c6fc42ec5e05f655eb093b3b4bdc885996 /packages/taler-wallet-webextension/src/wallet | |
parent | 557dcec30db6573c5d11ca26432008ac6621642e (diff) | |
download | wallet-core-cd8f76db61f4a1ab1a8a8a4d29b2f3e863b59854.tar.xz |
taler-util,wallet-core: implement TalerPreciseTimestamp
Fixes #7703
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
6 files changed, 21 insertions, 19 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx index b927ffbae..ddcba6fae 100644 --- a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx @@ -26,7 +26,7 @@ import { ShowRecoveryInfo, } from "./BackupPage.js"; import * as tests from "@gnu-taler/web-util/testing"; -import { TalerProtocolTimestamp } from "@gnu-taler/taler-util"; +import { TalerPreciseTimestamp, TalerProtocolTimestamp } from "@gnu-taler/taler-util"; export default { title: "backup", @@ -39,7 +39,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], @@ -60,7 +60,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], @@ -171,7 +171,7 @@ export const OneProvider = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], diff --git a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx index 8acfe3ecf..5ae52db6f 100644 --- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx @@ -199,7 +199,7 @@ export function BackupView({ status={provider.paymentStatus} timestamp={ provider.lastSuccessfulBackupTimestamp - ? AbsoluteTime.fromTimestamp( + ? AbsoluteTime.fromPreciseTimestamp( provider.lastSuccessfulBackupTimestamp, ) : undefined diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx index 682f03f39..9c03d18f6 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx @@ -19,7 +19,7 @@ * @author Sebastian Javier Marchano (sebasjm) */ -import { AbsoluteTime, TalerProtocolTimestamp } from "@gnu-taler/taler-util"; +import { AbsoluteTime, TalerPreciseTimestamp, TalerProtocolTimestamp } from "@gnu-taler/taler-util"; import { ProviderPaymentType } from "@gnu-taler/taler-wallet-core"; import * as tests from "@gnu-taler/web-util/testing"; import { ProviderView as TestedComponent } from "./ProviderDetailPage.js"; @@ -40,7 +40,7 @@ export const Active = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], @@ -64,9 +64,9 @@ export const ActiveErrorSync = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), lastAttemptedBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925078), + TalerPreciseTimestamp.fromSeconds(1625063925078), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], @@ -99,7 +99,7 @@ export const ActiveBackupProblemUnreadable = tests.createExample( name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925), + TalerPreciseTimestamp.fromSeconds(1625063925), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], @@ -127,7 +127,7 @@ export const ActiveBackupProblemDevice = tests.createExample(TestedComponent, { name: "sync.demo", syncProviderBaseUrl: "http://sync.taler:9967/", lastSuccessfulBackupTimestamp: - TalerProtocolTimestamp.fromSeconds(1625063925078), + TalerPreciseTimestamp.fromSeconds(1625063925078), paymentProposalIds: [ "43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG", ], diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx index bf7bc0669..19ae39106 100644 --- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx +++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx @@ -151,7 +151,7 @@ export function ProviderView({ }: ViewProps): VNode { const { i18n } = useTranslationContext(); const lb = info.lastSuccessfulBackupTimestamp - ? AbsoluteTime.fromTimestamp(info.lastSuccessfulBackupTimestamp) + ? AbsoluteTime.fromPreciseTimestamp(info.lastSuccessfulBackupTimestamp) : undefined; const isPaid = info.paymentStatus.type === ProviderPaymentType.Paid || diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx index b2a8de014..c2bceb067 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx @@ -23,6 +23,7 @@ import { AbsoluteTime, PaymentStatus, RefreshReason, + TalerPreciseTimestamp, TalerProtocolTimestamp, TransactionCommon, TransactionDeposit, @@ -245,7 +246,7 @@ export const WithdrawFiveMinutesAgo = tests.createExample( () => ({ transaction: { ...exampleData.withdraw, - timestamp: TalerProtocolTimestamp.fromSeconds( + timestamp: TalerPreciseTimestamp.fromSeconds( new Date().getTime() / 1000 - 60 * 5, ), }, @@ -257,7 +258,7 @@ export const WithdrawFiveMinutesAgoAndPending = tests.createExample( () => ({ transaction: { ...exampleData.withdraw, - timestamp: TalerProtocolTimestamp.fromSeconds( + timestamp: TalerPreciseTimestamp.fromSeconds( new Date().getTime() / 1000 - 60 * 5, ), txState: { diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index 9541cc33f..39175186f 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -25,6 +25,7 @@ import { parsePaytoUri, PaytoUri, stringifyPaytoUri, + TalerPreciseTimestamp, TalerProtocolTimestamp, Transaction, TransactionDeposit, @@ -585,7 +586,7 @@ export function TransactionView({ on{" "} { <Time - timestamp={AbsoluteTime.fromTimestamp( + timestamp={AbsoluteTime.fromProtocolTimestamp( r.timestamp, )} format="dd MMMM yyyy" @@ -671,7 +672,7 @@ export function TransactionView({ if (transaction.type === TransactionType.Deposit) { const payto = parsePaytoUri(transaction.targetPaytoUri); - const wireTime = AbsoluteTime.fromTimestamp( + const wireTime = AbsoluteTime.fromProtocolTimestamp( transaction.wireTransferDeadline, ); const shouldBeWired = wireTime.t_ms !== "never" && isPast(wireTime.t_ms); @@ -1204,7 +1205,7 @@ function DeliveryDetails({ </td> <td> <Time - timestamp={AbsoluteTime.fromTimestamp(date)} + timestamp={AbsoluteTime.fromProtocolTimestamp(date)} format="dd MMMM yyyy, HH:mm" /> </td> @@ -1768,7 +1769,7 @@ function Header({ kind, type, }: { - timestamp: TalerProtocolTimestamp; + timestamp: TalerPreciseTimestamp; total: AmountJson; children: ComponentChildren; kind: Kind; @@ -1785,7 +1786,7 @@ function Header({ <div> <SubTitle>{children}</SubTitle> <Time - timestamp={AbsoluteTime.fromTimestamp(timestamp)} + timestamp={AbsoluteTime.fromPreciseTimestamp(timestamp)} format="dd MMMM yyyy, HH:mm" /> </div> |