diff options
author | Florian Dold <florian@dold.me> | 2023-04-06 12:47:34 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-04-06 12:47:34 +0200 |
commit | 43ae414a55b84b1125c5e4377c6d485ca6c748e2 (patch) | |
tree | 3e2f9ffc272406aa25327f19b9006d020f070658 /packages/taler-wallet-webextension/src/wallet | |
parent | 3cf6d15eae299576eada8b501e5848ef29dad03c (diff) | |
download | wallet-core-43ae414a55b84b1125c5e4377c6d485ca6c748e2.tar.xz |
-re-add missing fields, fix types
Diffstat (limited to 'packages/taler-wallet-webextension/src/wallet')
3 files changed, 29 insertions, 16 deletions
diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts index b744b80e5..42a3ba847 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/state.ts @@ -151,7 +151,7 @@ export function useComponentState({ // eslint-disable-next-line react-hooks/rules-of-hooks const hook = useAsyncAsHook(async () => { - const fee = await api.wallet.call(WalletApiOperation.GetFeeForDeposit, { + const fee = await api.wallet.call(WalletApiOperation.PrepareDeposit, { amount: amountStr, depositPaytoUri, }); @@ -181,7 +181,7 @@ export function useComponentState({ const totalFee = fee !== undefined - ? Amounts.sum([fee.wire, fee.coin, fee.refresh]).amount + ? Amounts.sum([fee.fees.wire, fee.fees.coin, fee.fees.refresh]).amount : Amounts.zeroOfCurrency(currency); const totalToDeposit = diff --git a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts index 1489e2bb9..a06b1ae75 100644 --- a/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts +++ b/packages/taler-wallet-webextension/src/wallet/DepositPage/test.ts @@ -23,6 +23,7 @@ import { Amounts, DepositGroupFees, parsePaytoUri, + PrepareDepositResponse, ScopeType, stringifyPaytoUri, } from "@gnu-taler/taler-util"; @@ -36,16 +37,24 @@ import { useComponentState } from "./state.js"; const currency = "EUR"; const amount = `${currency}:0`; -const withoutFee = (): DepositGroupFees => ({ - coin: Amounts.stringify(`${currency}:0`), - wire: Amounts.stringify(`${currency}:0`), - refresh: Amounts.stringify(`${currency}:0`), +const withoutFee = (): PrepareDepositResponse => ({ + effectiveDepositAmount: `${currency}:5`, + totalDepositCost: `${currency}:5`, + fees: { + coin: Amounts.stringify(`${currency}:0`), + wire: Amounts.stringify(`${currency}:0`), + refresh: Amounts.stringify(`${currency}:0`), + }, }); -const withSomeFee = (): DepositGroupFees => ({ - coin: Amounts.stringify(`${currency}:1`), - wire: Amounts.stringify(`${currency}:1`), - refresh: Amounts.stringify(`${currency}:1`), +const withSomeFee = (): PrepareDepositResponse => ({ + effectiveDepositAmount: `${currency}:5`, + totalDepositCost: `${currency}:5`, + fees: { + coin: Amounts.stringify(`${currency}:1`), + wire: Amounts.stringify(`${currency}:1`), + refresh: Amounts.stringify(`${currency}:1`), + }, }); describe("DepositPage states", () => { @@ -182,7 +191,7 @@ describe("DepositPage states", () => { }, ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withoutFee(), ); @@ -241,13 +250,13 @@ describe("DepositPage states", () => { }, ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withoutFee(), ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withoutFee(), ); @@ -330,17 +339,17 @@ describe("DepositPage states", () => { }, ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withoutFee(), ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withSomeFee(), ); handler.addWalletCallResponse( - WalletApiOperation.GetFeeForDeposit, + WalletApiOperation.PrepareDeposit, undefined, withSomeFee(), ); diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx index d338b77f5..bf59573ec 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx @@ -34,6 +34,8 @@ import { TransactionPeerPushDebit, TransactionRefresh, TransactionRefund, + TransactionState, + TransactionSubstate, TransactionTip, TransactionType, TransactionWithdrawal, @@ -68,6 +70,8 @@ const commonTransaction = { transactionId: "txn:deposit:12", frozen: undefined as any as boolean, //deprecated type: TransactionType.Deposit, + txState: TransactionState.Unknown, + txSubstate: TransactionSubstate.None, } as TransactionCommon; import merchantIcon from "../../static-dev/merchant-icon.jpeg"; |