Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Bonus Pagamenti Digitali): [#177145461] Show privative cards in wallet home #2878

Merged
merged 48 commits into from
Mar 15, 2021

Conversation

debiff
Copy link
Contributor

@debiff debiff commented Mar 9, 2021

Short description

This PR show the preview of the privative cards in the wallet home.

List of changes proposed in this pull request

  • Add PrivativeWalletPreview component
  • Create a new PrivativePaymentMethod type
  • Refactor CardPreview component to favor composition
abi found abi not found
abiFound abiNotFound

@pagopa-github-bot pagopa-github-bot changed the title [#177145461] Show privative cards in wallet home feat(Bonus Pagamenti Digitali): [#177145461] Show privative cards in wallet home Mar 9, 2021
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Mar 9, 2021

Affected stories

  • 🌟 #177145461: Come CIT voglio visualizzare le mie carte privative nel wallet

Generated by 🚫 dangerJS against 388fada

@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #2878 (388fada) into master (9c19f25) will increase coverage by 0.05%.
The diff coverage is 78.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2878      +/-   ##
==========================================
+ Coverage   57.94%   58.00%   +0.05%     
==========================================
  Files         877      880       +3     
  Lines       24065    24141      +76     
  Branches     4439     4453      +14     
==========================================
+ Hits        13944    14002      +58     
- Misses      10032    10049      +17     
- Partials       89       90       +1     
Impacted Files Coverage Δ
ts/navigation/routes.ts 100.00% <ø> (ø)
ts/store/reducers/wallet/wallets.ts 58.10% <27.27%> (-2.04%) ⬇️
...features/wallet/component/WalletV2PreviewCards.tsx 56.52% <33.33%> (-3.48%) ⬇️
ts/utils/paymentMethod.ts 77.27% <45.45%> (-5.01%) ⬇️
ts/types/pagopa.ts 97.59% <71.42%> (-2.41%) ⬇️
ts/utils/walletv2.ts 78.43% <75.00%> (-0.74%) ⬇️
...allet/bancomat/component/BancomatWalletPreview.tsx 56.66% <100.00%> (ø)
...wallet/bancomatpay/component/BPayWalletPreview.tsx 100.00% <100.00%> (ø)
.../wallet/cobadge/component/CobadgeWalletPreview.tsx 100.00% <100.00%> (ø)
ts/features/wallet/component/CardLayoutPreview.tsx 100.00% <100.00%> (ø)
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c19f25...388fada. Read the comment docs.

</Body>
}
right={renderRight(props, imgDimensions)}
onPress={() => props.navigateToCobadgeDetails(props.privative)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onPress={() => props.navigateToCobadgeDetails(props.privative)}
onPress={() => props.navigateToPrivativeDetails(props.privative)}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7402c36

Comment on lines 83 to 85
const mapDispatchToProps = (dispatch: Dispatch) => ({
navigateToCobadgeDetails: (privative: PrivativePaymentMethod) =>
dispatch(navigateToPrivativeDetailScreen(privative))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const mapDispatchToProps = (dispatch: Dispatch) => ({
navigateToCobadgeDetails: (privative: PrivativePaymentMethod) =>
dispatch(navigateToPrivativeDetailScreen(privative))
const mapDispatchToProps = (dispatch: Dispatch) => ({
navigateToPrivativeDetails: (privative: PrivativePaymentMethod) =>
dispatch(navigateToPrivativeDetailScreen(privative))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7402c36

@@ -223,6 +225,10 @@ export type CreditCardPaymentMethod = RawCreditCardPaymentMethod &
PaymentMethodRepresentation &
WithAbi;

export type PrivativePaymentMethod = CreditCardPaymentMethod & {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about this and maybe the cleanest solution is to declare:

export type RawPrivativePaymentMethod = WalletV2WithoutInfo & {
  kind: "Privative";
  info: CardInfo;
};

export type PrivativePaymentMethod = RawPrivativePaymentMethod & { ... };

In order to have a a specific type inside the domain model. What you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added in a62709b

ts/features/wallet/component/CardLayoutPreview.tsx Outdated Show resolved Hide resolved
ts/features/wallet/component/CardLogoPreview.tsx Outdated Show resolved Hide resolved
expect(caption).not.toBeNull();
expect(caption).toHaveTextContent(aPrivativeCard.caption);
});
it("should show the fallback gdo logo if useImageResize return a size but there isn't the cardLogo", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should show the fallback gdo logo if useImageResize return a size but there isn't the cardLogo", () => {
it("should show the fallback gdo logo if useImageResize returns a size but there isn't the cardLogo", () => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified in 7822b59

ts/store/reducers/wallet/wallets.ts Outdated Show resolved Hide resolved
@fabriziofff fabriziofff merged commit 58b1098 into master Mar 15, 2021
@fabriziofff fabriziofff deleted the 177145461-preview-privative-card branch March 15, 2021 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants