From 27e4ff3011527d9c0b7630dc7a4080f8fb817300 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 6 Feb 2024 17:06:56 -0300 Subject: fixes #8336 remove rewards --- .../src/NavigationBar.tsx | 4 +- .../src/components/HistoryItem.tsx | 19 +- .../src/cta/Refund/views.tsx | 2 +- .../src/cta/Reward/index.ts | 84 -------- .../src/cta/Reward/state.ts | 100 --------- .../src/cta/Reward/stories.tsx | 46 ----- .../src/cta/Reward/test.ts | 228 --------------------- .../src/cta/Reward/views.tsx | 90 -------- .../src/cta/index.stories.ts | 1 - .../src/platform/chrome.ts | 8 +- .../src/popup/TalerActionFound.stories.tsx | 4 - .../src/popup/TalerActionFound.tsx | 12 +- .../src/wallet/AddNewActionView.tsx | 2 - .../src/wallet/Application.tsx | 29 --- .../src/wallet/History.stories.tsx | 9 - .../src/wallet/Transaction.stories.tsx | 34 +-- .../src/wallet/Transaction.tsx | 92 +-------- 17 files changed, 20 insertions(+), 744 deletions(-) delete mode 100644 packages/taler-wallet-webextension/src/cta/Reward/index.ts delete mode 100644 packages/taler-wallet-webextension/src/cta/Reward/state.ts delete mode 100644 packages/taler-wallet-webextension/src/cta/Reward/stories.tsx delete mode 100644 packages/taler-wallet-webextension/src/cta/Reward/test.ts delete mode 100644 packages/taler-wallet-webextension/src/cta/Reward/views.tsx (limited to 'packages/taler-wallet-webextension/src') diff --git a/packages/taler-wallet-webextension/src/NavigationBar.tsx b/packages/taler-wallet-webextension/src/NavigationBar.tsx index 97b1fbcde..fe4fcc2d9 100644 --- a/packages/taler-wallet-webextension/src/NavigationBar.tsx +++ b/packages/taler-wallet-webextension/src/NavigationBar.tsx @@ -125,8 +125,6 @@ export const Pages = { ctaPayTemplate: "/cta/pay/template", ctaRecovery: "/cta/recovery", ctaRefund: "/cta/refund", - ctaTips: "/cta/tip", - ctaRewards: "/cta/rewards", ctaWithdraw: "/cta/withdraw", ctaDeposit: "/cta/deposit", ctaInvoiceCreate: pageDefinition<{ amount?: string }>( @@ -147,7 +145,6 @@ const talerUriActionToPageName: { } = { [TalerUriAction.Withdraw]: "ctaWithdraw", [TalerUriAction.Pay]: "ctaPay", - [TalerUriAction.Reward]: "ctaRewards", [TalerUriAction.Refund]: "ctaRefund", [TalerUriAction.PayPull]: "ctaInvoicePay", [TalerUriAction.PayPush]: "ctaTransferPickup", @@ -157,6 +154,7 @@ const talerUriActionToPageName: { [TalerUriAction.DevExperiment]: undefined, [TalerUriAction.Exchange]: undefined, [TalerUriAction.Auditor]: undefined, + [TalerUriAction.Reward]: undefined, }; export function getPathnameForTalerURI(talerUri: string): string | undefined { diff --git a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx index f65535a3d..4b44365ea 100644 --- a/packages/taler-wallet-webextension/src/components/HistoryItem.tsx +++ b/packages/taler-wallet-webextension/src/components/HistoryItem.tsx @@ -136,20 +136,7 @@ export function HistoryItem(props: { tx: Transaction }): VNode { ); case TransactionType.Reward: return ( - +
not supported
); case TransactionType.Refresh: return ( @@ -269,12 +256,12 @@ function Layout(props: LayoutProps): VNode { style={{ backgroundColor: props.currentState === TransactionMajorState.Pending || - props.currentState === TransactionMajorState.Dialog + props.currentState === TransactionMajorState.Dialog ? "lightcyan" : props.currentState === TransactionMajorState.Failed ? "#ff000040" : props.currentState === TransactionMajorState.Aborted || - props.currentState === TransactionMajorState.Aborting + props.currentState === TransactionMajorState.Aborting ? "#00000010" : "inherit", alignItems: "center", diff --git a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx index ef21a511e..ae4d728f3 100644 --- a/packages/taler-wallet-webextension/src/cta/Refund/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Refund/views.tsx @@ -29,7 +29,7 @@ export function IgnoredView(state: State.Ignored): VNode {

- You've ignored the tip. + You've ignored the refund.

diff --git a/packages/taler-wallet-webextension/src/cta/Reward/index.ts b/packages/taler-wallet-webextension/src/cta/Reward/index.ts deleted file mode 100644 index 5e56db7bc..000000000 --- a/packages/taler-wallet-webextension/src/cta/Reward/index.ts +++ /dev/null @@ -1,84 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see - */ - -import { AmountJson } from "@gnu-taler/taler-util"; -import { ErrorAlertView } from "../../components/CurrentAlerts.js"; -import { Loading } from "../../components/Loading.js"; -import { ErrorAlert } from "../../context/alert.js"; -import { ButtonHandler } from "../../mui/handlers.js"; -import { compose, StateViewMap } from "../../utils/index.js"; -import { useComponentState } from "./state.js"; -import { AcceptedView, IgnoredView, ReadyView } from "./views.js"; - -export interface Props { - talerTipUri?: string; - onCancel: () => Promise; - onSuccess: (tx: string) => Promise; -} - -export type State = - | State.Loading - | State.LoadingUriError - | State.Ignored - | State.Accepted - | State.Ready - | State.Ignored; - -export namespace State { - export interface Loading { - status: "loading"; - error: undefined; - } - - export interface LoadingUriError { - status: "error"; - error: ErrorAlert; - } - - export interface BaseInfo { - merchantBaseUrl: string; - amount: AmountJson; - exchangeBaseUrl: string; - error: undefined; - cancel: ButtonHandler; - } - - export interface Ignored extends BaseInfo { - status: "ignored"; - } - - export interface Accepted extends BaseInfo { - status: "accepted"; - } - export interface Ready extends BaseInfo { - status: "ready"; - accept: ButtonHandler; - } -} - -const viewMapping: StateViewMap = { - loading: Loading, - error: ErrorAlertView, - accepted: AcceptedView, - ignored: IgnoredView, - ready: ReadyView, -}; - -export const TipPage = compose( - "Tip", - (p: Props) => useComponentState(p), - viewMapping, -); diff --git a/packages/taler-wallet-webextension/src/cta/Reward/state.ts b/packages/taler-wallet-webextension/src/cta/Reward/state.ts deleted file mode 100644 index a4244a444..000000000 --- a/packages/taler-wallet-webextension/src/cta/Reward/state.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see - */ - -import { Amounts, TransactionIdStr } from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { alertFromError, useAlertContext } from "../../context/alert.js"; -import { useBackendContext } from "../../context/backend.js"; -import { useTranslationContext } from "@gnu-taler/web-util/browser"; -import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; -import { Props, State } from "./index.js"; - -export function useComponentState({ - talerTipUri: talerRewardUri, - onCancel, - onSuccess, -}: Props): State { - const api = useBackendContext(); - const { i18n } = useTranslationContext(); - const { pushAlertOnError } = useAlertContext(); - const tipInfo = useAsyncAsHook(async () => { - if (!talerRewardUri) throw Error("ERROR_NO-URI-FOR-TIP"); - const tip = await api.wallet.call(WalletApiOperation.PrepareReward, { - talerRewardUri, - }); - return { tip }; - }); - - if (!tipInfo) { - return { - status: "loading", - error: undefined, - }; - } - if (tipInfo.hasError) { - return { - status: "error", - error: alertFromError( - i18n.str`Could not load the status of the term of service`, - tipInfo, - ), - }; - } - // if (tipInfo.hasError) { - // return { - // status: "loading-uri", - // error: tipInfo, - // }; - // } - - const { tip } = tipInfo.response; - - const doAccept = async (): Promise => { - - const res = await api.wallet.call(WalletApiOperation.AcceptReward, { - transactionId: tip.transactionId, - }); - - //FIX: this may not be seen since we are moving to the success also - tipInfo.retry(); - onSuccess(res.transactionId); - }; - - const baseInfo = { - merchantBaseUrl: tip.merchantBaseUrl, - exchangeBaseUrl: tip.exchangeBaseUrl, - amount: Amounts.parseOrThrow(tip.rewardAmountEffective), - error: undefined, - cancel: { - onClick: pushAlertOnError(onCancel), - }, - }; - - if (tip.accepted) { - return { - status: "accepted", - ...baseInfo, - }; - } - - return { - status: "ready", - ...baseInfo, - accept: { - onClick: pushAlertOnError(doAccept), - }, - }; -} diff --git a/packages/taler-wallet-webextension/src/cta/Reward/stories.tsx b/packages/taler-wallet-webextension/src/cta/Reward/stories.tsx deleted file mode 100644 index bd5fdefd9..000000000 --- a/packages/taler-wallet-webextension/src/cta/Reward/stories.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { Amounts } from "@gnu-taler/taler-util"; -import * as tests from "@gnu-taler/web-util/testing"; -import { AcceptedView, ReadyView } from "./views.js"; - -export default { - title: "tip", -}; - -export const Accepted = tests.createExample(AcceptedView, { - status: "accepted", - error: undefined, - amount: Amounts.parseOrThrow("EUR:1"), - exchangeBaseUrl: "", - merchantBaseUrl: "", -}); - -export const Ready = tests.createExample(ReadyView, { - status: "ready", - error: undefined, - amount: Amounts.parseOrThrow("EUR:1"), - merchantBaseUrl: "http://merchant.url/", - exchangeBaseUrl: "http://exchange.url/", - accept: {}, - cancel: {}, -}); diff --git a/packages/taler-wallet-webextension/src/cta/Reward/test.ts b/packages/taler-wallet-webextension/src/cta/Reward/test.ts deleted file mode 100644 index aa19af261..000000000 --- a/packages/taler-wallet-webextension/src/cta/Reward/test.ts +++ /dev/null @@ -1,228 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see - */ - -/** - * - * @author Sebastian Javier Marchano (sebasjm) - */ - -import { AmountString, Amounts, TransactionIdStr } from "@gnu-taler/taler-util"; -import { WalletApiOperation } from "@gnu-taler/taler-wallet-core"; -import { expect } from "chai"; -import * as tests from "@gnu-taler/web-util/testing"; -import { nullFunction } from "../../mui/handlers.js"; -import { createWalletApiMock } from "../../test-utils.js"; -import { Props } from "./index.js"; -import { useComponentState } from "./state.js"; - -describe("Tip CTA states", () => { - it("should tell the user that the URI is missing", async () => { - const { handler, TestingContext } = createWalletApiMock(); - - const props: Props = { - talerTipUri: undefined, - onCancel: nullFunction, - onSuccess: nullFunction, - }; - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - ({ status, error }) => { - expect(status).equals("error"); - if (!error) expect.fail(); - expect(error.description).eq("ERROR_NO-URI-FOR-TIP"); - }, - ], - TestingContext, - ); - - expect(hookBehavior).deep.equal({ result: "ok" }); - expect(handler.getCallingQueueState()).eq("empty"); - }); - - it("should be ready for accepting the tip", async () => { - const { handler, TestingContext } = createWalletApiMock(); - - handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { - accepted: false, - exchangeBaseUrl: "exchange url", - merchantBaseUrl: "merchant url", - rewardAmountEffective: "EUR:1" as AmountString, - walletRewardId: "tip_id", - transactionId: "txn:tip:ABC1234" as TransactionIdStr, - expirationTimestamp: { - t_s: 1, - }, - rewardAmountRaw: "EUR:0" as AmountString, - }); - - const props: Props = { - talerTipUri: "taler://tip/asd", - onCancel: nullFunction, - onSuccess: nullFunction, - }; - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - (state) => { - if (state.status !== "ready") { - expect(state).eq({ status: "ready" }); - return; - } - if (state.error) expect.fail(); - expect(state.amount).deep.eq(Amounts.parseOrThrow("EUR:1")); - expect(state.merchantBaseUrl).eq("merchant url"); - expect(state.exchangeBaseUrl).eq("exchange url"); - if (state.accept.onClick === undefined) expect.fail(); - - handler.addWalletCallResponse(WalletApiOperation.AcceptReward); - state.accept.onClick(); - - handler.addWalletCallResponse( - WalletApiOperation.PrepareReward, - undefined, - { - accepted: true, - exchangeBaseUrl: "exchange url", - merchantBaseUrl: "merchant url", - rewardAmountEffective: "EUR:1" as AmountString, - walletRewardId: "tip_id", - transactionId: "txn:tip:ABC1234" as TransactionIdStr, - expirationTimestamp: { - t_s: 1, - }, - rewardAmountRaw: "EUR:0" as AmountString, - }, - ); - }, - (state) => { - if (state.status !== "accepted") expect.fail(); - if (state.error) expect.fail(); - expect(state.amount).deep.eq(Amounts.parseOrThrow("EUR:1")); - expect(state.merchantBaseUrl).eq("merchant url"); - expect(state.exchangeBaseUrl).eq("exchange url"); - }, - ], - TestingContext, - ); - - expect(hookBehavior).deep.equal({ result: "ok" }); - expect(handler.getCallingQueueState()).eq("empty"); - }); - - it.skip("should be ignored after clicking the ignore button", async () => { - const { handler, TestingContext } = createWalletApiMock(); - handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { - exchangeBaseUrl: "exchange url", - merchantBaseUrl: "merchant url", - rewardAmountEffective: "EUR:1" as AmountString, - walletRewardId: "tip_id", - transactionId: "txn:tip:ABC1234" as TransactionIdStr, - accepted: false, - expirationTimestamp: { - t_s: 1, - }, - rewardAmountRaw: "EUR:0" as AmountString, - }); - - const props: Props = { - talerTipUri: "taler://tip/asd", - onCancel: nullFunction, - onSuccess: nullFunction, - }; - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - (state) => { - if (state.status !== "ready") expect.fail(); - if (state.error) expect.fail(); - expect(state.amount).deep.eq(Amounts.parseOrThrow("EUR:1")); - expect(state.merchantBaseUrl).eq("merchant url"); - expect(state.exchangeBaseUrl).eq("exchange url"); - - //FIXME: add ignore button - }, - ], - TestingContext, - ); - - expect(hookBehavior).deep.equal({ result: "ok" }); - expect(handler.getCallingQueueState()).eq("empty"); - }); - - it("should render accepted if the tip has been used previously", async () => { - const { handler, TestingContext } = createWalletApiMock(); - - handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { - accepted: true, - exchangeBaseUrl: "exchange url", - merchantBaseUrl: "merchant url", - rewardAmountEffective: "EUR:1" as AmountString, - walletRewardId: "tip_id", - transactionId: "txn:tip:ABC1234" as TransactionIdStr, - expirationTimestamp: { - t_s: 1, - }, - rewardAmountRaw: "EUR:0" as AmountString, - }); - - const props: Props = { - talerTipUri: "taler://tip/asd", - onCancel: nullFunction, - onSuccess: nullFunction, - }; - - const hookBehavior = await tests.hookBehaveLikeThis( - useComponentState, - props, - [ - ({ status, error }) => { - expect(status).equals("loading"); - expect(error).undefined; - }, - (state) => { - if (state.status !== "accepted") expect.fail(); - if (state.error) expect.fail(); - expect(state.amount).deep.eq(Amounts.parseOrThrow("EUR:1")); - expect(state.merchantBaseUrl).eq("merchant url"); - expect(state.exchangeBaseUrl).eq("exchange url"); - }, - ], - TestingContext, - ); - - expect(hookBehavior).deep.equal({ result: "ok" }); - expect(handler.getCallingQueueState()).eq("empty"); - }); -}); diff --git a/packages/taler-wallet-webextension/src/cta/Reward/views.tsx b/packages/taler-wallet-webextension/src/cta/Reward/views.tsx deleted file mode 100644 index 9b4a6c3ef..000000000 --- a/packages/taler-wallet-webextension/src/cta/Reward/views.tsx +++ /dev/null @@ -1,90 +0,0 @@ -/* - This file is part of GNU Taler - (C) 2022 Taler Systems S.A. - - GNU Taler is free software; you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation; either version 3, or (at your option) any later version. - - GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with - GNU Taler; see the file COPYING. If not, see - */ - -import { TranslatedString } from "@gnu-taler/taler-util"; -import { useTranslationContext } from "@gnu-taler/web-util/browser"; -import { Fragment, h, VNode } from "preact"; -import { Amount } from "../../components/Amount.js"; -import { Part } from "../../components/Part.js"; -import { TermsOfService } from "../../components/TermsOfService/index.js"; -import { Button } from "../../mui/Button.js"; -import { State } from "./index.js"; - -export function IgnoredView(state: State.Ignored): VNode { - const { i18n } = useTranslationContext(); - return ( - - - You've ignored the tip. - - - ); -} - -export function ReadyView(state: State.Ready): VNode { - const { i18n } = useTranslationContext(); - return ( - -
-

- The merchant is offering you a reward -

- } - kind="positive" - /> - - -
-
- - - -
-
- ); -} - -export function AcceptedView(state: State.Accepted): VNode { - const { i18n } = useTranslationContext(); - return ( - -
- - Tip from {state.merchantBaseUrl} accepted. Check your - transactions list for more details. - -
-
- ); -} diff --git a/packages/taler-wallet-webextension/src/cta/index.stories.ts b/packages/taler-wallet-webextension/src/cta/index.stories.ts index 06b11ef6d..36e9cd1b9 100644 --- a/packages/taler-wallet-webextension/src/cta/index.stories.ts +++ b/packages/taler-wallet-webextension/src/cta/index.stories.ts @@ -22,7 +22,6 @@ export * as a1 from "./Deposit/stories.jsx"; export * as a3 from "./Payment/stories.jsx"; export * as a4 from "./Refund/stories.jsx"; -export * as a5 from "./Reward/stories.js"; export * as a6 from "./Withdraw/stories.jsx"; export * as a8 from "./InvoiceCreate/stories.js"; export * as a9 from "./InvoicePay/stories.js"; diff --git a/packages/taler-wallet-webextension/src/platform/chrome.ts b/packages/taler-wallet-webextension/src/platform/chrome.ts index d791a560f..d88dae460 100644 --- a/packages/taler-wallet-webextension/src/platform/chrome.ts +++ b/packages/taler-wallet-webextension/src/platform/chrome.ts @@ -197,11 +197,6 @@ function openWalletURIFromPopup(uri: TalerUri): void { `static/wallet.html#/cta/pay?talerUri=${encodeURIComponent(talerUri)}`, ); break; - case TalerUriAction.Reward: - url = chrome.runtime.getURL( - `static/wallet.html#/cta/rewards?talerUri=${encodeURIComponent(talerUri)}`, - ); - break; case TalerUriAction.Refund: url = chrome.runtime.getURL( `static/wallet.html#/cta/refund?talerUri=${encodeURIComponent( @@ -239,6 +234,9 @@ function openWalletURIFromPopup(uri: TalerUri): void { case TalerUriAction.Auditor: logger.warn(`taler://auditor not yet supported`); return; + case TalerUriAction.Reward: + logger.warn(`taler://reward not supported anymore`); + break; default: { const error: never = uri; logger.warn( diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.stories.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.stories.tsx index a5b31b387..0388664b3 100644 --- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.stories.tsx +++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.stories.tsx @@ -34,10 +34,6 @@ export const WithdrawalAction = tests.createExample(TestedComponent, { url: "taler://withdraw/something", }); -export const TipAction = tests.createExample(TestedComponent, { - url: "taler://tip/something", -}); - export const NotifyAction = tests.createExample(TestedComponent, { url: "taler://notify-reserve/something", }); diff --git a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx index 304c15f0b..f762121ab 100644 --- a/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx +++ b/packages/taler-wallet-webextension/src/popup/TalerActionFound.tsx @@ -65,17 +65,6 @@ function ContentByUriType({ ); - case TalerUriAction.Reward: - return ( -
-

- This page has a reward action. -

- -
- ); case TalerUriAction.Refund: return ( @@ -93,6 +82,7 @@ function ContentByUriType({ case TalerUriAction.PayPull: case TalerUriAction.PayPush: case TalerUriAction.Restore: + case TalerUriAction.Reward: case TalerUriAction.Auditor: case TalerUriAction.Exchange: return null; diff --git a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx index fc3a0916c..dd1777fd1 100644 --- a/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx +++ b/packages/taler-wallet-webextension/src/wallet/AddNewActionView.tsx @@ -66,8 +66,6 @@ export function AddNewActionView({ onCancel }: Props): VNode { return Open pay page; case TalerUriAction.Refund: return Open refund page; - case TalerUriAction.Reward: - return Open tip page; case TalerUriAction.Withdraw: return Open withdraw page; } diff --git a/packages/taler-wallet-webextension/src/wallet/Application.tsx b/packages/taler-wallet-webextension/src/wallet/Application.tsx index 3867845f2..140bb5683 100644 --- a/packages/taler-wallet-webextension/src/wallet/Application.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Application.tsx @@ -59,7 +59,6 @@ import { PaymentPage } from "../cta/Payment/index.js"; import { PaymentTemplatePage } from "../cta/PaymentTemplate/index.js"; import { RecoveryPage } from "../cta/Recovery/index.js"; import { RefundPage } from "../cta/Refund/index.js"; -import { TipPage } from "../cta/Reward/index.js"; import { TransferCreatePage } from "../cta/TransferCreate/index.js"; import { TransferPickupPage } from "../cta/TransferPickup/index.js"; import { @@ -365,34 +364,6 @@ export function Application(): VNode { )} /> - ( - - redirectTo(Pages.balance)} - onSuccess={(tid: string) => - redirectTo(Pages.balanceTransaction({ tid })) - } - /> - - )} - /> - ( - - redirectTo(Pages.balance)} - onSuccess={(tid: string) => - redirectTo(Pages.balanceTransaction({ tid })) - } - /> - - )} - /> ( diff --git a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx index 8b4f64a93..cc87cb992 100644 --- a/packages/taler-wallet-webextension/src/wallet/History.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/History.stories.tsx @@ -35,7 +35,6 @@ import { TransactionPeerPushDebit, TransactionRefresh, TransactionRefund, - TransactionReward, TransactionType, TransactionWithdrawal, WithdrawalType, @@ -112,11 +111,6 @@ const exampleData = { exchangeBaseUrl: "http://exchange.taler", refreshReason: RefreshReason.PayMerchant, } as TransactionRefresh, - tip: { - ...commonTransaction(), - type: TransactionType.Reward, - merchantBaseUrl: "http://ads.merchant.taler.net/", - } as TransactionReward, refund: { ...commonTransaction(), type: TransactionType.Refund, @@ -277,7 +271,6 @@ export const SomeTransactions = tests.createExample(TestedComponent, { }, }, exampleData.refund, - exampleData.tip, exampleData.deposit, ], balances: [ @@ -371,7 +364,6 @@ export const SomeTransactionsInDifferentStates = tests.createExample( }, }, exampleData.refund, - exampleData.tip, exampleData.deposit, ], balances: [ @@ -402,7 +394,6 @@ export const SomeTransactionsWithTwoCurrencies = tests.createExample( exampleData.payment, exampleData.refresh, exampleData.refund, - exampleData.tip, exampleData.deposit, ], balances: [ diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx index c17d15b01..194f0e0bb 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.stories.tsx @@ -38,11 +38,10 @@ import { TransactionPeerPushDebit, TransactionRefresh, TransactionRefund, - TransactionReward, TransactionType, TransactionWithdrawal, WithdrawalDetails, - WithdrawalType, + WithdrawalType } from "@gnu-taler/taler-util"; import * as tests from "@gnu-taler/web-util/testing"; import beer from "../../static-dev/beer.png"; @@ -137,17 +136,6 @@ const exampleData = { exchangeBaseUrl: "http://exchange.taler", refreshReason: RefreshReason.Manual, } as TransactionRefresh, - tip: { - ...commonTransaction, - type: TransactionType.Reward, - // merchant: { - // name: "the merchant", - // logo: merchantIcon, - // website: "https://www.themerchant.taler", - // email: "contact@merchant.taler", - // }, - merchantBaseUrl: "http://merchant.taler", - } as TransactionReward, refund: { ...commonTransaction, type: TransactionType.Refund, @@ -584,26 +572,6 @@ export const RefreshError = tests.createExample(TestedComponent, { }, }); -export const Tip = tests.createExample(TestedComponent, { - transaction: exampleData.tip, -}); - -export const TipError = tests.createExample(TestedComponent, { - transaction: { - ...exampleData.tip, - error: transactionError, - }, -}); - -export const TipPending = tests.createExample(TestedComponent, { - transaction: { - ...exampleData.tip, - txState: { - major: TransactionMajorState.Pending, - }, - }, -}); - export const Refund = tests.createExample(TestedComponent, { transaction: exampleData.refund, }); diff --git a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx index f6c98952e..65fc90f44 100644 --- a/packages/taler-wallet-webextension/src/wallet/Transaction.tsx +++ b/packages/taler-wallet-webextension/src/wallet/Transaction.tsx @@ -229,8 +229,8 @@ function TransactionTemplate({
{transaction?.error && - // FIXME: wallet core should stop sending this error on KYC - transaction.error.code !== + // FIXME: wallet core should stop sending this error on KYC + transaction.error.code !== TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED ? ( {transaction.txState.major !== - TransactionMajorState.Pending ? undefined : transaction.txState + TransactionMajorState.Pending ? undefined : transaction.txState .minor === TransactionMinorState.KycRequired || - transaction.txState.minor === + transaction.txState.minor === TransactionMinorState.AmlRequired ? undefined : transaction - .withdrawalDetails.type === WithdrawalType.ManualTransfer ? ( + .withdrawalDetails.type === WithdrawalType.ManualTransfer ? ( //manual withdrawal -
- {transaction.merchantBaseUrl} -
- {/* } - kind="neutral" - /> */} - - } - /> - - ); - } - if (transaction.type === TransactionType.Refund) { return ( {conversion.fraction === amount.value.fraction && - conversion.value === amount.value.value ? undefined : ( + conversion.value === amount.value.value ? undefined : ( Converted @@ -1839,47 +1808,6 @@ function RefreshDetails({ amount }: { amount: AmountWithFee }): VNode { ); } -function TipDetails({ amount }: { amount: AmountWithFee }): VNode { - const { i18n } = useTranslationContext(); - - return ( - - - - Tip - - - - - - - {Amounts.isNonZero(amount.fee) && ( - - - Fees - - - - - - )} - - -
- - - - - Total - - - - - -
- ); -} - function Header({ timestamp, total, @@ -2054,7 +1982,7 @@ function ShowWithdrawalDetailForBankIntegrated({ /> )} {!transaction.withdrawalDetails.confirmed && - transaction.withdrawalDetails.bankConfirmationUrl ? ( + transaction.withdrawalDetails.bankConfirmationUrl ? (
-- cgit v1.2.3