summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-03-18 15:32:41 +0100
committerFlorian Dold <florian@dold.me>2022-03-21 19:20:48 +0100
commitf8d12f7b0d4af1b1769b89e80c87f9c169678564 (patch)
tree2478696c7bc1efc6d090b93aa340de542a7dccd9 /packages/taler-wallet-webextension/src
parent32cd54e11d80bde0274b3c0238f8f5bd00ff83cb (diff)
downloadwallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.gz
wallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.tar.bz2
wallet-core-f8d12f7b0d4af1b1769b89e80c87f9c169678564.zip
wallet: t_s/d_us migration
Diffstat (limited to 'packages/taler-wallet-webextension/src')
-rw-r--r--packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx62
-rw-r--r--packages/taler-wallet-webextension/src/components/PendingTransactions.tsx13
-rw-r--r--packages/taler-wallet-webextension/src/components/Time.tsx4
-rw-r--r--packages/taler-wallet-webextension/src/components/TransactionItem.tsx16
-rw-r--r--packages/taler-wallet-webextension/src/cta/Tip.stories.tsx9
-rw-r--r--packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx16
-rw-r--r--packages/taler-wallet-webextension/src/wallet/BackupPage.tsx18
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.stories.tsx7
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.tsx2
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx26
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx5
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx13
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.tsx20
14 files changed, 99 insertions, 114 deletions
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
index 658a41aa8..ea29d4a78 100644
--- a/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
+++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.stories.tsx
@@ -22,7 +22,11 @@
import { PendingTransactionsView as TestedComponent } from "./PendingTransactions";
import { Fragment, h, VNode } from "preact";
import { createExample } from "../test-utils";
-import { Transaction, TransactionType } from "@gnu-taler/taler-util";
+import {
+ TalerProtocolTimestamp,
+ Transaction,
+ TransactionType,
+} from "@gnu-taler/taler-util";
export default {
title: "component/PendingTransactions",
@@ -34,9 +38,7 @@ export const OnePendingTransaction = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
@@ -46,23 +48,17 @@ export const ThreePendingTransactions = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
@@ -72,72 +68,52 @@ export const TenPendingTransactions = createExample(TestedComponent, {
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1)
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
{
amountEffective: "USD:10",
type: TransactionType.Withdrawal,
- timestamp: {
- t_ms: 1,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(1),
} as Transaction,
],
});
diff --git a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
index eed31beb4..7923eb6ad 100644
--- a/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
+++ b/packages/taler-wallet-webextension/src/components/PendingTransactions.tsx
@@ -1,4 +1,9 @@
-import { Amounts, NotificationType, Transaction } from "@gnu-taler/taler-util";
+import {
+ AbsoluteTime,
+ Amounts,
+ NotificationType,
+ Transaction,
+} from "@gnu-taler/taler-util";
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
import { Fragment, h, JSX } from "preact";
import { useAsyncAsHook } from "../hooks/useAsyncAsHook";
@@ -70,7 +75,11 @@ export function PendingTransactionsView({
<b>
{amount.currency} {Amounts.stringifyValue(amount)}
</b>{" "}
- - <Time timestamp={t.timestamp} format="dd MMMM yyyy" />
+ -{" "}
+ <Time
+ timestamp={AbsoluteTime.fromTimestamp(t.timestamp)}
+ format="dd MMMM yyyy"
+ />
</Typography>
),
};
diff --git a/packages/taler-wallet-webextension/src/components/Time.tsx b/packages/taler-wallet-webextension/src/components/Time.tsx
index 452b08334..902187aa3 100644
--- a/packages/taler-wallet-webextension/src/components/Time.tsx
+++ b/packages/taler-wallet-webextension/src/components/Time.tsx
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Timestamp } from "@gnu-taler/taler-util";
+import { AbsoluteTime } from "@gnu-taler/taler-util";
import { formatISO, format } from "date-fns";
import { h, VNode } from "preact";
@@ -22,7 +22,7 @@ export function Time({
timestamp,
format: formatString,
}: {
- timestamp: Timestamp | undefined;
+ timestamp: AbsoluteTime | undefined;
format: string;
}): VNode {
return (
diff --git a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
index 12ed4139b..d7eae7bb6 100644
--- a/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
+++ b/packages/taler-wallet-webextension/src/components/TransactionItem.tsx
@@ -18,7 +18,7 @@ import {
AmountJson,
Amounts,
AmountString,
- Timestamp,
+ AbsoluteTime,
Transaction,
TransactionType,
} from "@gnu-taler/taler-util";
@@ -46,7 +46,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.exchangeBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"W"}
pending={tx.pending}
/>
@@ -59,7 +59,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
debitCreditIndicator={"debit"}
title={tx.info.merchant.name}
subtitle={tx.info.summary}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"P"}
pending={tx.pending}
/>
@@ -72,7 +72,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
debitCreditIndicator={"credit"}
subtitle={tx.info.summary}
title={tx.info.merchant.name}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"R"}
pending={tx.pending}
/>
@@ -84,7 +84,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.merchantBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"T"}
pending={tx.pending}
/>
@@ -96,7 +96,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"credit"}
title={new URL(tx.exchangeBaseUrl).hostname}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"R"}
pending={tx.pending}
/>
@@ -108,7 +108,7 @@ export function TransactionItem(props: { tx: Transaction }): VNode {
amount={tx.amountEffective}
debitCreditIndicator={"debit"}
title={tx.targetPaytoUri}
- timestamp={tx.timestamp}
+ timestamp={AbsoluteTime.fromTimestamp(tx.timestamp)}
iconPath={"D"}
pending={tx.pending}
/>
@@ -165,7 +165,7 @@ function TransactionLayout(props: TransactionLayoutProps): VNode {
interface TransactionLayoutProps {
debitCreditIndicator: "debit" | "credit" | "unknown";
amount: AmountString | "unknown";
- timestamp: Timestamp;
+ timestamp: AbsoluteTime;
title: string;
subtitle?: string;
id: string;
diff --git a/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx b/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
index 8da599513..e475a9610 100644
--- a/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
+++ b/packages/taler-wallet-webextension/src/cta/Tip.stories.tsx
@@ -19,6 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { AbsoluteTime, TalerProtocolTimestamp } from "@gnu-taler/taler-util";
import { createExample } from "../test-utils";
import { View as TestedComponent } from "./Tip";
@@ -33,9 +34,7 @@ export const Accepted = createExample(TestedComponent, {
accepted: true,
merchantBaseUrl: "",
exchangeBaseUrl: "",
- expirationTimestamp: {
- t_ms: 0,
- },
+ expirationTimestamp: TalerProtocolTimestamp.fromSeconds(1),
tipAmountEffective: "USD:10",
tipAmountRaw: "USD:5",
walletTipId: "id",
@@ -47,9 +46,7 @@ export const NotYetAccepted = createExample(TestedComponent, {
accepted: false,
merchantBaseUrl: "http://merchant.url/",
exchangeBaseUrl: "http://exchange.url/",
- expirationTimestamp: {
- t_ms: 0,
- },
+ expirationTimestamp: TalerProtocolTimestamp.fromSeconds(1),
tipAmountEffective: "USD:10",
tipAmountRaw: "USD:5",
walletTipId: "id",
diff --git a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
index 738ece2f1..3deea032d 100644
--- a/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
+++ b/packages/taler-wallet-webextension/src/popup/DeveloperPage.tsx
@@ -20,7 +20,7 @@ import {
CoinDumpJson,
ExchangeListItem,
NotificationType,
- Timestamp,
+ AbsoluteTime,
Translate,
} from "@gnu-taler/taler-util";
import { PendingTaskInfo } from "@gnu-taler/taler-wallet-core";
diff --git a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
index b2771bc2a..92536db85 100644
--- a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
@@ -23,6 +23,7 @@ import { ProviderPaymentType } from "@gnu-taler/taler-wallet-core";
import { addDays } from "date-fns";
import { BackupView as TestedComponent } from "./BackupPage";
import { createExample } from "../test-utils";
+import { TalerProtocolTimestamp } from "@gnu-taler/taler-util";
export default {
title: "wallet/backup/list",
@@ -40,9 +41,8 @@ export const LotOfProviders = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925),
paymentProposalIds: [
"43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG",
],
@@ -62,9 +62,8 @@ export const LotOfProviders = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925),
paymentProposalIds: [
"43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG",
],
@@ -172,9 +171,8 @@ export const OneProvider = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.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 e1d34748b..8c12201b9 100644
--- a/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/BackupPage.tsx
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-import { Timestamp, Translate } from "@gnu-taler/taler-util";
+import { AbsoluteTime, Translate } from "@gnu-taler/taler-util";
import {
ProviderInfo,
ProviderPaymentPaid,
@@ -104,7 +104,13 @@ export function BackupView({
<BackupLayout
key={idx}
status={provider.paymentStatus}
- timestamp={provider.lastSuccessfulBackupTimestamp}
+ timestamp={
+ provider.lastSuccessfulBackupTimestamp
+ ? AbsoluteTime.fromTimestamp(
+ provider.lastSuccessfulBackupTimestamp,
+ )
+ : undefined
+ }
id={provider.syncProviderBaseUrl}
active={provider.active}
title={provider.name}
@@ -144,7 +150,7 @@ export function BackupView({
interface TransactionLayoutProps {
status: ProviderPaymentStatus;
- timestamp?: Timestamp;
+ timestamp?: AbsoluteTime;
title: string;
id: string;
active: boolean;
@@ -192,7 +198,7 @@ function BackupLayout(props: TransactionLayoutProps): VNode {
);
}
-function ExpirationText({ until }: { until: Timestamp }): VNode {
+function ExpirationText({ until }: { until: AbsoluteTime }): VNode {
const { i18n } = useTranslationContext();
return (
<Fragment>
@@ -207,13 +213,13 @@ function ExpirationText({ until }: { until: Timestamp }): VNode {
);
}
-function colorByTimeToExpire(d: Timestamp): string {
+function colorByTimeToExpire(d: AbsoluteTime): string {
if (d.t_ms === "never") return "rgb(28, 184, 65)";
const months = differenceInMonths(d.t_ms, new Date());
return months > 1 ? "rgb(28, 184, 65)" : "rgb(223, 117, 20)";
}
-function daysUntil(d: Timestamp): string {
+function daysUntil(d: AbsoluteTime): string {
if (d.t_ms === "never") return "";
const duration = intervalToDuration({
start: d.t_ms,
diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
index bd52995d9..8138e63dd 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
@@ -21,6 +21,7 @@
import {
PaymentStatus,
+ TalerProtocolTimestamp,
TransactionCommon,
TransactionDeposit,
TransactionPayment,
@@ -45,9 +46,9 @@ const commonTransaction = () =>
amountRaw: "USD:10",
amountEffective: "USD:9",
pending: false,
- timestamp: {
- t_ms: new Date().getTime() - count++ * 1000 * 60 * 60 * 7,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(
+ new Date().getTime() - count++ * 60 * 60 * 7,
+ ),
transactionId: "12",
} as TransactionCommon);
diff --git a/packages/taler-wallet-webextension/src/wallet/History.tsx b/packages/taler-wallet-webextension/src/wallet/History.tsx
index 02fc0a76c..5d00e2e01 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.tsx
@@ -126,7 +126,7 @@ export function HistoryView({
.filter((t) => t.amountRaw.split(":")[0] === selectedCurrency)
.reduce((rv, x) => {
const theDate =
- x.timestamp.t_ms === "never" ? 0 : normalizeToDay(x.timestamp.t_ms);
+ x.timestamp.t_s === "never" ? 0 : normalizeToDay(x.timestamp.t_s * 1000);
if (theDate) {
(rv[theDate] = rv[theDate] || []).push(x);
}
diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
index a170620a3..c4c070fa8 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
@@ -19,6 +19,7 @@
* @author Sebastian Javier Marchano (sebasjm)
*/
+import { TalerProtocolTimestamp } from "@gnu-taler/taler-util";
import { ProviderPaymentType } from "@gnu-taler/taler-wallet-core";
import { createExample } from "../test-utils";
import { ProviderView as TestedComponent } from "./ProviderDetailPage";
@@ -38,9 +39,8 @@ export const Active = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925),
paymentProposalIds: [
"43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG",
],
@@ -63,12 +63,10 @@ export const ActiveErrorSync = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
- lastAttemptedBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925),
+ lastAttemptedBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925078),
paymentProposalIds: [
"43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG",
],
@@ -97,9 +95,8 @@ export const ActiveBackupProblemUnreadable = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.fromSeconds(1625063925),
paymentProposalIds: [
"43Q5WWRJPNS4SE9YKS54H9THDS94089EDGXW9EHBPN6E7M184XEG",
],
@@ -125,9 +122,8 @@ export const ActiveBackupProblemDevice = createExample(TestedComponent, {
active: true,
name: "sync.demo",
syncProviderBaseUrl: "http://sync.taler:9967/",
- lastSuccessfulBackupTimestamp: {
- t_ms: 1625063925078,
- },
+ lastSuccessfulBackupTimestamp:
+ TalerProtocolTimestamp.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 765f34a02..afd9612ee 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetailPage.tsx
@@ -15,6 +15,7 @@
*/
import * as utils from "@gnu-taler/taler-util";
+import { AbsoluteTime } from "@gnu-taler/taler-util";
import {
ProviderInfo,
ProviderPaymentStatus,
@@ -122,7 +123,9 @@ export function ProviderView({
</Fragment>
);
}
- const lb = info.lastSuccessfulBackupTimestamp;
+ const lb = info.lastSuccessfulBackupTimestamp
+ ? AbsoluteTime.fromTimestamp(info.lastSuccessfulBackupTimestamp)
+ : undefined;
const isPaid =
info.paymentStatus.type === ProviderPaymentType.Paid ||
info.paymentStatus.type === ProviderPaymentType.TermsChanged;
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
index 7b6ac1fdc..f02938420 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
@@ -21,6 +21,7 @@
import {
PaymentStatus,
+ TalerProtocolTimestamp,
TransactionCommon,
TransactionDeposit,
TransactionPayment,
@@ -53,9 +54,7 @@ const commonTransaction = {
amountRaw: "KUDOS:11",
amountEffective: "KUDOS:9.2",
pending: false,
- timestamp: {
- t_ms: new Date().getTime(),
- },
+ timestamp: TalerProtocolTimestamp.now(),
transactionId: "12",
} as TransactionCommon;
@@ -144,18 +143,14 @@ export const Withdraw = createExample(TestedComponent, {
export const WithdrawOneMinuteAgo = createExample(TestedComponent, {
transaction: {
...exampleData.withdraw,
- timestamp: {
- t_ms: new Date().getTime() - 60 * 1000,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(new Date().getTime() - 60),
},
});
export const WithdrawOneMinuteAgoAndPending = createExample(TestedComponent, {
transaction: {
...exampleData.withdraw,
- timestamp: {
- t_ms: new Date().getTime() - 60 * 1000,
- },
+ timestamp: TalerProtocolTimestamp.fromSeconds(new Date().getTime() - 60),
pending: true,
},
});
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index b367416fa..0e58aaf61 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -15,6 +15,7 @@
*/
import {
+ AbsoluteTime,
AmountLike,
Amounts,
NotificationType,
@@ -137,9 +138,9 @@ export function TransactionView({
}): VNode {
const showRetry =
transaction.error !== undefined ||
- transaction.timestamp.t_ms === "never" ||
+ transaction.timestamp.t_s === "never" ||
(transaction.pending &&
- differenceInSeconds(new Date(), transaction.timestamp.t_ms) > 10);
+ differenceInSeconds(new Date(), transaction.timestamp.t_s * 1000) > 10);
return (
<Fragment>
@@ -218,7 +219,7 @@ export function TransactionView({
<h2>
<i18n.Translate>Withdrawal</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)} format="dd MMMM yyyy, HH:mm" />
{transaction.pending ? (
transaction.withdrawalDetails.type ===
WithdrawalType.ManualTransfer ? (
@@ -342,7 +343,7 @@ export function TransactionView({
<h2>
<i18n.Translate>Payment</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)} format="dd MMMM yyyy, HH:mm" />
<br />
<Part
big
@@ -425,7 +426,7 @@ export function TransactionView({
<h2>
<i18n.Translate>Deposit</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)} format="dd MMMM yyyy, HH:mm" />
<br />
<Part
big
@@ -459,7 +460,7 @@ export function TransactionView({
<h2>
<i18n.Translate>Refresh</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)} format="dd MMMM yyyy, HH:mm" />
<br />
<Part
big
@@ -493,7 +494,7 @@ export function TransactionView({
<h2>
<i18n.Translate>Tip</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)} format="dd MMMM yyyy, HH:mm" />
<br />
<Part
big
@@ -527,7 +528,10 @@ export function TransactionView({
<h2>
<i18n.Translate>Refund</i18n.Translate>
</h2>
- <Time timestamp={transaction.timestamp} format="dd MMMM yyyy, HH:mm" />
+ <Time
+ timestamp={AbsoluteTime.fromTimestamp(transaction.timestamp)}
+ format="dd MMMM yyyy, HH:mm"
+ />
<br />
<Part
big