Skip to content

[PN-18165] refactor handle deliverFailureCause RIR #241

Open
DacunzoMa wants to merge 3 commits intofeature/PN-15211from
feature/PN-18165
Open

[PN-18165] refactor handle deliverFailureCause RIR #241
DacunzoMa wants to merge 3 commits intofeature/PN-15211from
feature/PN-18165

Conversation

@DacunzoMa
Copy link
Collaborator

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

1 participant