-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Bonus Pagamenti Digitali): [#175401460] Remove all WalletV2 plac…
…eholders and use the real type and implementation (#2311) * draft store action reducers * wip * complete reducer for bpdPaymentMethodActivation * wip * add update logic * [#175010541] draft layout * wip * poc pot! * rework store * schedule retry * wip retry * better focus handling * clean code * refinements * renaming * move style to styles * EnrollPaymentMethodScreen static content * link to business logic * add comment * [#175329974] Add TMPBpdScreen * fix typescript * fix test fail * [#174794326,174794981] support get payment status * [#174794326,174794981] support update (enroll + delete) payment status * locales refactoring * fix LoadAddBancomat caption * register added bancomat in the current session * wip enhance bancomat onboarding * AskBpdActivationScreen * complete navigation based on bancomat onboarding state * fix typescript * fix typescript * fix integration with legacy add payment method * renaming * support 409 http response status code * use const for loadingState * fix merge * added CardBpdToggle * bancomatbpdtoggle * add toggle factory, * fix compile errors * fix compile * change url for bpd * [#175329974] sync activationDate&deactivationDate with local type definition * Remove custom login * Update locales/it/index.yml * change char Co-authored-by: Matteo Boschi <[email protected]>
- Loading branch information
1 parent
a2e4440
commit 9528094
Showing
18 changed files
with
161 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ts/features/bonus/bpd/components/paymentMethodActivationToggle/BancomatBpdToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import * as React from "react"; | ||
import pagoBancomatImage from "../../../../../../img/wallet/cards-icons/pagobancomat.png"; | ||
import { PatchedWalletV2 } from "../../../../../types/pagopa"; | ||
import { HPan } from "../../store/actions/paymentMethods"; | ||
import { hasBpdCapability } from "../../utils"; | ||
import PaymentMethodBpdToggle from "./base/PaymentMethodBpdToggle"; | ||
|
||
type Props = { | ||
card: PatchedWalletV2; | ||
}; | ||
|
||
/** | ||
* Customize a {@link PaymentMethodBpdToggle} with the data from a Bancomat | ||
* @param props | ||
* @constructor | ||
*/ | ||
export const BancomatBpdToggle: React.FunctionComponent<Props> = props => ( | ||
<PaymentMethodBpdToggle | ||
hPan={props.card.info.hashPan as HPan} | ||
icon={pagoBancomatImage} | ||
hasBpdCapability={hasBpdCapability(props.card)} | ||
// TODO: load bank name and displayhere | ||
caption={`bank name here!`} | ||
/> | ||
); |
21 changes: 21 additions & 0 deletions
21
...ures/bonus/bpd/components/paymentMethodActivationToggle/BpdPaymentMethodToggleFactory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as React from "react"; | ||
import { WalletTypeEnum } from "../../../../../../definitions/pagopa/bancomat/WalletV2"; | ||
import { PatchedWalletV2 } from "../../../../../types/pagopa"; | ||
import { BancomatBpdToggle } from "./BancomatBpdToggle"; | ||
import { CardBpdToggle } from "./CardBpdToggle"; | ||
|
||
/** | ||
* Return a specific toggle based on the WalletTypeEnum | ||
* @param wallet | ||
*/ | ||
export const bpdToggleFactory = (wallet: PatchedWalletV2) => { | ||
switch (wallet.walletType) { | ||
case WalletTypeEnum.Bancomat: | ||
return <BancomatBpdToggle key={wallet.info.hashPan} card={wallet} />; | ||
case WalletTypeEnum.Card: | ||
return <CardBpdToggle key={wallet.info.hashPan} card={wallet} />; | ||
default: | ||
// TODO: temp, default view with default icon | ||
return <CardBpdToggle key={wallet.info.hashPan} card={wallet} />; | ||
} | ||
}; |
26 changes: 26 additions & 0 deletions
26
ts/features/bonus/bpd/components/paymentMethodActivationToggle/CardBpdToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as React from "react"; | ||
import { getCardIconFromBrandLogo } from "../../../../../components/wallet/card/Logo"; | ||
import { PatchedWalletV2 } from "../../../../../types/pagopa"; | ||
import { HPan } from "../../store/actions/paymentMethods"; | ||
import { hasBpdCapability } from "../../utils"; | ||
import PaymentMethodBpdToggle from "./base/PaymentMethodBpdToggle"; | ||
|
||
type Props = { | ||
card: PatchedWalletV2; | ||
}; | ||
|
||
const FOUR_UNICODE_CIRCLES = "●".repeat(4); | ||
|
||
/** | ||
* Customize a {@link PaymentMethodBpdToggle} with the data from a Credit Card | ||
* @param props | ||
* @constructor | ||
*/ | ||
export const CardBpdToggle: React.FunctionComponent<Props> = props => ( | ||
<PaymentMethodBpdToggle | ||
hPan={props.card.info.hashPan as HPan} | ||
icon={getCardIconFromBrandLogo(props.card.info)} | ||
hasBpdCapability={hasBpdCapability(props.card)} | ||
caption={`${FOUR_UNICODE_CIRCLES} ${props.card.info.blurredNumber}`} | ||
/> | ||
); |
6 changes: 3 additions & 3 deletions
6
...ymentMethodActivationToggle/BpdToggle.tsx → ...MethodActivationToggle/base/BpdToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { PatchedWalletV2 } from "../../../types/pagopa"; | ||
|
||
/** | ||
* Return true if bpd is enabled for the wallet (aka payment method) | ||
* TODO: replace string with enum | ||
* @param wallet | ||
*/ | ||
export const hasBpdCapability = (wallet: PatchedWalletV2) => | ||
wallet.enableableFunctions.includes("BPD"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.