Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

[#176924316] Add Start EYCA activation api #20

Merged
merged 19 commits into from
Feb 23, 2021

Conversation

AleDore
Copy link
Contributor

@AleDore AleDore commented Feb 16, 2021

List of Changes

  • Add startEycaActivation API
  • Refactor orchestrator utilities in order to check concurrent running orchestrators both for EYCA Card and CGN

Motivation and Context

While a citizen requests for a CGN and he's between 18 up to 30 years old, he wants also activate an EYCA card ( CGN and EYCA are co-badged ), but in case of something goes wrong in EYCA activation, it must be possible to call directly EYCA activation from APP ( user retries ). Please Note that an EYCA activation process could not start if the user does not have already an ACTIVATED CGN.

How Has This Been Tested?

It has been tested by performing unit tests and integration test.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@pagopa-github-bot
Copy link
Contributor

pagopa-github-bot commented Feb 16, 2021

Warnings
⚠️ This PR changes a total of 1314 LOCs, that is more than a reasonable size of 250. Consider splitting the pull request into smaller ones.

Affected stories

  • 🌟 #176924316: Come Giovane, voglio poter riprovare l' accreditamento sul circuito EYCA, in modo da poterla rilanciare qualora vada in errore

Generated by 🚫 dangerJS against fcb41c5

@codecov
Copy link

codecov bot commented Feb 16, 2021

Codecov Report

Merging #20 (fcb41c5) into master (4ea5745) will increase coverage by 0.74%.
The diff coverage is 86.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
+ Coverage   81.01%   81.76%   +0.74%     
==========================================
  Files          32       35       +3     
  Lines         864     1020     +156     
  Branches       99      122      +23     
==========================================
+ Hits          700      834     +134     
- Misses        159      179      +20     
- Partials        5        7       +2     
Impacted Files Coverage Δ
UpdateCgnOrchestrator/index.ts 72.36% <75.00%> (+0.36%) ⬆️
GetEycaStatus/handler.ts 80.00% <80.00%> (ø)
GetEycaActivation/handler.ts 85.71% <85.71%> (ø)
StartEycaActivation/handler.ts 86.66% <86.66%> (ø)
ContinueEycaActivation/index.ts 100.00% <100.00%> (ø)
GetCgnStatus/handler.ts 80.00% <100.00%> (-0.96%) ⬇️
StartCgnActivation/handler.ts 78.20% <100.00%> (-0.28%) ⬇️
UpsertCgnStatus/handler.ts 83.67% <100.00%> (ø)
utils/models.ts 66.66% <100.00%> (+9.52%) ⬆️
utils/orchestrators.ts 80.85% <100.00%> (+0.41%) ⬆️
... and 3 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 70778e0...fcb41c5. Read the comment docs.

@AleDore AleDore changed the base branch from 176782168_add_eyca_async_activation to master February 16, 2021 15:25
Copy link

@BurnedMarshal BurnedMarshal left a comment

Choose a reason for hiding this comment

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

The review is ongoing. Part 1

StartEycaActivation/handler.ts Outdated Show resolved Hide resolved
StartEycaActivation/handler.ts Outdated Show resolved Hide resolved
// if orchestrator is running we return an Accepted Response
// otherwise we assume the orchestrator is in error or
// it has been canceled so we can try to start a new activation process
mapOrchestratorStatus(_).map(() => fiscalCode)

Choose a reason for hiding this comment

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

We are ignoring here the right value of the chain (always fiscalcode), can we pass void 0 instead to avoid confusion?

Comment on lines +76 to +78
return taskEither.of(
ResponseErrorInternal("Cannot recognize the orchestrator status")
);

Choose a reason for hiding this comment

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

I don't understand the purpose of this return.

Copy link
Contributor Author

@AleDore AleDore Feb 18, 2021

Choose a reason for hiding this comment

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

Since the activation orchestrator will run until a final status is reached, if its status is not running or pending the card has been already updated (and we check card status at the top of the chain), so other statuses makes no sense and we will return an Internal Error (it should never happens). Let's keep in mind that another PR will add a specific mapping for error status that now seems to miss :)

Comment on lines 150 to 151
maybeUserEycaCard.foldL(
() => taskEither.of(void 0),
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
maybeUserEycaCard.foldL(
() => taskEither.of(void 0),
maybeUserEycaCard.fold(
taskEither.of(void 0),

@AleDore AleDore requested a review from balanza February 22, 2021 10:29
@AleDore
Copy link
Contributor Author

AleDore commented Feb 22, 2021

Can we merge @balanza @BurnedMarshal ?

@AleDore AleDore merged commit 197eec9 into master Feb 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants