diff options
author | Sebastian <sebasjm@gmail.com> | 2022-08-10 11:50:46 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-08-10 11:50:46 -0300 |
commit | dce055d0d3fe2037d4c3018baa360b9082e37194 (patch) | |
tree | fd8daa463459b4daa78fe41bb5262d302d03ff7a /packages/taler-wallet-webextension/src/cta/Payment | |
parent | 7a600514c6d43bbaeba6b962533415e59fc46057 (diff) | |
download | wallet-core-dce055d0d3fe2037d4c3018baa360b9082e37194.tar.xz |
withdraw call to action
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment')
4 files changed, 15 insertions, 15 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/index.ts b/packages/taler-wallet-webextension/src/cta/Payment/index.ts index 5c0f6f0d6..2eb41eb17 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/index.ts @@ -28,7 +28,7 @@ import { LoadingUriView, BaseView } from "./views.js"; export interface Props { talerPayUri?: string; goToWalletManualWithdraw: (currency?: string) => Promise<void>; - goBack: () => Promise<void>; + cancel: () => Promise<void>; } export type State = @@ -56,7 +56,7 @@ export namespace State { uri: string; error: undefined; goToWalletManualWithdraw: (currency?: string) => Promise<void>; - goBack: () => Promise<void>; + cancel: () => Promise<void>; } export interface NoBalanceForCurrency extends BaseInfo { status: "no-balance-for-currency" diff --git a/packages/taler-wallet-webextension/src/cta/Payment/state.ts b/packages/taler-wallet-webextension/src/cta/Payment/state.ts index f75cef06f..842bb7ed6 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/state.ts @@ -24,7 +24,7 @@ import * as wxApi from "../../wxApi.js"; import { Props, State } from "./index.js"; export function useComponentState( - { talerPayUri, goBack, goToWalletManualWithdraw }: Props, + { talerPayUri, cancel, goToWalletManualWithdraw }: Props, api: typeof wxApi, ): State { const [payResult, setPayResult] = useState<ConfirmPayResult | undefined>( @@ -82,7 +82,7 @@ export function useComponentState( uri: hook.response.uri, amount, error: undefined, - goBack, goToWalletManualWithdraw + cancel, goToWalletManualWithdraw } if (!foundBalance) { diff --git a/packages/taler-wallet-webextension/src/cta/Payment/test.ts b/packages/taler-wallet-webextension/src/cta/Payment/test.ts index afd881a72..2052927b1 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/test.ts @@ -70,7 +70,7 @@ describe("Payment CTA states", () => { it("should tell the user that the URI is missing", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: undefined, goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: undefined, cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, } as Partial<typeof wxApi> as any), ); @@ -98,7 +98,7 @@ describe("Payment CTA states", () => { it("should response with no balance", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -133,7 +133,7 @@ describe("Payment CTA states", () => { it("should not be able to pay if there is no enough balance", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -172,7 +172,7 @@ describe("Payment CTA states", () => { it("should be able to pay (without fee)", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -214,7 +214,7 @@ describe("Payment CTA states", () => { it("should be able to pay (with fee)", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -256,7 +256,7 @@ describe("Payment CTA states", () => { it("should get confirmation done after pay successfully", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -317,7 +317,7 @@ describe("Payment CTA states", () => { it("should not stay in ready state after pay with error", async () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: nullFunction, preparePay: async () => ({ @@ -393,7 +393,7 @@ describe("Payment CTA states", () => { const { getLastResultOrThrow, waitNextUpdate, assertNoPendingUpdate } = mountHook(() => - useComponentState({ talerPayUri: "taller://pay", goBack: nullFunction, goToWalletManualWithdraw: nullFunction }, { + useComponentState({ talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction }, { onUpdateNotification: subscriptions.saveSubscription, preparePay: async () => ({ diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx index 4c2ddc0f2..d18dc7065 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx @@ -74,7 +74,7 @@ export function BaseView(state: SupportedStates): VNode { ? Amounts.parseOrThrow(state.payStatus.amountEffective) : state.amount, }; - const totalFees = Amounts.sub(price.effective, price.raw).amount; + // const totalFees = Amounts.sub(price.effective, price.raw).amount; return ( <WalletAction> @@ -168,7 +168,7 @@ export function BaseView(state: SupportedStates): VNode { goToWalletManualWithdraw={state.goToWalletManualWithdraw} /> <section> - <Link upperCased onClick={state.goBack}> + <Link upperCased onClick={state.cancel}> <i18n.Translate>Cancel</i18n.Translate> </Link> </section> @@ -358,7 +358,7 @@ function ButtonsSection({ onClick={state.payHandler.onClick} > <i18n.Translate> - Pay + Send {<Amount value={state.payStatus.amountEffective} />} </i18n.Translate> </Button> |