diff options
author | Florian Dold <florian@dold.me> | 2023-08-03 18:35:07 +0200 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-08-03 18:35:07 +0200 |
commit | fdbd55d2bde0961a4c1ff26b04e442459ab782b0 (patch) | |
tree | d0d04f42a5477f6d7d39a8940d59ff1548166711 /packages/taler-wallet-webextension/src/cta | |
parent | 0fe4840ca2612dda06417cdebe5229eea98180be (diff) | |
download | wallet-core-fdbd55d2bde0961a4c1ff26b04e442459ab782b0.tar.xz |
-towards tip->reward rename
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Reward/index.ts (renamed from packages/taler-wallet-webextension/src/cta/Tip/index.ts) | 0 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Reward/state.ts (renamed from packages/taler-wallet-webextension/src/cta/Tip/state.ts) | 14 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Reward/stories.tsx (renamed from packages/taler-wallet-webextension/src/cta/Tip/stories.tsx) | 0 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Reward/test.ts (renamed from packages/taler-wallet-webextension/src/cta/Tip/test.ts) | 34 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Reward/views.tsx (renamed from packages/taler-wallet-webextension/src/cta/Tip/views.tsx) | 0 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/index.stories.ts | 2 |
6 files changed, 25 insertions, 25 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Tip/index.ts b/packages/taler-wallet-webextension/src/cta/Reward/index.ts index 5e56db7bc..5e56db7bc 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Reward/index.ts diff --git a/packages/taler-wallet-webextension/src/cta/Tip/state.ts b/packages/taler-wallet-webextension/src/cta/Reward/state.ts index d34e9e264..98463cb60 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/state.ts +++ b/packages/taler-wallet-webextension/src/cta/Reward/state.ts @@ -23,7 +23,7 @@ import { useAsyncAsHook } from "../../hooks/useAsyncAsHook.js"; import { Props, State } from "./index.js"; export function useComponentState({ - talerTipUri, + talerTipUri: talerRewardUri, onCancel, onSuccess, }: Props): State { @@ -31,9 +31,9 @@ export function useComponentState({ const { i18n } = useTranslationContext(); const { pushAlertOnError } = useAlertContext(); const tipInfo = useAsyncAsHook(async () => { - if (!talerTipUri) throw Error("ERROR_NO-URI-FOR-TIP"); - const tip = await api.wallet.call(WalletApiOperation.PrepareTip, { - talerTipUri, + if (!talerRewardUri) throw Error("ERROR_NO-URI-FOR-TIP"); + const tip = await api.wallet.call(WalletApiOperation.PrepareReward, { + talerRewardUri, }); return { tip }; }); @@ -63,8 +63,8 @@ export function useComponentState({ const { tip } = tipInfo.response; const doAccept = async (): Promise<void> => { - const res = await api.wallet.call(WalletApiOperation.AcceptTip, { - walletTipId: tip.walletTipId, + const res = await api.wallet.call(WalletApiOperation.AcceptReward, { + walletRewardId: tip.walletRewardId, }); //FIX: this may not be seen since we are moving to the success also @@ -75,7 +75,7 @@ export function useComponentState({ const baseInfo = { merchantBaseUrl: tip.merchantBaseUrl, exchangeBaseUrl: tip.exchangeBaseUrl, - amount: Amounts.parseOrThrow(tip.tipAmountEffective), + amount: Amounts.parseOrThrow(tip.rewardAmountEffective), error: undefined, cancel: { onClick: pushAlertOnError(onCancel), diff --git a/packages/taler-wallet-webextension/src/cta/Tip/stories.tsx b/packages/taler-wallet-webextension/src/cta/Reward/stories.tsx index bd5fdefd9..bd5fdefd9 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Reward/stories.tsx diff --git a/packages/taler-wallet-webextension/src/cta/Tip/test.ts b/packages/taler-wallet-webextension/src/cta/Reward/test.ts index e0b6210a2..6d7bad0c8 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Reward/test.ts @@ -62,17 +62,17 @@ describe("Tip CTA states", () => { it("should be ready for accepting the tip", async () => { const { handler, TestingContext } = createWalletApiMock(); - handler.addWalletCallResponse(WalletApiOperation.PrepareTip, undefined, { + handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { accepted: false, exchangeBaseUrl: "exchange url", merchantBaseUrl: "merchant url", - tipAmountEffective: "EUR:1", - walletTipId: "tip_id", + rewardAmountEffective: "EUR:1", + walletRewardId: "tip_id", transactionId: "txn:tip:ABC1234", expirationTimestamp: { t_s: 1, }, - tipAmountRaw: "", + rewardAmountRaw: "", }); const props: Props = { @@ -100,23 +100,23 @@ describe("Tip CTA states", () => { expect(state.exchangeBaseUrl).eq("exchange url"); if (state.accept.onClick === undefined) expect.fail(); - handler.addWalletCallResponse(WalletApiOperation.AcceptTip); + handler.addWalletCallResponse(WalletApiOperation.AcceptReward); state.accept.onClick(); handler.addWalletCallResponse( - WalletApiOperation.PrepareTip, + WalletApiOperation.PrepareReward, undefined, { accepted: true, exchangeBaseUrl: "exchange url", merchantBaseUrl: "merchant url", - tipAmountEffective: "EUR:1", - walletTipId: "tip_id", + rewardAmountEffective: "EUR:1", + walletRewardId: "tip_id", transactionId: "txn:tip:ABC1234", expirationTimestamp: { t_s: 1, }, - tipAmountRaw: "", + rewardAmountRaw: "", }, ); }, @@ -137,17 +137,17 @@ describe("Tip CTA states", () => { it.skip("should be ignored after clicking the ignore button", async () => { const { handler, TestingContext } = createWalletApiMock(); - handler.addWalletCallResponse(WalletApiOperation.PrepareTip, undefined, { + handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { exchangeBaseUrl: "exchange url", merchantBaseUrl: "merchant url", - tipAmountEffective: "EUR:1", - walletTipId: "tip_id", + rewardAmountEffective: "EUR:1", + walletRewardId: "tip_id", transactionId: "txn:tip:ABC1234", accepted: false, expirationTimestamp: { t_s: 1, }, - tipAmountRaw: "", + rewardAmountRaw: "", }); const props: Props = { @@ -184,17 +184,17 @@ describe("Tip CTA states", () => { it("should render accepted if the tip has been used previously", async () => { const { handler, TestingContext } = createWalletApiMock(); - handler.addWalletCallResponse(WalletApiOperation.PrepareTip, undefined, { + handler.addWalletCallResponse(WalletApiOperation.PrepareReward, undefined, { accepted: true, exchangeBaseUrl: "exchange url", merchantBaseUrl: "merchant url", - tipAmountEffective: "EUR:1", - walletTipId: "tip_id", + rewardAmountEffective: "EUR:1", + walletRewardId: "tip_id", transactionId: "txn:tip:ABC1234", expirationTimestamp: { t_s: 1, }, - tipAmountRaw: "", + rewardAmountRaw: "", }); const props: Props = { diff --git a/packages/taler-wallet-webextension/src/cta/Tip/views.tsx b/packages/taler-wallet-webextension/src/cta/Reward/views.tsx index 5d99a0132..5d99a0132 100644 --- a/packages/taler-wallet-webextension/src/cta/Tip/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Reward/views.tsx diff --git a/packages/taler-wallet-webextension/src/cta/index.stories.ts b/packages/taler-wallet-webextension/src/cta/index.stories.ts index 84863f84f..06b11ef6d 100644 --- a/packages/taler-wallet-webextension/src/cta/index.stories.ts +++ b/packages/taler-wallet-webextension/src/cta/index.stories.ts @@ -22,7 +22,7 @@ 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 "./Tip/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"; |