gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-wallet-core] branch master updated: fixes #8336 remove rewards


From: gnunet
Subject: [taler-wallet-core] branch master updated: fixes #8336 remove rewards
Date: Tue, 06 Feb 2024 21:07:02 +0100

This is an automated email from the git hooks/post-receive script.

sebasjm pushed a commit to branch master
in repository wallet-core.

The following commit(s) were added to refs/heads/master by this push:
     new 27e4ff301 fixes #8336 remove rewards
27e4ff301 is described below

commit 27e4ff3011527d9c0b7630dc7a4080f8fb817300
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Tue Feb 6 17:06:56 2024 -0300

    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(-)

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 (
-        <Layout
-          id={tx.transactionId}
-          amount={tx.amountEffective}
-          debitCreditIndicator={"credit"}
-          title={new URL(tx.merchantBaseUrl).hostname}
-          timestamp={AbsoluteTime.fromPreciseTimestamp(tx.timestamp)}
-          iconPath={"T"}
-          currentState={tx.txState.major}
-          description={
-            tx.txState.major === TransactionMajorState.Pending
-              ? i18n.str`Grabbing the tipping...`
-              : undefined
-          }
-        />
+        <div>not supported</div>
       );
     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 {
     <Fragment>
       <section>
         <p>
-          <i18n.Translate>You&apos;ve ignored the tip.</i18n.Translate>
+          <i18n.Translate>You&apos;ve ignored the refund.</i18n.Translate>
         </p>
       </section>
     </Fragment>
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 <http://www.gnu.org/licenses/>
- */
-
-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<void>;
-  onSuccess: (tx: string) => Promise<void>;
-}
-
-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<State> = {
-  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 <http://www.gnu.org/licenses/>
- */
-
-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<void> => {
-
-    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 <http://www.gnu.org/licenses/>
- */
-
-/**
- *
- * @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 <http://www.gnu.org/licenses/>
- */
-
-/**
- *
- * @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 <http://www.gnu.org/licenses/>
- */
-
-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 (
-    <Fragment>
-      <span>
-        <i18n.Translate>You&apos;ve ignored the tip.</i18n.Translate>
-      </span>
-    </Fragment>
-  );
-}
-
-export function ReadyView(state: State.Ready): VNode {
-  const { i18n } = useTranslationContext();
-  return (
-    <Fragment>
-      <section>
-        <p>
-          <i18n.Translate>The merchant is offering you a 
reward</i18n.Translate>
-        </p>
-        <Part
-          title={i18n.str`Amount`}
-          text={<Amount value={state.amount} />}
-          kind="positive"
-        />
-        <Part
-          title={i18n.str`Merchant URL`}
-          text={state.merchantBaseUrl as TranslatedString}
-          kind="neutral"
-        />
-        <Part
-          title={i18n.str`Exchange`}
-          text={state.exchangeBaseUrl as TranslatedString}
-          kind="neutral"
-        />
-      </section>
-      <section>
-        <TermsOfService key="terms" exchangeUrl={state.exchangeBaseUrl} >
-          <Button
-            variant="contained"
-            color="success"
-            onClick={state.accept.onClick}
-          >
-            <i18n.Translate>
-              Receive &nbsp; {<Amount value={state.amount} />}
-            </i18n.Translate>
-          </Button>
-        </TermsOfService>
-      </section>
-    </Fragment>
-  );
-}
-
-export function AcceptedView(state: State.Accepted): VNode {
-  const { i18n } = useTranslationContext();
-  return (
-    <Fragment>
-      <section>
-        <i18n.Translate>
-          Tip from <code>{state.merchantBaseUrl}</code> accepted. Check your
-          transactions list for more details.
-        </i18n.Translate>
-      </section>
-    </Fragment>
-  );
-}
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({
           </Button>
         </div>
       );
-    case TalerUriAction.Reward:
-      return (
-        <div>
-          <p>
-            <i18n.Translate>This page has a reward action.</i18n.Translate>
-          </p>
-          <Button variant="contained" color="success" onClick={onConfirm}>
-            <i18n.Translate>Open reward page</i18n.Translate>
-          </Button>
-        </div>
-      );
 
     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 <i18n.Translate>Open pay page</i18n.Translate>;
                 case TalerUriAction.Refund:
                   return <i18n.Translate>Open refund page</i18n.Translate>;
-                case TalerUriAction.Reward:
-                  return <i18n.Translate>Open tip page</i18n.Translate>;
                 case TalerUriAction.Withdraw:
                   return <i18n.Translate>Open withdraw page</i18n.Translate>;
               }
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 {
               </CallToActionTemplate>
             )}
           />
-          <Route
-            path={Pages.ctaTips}
-            component={({ talerUri }: { talerUri: string }) => (
-              <CallToActionTemplate title={i18n.str`Digital cash rewards`}>
-                <TipPage
-                  talerTipUri={decodeURIComponent(talerUri)}
-                  onCancel={() => redirectTo(Pages.balance)}
-                  onSuccess={(tid: string) =>
-                    redirectTo(Pages.balanceTransaction({ tid }))
-                  }
-                />
-              </CallToActionTemplate>
-            )}
-          />
-          <Route
-            path={Pages.ctaRewards}
-            component={({ talerUri }: { talerUri: string }) => (
-              <CallToActionTemplate title={i18n.str`Digital cash rewards`}>
-                <TipPage
-                  talerTipUri={decodeURIComponent(talerUri)}
-                  onCancel={() => redirectTo(Pages.balance)}
-                  onSuccess={(tid: string) =>
-                    redirectTo(Pages.balanceTransaction({ tid }))
-                  }
-                />
-              </CallToActionTemplate>
-            )}
-          />
           <Route
             path={Pages.ctaWithdraw}
             component={({ talerUri }: { talerUri: string }) => (
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({
     <Fragment>
       <section style={{ padding: 8, textAlign: "center" }}>
         {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 ? (
           <ErrorAlertView
             error={alertFromError(
@@ -465,11 +465,11 @@ export function TransactionView({
         </Header>
 
         {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
           <BankDetailsByPaytoType
             amount={raw}
@@ -751,40 +751,6 @@ export function TransactionView({
     );
   }
 
-  if (transaction.type === TransactionType.Reward) {
-    return (
-      <TransactionTemplate
-        transaction={transaction}
-        onDelete={onDelete}
-        onRetry={onRetry}
-        onAbort={onAbort}
-        onResume={onResume}
-        onSuspend={onSuspend}
-        onCancel={onCancel}
-      >
-        <Header
-          timestamp={transaction.timestamp}
-          type={i18n.str`Tip`}
-          total={effective}
-          kind="positive"
-        >
-          {transaction.merchantBaseUrl}
-        </Header>
-        {/* <Part
-          title={i18n.str`Merchant`}
-          text={<MerchantDetails merchant={transaction.merchant} />}
-          kind="neutral"
-        /> */}
-        <Part
-          title={i18n.str`Details`}
-          text={
-            <TipDetails amount={getAmountWithFee(effective, raw, "credit")} />
-          }
-        />
-      </TransactionTemplate>
-    );
-  }
-
   if (transaction.type === TransactionType.Refund) {
     return (
       <TransactionTemplate
@@ -1042,6 +1008,9 @@ export function TransactionView({
   if (transaction.type === TransactionType.Recoup) {
     throw Error("recoup transaction not implemented");
   }
+  if (transaction.type === TransactionType.Reward) {
+    throw Error("recoup transaction not implemented");
+  }
   assertUnreachable(transaction);
 }
 
@@ -1453,7 +1422,7 @@ export function WithdrawDetails({
             </td>
           </tr>
           {conversion.fraction === amount.value.fraction &&
-          conversion.value === amount.value.value ? undefined : (
+            conversion.value === amount.value.value ? undefined : (
             <tr>
               <td>
                 <i18n.Translate>Converted</i18n.Translate>
@@ -1839,47 +1808,6 @@ function RefreshDetails({ amount }: { amount: 
AmountWithFee }): VNode {
   );
 }
 
-function TipDetails({ amount }: { amount: AmountWithFee }): VNode {
-  const { i18n } = useTranslationContext();
-
-  return (
-    <PurchaseDetailsTable>
-      <tr>
-        <td>
-          <i18n.Translate>Tip</i18n.Translate>
-        </td>
-        <td>
-          <Amount value={amount.value} maxFracSize={amount.maxFrac} />
-        </td>
-      </tr>
-
-      {Amounts.isNonZero(amount.fee) && (
-        <tr>
-          <td>
-            <i18n.Translate>Fees</i18n.Translate>
-          </td>
-          <td>
-            <Amount value={amount.fee} maxFracSize={amount.maxFrac} />
-          </td>
-        </tr>
-      )}
-      <tr>
-        <td colSpan={2}>
-          <hr />
-        </td>
-      </tr>
-      <tr>
-        <td>
-          <i18n.Translate>Total</i18n.Translate>
-        </td>
-        <td>
-          <Amount value={amount.total} maxFracSize={amount.maxFrac} />
-        </td>
-      </tr>
-    </PurchaseDetailsTable>
-  );
-}
-
 function Header({
   timestamp,
   total,
@@ -2054,7 +1982,7 @@ function ShowWithdrawalDetailForBankIntegrated({
         />
       )}
       {!transaction.withdrawalDetails.confirmed &&
-      transaction.withdrawalDetails.bankConfirmationUrl ? (
+        transaction.withdrawalDetails.bankConfirmationUrl ? (
         <InfoBox>
           <div style={{ display: "block" }}>
             <i18n.Translate>

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]