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(IT Wallet): [SIW-1797,SIW-1608] Handle all credential statuses for the physical and digital document #6349

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

gispada
Copy link
Collaborator

@gispada gispada commented Oct 31, 2024

Warning

Depends on #6338

Short description

This PR extends the status set of credentials, that are now defined as follows:

  • Physical document: valid, expiring, expired, invalid (as attested by the status attestation)
  • Digital document: valid, jwtExpiring, jwtExpired

This is necessary because there are several UI differences that depend on those statuses. In case of overlapping between the physical and digital document a specific order has been defined (see IO-WALLET-DR-0018): the utility function getCredentialStatus has been modified accordingly and must be considered the only source of truth for the status.

Additionally when the status attestation returns a specific error code and this code is successfully mapped with one of the issuance_errors_supported, the credential detail screen will show a dynamic alert with a bottom sheet based on this error.

List of changes proposed in this pull request

  • Centralized the status set in itwTypesUtils (and removed the unused pending status)
  • Updated the assets for invalid cards and removed the unused eID assets
  • Split ItwPresentationAlertsSection into two components:
    • ItwPresentationCredentialInfoAlert to display informative content about the credential
    • ItwPresentationCredentialStatusAlert to display an alert related to the credential status (both dynamic and static content)
  • Modified getCredentialStatus and added more unit tests
  • Aligned the eID status to the new values: since only the JWT expiration date is available, its statuses can be valid, jwtExpiring and jwtExpired (digital credential only)
  • Updated locales and removed unused keys
  • Updated several components to reflect the new statues
  • Updated tests (in a few tests involving the credential card the eID was removed because it's not shown anymore)

How to test

To test this PR there are two ways:

  • For physical documents: use a proxy to mock the /status response with a 404 and a body like { "error": "credential_voided" } (check the EC to find the exact error codes)
  • For digital documents: mock the JWT expiration date found in the stored credential object (jwt.expiration)

It is also possible to force the return value of getCredentialStatus with the desired status.

Refer to the approved only Figma, "Ciclo di vita credenziali."

gispada and others added 25 commits October 25, 2024 17:10
@pagopa-github-bot
Copy link
Collaborator

pagopa-github-bot commented Oct 31, 2024

Warnings
⚠️

Multiple stories with different types are associated with this Pull request.
Only one tag will be added, following the order: feature > bug > chore

Affected stories

  • ⚙️ SIW-1797: [io-app] Mostrare gli errori estesi di stato delle credenziali nelle card e nel dettaglio
  • 🌟 SIW-1608: Come cittadino voglio sapere il motivo preciso per cui la mia credenziale non è valida o sto ottenendo un errore nel flusso di emissione
    subtask of
    • SIW-1457: Evoluzione flusso ottenimento credenziale

Generated by 🚫 dangerJS against f8ba531

Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 42.37288% with 68 lines in your changes missing coverage. Please review.

Project coverage is 46.94%. Comparing base (4f204b4) to head (f8ba531).
Report is 670 commits behind head on master.

Files with missing lines Patch % Lines
...omponents/ItwPresentationCredentialStatusAlert.tsx 17.85% 23 Missing ⚠️
...ures/itwallet/credentials/store/selectors/index.ts 13.33% 13 Missing ⚠️
.../components/ItwPresentationCredentialInfoAlert.tsx 23.07% 10 Missing ⚠️
...s/ItwPresentationCredentialVerificationExpired.tsx 11.11% 8 Missing ⚠️
.../itwallet/common/components/ItwCredentialClaim.tsx 66.66% 4 Missing ⚠️
.../screens/ItwPresentationCredentialDetailScreen.tsx 0.00% 4 Missing ⚠️
...dentials/saga/checkCredentialsStatusAttestation.ts 0.00% 3 Missing ⚠️
...ation/components/ItwPresentationCredentialCard.tsx 0.00% 2 Missing ⚠️
...allet/common/components/ItwDigitalVersionBadge.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6349      +/-   ##
==========================================
- Coverage   48.42%   46.94%   -1.48%     
==========================================
  Files        1488     1817     +329     
  Lines       31617    36999    +5382     
  Branches     7669     8854    +1185     
==========================================
+ Hits        15311    17371    +2060     
- Misses      16238    19561    +3323     
+ Partials       68       67       -1     
Files with missing lines Coverage Δ
img/features/itWallet/cards/dc_off.png 100.00% <ø> (ø)
img/features/itWallet/cards/mdl_off.png 100.00% <ø> (ø)
img/features/itWallet/cards/ts_off.png 100.00% <ø> (ø)
ts/features/design-system/core/DSCards.tsx 53.33% <ø> (-13.34%) ⬇️
ts/features/itwallet/analytics/index.ts 30.23% <ø> (ø)
...s/itwallet/common/components/ItwCredentialCard.tsx 100.00% <100.00%> (ø)
...twallet/common/components/ItwEidLifecycleAlert.tsx 90.00% <100.00%> (ø)
...twallet/common/components/ItwWalletReadyBanner.tsx 90.00% <100.00%> (ø)
...s/features/itwallet/common/utils/itwClaimsUtils.ts 96.66% <100.00%> (ø)
...tation/components/ItwPresentationClaimsSection.tsx 95.45% <100.00%> (ø)
... and 10 more

... and 1424 files with indirect coverage changes


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 f620db4...f8ba531. Read the comment docs.

@gispada gispada marked this pull request as ready for review October 31, 2024 13:38
Base automatically changed from SIW-1780-credential-status-error-during-issuance to master October 31, 2024 16:29
Copy link

dpulls bot commented Oct 31, 2024

🎉 All dependencies have been resolved !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants