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: [IOBP-309, IOBP-312] Add error handling for payment verification and activation requests #5378

Conversation

mastro993
Copy link
Contributor

@mastro993 mastro993 commented Jan 4, 2024

Short description

This PR adds the handling of failures during the verification and activation requests for a payment.

List of changes proposed in this pull request

  • Added WalletPaymentFailure type
  • Added WalletPaymentFailureDetail component to display payment failures
  • Added usePaymentFailureSupportModal hook to display the payment support request bottom sheet modal
  • Added required locale keys

How to test

Using the io-dev-api-server, checkout this branch pagopa/io-dev-api-server#335 and add the following to the config.json:

 "features": {
    "wallet": {
      "verificationFailure": {
        "faultCodeCategory": "PAYMENT_UNAVAILABLE",
        "faultCodeDetail":"PPT_PSP_SCONOSCIUTO"
      }
    }
  }

With the IO app, navigate to the wallet payment playground and check that the failure is correctly displayed.

Preview

RocketSim_Recording_iPhone_13_6.1_2024-01-04_17.12.43.mp4

@pagopa-github-bot pagopa-github-bot changed the title [IOBP-309] Add error handling for payment verification request feat: [IOBP-309] Add error handling for payment verification request Jan 4, 2024
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Jan 4, 2024

Warnings
⚠️ Please include a Pivotal story or Jira ticket at the beginning of the PR title

Example of PR titles that include pivotal stories:

  • single story: [#123456] my PR title
  • multiple stories: [#123456,#123457,#123458] my PR title

Example of PR titles that include Jira tickets:

  • single story: [PROJID-123] my PR title
  • multiple stories: [PROJID-1,PROJID-2,PROJID-3] my PR title

Generated by 🚫 dangerJS against 5dc9500

@mastro993 mastro993 added the IO-Bonus e pagamenti IO - Bonus e pagamenti label Jan 4, 2024
Copy link

codecov bot commented Jan 4, 2024

Codecov Report

Attention: 80 lines in your changes are missing coverage. Please review.

Comparison is base (2986e5c) 47.48% compared to head (5dc9500) 47.38%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5378      +/-   ##
==========================================
- Coverage   47.48%   47.38%   -0.11%     
==========================================
  Files        1636     1639       +3     
  Lines       34146    34231      +85     
  Branches     8346     8364      +18     
==========================================
+ Hits        16213    16219       +6     
- Misses      17875    17954      +79     
  Partials       58       58              
Files Coverage Δ
...omponents/screens/OperationResultScreenContent.tsx 100.00% <100.00%> (ø)
...tures/walletV3/payment/store/actions/networking.ts 100.00% <ø> (ø)
.../features/walletV3/payment/store/reducers/index.ts 10.71% <ø> (ø)
ts/features/walletV3/payment/types/failure.ts 100.00% <100.00%> (ø)
ts/utils/supportAssistance.ts 92.64% <100.00%> (+0.10%) ⬆️
...networking/handleWalletPaymentCreateTransaction.ts 84.61% <83.33%> (-6.30%) ⬇️
...t/saga/networking/handleWalletPaymentGetDetails.ts 84.61% <83.33%> (-6.30%) ⬇️
...etV3/payment/screens/WalletPaymentDetailScreen.tsx 9.52% <0.00%> (-0.48%) ⬇️
.../payment/components/WalletPaymentFailureDetail.tsx 2.85% <2.85%> (ø)
...V3/payment/hooks/usePaymentFailureSupportModal.tsx 2.38% <2.38%> (ø)

Continue to review full report in Codecov by Sentry.

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

@mastro993 mastro993 changed the title feat: [IOBP-309] Add error handling for payment verification request feat: [IOBP-309] Add error handling for payment verification and activation requests Jan 8, 2024
@mastro993 mastro993 changed the title feat: [IOBP-309] Add error handling for payment verification and activation requests feat: [IOBP-309, IOBP-312] Add error handling for payment verification and activation requests Jan 8, 2024
@mastro993 mastro993 marked this pull request as ready for review January 9, 2024 14:38
@mastro993 mastro993 requested review from thisisjp and a team as code owners January 9, 2024 14:38
@mastro993 mastro993 marked this pull request as draft January 10, 2024 13:19
@mastro993 mastro993 marked this pull request as ready for review January 10, 2024 15:38
Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

Beyond the following small change, there seems to be strange a behavior in OperationResultContent component where the close button is present as shown below:

@mastro993
Copy link
Contributor Author

Beyond the following small change, there seems to be strange a behavior in OperationResultContent component where the close button is present as shown below:

Fixed in 141c5f7

Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

LGTM!

@mastro993 mastro993 merged commit a29e57f into master Jan 11, 2024
7 checks passed
@mastro993 mastro993 deleted the IOBP-309-gestione-errori-in-fase-di-verifica-avviso-integrazione-ecommerce branch January 11, 2024 13:51
mastro993 added a commit that referenced this pull request Jan 12, 2024
⚠️ Depends on #5378

## Short description
This PR adds the handling of the payment error outcomes.

## List of changes proposed in this pull request
- Added components mapping based on the outcome in
`WalletPaymentOutcomeScreen`
- Added required locales keys
- Refactored `usePaymentFailureSupportModal` to remove the requirement
of passing `RptId` as its argument.

## How to test
Within the **Profile > New Wallet > Payment** playground, using the
`io-dev-api-server`, try to simulate different payment outcomes and
check that the screen and its components are displayed correctly.

## Preview


https://github.com/pagopa/io-app/assets/6160324/cb7c33f1-9c0d-471c-accf-a362efc42264

---------

Co-authored-by: Alessandro Izzo <[email protected]>
Co-authored-by: Mario Perrotta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO-Bonus e pagamenti IO - Bonus e pagamenti
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants