aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/wallet
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
-rw-r--r--packages/taler-wallet-webextension/src/wallet/AddBackupProvider/stories.tsx5
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Application.tsx7
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx23
-rw-r--r--packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts39
-rw-r--r--packages/taler-wallet-webextension/src/wallet/History.stories.tsx147
-rw-r--r--packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx23
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx57
-rw-r--r--packages/taler-wallet-webextension/src/wallet/Transaction.tsx3
8 files changed, 156 insertions, 148 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/stories.tsx b/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/stories.tsx
index 736de11f4..7ac92c6c9 100644
--- a/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/AddBackupProvider/stories.tsx
@@ -21,6 +21,7 @@
import * as tests from "@gnu-taler/web-util/testing";
import { ConfirmProviderView, SelectProviderView } from "./views.js";
+import { AmountString } from "@gnu-taler/taler-util";
export default {
title: "add backup provider",
@@ -29,7 +30,7 @@ export default {
export const DemoService = tests.createExample(ConfirmProviderView, {
url: "https://sync.demo.taler.net/",
provider: {
- annual_fee: "KUDOS:0.1",
+ annual_fee: "KUDOS:0.1" as AmountString,
storage_limit_in_megabytes: 20,
version: "1",
},
@@ -43,7 +44,7 @@ export const DemoService = tests.createExample(ConfirmProviderView, {
export const FreeService = tests.createExample(ConfirmProviderView, {
url: "https://sync.taler:9667/",
provider: {
- annual_fee: "ARS:0",
+ annual_fee: "ARS:0" as AmountString,
storage_limit_in_megabytes: 20,
version: "1",
},
diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx
index 18291a25a..4c4ba1855 100644
--- a/packages/taler-wallet-webextension/src/wallet/Application.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx
@@ -21,6 +21,7 @@
*/
import {
+ Amounts,
TalerUri,
TranslatedString,
stringifyTalerUri,
@@ -426,7 +427,7 @@ export function Application(): VNode {
}) => (
<CallToActionTemplate title={i18n.str`Digital cash deposit`}>
<DepositPageCTA
- amountStr={amount}
+ amountStr={Amounts.stringify(Amounts.parseOrThrow(amount))}
talerDepositUri={decodeURIComponent(talerUri)}
cancel={() => redirectTo(Pages.balance)}
onSuccess={(tid: string) =>
@@ -441,7 +442,7 @@ export function Application(): VNode {
component={({ amount }: { amount: string }) => (
<CallToActionTemplate title={i18n.str`Digital cash invoice`}>
<InvoiceCreatePage
- amount={amount}
+ amount={Amounts.stringify(Amounts.parseOrThrow(amount))}
onClose={() => redirectTo(Pages.balance)}
onSuccess={(tid: string) =>
redirectTo(Pages.balanceTransaction({ tid }))
@@ -455,7 +456,7 @@ export function Application(): VNode {
component={({ amount }: { amount: string }) => (
<CallToActionTemplate title={i18n.str`Digital cash transfer`}>
<TransferCreatePage
- amount={amount}
+ amount={Amounts.stringify(Amounts.parseOrThrow(amount))}
onClose={() => redirectTo(Pages.balance)}
onSuccess={(tid: string) =>
redirectTo(Pages.balanceTransaction({ tid }))
diff --git a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
index 59bcd5ce9..ae160a30c 100644
--- a/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Backup.stories.tsx
@@ -28,6 +28,7 @@ import {
import * as tests from "@gnu-taler/web-util/testing";
import {
AbsoluteTime,
+ AmountString,
TalerPreciseTimestamp,
TalerProtocolTimestamp,
} from "@gnu-taler/taler-util";
@@ -52,7 +53,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
paidUntil: AbsoluteTime.fromMilliseconds(1656599921000),
},
terms: {
- annualFee: "ARS:1",
+ annualFee: "ARS:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -73,7 +74,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
),
},
terms: {
- annualFee: "ARS:1",
+ annualFee: "ARS:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -88,7 +89,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
talerUri: "taler://",
},
terms: {
- annualFee: "KUDOS:0.1",
+ annualFee: "KUDOS:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -100,10 +101,10 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
paymentProposalIds: [],
paymentStatus: {
type: ProviderPaymentType.InsufficientBalance,
- amount: "KUDOS:10",
+ amount: "KUDOS:10" as AmountString,
},
terms: {
- annualFee: "KUDOS:0.1",
+ annualFee: "KUDOS:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -116,19 +117,19 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
paymentStatus: {
type: ProviderPaymentType.TermsChanged,
newTerms: {
- annualFee: "USD:2",
+ annualFee: "USD:2" as AmountString,
storageLimitInMegabytes: 8,
supportedProtocolVersion: "2",
},
oldTerms: {
- annualFee: "USD:1",
+ annualFee: "USD:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "1",
},
paidUntil: AbsoluteTime.never(),
},
terms: {
- annualFee: "KUDOS:0.1",
+ annualFee: "KUDOS:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -142,7 +143,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
type: ProviderPaymentType.Unpaid,
},
terms: {
- annualFee: "KUDOS:0.1",
+ annualFee: "KUDOS:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -156,7 +157,7 @@ export const LotOfProviders = tests.createExample(TestedComponent, {
type: ProviderPaymentType.Unpaid,
},
terms: {
- annualFee: "KUDOS:0.1",
+ annualFee: "KUDOS:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -180,7 +181,7 @@ export const OneProvider = tests.createExample(TestedComponent, {
paidUntil: AbsoluteTime.fromMilliseconds(1656599921000),
},
terms: {
- annualFee: "ARS:1",
+ annualFee: "ARS:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
index 4d09d2549..5384fe4c5 100644
--- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
+++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts
@@ -21,6 +21,7 @@
import {
Amounts,
+ AmountString,
DepositGroupFees,
parsePaytoUri,
PrepareDepositResponse,
@@ -38,8 +39,8 @@ import { useComponentState } from "./state.js";
const currency = "EUR";
const amount = `${currency}:0`;
const withoutFee = (): PrepareDepositResponse => ({
- effectiveDepositAmount: `${currency}:5`,
- totalDepositCost: `${currency}:5`,
+ effectiveDepositAmount: `${currency}:5` as AmountString,
+ totalDepositCost: `${currency}:5` as AmountString,
fees: {
coin: Amounts.stringify(`${currency}:0`),
wire: Amounts.stringify(`${currency}:0`),
@@ -48,8 +49,8 @@ const withoutFee = (): PrepareDepositResponse => ({
});
const withSomeFee = (): PrepareDepositResponse => ({
- effectiveDepositAmount: `${currency}:5`,
- totalDepositCost: `${currency}:5`,
+ effectiveDepositAmount: `${currency}:5` as AmountString,
+ totalDepositCost: `${currency}:5` as AmountString,
fees: {
coin: Amounts.stringify(`${currency}:1`),
wire: Amounts.stringify(`${currency}:1`),
@@ -65,10 +66,10 @@ describe("DepositPage states", () => {
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
{
- available: `${currency}:0`,
+ available: `${currency}:0` as AmountString,
hasPendingTransactions: false,
- pendingIncoming: `${currency}:0`,
- pendingOutgoing: `${currency}:0`,
+ pendingIncoming: `${currency}:0` as AmountString,
+ pendingOutgoing: `${currency}:0` as AmountString,
requiresUserInput: false,
scopeInfo: {
currency,
@@ -111,10 +112,10 @@ describe("DepositPage states", () => {
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
{
- available: `${currency}:1`,
+ available: `${currency}:1` as AmountString,
hasPendingTransactions: false,
- pendingIncoming: `${currency}:0`,
- pendingOutgoing: `${currency}:0`,
+ pendingIncoming: `${currency}:0` as AmountString,
+ pendingOutgoing: `${currency}:0` as AmountString,
requiresUserInput: false,
scopeInfo: {
currency,
@@ -170,10 +171,10 @@ describe("DepositPage states", () => {
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
{
- available: `${currency}:1`,
+ available: `${currency}:1` as AmountString,
hasPendingTransactions: false,
- pendingIncoming: `${currency}:0`,
- pendingOutgoing: `${currency}:0`,
+ pendingIncoming: `${currency}:0` as AmountString,
+ pendingOutgoing: `${currency}:0` as AmountString,
requiresUserInput: false,
scopeInfo: {
currency,
@@ -229,10 +230,10 @@ describe("DepositPage states", () => {
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
{
- available: `${currency}:5`,
+ available: `${currency}:5` as AmountString,
hasPendingTransactions: false,
- pendingIncoming: `${currency}:0`,
- pendingOutgoing: `${currency}:0`,
+ pendingIncoming: `${currency}:0` as AmountString,
+ pendingOutgoing: `${currency}:0` as AmountString,
requiresUserInput: false,
scopeInfo: {
currency,
@@ -318,10 +319,10 @@ describe("DepositPage states", () => {
handler.addWalletCallResponse(WalletApiOperation.GetBalances, undefined, {
balances: [
{
- available: `${currency}:10`,
+ available: `${currency}:10` as AmountString,
hasPendingTransactions: false,
- pendingIncoming: `${currency}:0`,
- pendingOutgoing: `${currency}:0`,
+ pendingIncoming: `${currency}:0` as AmountString,
+ pendingOutgoing: `${currency}:0` as AmountString,
requiresUserInput: false,
scopeInfo: {
currency,
diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
index 1ddb24b02..9bf39b8ae 100644
--- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx
@@ -20,6 +20,7 @@
*/
import {
+ AmountString,
PaymentStatus,
RefreshReason,
ScopeType,
@@ -49,17 +50,17 @@ export default {
let count = 0;
const commonTransaction = (): TransactionCommon =>
- ({
- amountRaw: "USD:10",
- amountEffective: "USD:9",
- txState: {
- major: TransactionMajorState.Done,
- },
- timestamp: TalerProtocolTimestamp.fromSeconds(
- new Date().getTime() / 1000 - count++ * 60 * 60 * 7,
- ),
- transactionId: String(count),
- } as TransactionCommon);
+({
+ amountRaw: "USD:10",
+ amountEffective: "USD:9",
+ txState: {
+ major: TransactionMajorState.Done,
+ },
+ timestamp: TalerProtocolTimestamp.fromSeconds(
+ new Date().getTime() / 1000 - count++ * 60 * 60 * 7,
+ ),
+ transactionId: String(count),
+} as TransactionCommon);
const exampleData = {
withdraw: {
@@ -76,7 +77,7 @@ const exampleData = {
} as TransactionWithdrawal,
payment: {
...commonTransaction(),
- amountEffective: "USD:11",
+ amountEffective: "USD:11" as AmountString,
type: TransactionType.Payment,
posConfirmation: undefined,
info: {
@@ -91,8 +92,8 @@ const exampleData = {
},
refunds: [],
refundPending: undefined,
- totalRefundEffective: "USD:0",
- totalRefundRaw: "USD:0",
+ totalRefundEffective: "USD:0" as AmountString,
+ totalRefundRaw: "USD:0" as AmountString,
proposalId: "1EMJJH8EP1NX3XF7733NCYS2DBEJW4Q2KA5KEB37MCQJQ8Q5HMC0",
status: PaymentStatus.Accepted,
refundQueryActive: false,
@@ -106,8 +107,8 @@ const exampleData = {
refresh: {
...commonTransaction(),
type: TransactionType.Refresh,
- refreshInputAmount: "USD:1",
- refreshOutputAmount: "USD:0.5",
+ refreshInputAmount: "USD:1" as AmountString,
+ refreshOutputAmount: "USD:0.5" as AmountString,
exchangeBaseUrl: "http://exchange.taler",
refreshReason: RefreshReason.PayMerchant,
} as TransactionRefresh,
@@ -178,9 +179,9 @@ export const SomeBalanceWithNoTransactions = tests.createExample(
transactions: [],
balances: [
{
- available: "TESTKUDOS:10",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "TESTKUDOS:10" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -197,9 +198,9 @@ export const OneSimpleTransaction = tests.createExample(TestedComponent, {
transactions: [exampleData.withdraw],
balances: [
{
- available: "USD:10",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:10" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -217,9 +218,9 @@ export const TwoTransactionsAndZeroBalance = tests.createExample(
transactions: [exampleData.withdraw, exampleData.deposit],
balances: [
{
- available: "USD:0",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:0" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -243,9 +244,9 @@ export const OneTransactionPending = tests.createExample(TestedComponent, {
],
balances: [
{
- available: "USD:10",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:10" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -277,9 +278,9 @@ export const SomeTransactions = tests.createExample(TestedComponent, {
],
balances: [
{
- available: "USD:10",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:10" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -370,9 +371,9 @@ export const SomeTransactionsInDifferentStates = tests.createExample(
],
balances: [
{
- available: "USD:10",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:10" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -400,9 +401,9 @@ export const SomeTransactionsWithTwoCurrencies = tests.createExample(
],
balances: [
{
- available: "USD:0",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:0" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -412,9 +413,9 @@ export const SomeTransactionsWithTwoCurrencies = tests.createExample(
},
},
{
- available: "TESTKUDOS:10",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "TESTKUDOS:10" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -431,9 +432,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, {
transactions: [exampleData.withdraw],
balances: [
{
- available: "USD:1000",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:1000" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -443,9 +444,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, {
},
},
{
- available: "EUR:881",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "EUR:881" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -455,9 +456,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, {
},
},
{
- available: "COL:4043000.5",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "COL:4043000.5" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -467,9 +468,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, {
},
},
{
- available: "JPY:11564450.6",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "JPY:11564450.6" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -479,9 +480,9 @@ export const FiveOfficialCurrencies = tests.createExample(TestedComponent, {
},
},
{
- available: "GBP:736",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "GBP:736" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -499,9 +500,9 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample(
transactions: [exampleData.withdraw],
balances: [
{
- available: "USD:881001321230000",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:881001321230000" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -511,9 +512,9 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample(
},
},
{
- available: "EUR:10",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "EUR:10" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -523,9 +524,9 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample(
},
},
{
- available: "COL:443000123123000.5123123",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "COL:443000123123000.5123123" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
scopeInfo: {
currency: "Ásd",
@@ -535,9 +536,9 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample(
requiresUserInput: false,
},
{
- available: "JPY:1564450000000.6123123",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "JPY:1564450000000.6123123" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -547,9 +548,9 @@ export const FiveOfficialCurrenciesWithHighValue = tests.createExample(
},
},
{
- available: "GBP:736001231231200.23123",
- pendingIncoming: "TESTKUDOS:0",
- pendingOutgoing: "TESTKUDOS:0",
+ available: "GBP:736001231231200.23123" as AmountString,
+ pendingIncoming: "TESTKUDOS:0" as AmountString,
+ pendingOutgoing: "TESTKUDOS:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
@@ -571,9 +572,9 @@ export const PeerToPeer = tests.createExample(TestedComponent, {
],
balances: [
{
- available: "USD:10",
- pendingIncoming: "USD:0",
- pendingOutgoing: "USD:0",
+ available: "USD:10" as AmountString,
+ pendingIncoming: "USD:0" as AmountString,
+ pendingOutgoing: "USD:0" as AmountString,
hasPendingTransactions: false,
requiresUserInput: false,
scopeInfo: {
diff --git a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
index fbaa0b0ea..f81a86b9d 100644
--- a/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/ProviderDetail.stories.tsx
@@ -21,6 +21,7 @@
import {
AbsoluteTime,
+ AmountString,
TalerPreciseTimestamp,
TalerProtocolTimestamp,
} from "@gnu-taler/taler-util";
@@ -53,7 +54,7 @@ export const Active = tests.createExample(TestedComponent, {
paidUntil: AbsoluteTime.fromMilliseconds(1656599921000),
},
terms: {
- annualFee: "EUR:1",
+ annualFee: "EUR:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -84,7 +85,7 @@ export const ActiveErrorSync = tests.createExample(TestedComponent, {
message: "message",
},
terms: {
- annualFee: "EUR:1",
+ annualFee: "EUR:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -111,7 +112,7 @@ export const ActiveBackupProblemUnreadable = tests.createExample(
type: "backup-unreadable",
},
terms: {
- annualFee: "EUR:1",
+ annualFee: "EUR:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -140,7 +141,7 @@ export const ActiveBackupProblemDevice = tests.createExample(TestedComponent, {
backupTimestamp: AbsoluteTime.fromMilliseconds(1656599921000),
},
terms: {
- annualFee: "EUR:1",
+ annualFee: "EUR:1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -157,7 +158,7 @@ export const InactiveUnpaid = tests.createExample(TestedComponent, {
type: ProviderPaymentType.Unpaid,
},
terms: {
- annualFee: "EUR:0.1",
+ annualFee: "EUR:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -174,10 +175,10 @@ export const InactiveInsufficientBalance = tests.createExample(
paymentProposalIds: [],
paymentStatus: {
type: ProviderPaymentType.InsufficientBalance,
- amount: "EUR:123",
+ amount: "EUR:123" as AmountString,
},
terms: {
- annualFee: "EUR:0.1",
+ annualFee: "EUR:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -196,7 +197,7 @@ export const InactivePending = tests.createExample(TestedComponent, {
talerUri: "taler://pay/sad",
},
terms: {
- annualFee: "EUR:0.1",
+ annualFee: "EUR:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
@@ -213,18 +214,18 @@ export const ActiveTermsChanged = tests.createExample(TestedComponent, {
type: ProviderPaymentType.TermsChanged,
paidUntil: AbsoluteTime.fromMilliseconds(1656599921000),
newTerms: {
- annualFee: "EUR:10",
+ annualFee: "EUR:10" as AmountString,
storageLimitInMegabytes: 8,
supportedProtocolVersion: "0.0",
},
oldTerms: {
- annualFee: "EUR:0.1",
+ annualFee: "EUR:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
},
terms: {
- annualFee: "EUR:0.1",
+ annualFee: "EUR:0.1" as AmountString,
storageLimitInMegabytes: 16,
supportedProtocolVersion: "0.0",
},
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx
index f1ae84ed3..09f7c4dc1 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 {
AbsoluteTime,
+ AmountString,
PaymentStatus,
RefreshReason,
TalerPreciseTimestamp,
@@ -60,8 +61,8 @@ export default {
const commonTransaction: TransactionCommon = {
error: undefined,
- amountRaw: "KUDOS:11",
- amountEffective: "KUDOS:9.2",
+ amountRaw: "KUDOS:11" as AmountString,
+ amountEffective: "KUDOS:9.2" as AmountString,
txState: {
major: TransactionMajorState.Done,
},
@@ -91,7 +92,7 @@ const exampleData = {
} as TransactionWithdrawal,
payment: {
...commonTransaction,
- amountEffective: "KUDOS:12",
+ amountEffective: "KUDOS:12" as AmountString,
type: TransactionType.Payment,
posConfirmation: undefined,
info: {
@@ -113,8 +114,8 @@ const exampleData = {
},
refunds: [],
refundPending: undefined,
- totalRefundEffective: "KUDOS:0",
- totalRefundRaw: "KUDOS:0",
+ totalRefundEffective: "KUDOS:0" as AmountString,
+ totalRefundRaw: "KUDOS:0" as AmountString,
proposalId: "1EMJJH8EP1NX3XF7733NCYS2DBEJW4Q2KA5KEB37MCQJQ8Q5HMC0",
status: PaymentStatus.Accepted,
refundQueryActive: false,
@@ -131,8 +132,8 @@ const exampleData = {
refresh: {
...commonTransaction,
type: TransactionType.Refresh,
- refreshInputAmount: "KUDOS:1",
- refreshOutputAmount: "KUDOS:0.5",
+ refreshInputAmount: "KUDOS:1" as AmountString,
+ refreshOutputAmount: "KUDOS:0.5" as AmountString,
exchangeBaseUrl: "http://exchange.taler",
refreshReason: RefreshReason.Manual,
} as TransactionRefresh,
@@ -358,14 +359,14 @@ export const PaymentError = tests.createExample(TestedComponent, {
export const PaymentWithRefund = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
- totalRefundEffective: "KUDOS:1",
- totalRefundRaw: "KUDOS:1",
+ amountRaw: "KUDOS:12" as AmountString,
+ totalRefundEffective: "KUDOS:1" as AmountString,
+ totalRefundRaw: "KUDOS:1" as AmountString,
refunds: [
{
transactionId: "1123123",
- amountRaw: "KUDOS:1",
- amountEffective: "KUDOS:1",
+ amountRaw: "KUDOS:1" as AmountString,
+ amountEffective: "KUDOS:1" as AmountString,
timestamp: TalerProtocolTimestamp.fromSeconds(1546546544),
},
],
@@ -375,7 +376,7 @@ export const PaymentWithRefund = tests.createExample(TestedComponent, {
export const PaymentWithDeliveryDate = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
+ amountRaw: "KUDOS:12" as AmountString,
info: {
...exampleData.payment.info,
// delivery_date: {
@@ -388,7 +389,7 @@ export const PaymentWithDeliveryDate = tests.createExample(TestedComponent, {
export const PaymentWithDeliveryAddr = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
+ amountRaw: "KUDOS:12" as AmountString,
info: {
...exampleData.payment.info,
// delivery_location: {
@@ -404,7 +405,7 @@ export const PaymentWithDeliveryAddr = tests.createExample(TestedComponent, {
export const PaymentWithDeliveryFull = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
+ amountRaw: "KUDOS:12" as AmountString,
info: {
...exampleData.payment.info,
// delivery_date: {
@@ -423,35 +424,35 @@ export const PaymentWithDeliveryFull = tests.createExample(TestedComponent, {
export const PaymentWithRefundPending = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
- refundPending: "KUDOS:3",
- totalRefundEffective: "KUDOS:1",
- totalRefundRaw: "KUDOS:1",
+ amountRaw: "KUDOS:12" as AmountString,
+ refundPending: "KUDOS:3" as AmountString,
+ totalRefundEffective: "KUDOS:1" as AmountString,
+ totalRefundRaw: "KUDOS:1" as AmountString,
},
});
export const PaymentWithFeeAndRefund = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:11",
- totalRefundEffective: "KUDOS:1",
- totalRefundRaw: "KUDOS:1",
+ amountRaw: "KUDOS:11" as AmountString,
+ totalRefundEffective: "KUDOS:1" as AmountString,
+ totalRefundRaw: "KUDOS:1" as AmountString,
},
});
export const PaymentWithFeeAndRefundFee = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:11",
- totalRefundEffective: "KUDOS:1",
- totalRefundRaw: "KUDOS:2",
+ amountRaw: "KUDOS:11" as AmountString,
+ totalRefundEffective: "KUDOS:1" as AmountString,
+ totalRefundRaw: "KUDOS:2" as AmountString,
},
});
export const PaymentWithoutFee = tests.createExample(TestedComponent, {
transaction: {
...exampleData.payment,
- amountRaw: "KUDOS:12",
+ amountRaw: "KUDOS:12" as AmountString,
},
});
@@ -537,8 +538,8 @@ export const DepositTalerBank = tests.createExample(TestedComponent, {
export const DepositBitcoin = tests.createExample(TestedComponent, {
transaction: {
...exampleData.deposit,
- amountRaw: "BITCOINBTC:0.0000011",
- amountEffective: "BITCOINBTC:0.00000092",
+ amountRaw: "BITCOINBTC:0.0000011" as AmountString,
+ amountEffective: "BITCOINBTC:0.00000092" as AmountString,
targetPaytoUri:
"payto://bitcoin/bcrt1q6ps8qs6v8tkqrnru4xqqqa6rfwcx5ufpdfqht4?amount=BTC:0.1&subject=0ZSX8SH0M30KHX8K3Y1DAMVGDQV82XEF9DG1HC4QMQ3QWYT4AF00",
},
diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
index 3b76558ce..422695367 100644
--- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
+++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx
@@ -18,6 +18,7 @@ import {
AbsoluteTime,
AmountJson,
Amounts,
+ AmountString,
Location,
MerchantInfo,
NotificationType,
@@ -1655,7 +1656,7 @@ function RefundDetails({ amount }: { amount: AmountWithFee }): VNode {
type AmountAmountByWireTransferByWire = {
id: string;
- amount: string;
+ amount: AmountString;
}[];
function calculateAmountByWireTransfer(