[PN-18165] refactor handle deliverFailureCause RIR #241
Open
DacunzoMa wants to merge 3 commits intofeature/PN-15211from
Open
[PN-18165] refactor handle deliverFailureCause RIR #241DacunzoMa wants to merge 3 commits intofeature/PN-15211from
DacunzoMa wants to merge 3 commits intofeature/PN-15211from
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the handling of delivery failure causes for RIR (Registered International Returns) events, specifically focusing on the RECRI004A and RECRI004C event codes. The main change is that RECRI004A now accepts specific failure cause codes (M01-M09) instead of skipping validation, and RECRI004C's final status is now determined dynamically based on the failure cause propagated from RECRI004A.
Changes:
- Updated RECRI004A to validate against specific delivery failure causes (M01-M09) instead of using SKIP_VALIDATION
- Added specialized validation logic in SequenceValidatorRir to handle RECRI004A failure cause validation
- Implemented custom final event building logic in FinalEventBuilderRir to dynamically determine RECRI004C status based on failure cause
- Refactored GenericSequenceValidator methods to be protected to enable inheritance-based customization
- Updated tests to reflect new behavior where RECRI004C includes delivery failure cause information
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java | Changed RECRI004A from SKIP_VALIDATION to specific failure cause list (M01-M09) |
| src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java | Added override to provide custom validation logic for RECRI004A delivery failure causes |
| src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidator.java | Refactored validation methods to protected visibility and extracted single-event validation |
| src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java | Implemented custom execute method to dynamically determine RECRI004C status based on failure cause |
| src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRirTest.java | Added test cases for RECRI004A validation with valid, invalid, and missing failure causes |
| src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java | Added test for RECRI004C final event building, removed unused mock |
| src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlerFactoryRirIT.java | Updated integration test assertions to expect delivery failure cause in RECRI004C events |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java
Show resolved
Hide resolved
src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java
Show resolved
Hide resolved
src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java
Outdated
Show resolved
Hide resolved
src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java
Show resolved
Hide resolved
src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java
Outdated
Show resolved
Hide resolved
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.