From d58a0e6767c042166711b6b35b5c0ab22a636421 Mon Sep 17 00:00:00 2001 From: Omur Sahin Date: Thu, 8 Oct 2026 20:28:38 +0300 Subject: [PATCH] pn-paper-tracker source code --- .../cs/rest/pn-paper-tracker/.gitignore | 49 + .../cs/rest/pn-paper-tracker/CODEOWNERS | 5 + jdk_21_maven/cs/rest/pn-paper-tracker/LICENSE | 274 + .../cs/rest/pn-paper-tracker/README.md | 133 + .../config/application.properties | 84 + .../pn-paper-tracker/config/logback-local.xml | 12 + .../docs/asyncapi/external-datalake-v1.yaml | 144 + .../docs/asyncapi/internal-datalake-v1.yaml | 88 + .../docs/ms/ArchitetturaInterna.md | 148 + .../docs/openapi/api-internal-v1.yaml | 709 +++ .../external-channel/pn-external-channel.yaml | 468 ++ .../external-channel/schemas-digital-v1.yaml | 233 + .../external-channel/schemas-paper-v1.yaml | 423 ++ .../schemas-pn-errors-v1.yaml | 61 + .../docs/openapi/remote-refs.yaml | 38 + .../index.js | 8 + .../package-lock.json | 5620 +++++++++++++++++ .../package.json | 37 + .../src/app/dynamo.js | 102 + .../src/app/eventHandler.js | 140 + .../src/app/log.js | 27 + .../src/app/sqs.js | 52 + .../src/app/utils.js | 95 + .../src/test/dynamo.test.js | 92 + .../src/test/eventHandler.test.js | 439 ++ .../src/test/sqs.test.js | 79 + .../src/test/utils.test.js | 169 + .../cs/rest/pn-paper-tracker/lombok.config | 2 + jdk_21_maven/cs/rest/pn-paper-tracker/mvnw | 310 + .../cs/rest/pn-paper-tracker/mvnw.cmd | 182 + jdk_21_maven/cs/rest/pn-paper-tracker/pom.xml | 440 ++ .../scripts/aws/cfn/application-dev.env | 93 + .../scripts/aws/cfn/data-quality-dev-cfg.json | 6 + .../scripts/aws/cfn/data-quality.yml | 170 + .../scripts/aws/cfn/microservice-dev-cfg.json | 23 + .../scripts/aws/cfn/microservice.yml | 998 +++ .../scripts/aws/cfn/storage.yml | 251 + .../papertracker/PaperTrackerApplication.java | 14 + .../config/PnPaperTrackerConfigs.java | 102 + .../config/TrackerConfigUtils.java | 353 ++ .../msclient/DataVaultClientConfigurator.java | 25 + .../PaperChannelClientConfigurator.java | 25 + .../SafeStorageClientConfigurator.java | 25 + .../springbootcfg/AwsConfigsActivation.java | 10 + .../AwsServicesClientsConfigActivation.java | 14 + .../ClientAspectLoggingActivation.java | 8 + .../springbootcfg/MDCTraceIdWebFilter.java | 10 + .../PnErrorWebExceptionHandlerActivation.java | 17 + ...ponseEntityExceptionHandlerActivation.java | 14 + .../ServerAspectLoggingActivation.java | 8 + .../SpringAnalyzerActivation.java | 24 + .../SpringAnalyzerClientConfig.java | 7 + .../springbootcfg/SqsTracingConfig.java | 35 + .../exception/ConfigNotFound.java | 11 + .../exception/PaperTrackerException.java | 12 + .../PaperTrackerExceptionHandler.java | 73 + .../PnPaperTrackerBadRequestException.java | 13 + .../PnPaperTrackerConflictException.java | 11 + .../PnPaperTrackerNotFoundException.java | 11 + .../PnPaperTrackerValidationException.java | 15 + .../PaperProgressStatusEventMapper.java | 97 + .../PaperTrackerDryRunOutputsMapper.java | 56 + .../mapper/PaperTrackerMapStructMapper.java | 75 + .../mapper/PaperTrackingsErrorsMapper.java | 44 + .../mapper/PaperTrackingsMapper.java | 105 + .../papertracker/mapper/SendEventMapper.java | 153 + .../dao/PaperTrackerDryRunOutputsDAO.java | 12 + .../middleware/dao/PaperTrackingsDAO.java | 25 + .../dao/PaperTrackingsErrorsDAO.java | 13 + .../dynamo/AdditionalDetailsConverter.java | 95 + .../middleware/dao/dynamo/BaseDao.java | 184 + .../PaperTrackerDryRunOutputsDAOImpl.java | 35 + .../dao/dynamo/PaperTrackingsDAOImpl.java | 206 + .../dynamo/PaperTrackingsErrorsDAOImpl.java | 53 + .../dao/dynamo/entity/Attachment.java | 43 + .../dao/dynamo/entity/BusinessState.java | 12 + .../dao/dynamo/entity/ErrorCategory.java | 36 + .../dao/dynamo/entity/ErrorCause.java | 25 + .../dao/dynamo/entity/ErrorDetails.java | 26 + .../dao/dynamo/entity/ErrorType.java | 9 + .../middleware/dao/dynamo/entity/Event.java | 83 + .../dao/dynamo/entity/FlowThrow.java | 15 + .../dao/dynamo/entity/OcrRequest.java | 42 + .../dao/dynamo/entity/PaperStatus.java | 53 + .../entity/PaperTrackerDryRunOutputs.java | 61 + .../dao/dynamo/entity/PaperTrackings.java | 119 + .../dynamo/entity/PaperTrackingsErrors.java | 70 + .../dynamo/entity/PaperTrackingsState.java | 10 + .../dao/dynamo/entity/ProcessingMode.java | 6 + .../dao/dynamo/entity/ProductType.java | 37 + .../dao/dynamo/entity/ValidationConfig.java | 56 + .../dao/dynamo/entity/ValidationFlow.java | 40 + .../eventBridge/EventBridgePublisher.java | 45 + .../middleware/msclient/DataVaultClient.java | 12 + .../msclient/PaperChannelClient.java | 10 + .../msclient/SafeStorageClient.java | 8 + .../msclient/impl/DataVaultClientImpl.java | 46 + .../msclient/impl/PaperChannelClientImpl.java | 44 + .../msclient/impl/SafeStorageClientImpl.java | 59 + .../PnPaperTrackerMiddlewareConfigs.java | 58 + .../queue/consumer/PnEventInboundService.java | 93 + .../internal/ExternalChannelHandler.java | 92 + .../ExternalChannelSourceEventsHandler.java | 70 + .../consumer/internal/OcrEventHandler.java | 60 + .../queue/model/CustomEventHeader.java | 22 + .../queue/model/DeliveryPushEvent.java | 20 + .../queue/model/ExternalChannelEvent.java | 18 + .../model/ExternalChannelEventHeader.java | 20 + .../middleware/queue/model/OcrEvent.java | 23 + .../ExternalChannelOutputsMomProducer.java | 16 + ...hannelToPaperChannelDryRunMomProducer.java | 30 + ...ernalChannelToPaperTrackerMomProducer.java | 31 + .../queue/producer/OcrMomProducer.java | 16 + .../model/DeliveryFailureCauseEnum.java | 41 + .../papertracker/model/DocumentTypeEnum.java | 30 + .../pn/papertracker/model/EventStatus.java | 17 + .../model/EventStatusCodeEnum.java | 168 + .../pn/papertracker/model/EventTypeEnum.java | 13 + .../pn/papertracker/model/FileType.java | 24 + .../pn/papertracker/model/HandlerContext.java | 30 + .../pn/papertracker/model/OcrStatusEnum.java | 7 + .../pn/papertracker/model/OriginType.java | 7 + .../model/PredictedRefinementType.java | 6 + .../pn/papertracker/model/SourceType.java | 7 + .../model/sequence/DateValidationGroup.java | 42 + .../sequence/RequiredSequenceStatusCodes.java | 48 + .../model/sequence/SequenceAttachments.java | 52 + .../model/sequence/SequenceConfig.java | 13 + .../model/sequence/SequenceConfiguration.java | 90 + .../rest/NotificationReworkController.java | 31 + .../rest/PaperTrackerErrorController.java | 27 + .../rest/PaperTrackerOutputController.java | 27 + .../rest/PaperTrackerTrackingController.java | 53 + .../service/NotificationReworkService.java | 12 + .../service/PaperTrackerErrorService.java | 14 + .../service/PaperTrackerOutputService.java | 10 + .../service/PaperTrackerTrackingService.java | 19 + .../service/SourceQueueProxyService.java | 13 + .../handler_step/AR/DematValidatorAr.java | 17 + .../handler_step/AR/FinalEventBuilderAr.java | 260 + .../handler_step/AR/HandlersFactoryAr.java | 46 + .../handler_step/AR/SequenceValidatorAr.java | 17 + .../service/handler_step/Handler.java | 8 + .../service/handler_step/HandlerImpl.java | 35 + .../service/handler_step/HandlerStep.java | 8 + .../service/handler_step/HandlersFactory.java | 14 + .../handler_step/RIR/DematValidatorRir.java | 17 + .../RIR/FinalEventBuilderRir.java | 61 + .../handler_step/RIR/HandlersFactoryRir.java | 47 + .../RIR/SequenceValidatorRir.java | 61 + .../handler_step/RIS/DematValidatorRis.java | 31 + .../RIS/FinalEventBuilderRis.java | 17 + .../handler_step/RIS/HandlersFactoryRis.java | 44 + .../RIS/SequenceValidatorRis.java | 17 + .../handler_step/RS/DematValidatorRs.java | 33 + .../handler_step/RS/FinalEventBuilderRs.java | 17 + .../handler_step/RS/HandlersFactoryRs.java | 44 + .../handler_step/RS/SequenceValidatorRs.java | 17 + .../handler_step/_890/DematValidator890.java | 17 + .../_890/FinalEventBuilder890.java | 52 + .../handler_step/_890/HandlersFactory890.java | 121 + .../_890/PendingFinalEventTrigger.java | 34 + .../_890/RECAG012EventBuilder.java | 182 + .../_890/RECAG012EventChecker.java | 117 + .../_890/SequenceValidator890.java | 127 + .../generic/AbstractHandlersFactory.java | 224 + .../generic/CheckOcrResponse.java | 162 + .../generic/CheckTrackingProduct.java | 70 + .../generic/CheckTrackingState.java | 79 + .../generic/DuplicatedEventFiltering.java | 167 + .../generic/GenericDematValidator.java | 144 + .../generic/GenericFinalEventBuilder.java | 89 + .../generic/GenericSequenceValidator.java | 556 ++ .../generic/HandlersRegistry.java | 27 + .../generic/IntermediateEventsBuilder.java | 30 + .../handler_step/generic/M10RetryTrigger.java | 79 + .../generic/MetadataUpserter.java | 78 + .../generic/NotRetryableErrorInserting.java | 46 + .../generic/OutputTargetSender.java | 113 + .../handler_step/generic/PcRetryService.java | 64 + .../handler_step/generic/RetrySender.java | 40 + .../generic/RetrySenderCON996.java | 31 + .../generic/UnrecognizedEventHandler.java | 23 + .../impl/NotificationReworkServiceImpl.java | 92 + .../impl/PaperTrackerErrorServiceImpl.java | 56 + .../impl/PaperTrackerOutputServiceImpl.java | 40 + .../impl/PaperTrackerTrackingServiceImpl.java | 71 + .../impl/SourceQueueProxyServiceImpl.java | 201 + .../utils/AttachmentsConfigUtils.java | 39 + .../pn/papertracker/utils/LogUtility.java | 139 + .../pn/papertracker/utils/MetricUtils.java | 55 + .../pn/papertracker/utils/OcrUtility.java | 254 + .../papertracker/utils/PcRetryUtilsMock.java | 60 + .../pn/papertracker/utils/QueueConst.java | 12 + .../pn/papertracker/utils/TrackerUtility.java | 378 ++ .../src/main/resources/application.properties | 8 + .../pn-paper-tracker/src/test/java/.gitkeep | 0 .../it/pagopa/pn/papertracker/BaseTest.java | 26 + .../pn/papertracker/LocalStackTestConfig.java | 61 + .../papertracker/TrackerConfigUtilsTest.java | 406 ++ .../config/PnPaperTrackerConfigsTest.java | 57 + .../PaperTrackerExceptionHandlerTest.java | 121 + .../papertracker/it/AR/AbstractARTestIT.java | 157 + .../it/AR/DryAROcrDisableTestIT.java | 51 + .../papertracker/it/AR/DryAROcrDryTestIT.java | 55 + .../papertracker/it/AR/DryAROcrRunTestIT.java | 55 + .../papertracker/it/AR/TestCaseHandlerAR.java | 26 + .../it/GenericTestCaseHandler.java | 19 + .../it/GenericTestCaseHandlerImpl.java | 322 + .../it/RIR/DryRIROcrDisableTestIT.java | 77 + .../it/RIR/TestCaseHandlerRIR.java | 25 + .../it/RIS/DryRISOcrDisableTestIT.java | 75 + .../it/RIS/TestCaseHandlerRIS.java | 26 + .../papertracker/it/RS/AbstractRSTestIT.java | 129 + .../it/RS/DryRSOcrDisableTestIT.java | 76 + .../papertracker/it/RS/DryRSOcrDryTestIT.java | 69 + .../papertracker/it/RS/DryRSOcrRunTestIT.java | 68 + .../papertracker/it/RS/TestCaseHandlerRS.java | 26 + .../pn/papertracker/it/SequenceLoader.java | 46 + .../pn/papertracker/it/SequenceRunner.java | 67 + .../it/_890/Abstract890TestIT.java | 124 + .../it/_890/Dry890OcrDisableStrictTestIT.java | 53 + .../it/_890/Dry890OcrDisableTestIT.java | 54 + .../it/_890/Dry890OcrDryStrictTestIT.java | 57 + .../it/_890/Dry890OcrDryTestIT.java | 56 + .../it/_890/Dry890OcrRunStrictTestIT.java | 56 + .../it/_890/Dry890OcrRunTestIT.java | 55 + .../it/_890/TestCaseHandler890.java | 24 + .../pn/papertracker/it/model/Expected.java | 22 + .../it/model/ProductTestCase.java | 22 + .../pn/papertracker/it/model/TestEvent.java | 11 + .../it/validator/ErrorValidator.java | 73 + .../it/validator/OutputValidator.java | 182 + .../it/validator/TrackingValidator.java | 315 + .../PaperTrackerDryRunOutputsMapperTest.java | 59 + .../mapper/PaperTrackingsMapperTest.java | 547 ++ .../mapper/SendEventMapperTest.java | 71 + .../PaperTrackerDryRunOutputsDaoIT.java | 109 + .../dao/dynamo/PaperTrackingsDaoIT.java | 242 + .../dao/dynamo/PaperTrackingsErrorsDaoIT.java | 83 + .../eventBridge/EventBridgePublisherTest.java | 84 + .../consumer/PnEventInboundServiceTest.java | 93 + .../internal/ExternalChannelHandlerTest.java | 159 + ...xternalChannelSourceEventsHandlerTest.java | 111 + .../internal/OcrEventHandlerTest.java | 78 + .../NotificationReworkControllerTest.java | 100 + .../rest/PaperTrackerErrorControllerTest.java | 68 + .../PaperTrackerOutputControllerTest.java | 67 + .../PaperTrackerTrackingControllerTest.java | 168 + .../AR/FinalEventBuilderArTest.java | 258 + .../AR/HandlersFactoryArTest.java | 322 + .../AR/RECRN003CMessageHandlerTest.java | 185 + .../AR/RECRN004CMessageHandlerTest.java | 184 + .../AR/RECRN005CMessageHandlerTest.java | 257 + .../RECRN00XCAbstractMessageHandlerTest.java | 419 ++ .../AR/SequenceValidatorArTest.java | 714 +++ .../RIR/FinalEventBuilderRirTest.java | 205 + .../RIR/HandlersFactoryRirTest.java | 270 + .../RIR/SequenceValidatorRirTest.java | 346 + .../RIS/DematValidatorRisTest.java | 66 + .../RIS/HandlersFactoryRisTest.java | 144 + .../handler_step/RS/DematValidatorRsTest.java | 76 + .../RS/HandlersFactoryRsTest.java | 144 + .../service/handler_step/TestUtils.java | 249 + .../_890/FinalEventBuilder890Test.java | 197 + .../_890/HandlersFactory890Test.java | 194 + .../_890/RECAG012EventBuilderTest.java | 467 ++ .../_890/RECAG012EventCheckerTest.java | 458 ++ .../_890/SequenceValidator890Test.java | 286 + .../generic/CheckOcrResponseTest.java | 119 + .../generic/CheckTrackingProductTest.java | 118 + .../generic/CheckTrackingStateTest.java | 142 + .../generic/DuplicatedEventFilteringTest.java | 236 + .../generic/GenericDematValidatorTest.java | 293 + .../generic/GenericFinalEventBuilderTest.java | 134 + .../generic/GenericSequenceValidatorTest.java | 201 + .../IntermediateEventsBuilderTest.java | 63 + .../generic/M10RetryTriggerTest.java | 143 + .../generic/MetadataUpserterTest.java | 137 + .../generic/OutputTargetSenderTest.java | 203 + .../generic/PcRetryServiceTest.java | 123 + .../generic/RetrySenderCon996Test.java | 112 + .../handler_step/generic/RetrySenderTest.java | 115 + .../NotificationReworkServiceImplTest.java | 353 ++ .../PaperTrackerErrorServiceImplTest.java | 152 + .../PaperTrackerOutputServiceImplTest.java | 136 + .../PaperTrackerTrackingServiceImplTest.java | 287 + .../impl/SourceQueueProxyServiceImplTest.java | 482 ++ .../pn/papertracker/utils/LogUtilityTest.java | 212 + .../papertracker/utils/MetricUtilsTest.java | 54 + .../pn/papertracker/utils/OcrUtilityTest.java | 315 + .../utils/PcRetryUtilsMockTest.java | 158 + .../utils/TrackerUtilityTest.java | 133 + .../src/test/resources/.gitkeep | 0 .../resources/application.test-IT.properties | 67 + .../test/resources/testcase/AR/fail_ar.json | 120 + .../test/resources/testcase/AR/fail_ar_2.json | 124 + .../AR/fail_compiuta_giacenza_ar.json | 153 + .../AR/fail_compiuta_giacenza_pnrn_ar.json | 138 + .../AR/fail_con996_pcretry_furto_ar.json | 194 + .../testcase/AR/fail_discovery_ar.json | 126 + .../testcase/AR/fail_giacenza_ar.json | 137 + .../testcase/AR/fail_giacenza_pnrn_ar.json | 138 + .../testcase/AR/fail_irreperibile_ar.json | 124 + .../disable/fail_compiuta_giacenza_ar_2.json | 160 + .../run/fail_compiuta_giacenza_ar_2_KO.json | 163 + .../run/fail_compiuta_giacenza_ar_2_OK.json | 237 + .../run/ok_ar_duplicate_ocr_response.json | 148 + .../run/ok_ar_ocr_pending.json | 124 + .../testcase/AR/not_retryable_event.json | 76 + .../src/test/resources/testcase/AR/ok_ar.json | 130 + .../testcase/AR/ok_ar_dematAfterDone.json | 140 + .../testcase/AR/ok_ar_duplicate_event.json | 147 + .../AR/ok_ar_sourceType_originType.json | 98 + .../test/resources/testcase/AR/ok_ar_zip.json | 91 + .../AR/ok_causa_forza_maggiore_ar.json | 142 + .../resources/testcase/AR/ok_giacenza_ar.json | 136 + .../testcase/AR/ok_giacenza_pnrn_ar.json | 150 + .../testcase/AR/ok_non_rendicontabile_ar.json | 168 + .../resources/testcase/AR/ok_retry_ar.json | 276 + .../resources/testcase/AR/ok_retry_ar_2.json | 180 + .../testcase/AR/ok_retry_m10_ar.json | 628 ++ .../fail_ar_m10_delivery.json | 103 + .../AR/validation_error/ok_ar_bad_event.json | 132 + .../ok_ar_empty_deliveryfailurecause.json | 102 + .../ok_ar_empty_registeredlettecode.json | 100 + .../ok_ar_event_other_product.json | 180 + .../ok_ar_inconsistent-state.json | 160 + .../ok_ar_invalid_datetime.json | 113 + .../validation_error/ok_ar_no_attachment.json | 105 + .../AR/validation_error/ok_ar_no_eventB.json | 78 + .../validation_error/ok_ar_not_ordered.json | 126 + ...k_ar_notexpected_deliveryfailurecause.json | 104 + .../validation_error/ok_ar_timestamp_err.json | 169 + .../ok_ar_unespected_demat.json | 106 + .../ok_invalid_registeredlettecode.json | 113 + .../RIR/fail_con996_pcretry_furto_rir.json | 173 + .../resources/testcase/RIR/fail_rir_KO_1.json | 105 + .../resources/testcase/RIR/fail_rir_KO_2.json | 104 + .../resources/testcase/RIR/fail_rir_OK.json | 105 + .../testcase/RIR/ok_pcretry_con996_rir.json | 127 + .../testcase/RIR/ok_retry_m10_rir.json | 698 ++ .../resources/testcase/RIR/ok_retry_rir.json | 147 + .../test/resources/testcase/RIR/ok_rir.json | 100 + ...il_rir_no_equals_deliveryfailurecause.json | 117 + .../ok_rir_duplicate_event.json | 121 + .../ok_rir_empty_registeredlettecode.json | 110 + .../ok_rir_event_not_expected.json | 104 + .../ok_rir_event_other_product.json | 152 + .../ok_rir_invalid_datetime.json | 119 + .../ok_rir_invalid_registeredlettecode.json | 126 + .../ok_rir_no_attachment.json | 104 + .../RIR/validation_error/ok_rir_no_demat.json | 83 + .../validation_error/ok_rir_not_ordered.json | 99 + ..._rir_notexpected_deliveryfailurecause.json | 107 + .../ok_rir_timestamp_err.json | 118 + .../ok_rir_unespected_demat.json | 119 + .../test/resources/testcase/RIS/fail_ris.json | 98 + .../testcase/RIS/ok_retry_m10_ris.json | 499 ++ .../resources/testcase/RIS/ok_retry_ris.json | 121 + .../test/resources/testcase/RIS/ok_ris.json | 83 + .../fail_ris_deliveryfailurecause.json | 95 + .../fail_ris_duplicate_event.json | 119 + .../fail_ris_empty_registeredlettecode.json | 108 + .../fail_ris_event_other_product.json | 150 + .../fail_ris_invalid_datetime.json | 117 + .../fail_ris_invalid_registeredlettecode.json | 124 + .../fail_ris_no_attachment.json | 102 + .../validation_error/fail_ris_no_demat.json | 81 + .../fail_ris_not_ordered.json | 97 + .../fail_ris_timestamp_err.json | 122 + .../fail_ris_unespected_demat.json | 117 + .../testcase/RS/fail_deceduto_rs.json | 129 + .../RS/fail_irreperibile_assoluto_rs.json | 128 + .../RS/fail_mancata_consegna_giacenza.json | 140 + .../test/resources/testcase/RS/fail_rs.json | 128 + .../RS/ok_causa_forza_maggiore_rs.json | 93 + .../testcase/RS/ok_compiuta_giacenza_rs.json | 140 + .../testcase/RS/ok_non_rendicontabile_rs.json | 119 + .../testcase/RS/ok_retry_m10_rs.json | 437 ++ .../resources/testcase/RS/ok_retry_rs.json | 113 + .../src/test/resources/testcase/RS/ok_rs.json | 73 + ...ail_rs_no_equals_deliveryfailurecause.json | 108 + ..._consegna_giacenza_rs_duplicate_event.json | 156 + ...giacenza_rs_empty_registeredlettecode.json | 110 + ...nsegna_giacenza_rs_event_not_expected.json | 139 + ...segna_giacenza_rs_event_other_product.json | 187 + ...consegna_giacenza_rs_invalid_datetime.json | 119 + ...acenza_rs_invalid_registeredlettecode.json | 125 + ...ta_consegna_giacenza_rs_no_attachment.json | 104 + ...mancata_consegna_giacenza_rs_no_demat.json | 83 + ...cata_consegna_giacenza_rs_not_ordered.json | 134 + ...a_rs_notexpected_deliveryfailurecause.json | 109 + ...ta_consegna_giacenza_rs_timestamp_err.json | 159 + ...consegna_giacenza_rs_unespected_demat.json | 119 + .../resources/testcase/_890/fail_890.json | 121 + .../testcase/_890/fail_discovery_890.json | 137 + .../_890/fail_discovery_irreperibile_890.json | 138 + .../_890/fail_evento_inesistente_890.json | 90 + .../_890/fail_indirizzo_inesatto_890.json | 121 + .../testcase/_890/fail_irreperibile_890.json | 137 + .../giacenza/fail_giacenza_gt10_23L_890.json | 150 + .../_890/giacenza/fail_giacenza_gt10_890.json | 150 + .../giacenza/fail_giacenza_lte10_890.json | 150 + ...acenza_890_empty_registeredlettercode.json | 186 + ...nza_890_empty_registeredlettercode_KO.json | 155 + ...nza_890_empty_registeredlettercode_OK.json | 225 + .../run/ok_890_duplicate_ocr_response.json | 148 + .../run/ok_890_ocr_pending.json | 125 + .../giacenza/ok_compiuta_giacenza_890.json | 150 + .../ok_compiuta_giacenza_890_RECAG010A.json | 157 + .../_890/giacenza/ok_giacenza-gt10_890.json | 143 + .../giacenza/ok_giacenza_cad_lte10_890.json | 143 + .../ok_giacenza_delegato_gt10_23L_890.json | 149 + .../ok_giacenza_delegato_gt10_890.json | 143 + .../ok_giacenza_delegato_gt10_890_zip.json | 109 + .../ok_giacenza_delegato_lte10_890.json | 143 + .../giacenza/ok_giacenza_gt10_23L_890.json | 149 + .../_890/giacenza/ok_giacenza_lte10_890.json | 143 + .../testcase/_890/giacenza/ok_rec008_890.json | 149 + .../_890/giacenza/ok_rec008_890_e.json | 155 + ...piuta_giacenza_890_invalid_attachment.json | 183 + .../compiuta_giacenza_890_no_attachment.json | 166 + .../fail_giacenza_890_invalid_attachment.json | 181 + .../fail_giacenza_890_no_attachment.json | 164 + .../fail_giacenza_lte10_890_no_23L.json | 121 + ...acenza_lte10_890_no_23L_duplicate_012.json | 127 + ...iacenza_lte10_890_no_23L_multiple_012.json | 142 + ...enza_890_RECAG012_registeredlettecode.json | 143 + .../ok_giacenza_890_invalid_attachment.json | 176 + .../ok_giacenza_890_invalid_datetime.json | 177 + ...cenza_890_invalid_registeredlettecode.json | 184 + .../ok_giacenza_890_more_error.json | 220 + .../ok_giacenza_890_no_RECAG012.json | 110 + .../ok_giacenza_890_no_attachment.json | 159 + ...cenza_delegato_890_invalid_attachment.json | 176 + ...k_giacenza_delegato_890_no_attachment.json | 159 + .../testcase/_890/not_retryable_event.json | 76 + .../test/resources/testcase/_890/ok_890.json | 125 + .../testcase/_890/ok_890_duplicate_event.json | 147 + .../_890/ok_890_sourceType_originType.json | 92 + .../_890/ok_causa_forzamaggiore_890.json | 126 + .../_890/ok_duplicate_final_event.json | 148 + .../_890/ok_nonrendicontabile_890.json | 155 + .../_890/ok_persona_abilitata_890.json | 125 + .../resources/testcase/_890/ok_retry_890.json | 197 + .../testcase/_890/ok_retry_m10_890.json | 657 ++ .../_890/ok_two_different_final_event.json | 148 + .../fail_890_empty_deliveryfailurecause.json | 104 + .../validation_error/ok_890_bad_event.json | 131 + .../ok_890_empty_registeredlettecode.json | 107 + .../ok_890_event_other_product.json | 178 + .../ok_890_invalid_datetime.json | 115 + .../ok_890_invalid_deliveryfailurecause.json | 112 + .../ok_890_invalid_registeredlettecode.json | 115 + .../ok_890_no_attachment.json | 102 + .../validation_error/ok_890_no_eventB.json | 79 + .../validation_error/ok_890_not_ordered.json | 125 + ..._890_notexpected_deliveryfailurecause.json | 107 + .../ok_890_timestamp_err.json | 172 + .../ok_890_unespected_demat.json | 108 + .../testcase/rework/ok_ar_rework.json | 113 + .../test/resources/testcontainers/credentials | 4 + .../src/test/resources/testcontainers/init.sh | 82 + 464 files changed, 60997 insertions(+) create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/.gitignore create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/CODEOWNERS create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/LICENSE create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/README.md create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/config/application.properties create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/config/logback-local.xml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/external-datalake-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/internal-datalake-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/ms/ArchitetturaInterna.md create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/api-internal-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/pn-external-channel.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-digital-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-paper-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-pn-errors-v1.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/remote-refs.yaml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/index.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package-lock.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/dynamo.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/eventHandler.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/log.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/sqs.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/utils.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/dynamo.test.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/eventHandler.test.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/sqs.test.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/utils.test.js create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/lombok.config create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/mvnw create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/mvnw.cmd create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/pom.xml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/application-dev.env create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality-dev-cfg.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality.yml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice-dev-cfg.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice.yml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/storage.yml create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/PaperTrackerApplication.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/TrackerConfigUtils.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/DataVaultClientConfigurator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/PaperChannelClientConfigurator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/SafeStorageClientConfigurator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsConfigsActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsServicesClientsConfigActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ClientAspectLoggingActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/MDCTraceIdWebFilter.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnErrorWebExceptionHandlerActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnResponseEntityExceptionHandlerActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ServerAspectLoggingActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerActivation.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerClientConfig.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SqsTracingConfig.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/ConfigNotFound.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerException.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerBadRequestException.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerConflictException.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerNotFoundException.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerValidationException.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperProgressStatusEventMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerMapStructMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsErrorsMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/SendEventMapper.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackerDryRunOutputsDAO.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsDAO.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsErrorsDAO.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/AdditionalDetailsConverter.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/BaseDao.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDAOImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDAOImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDAOImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Attachment.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/BusinessState.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCategory.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCause.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorDetails.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Event.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/FlowThrow.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/OcrRequest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperStatus.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackerDryRunOutputs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackings.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsErrors.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsState.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProcessingMode.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProductType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationConfig.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationFlow.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisher.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/DataVaultClient.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/PaperChannelClient.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/SafeStorageClient.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/DataVaultClientImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/PaperChannelClientImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/SafeStorageClientImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/PnPaperTrackerMiddlewareConfigs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/CustomEventHeader.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/DeliveryPushEvent.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEvent.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEventHeader.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/OcrEvent.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelOutputsMomProducer.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperChannelDryRunMomProducer.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperTrackerMomProducer.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/OcrMomProducer.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DeliveryFailureCauseEnum.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DocumentTypeEnum.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatus.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventTypeEnum.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/FileType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/HandlerContext.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OcrStatusEnum.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OriginType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/PredictedRefinementType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/SourceType.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/DateValidationGroup.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/RequiredSequenceStatusCodes.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceAttachments.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfig.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfiguration.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/NotificationReworkController.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorController.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputController.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingController.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/NotificationReworkService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerErrorService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerOutputService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerTrackingService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/SourceQueueProxyService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/DematValidatorAr.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderAr.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryAr.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorAr.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/Handler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerStep.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlersFactory.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/DematValidatorRir.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRir.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRis.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/FinalEventBuilderRis.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRis.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/SequenceValidatorRis.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/FinalEventBuilderRs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/SequenceValidatorRs.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/DematValidator890.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/PendingFinalEventTrigger.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilder.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventChecker.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/AbstractHandlersFactory.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponse.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProduct.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingState.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFiltering.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericDematValidator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilder.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/HandlersRegistry.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilder.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTrigger.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserter.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/NotRetryableErrorInserting.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSender.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryService.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySender.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCON996.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/UnrecognizedEventHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/AttachmentsConfigUtils.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/LogUtility.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/MetricUtils.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/OcrUtility.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMock.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/QueueConst.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/TrackerUtility.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/main/resources/application.properties create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/.gitkeep create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/BaseTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/LocalStackTestConfig.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/TrackerConfigUtilsTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigsTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/AbstractARTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDisableTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDryTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrRunTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/TestCaseHandlerAR.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandler.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandlerImpl.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/DryRIROcrDisableTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/TestCaseHandlerRIR.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/DryRISOcrDisableTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/TestCaseHandlerRIS.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/AbstractRSTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDisableTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDryTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrRunTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/TestCaseHandlerRS.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceLoader.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceRunner.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Abstract890TestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableStrictTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryStrictTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunStrictTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunTestIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/TestCaseHandler890.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/Expected.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/ProductTestCase.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/TestEvent.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/ErrorValidator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/OutputValidator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/TrackingValidator.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapperTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapperTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/SendEventMapperTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDaoIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDaoIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDaoIT.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisherTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundServiceTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/NotificationReworkControllerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorControllerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputControllerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingControllerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderArTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryArTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN003CMessageHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN004CMessageHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN005CMessageHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN00XCAbstractMessageHandlerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorArTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRirTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRirTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRisTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRisTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRsTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRsTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/TestUtils.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890Test.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890Test.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilderTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventCheckerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890Test.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponseTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProductTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingStateTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFilteringTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericDematValidatorTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilderTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidatorTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilderTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTriggerTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserterTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSenderTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryServiceTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCon996Test.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImplTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImplTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImplTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImplTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImplTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/LogUtilityTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/MetricUtilsTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/OcrUtilityTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMockTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/TrackerUtilityTest.java create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/.gitkeep create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/application.test-IT.properties create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar_2.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_pnrn_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_con996_pcretry_furto_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_discovery_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_pnrn_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_irreperibile_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/disable/fail_compiuta_giacenza_ar_2.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_KO.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_OK.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_duplicate_ocr_response.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_ocr_pending.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/not_retryable_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_dematAfterDone.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_duplicate_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_sourceType_originType.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_zip.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_causa_forza_maggiore_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_pnrn_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_non_rendicontabile_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar_2.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_m10_ar.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/fail_ar_m10_delivery.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_bad_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_event_other_product.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_inconsistent-state.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_eventB.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_not_ordered.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_notexpected_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_timestamp_err.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_unespected_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_con996_pcretry_furto_rir.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_1.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_2.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_OK.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_pcretry_con996_rir.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_m10_rir.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_rir.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_rir.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/fail_rir_no_equals_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_duplicate_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_empty_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_not_expected.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_other_product.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_not_ordered.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_notexpected_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_timestamp_err.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_unespected_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/fail_ris.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_m10_ris.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_ris.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_ris.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_duplicate_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_empty_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_event_other_product.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_not_ordered.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_timestamp_err.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_unespected_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_deceduto_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_irreperibile_assoluto_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_mancata_consegna_giacenza.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_causa_forza_maggiore_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_compiuta_giacenza_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_non_rendicontabile_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_m10_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_rs.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/fail_rs_no_equals_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_duplicate_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_empty_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_not_expected.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_other_product.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_not_ordered.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_notexpected_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_timestamp_err.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_unespected_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_irreperibile_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_evento_inesistente_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_indirizzo_inesatto_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_irreperibile_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_23L_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_lte10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/disable/ok_giacenza_890_empty_registeredlettercode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_KO.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_OK.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_duplicate_ocr_response.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_ocr_pending.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890_RECAG010A.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza-gt10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_cad_lte10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_23L_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890_zip.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_lte10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_gt10_23L_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_lte10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890_e.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_invalid_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_invalid_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_duplicate_012.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_multiple_012.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_RECAG012_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_more_error.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_RECAG012.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_invalid_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/not_retryable_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_duplicate_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_sourceType_originType.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_causa_forzamaggiore_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_duplicate_final_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_nonrendicontabile_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_persona_abilitata_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_m10_890.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_two_different_final_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/fail_890_empty_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_bad_event.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_empty_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_event_other_product.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_datetime.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_registeredlettecode.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_attachment.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_eventB.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_not_ordered.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_notexpected_deliveryfailurecause.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_timestamp_err.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_unespected_demat.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/rework/ok_ar_rework.json create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/credentials create mode 100644 jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/init.sh diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/.gitignore b/jdk_21_maven/cs/rest/pn-paper-tracker/.gitignore new file mode 100644 index 000000000..a3d88a0e7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/.gitignore @@ -0,0 +1,49 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ +.history +.vscode +target + +# coverage +.nyc_output/ +coverage/ + +# lambda +function.zip +code_layer.zip +lib_layer.zip +nodejs/ + +# Node.js +node_modules/ \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/CODEOWNERS b/jdk_21_maven/cs/rest/pn-paper-tracker/CODEOWNERS new file mode 100644 index 000000000..fdc25761c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/CODEOWNERS @@ -0,0 +1,5 @@ +# Root folder ownership to administrators and developers team +* @pagopa/pn-pagopa-core-analog + +# scripts/aws/cfn ownership on yml files to administrators +scripts/aws/cfn/*.yml @pagopa/pn-pagopa-infra \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/LICENSE b/jdk_21_maven/cs/rest/pn-paper-tracker/LICENSE new file mode 100644 index 000000000..a74f04438 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/LICENSE @@ -0,0 +1,274 @@ +European Union Public Licence +V. 1.2 + +EUPL © the European Union 2007, 2016 + +This European Union Public Licence (the ‘EUPL’) applies to the Work (as +defined below) which is provided under the terms of this Licence. Any use of +the Work, other than as authorised under this Licence is prohibited (to the +extent such use is covered by a right of the copyright holder of the Work). + +The Work is provided under the terms of this Licence when the Licensor (as +defined below) has placed the following notice immediately following the +copyright notice for the Work: “Licensed under the EUPL”, or has expressed by +any other means his willingness to license under the EUPL. + +1. Definitions + +In this Licence, the following terms have the following meaning: +— ‘The Licence’: this Licence. +— ‘The Original Work’: the work or software distributed or communicated by the + ‘Licensor under this Licence, available as Source Code and also as + ‘Executable Code as the case may be. +— ‘Derivative Works’: the works or software that could be created by the + ‘Licensee, based upon the Original Work or modifications thereof. This + ‘Licence does not define the extent of modification or dependence on the + ‘Original Work required in order to classify a work as a Derivative Work; + ‘this extent is determined by copyright law applicable in the country + ‘mentioned in Article 15. +— ‘The Work’: the Original Work or its Derivative Works. +— ‘The Source Code’: the human-readable form of the Work which is the most + convenient for people to study and modify. + +— ‘The Executable Code’: any code which has generally been compiled and which + is meant to be interpreted by a computer as a program. +— ‘The Licensor’: the natural or legal person that distributes or communicates + the Work under the Licence. +— ‘Contributor(s)’: any natural or legal person who modifies the Work under + the Licence, or otherwise contributes to the creation of a Derivative Work. +— ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of + the Work under the terms of the Licence. +— ‘Distribution’ or ‘Communication’: any act of selling, giving, lending, + renting, distributing, communicating, transmitting, or otherwise making + available, online or offline, copies of the Work or providing access to its + essential functionalities at the disposal of any other natural or legal + person. + +2. Scope of the rights granted by the Licence + +The Licensor hereby grants You a worldwide, royalty-free, non-exclusive, +sublicensable licence to do the following, for the duration of copyright +vested in the Original Work: + +— use the Work in any circumstance and for all usage, +— reproduce the Work, +— modify the Work, and make Derivative Works based upon the Work, +— communicate to the public, including the right to make available or display + the Work or copies thereof to the public and perform publicly, as the case + may be, the Work, +— distribute the Work or copies thereof, +— lend and rent the Work or copies thereof, +— sublicense rights in the Work or copies thereof. + +Those rights can be exercised on any media, supports and formats, whether now +known or later invented, as far as the applicable law permits so. + +In the countries where moral rights apply, the Licensor waives his right to +exercise his moral right to the extent allowed by law in order to make +effective the licence of the economic rights here above listed. + +The Licensor grants to the Licensee royalty-free, non-exclusive usage rights +to any patents held by the Licensor, to the extent necessary to make use of +the rights granted on the Work under this Licence. + +3. Communication of the Source Code + +The Licensor may provide the Work either in its Source Code form, or as +Executable Code. If the Work is provided as Executable Code, the Licensor +provides in addition a machine-readable copy of the Source Code of the Work +along with each copy of the Work that the Licensor distributes or indicates, +in a notice following the copyright notice attached to the Work, a repository +where the Source Code is easily and freely accessible for as long as the +Licensor continues to distribute or communicate the Work. + +4. Limitations on copyright + +Nothing in this Licence is intended to deprive the Licensee of the benefits +from any exception or limitation to the exclusive rights of the rights owners +in the Work, of the exhaustion of those rights or of other applicable +limitations thereto. + +5. Obligations of the Licensee + +The grant of the rights mentioned above is subject to some restrictions and +obligations imposed on the Licensee. Those obligations are the following: + +Attribution right: The Licensee shall keep intact all copyright, patent or +trademarks notices and all notices that refer to the Licence and to the +disclaimer of warranties. The Licensee must include a copy of such notices and +a copy of the Licence with every copy of the Work he/she distributes or +communicates. The Licensee must cause any Derivative Work to carry prominent +notices stating that the Work has been modified and the date of modification. + +Copyleft clause: If the Licensee distributes or communicates copies of the +Original Works or Derivative Works, this Distribution or Communication will be +done under the terms of this Licence or of a later version of this Licence +unless the Original Work is expressly distributed only under this version of +the Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee +(becoming Licensor) cannot offer or impose any additional terms or conditions +on the Work or Derivative Work that alter or restrict the terms of the +Licence. + +Compatibility clause: If the Licensee Distributes or Communicates Derivative +Works or copies thereof based upon both the Work and another work licensed +under a Compatible Licence, this Distribution or Communication can be done +under the terms of this Compatible Licence. For the sake of this clause, +‘Compatible Licence’ refers to the licences listed in the appendix attached to +this Licence. Should the Licensee's obligations under the Compatible Licence +conflict with his/her obligations under this Licence, the obligations of the +Compatible Licence shall prevail. + +Provision of Source Code: When distributing or communicating copies of the +Work, the Licensee will provide a machine-readable copy of the Source Code or +indicate a repository where this Source will be easily and freely available +for as long as the Licensee continues to distribute or communicate the Work. + +Legal Protection: This Licence does not grant permission to use the trade +names, trademarks, service marks, or names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the copyright notice. + +6. Chain of Authorship + +The original Licensor warrants that the copyright in the Original Work granted +hereunder is owned by him/her or licensed to him/her and that he/she has the +power and authority to grant the Licence. + +Each Contributor warrants that the copyright in the modifications he/she +brings to the Work are owned by him/her or licensed to him/her and that he/she +has the power and authority to grant the Licence. + +Each time You accept the Licence, the original Licensor and subsequent +Contributors grant You a licence to their contributions to the Work, under the +terms of this Licence. + +7. Disclaimer of Warranty + +The Work is a work in progress, which is continuously improved by numerous +Contributors. It is not a finished work and may therefore contain defects or +‘bugs’ inherent to this type of development. + +For the above reason, the Work is provided under the Licence on an ‘as is’ +basis and without warranties of any kind concerning the Work, including +without limitation merchantability, fitness for a particular purpose, absence +of defects or errors, accuracy, non-infringement of intellectual property +rights other than copyright as stated in Article 6 of this Licence. + +This disclaimer of warranty is an essential part of the Licence and a +condition for the grant of any rights to the Work. + +8. Disclaimer of Liability + +Except in the cases of wilful misconduct or damages directly caused to natural +persons, the Licensor will in no event be liable for any direct or indirect, +material or moral, damages of any kind, arising out of the Licence or of the +use of the Work, including without limitation, damages for loss of goodwill, +work stoppage, computer failure or malfunction, loss of data or any commercial +damage, even if the Licensor has been advised of the possibility of such +damage. However, the Licensor will be liable under statutory product liability +laws as far such laws apply to the Work. + +9. Additional agreements + +While distributing the Work, You may choose to conclude an additional +agreement, defining obligations or services consistent with this Licence. +However, if accepting obligations, You may act only on your own behalf and on +your sole responsibility, not on behalf of the original Licensor or any other +Contributor, and only if You agree to indemnify, defend, and hold each +Contributor harmless for any liability incurred by, or claims asserted against +such Contributor by the fact You have accepted any warranty or additional +liability. + +10. Acceptance of the Licence + +The provisions of this Licence can be accepted by clicking on an icon ‘I +agree’ placed under the bottom of a window displaying the text of this Licence +or by affirming consent in any other similar way, in accordance with the rules +of applicable law. Clicking on that icon indicates your clear and irrevocable +acceptance of this Licence and all of its terms and conditions. + +Similarly, you irrevocably accept this Licence and all of its terms and +conditions by exercising any rights granted to You by Article 2 of this +Licence, such as the use of the Work, the creation by You of a Derivative Work +or the Distribution or Communication by You of the Work or copies thereof. + +11. Information to the public + +In case of any Distribution or Communication of the Work by means of +electronic communication by You (for example, by offering to download the Work +from a remote location) the distribution channel or media (for example, a +website) must at least provide to the public the information requested by the +applicable law regarding the Licensor, the Licence and the way it may be +accessible, concluded, stored and reproduced by the Licensee. + +12. Termination of the Licence + +The Licence and the rights granted hereunder will terminate automatically upon +any breach by the Licensee of the terms of the Licence. Such a termination +will not terminate the licences of any person who has received the Work from +the Licensee under the Licence, provided such persons remain in full +compliance with the Licence. + +13. Miscellaneous + +Without prejudice of Article 9 above, the Licence represents the complete +agreement between the Parties as to the Work. + +If any provision of the Licence is invalid or unenforceable under applicable +law, this will not affect the validity or enforceability of the Licence as a +whole. Such provision will be construed or reformed so as necessary to make it +valid and enforceable. + +The European Commission may publish other linguistic versions or new versions +of this Licence or updated versions of the Appendix, so far this is required +and reasonable, without reducing the scope of the rights granted by the +Licence. New versions of the Licence will be published with a unique version +number. + +All linguistic versions of this Licence, approved by the European Commission, +have identical value. Parties can take advantage of the linguistic version of +their choice. + +14. Jurisdiction + +Without prejudice to specific agreement between parties, +— any litigation resulting from the interpretation of this License, arising + between the European Union institutions, bodies, offices or agencies, as a + Licensor, and any Licensee, will be subject to the jurisdiction of the Court + of Justice of the European Union, as laid down in article 272 of the Treaty + on the Functioning of the European Union, +— any litigation arising between other parties and resulting from the + interpretation of this License, will be subject to the exclusive + jurisdiction of the competent court where the Licensor resides or conducts + its primary business. + +15. Applicable Law + +Without prejudice to specific agreement between parties, +— this Licence shall be governed by the law of the European Union Member State + where the Licensor has his seat, resides or has his registered office, +— this licence shall be governed by Belgian law if the Licensor has no seat, + residence or registered office inside a European Union Member State. + +Appendix + +‘Compatible Licences’ according to Article 5 EUPL are: +— GNU General Public License (GPL) v. 2, v. 3 +— GNU Affero General Public License (AGPL) v. 3 +— Open Software License (OSL) v. 2.1, v. 3.0 +— Eclipse Public License (EPL) v. 1.0 +— CeCILL v. 2.0, v. 2.1 +— Mozilla Public Licence (MPL) v. 2 +— GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3 +— Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for + works other than software +— European Union Public Licence (EUPL) v. 1.1, v. 1.2 +— Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or + Strong Reciprocity (LiLiQ-R+) + +— The European Commission may update this Appendix to later versions of the + above licences without producing a new version of the EUPL, as long as they + provide the rights granted in Article 2 of this Licence and protect the + covered Source Code from exclusive appropriation. +— All other changes or additions to this Appendix require the production of a + new EUPL version. diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/README.md b/jdk_21_maven/cs/rest/pn-paper-tracker/README.md new file mode 100644 index 000000000..842a7672b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/README.md @@ -0,0 +1,133 @@ +# pn-paper-tracker + +## Indice +- [Descrizione](#descrizione) +- [Tecnologie Utilizzate](#tecnologie-utilizzate) +- [Architettura](#architettura) +- [Interfacce del Servizio](#interfacce-del-servizio) +- [Allarmi e monitoraggio](#allarmi-e-monitoraggio) +- [Configurazione](#configurazione) +- [Esecuzione](#esecuzione) + +## Descrizione +**pn-paper-tracker** è il microservizio responsabile della validazione e tracciamento delle spedizioni analogiche (cartacee) all'interno del sistema **[SEND](https://notifichedigitali.it/)**. + +### Responsabilità principali + +* **Ricezione eventi:** Riceve gli aggiornamenti di stato delle spedizioni dal consolidatore tramite **pn-external-channel** +* **Validazione triplette:** Valida la coerenza degli eventi ricevuti (pre-esito, dematerializzazione, fascicolo chiuso) verificando: + * Presenza di tutti gli eventi richiesti per ogni flusso + * Coerenza dei timestamp di business + * Correttezza dei metadati (`registeredLetterCode`, `deliveryFailureCause`, ecc.) +* **Validazione OCR/AI:** Integra il servizio OCR per la verifica dei documenti allegati scansionati +* **Tracciamento spedizioni:** Mantiene lo stato completo di ogni tentativo di spedizione verso un destinatario +* **Inoltro eventi:** Produce eventi validati verso **pn-delivery-push** per l'aggiornamento della timeline notifica + +### Prodotti postali gestiti +* AR (Raccomandata con Ricevuta di Ritorno) +* RIR (Raccomandata Internazionale con Ricevuta di Ritorno) +* 890 (Atti Giudiziari) +* RS, RIS (Raccomandata Semplice, Raccomandati Internazionale Semplice) + +### Contesto storico +Il servizio è stato introdotto per separare le responsabilità di validazione e tracciamento dal microservizio **pn-paper-channel**, che ora gestisce solo le fasi iniziali (PREPARE e SEND). +Questa riorganizzazione permette di: +* Ridurre la complessità di pn-paper-channel +* Migliorare la manutenibilità +* Introdurre nuove validazioni OCR + +## Tecnologie Utilizzate +### Stack Tecnologico +* **Java 21** con **Spring Boot 3.x** e **WebFlux** +* **AWS SDK v2** per integrazione servizi AWS +* **OpenAPI 3.0** per definizione contratti API +* **AsyncAPI 3.0** per definizione DTO code +* **Maven** per build management + +### Servizi utilizzati +* **Amazon DynamoDB:** DB principale per tracciamento spedizioni +* **Amazon SQS:** messaggistica asincrona + +## Architettura + +Il microservizio pn-paper-tracker implementa una logica di business articolata per la gestione degli eventi provenienti dal consolidatore. +Per una descrizione dettagliata dei flussi, delle classi principali e delle sequenze di eventi, +è possibile consultare il file [ArchitetturaInterna.md](docs/ms/ArchitetturaInterna.md). + +### Dipendenze interne + +- **pn-paper-channel:** per la richiesta di retry nel caso di eventi retryable +- **pn-data-vault:** per l'anonimizzazione/deanonimizzazione dei dati sensibili + +### Dipendenze esterne + +- **servizio OCR:** per la validazione dei documenti allegati alla spedizione + +## Interfacce del Servizio + +| Tipo | Dir | Risorsa | Protocollo | Metodo | Route / Destinazione | Descrizione | +|-------|-----|---------------------------------------------|-------------|---------|-------------------------------------------------------------------------|--------------------------------------------------------| +| API | IN | pn-paper-tracker | REST | POST | /paper-tracker-private/v1/init | Inizializzazione entità di tracking | +| API | IN | pn-paper-tracker | REST | POST | /paper-tracker-private/v1/trackings | Recupero entità di tracking da lista di trackingId | +| API | IN | pn-paper-tracker | REST | POST | /paper-tracker-private/v1/errors | Recupero errori di tracking | +| API | IN | pn-paper-tracker | REST | POST | /paper-tracker-private/v1/outputs | Recupero degli oggetti in output | +| API | IN | pn-paper-tracker | REST | GET | /paper-tracker-private/v1/attempts/{attemptId} | Recupero tracking tramite attemptId | +| API | IN | pn-paper-tracker | REST | GET | /paper-tracker-private/v1/notification-rework/sequence | Recupero sequence e finalStatus per rework notifica | +| API | IN | pn-paper-tracker | REST | PUT | /paper-tracker-private/v1/notification-rework/{trackingId}/init | Avvio processo di invalidazione timeline per rework | +| API | OUT | pn-paper-channel | REST | GET | /paper-channel-private/v1/b2b/pc-retry/{requestId} | Verifica se ci sono altri retry | +| API | OUT | pn-data-vault | REST | PUT | /datavault-private/v1/paper-addresses/{paperRequestId}/{paperAddressId} | Inserisci o modifica un indirizzo | +| API | OUT | pn-data-vault | REST | GET | /datavault-private/v1/paper-addresses/{paperRequestId}/{paperAddressId} | Recupera tutti gli indirizzi associati alla spedizione | +| EVENT | IN | pn-ocr_outputs | SQS | CONSUME | - | Risposta validazione OCR degli allegati spedizione | +| EVENT | OUT | send-receipt-validation-input | SQS | PRODUCE | - | Invio allegati di spedizione all'OCR per validazione | +| EVENT | IN | pn-external_channel_to_paper_channel | SQS | CONSUME | - | Ricezione eventi dal consolidatore | +| EVENT | IN | pn-external_channel_to_paper_tracker | SQS | CONSUME | - | Ricezione eventi smistati da pn-paper-tracker | +| EVENT | OUT | pn-external_channel_to_paper_channel_dryrun | SQS | PRODUCE | - | Produzione eventi smistati verso pn-paper-channel | +| EVENT | OUT | pn-CoreEventBus | EventBridge | PUBLISH | - | Pubblicazione eventi su EventBridge | + +* **OpenAPI**: [api-internal-v1.yaml](docs/openapi/api-internal-v1.yaml) +* **AsyncAPI**: [internal-datalake-v1.yaml](docs/asyncapi/internal-datalake-v1.yaml) + +## Allarmi e monitoraggio + +| Tipo | Nome | Descrizione | +|-----------|----------------------------------|----------------------------------------------------------------------------------------------------------------| +| ALARM | pn-paper-tracker-890Errors-Alarm | Allarme su errori di tipo 890 (Atti Giudiziari). Scatta se il numero di errori supera la soglia configurata. | +| ALARM | pn-paper-tracker-RISErrors-Alarm | Allarme su errori di tipo RIS (Raccomandata Internazionale Semplice). | +| ALARM | pn-paper-tracker-ARErrors-Alarm | Allarme su errori di tipo AR (Raccomandata con Ricevuta di Ritorno). | +| ALARM | pn-paper-tracker-RSErrors-Alarm | Allarme su errori di tipo RS (Raccomandata Semplice). | +| ALARM | pn-paper-tracker-RIRErrors-Alarm | Allarme su errori di tipo RIR (Raccomandata Internazionale con Ricevuta di Ritorno). | +| LOG | /aws/ecs/pn-paper-tracker | Log applicativi ECS del microservizio, consultabili su CloudWatch Logs. | + +**Note operative:** +- Le metriche monitorate includono il conteggio degli errori per categoria di prodotto postale (890, AR, RS, RIS, RIR). + +Per consultare lo stato operativo del servizio, accedere alla dashboard CloudWatch `pn-paper-tracker` e al log group `/aws/ecs/pn-paper-tracker`. + +## Configurazione + +Le principali configurazioni del microservizio sono gestite tramite variabili d'ambiente: + +| Nome | Sorgente | Valori | Descrizione | +|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|--------|------------------------------------------------------------------------------------------| +| [PN_PAPERTRACKER_ENABLEOCRVALIDATIONFOR](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L4) | ENV | - | Abilita l'OCR per singolo prodotto | +| [PN_PAPERTRACKER_OCRFILTERTEMPORAL](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L8) | ENV | - | Abilita l'OCR in modalità RUN per spedizioni in specifiche fasce orarie | +| [PN_PAPERTRACKER_OCRFILTERUNIFIEDDELIVERYDRIVER](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L13) | ENV | - | Abilita l'OCR in modalità RUN per determinati recapitisti | +| [PN_PAPERTRACKER_ENABLEOCRVALIDATIONFORFILE](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L15) | ENV | - | Estensione file abilitata per la validazione OCR | +| [PN_PAPERTRACKER_SAVEANDNOTSENDTODELIVERYPUSH](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L20) | ENV | - | StatusCode che non invia a pn-delivery-push ma vengono salvati nel tracking | +| [PN_PAPERTRACKER_REQUIREDATTACHMENTSREFINEMENTSTOCK890](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L42) | ENV | - | Allegati necessari al perfezionamento giacenza 890 | +| [PN_PAPERTRACKER_SENDOCRATTACHMENTSFINALVALIDATION](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L60) | ENV | - | Allegati da inviare all'OCR per la validazione finale | +| [PN_PAPERTRACKER_PRODUCTSPROCESSINGMODES](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L85) | ENV | - | Modalità di processamento per prodotto | +| [PN_PAPERTRACKER_SENDTOCONSOLIDATOREERRORCATEGORIES](https://github.com/pagopa/pn-paper-tracker/blob/22b6733be808fb7fa5d6cf4fb904b6cebc6cde75/scripts/aws/cfn/application-dev.env#L89) | ENV | - | Categorie di errore previste per l'inoltro al consolidatore | +| [PN_PAPERTRACKER_PAPERTRACKINGSTTLDURATION](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L31) | ENV | 3650d | Durata di conservazione dei PaperTrackings | +| [PN_PAPERTRACKER_PAPERTRACKINGSERRORSTTLDURATION](https://github.com/pagopa/pn-paper-tracker/blob/ca6886a5053248cfcfe4635734d3ebb50197d2d3/scripts/aws/cfn/application-dev.env#L34) | ENV | 3650d | Durata di conservazione dei PaperTrackingErrors | + +Per l'elenco completo e i dettagli di tutte le variabili, è possibile consultare il file [application-dev.env](scripts/aws/cfn/application-dev.env). + +## Esecuzione +**Prerequisiti** +* Docker/Podman avviato + +Eseguire il comando Maven: +```bash +mvn spring-boot:run +``` diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/config/application.properties b/jdk_21_maven/cs/rest/pn-paper-tracker/config/application.properties new file mode 100644 index 000000000..fb6e63bbb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/config/application.properties @@ -0,0 +1,84 @@ +logging.config=config/logback-local.xml + +spring.application.name=pn-paper-tracker + +# Runtime mode +pn.env.runtime=DEVELOPMENT +#pn.env.runtime=PROD + +pn.paper-tracker.dao.paper-tracker-dry-run-outputs-table=pn-PaperTrackerDryRunOutputs +pn.paper-tracker.dao.paper-trackings-errors-table=pn-PaperTrackingsErrors +pn.paper-tracker.dao.paper-trackings-table=pn-PaperTrackings +server.port=8081 + +# AWS Configuration +aws.profile-name=default +aws.region-code=us-east-1 +aws.endpoint-url=http://localhost:4566 +spring.cloud.aws.credentials.profile-name=${PN_AWS_PROFILE_NAME:default} +cloud.aws.sqs.endpoint=http://localhost:4566 +cloud.aws.sqs.region=us-east-1 + +pn.paper-tracker.topics.external-channel-to-paper-tracker-queue=pn-external_channel_to_paper_tracker +pn.paper-tracker.topics.pn-ocr-outputs-queue=pn-paper_tracker_ocr_outputs + +pn.paper-tracker.topics.queue-ocr-inputs-url=http://localhost:4566/000000000000/dl-sqs +pn.paper-tracker.topics.queue-ocr-inputs-region=us-east-1 + +pn.paper-tracker.topics.external-channel-outputs-queue=pn-external_channel_outputs +pn.paper-tracker.topics.external-channel-to-paper-channel-queue=pn-external_channel_to_paper_channel +pn.paper-tracker.topics.external-channel-to-paper-channel_dryrun-queue=pn-external_channel_to_paper_channel_dryrun + +pn.paper-tracker.paper-trackings-ttl-duration=3650d +pn.paper-tracker.paper-trackings-errors-ttl-duration=3650d + +pn.paper-tracker.enable-ocr-validation-for= +pn.paper-tracker.enable-ocr-validation-for-file= +pn.paper-tracker.save-and-not-send-to-delivery-push=CON018 +pn.paper-tracker.paper-channel-base-url=http://localhost:8080 + +pn.paper-tracker.compiuta-giacenza-ar-duration=30d +pn.paper-tracker.enable-truncated-date-for-refinement-check=true +pn.paper-tracker.refinement-duration=10d + +pn.paper-tracker.required-attachments-refinement-stock890=1970-01-01;23L +pn.paper-tracker.send-ocr-attachments-refinement-stock890=1970-01-01;23L +pn.paper-tracker.send-ocr-attachments-final-validation-stock890=1970-01-01; +pn.paper-tracker.send-ocr-attachments-final-validation=1970-01-01;Plico;AR;23L +pn.paper-tracker.strict-final-validation-stock890=1970-01-01;false +pn.paper-tracker.strict-delivery-failure-cause=1970-01-01;false +pn.paper-tracker.products-processing-modes=1970-01-01;AR:RUN;890:DRY;RIR:DRY;RS:DRY;RIS:DRY +pn.paper-tracker.ocr-filter-temporal=* * 9-18 * * MON +pn.paper-tracker.ocr-filter-unified-delivery-driver=POSTE + +pn.paper-tracker.disable-all-consumers=true + +pn.paper-tracker.eventbus.name = paper-tracker-event-bus-name +pn.paper-tracker.eventbus.detailType = PaperChannelOutcomeEvent +pn.paper-tracker.eventbus.source = pn-paper-tracker + +# application-test.properties + +# Spring Cloud AWS 3.x Configuration +spring.cloud.aws.credentials.access-key=test +spring.cloud.aws.credentials.secret-key=test +spring.cloud.aws.region.static=us-east-1 +spring.cloud.aws.sqs.endpoint=http://localhost:4566 +spring.cloud.aws.sqs.region=us-east-1 +spring.cloud.aws.endpoint=http://localhost:4566 + +# SQS Listener Configuration +spring.cloud.aws.sqs.listener.acknowledgement-mode=manual +spring.cloud.aws.sqs.listener.poll-timeout=10s +spring.cloud.aws.sqs.listener.max-messages-per-poll=10 +spring.cloud.aws.sqs.listener.queue-stop-timeout=30s +spring.cloud.aws.sqs.listener.back-off-time=1s +spring.cloud.aws.sqs.listener.max-concurrent-messages=10 + +# Disable SSL for LocalStack +aws.disable-ssl=true + +# Debug Logging +logging.level.io.awspring.cloud=DEBUG +logging.level.software.amazon.awssdk=DEBUG +logging.level.software.amazon.awssdk.request=DEBUG \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/config/logback-local.xml b/jdk_21_maven/cs/rest/pn-paper-tracker/config/logback-local.xml new file mode 100644 index 000000000..7315d41ca --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/config/logback-local.xml @@ -0,0 +1,12 @@ + + + + + + %d [%X{trace_id}] %highlight(%-5level) - %-4relative - [%thread] - %cyan(%logger{20}) - %msg %n + + + + + + \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/external-datalake-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/external-datalake-v1.yaml new file mode 100644 index 000000000..b4585231b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/external-datalake-v1.yaml @@ -0,0 +1,144 @@ +asyncapi: '3.0.0' +info: + title: OCR Data Exchange + version: '1.0.0' + description: An event schema for data request to OCR/AI Service + +servers: + dl_sqs: + host: 'sqs.us-east-1.amazonaws.com' + protocol: 'sqs' + description: DataLake SQS + +channels: + dl_sqs: + address: arn:aws:sqs:us-east-1:123456789012:ocr + description: SQS queue + servers: + - $ref: '#/servers/dl_sqs' + messages: + ocr_event: + $ref: '#/components/messages/ocr_event' + +operations: + OCR_Command: + action: send + channel: + $ref: '#/channels/dl_sqs' + summary: >- + Send OCR command to the queue + messages: + - $ref: '#/channels/dl_sqs/messages/ocr_event' + + +components: + messages: + ocr_event: + name: ocr_event + title: OCR event + summary: >- + Send a command to the OCR service + contentType: application/json + payload: + $ref: '#/components/schemas/ocrDataPayload' + + schemas: + ocrDataPayload: + type: object + properties: + version: + type: string + description: Version of the schema + example: "1.0.0" + commandId: + type: string + description: Command unique ID + example: "1234567890" + commandType: + type: string + description: OCR command (TBD) + enum: + - postal + example: "postal" + data: + type: object + properties: + productType: + type: string + description: Product type + enum: + - AR + - RIR + - 890 + - RS + - RIS + example: "AR" + documentType: + type: string + description: Document type + enum: + - AR + - Plico + - 23L + - ARCAD + example: "AR" + unifiedDeliveryDriver: + type: string + description: Delivery driver + enum: + - Poste + - Sailpost + - PostAndService + - Fulmine + example: "Poste" + details: + type: object + properties: + deliveryDetailCode: + type: string + example: "RECRN001C" + notificationDate: + type: string + format: date-time + example: "2024-09-20T17:00:00Z" + registeredLetterCode: + type: string + example: "R14700511649" + deliveryFailureCause: + type: string + enum: + - M01 + - M02 + - M03 + - M04 + - M05 + - M06 + - M07 + - M08 + - M09 + - M10 + example: "M02" + attachment: + type: string + format: uri + example: "safestorage://PN_EXTERNAL_LEGAL_FACTS-14f3dbdc57574459812a96a0a0bc204d.pdf" + deliveryAttemptDate: + type: string + format: date-time + example: "2024-09-21T10:30:00Z" + allOf: + - if: + properties: + deliveryDetailCode: + enum: + - RECRN002C + - RECRN002F + - RECAG003C + - RECAG003F + then: + required: + - deliveryFailureCause + else: + not: + required: + - deliveryFailureCause \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/internal-datalake-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/internal-datalake-v1.yaml new file mode 100644 index 000000000..bdf33b9aa --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/asyncapi/internal-datalake-v1.yaml @@ -0,0 +1,88 @@ +asyncapi: '3.0.0' +info: + title: OCR Data Exchange + version: '1.0.0' + description: An event schema for data request to OCR/AI Service + +servers: + pn_sqs: + host: 'sqs.us-east-1.amazonaws.com' + protocol: 'sqs' + description: PN SQS + +channels: + pn_sqs: + address: arn:aws:sqs:us-east-1:123456789012:ocr + description: SQS queue + servers: + - $ref: '#/servers/pn_sqs' + messages: + ocr_result: + $ref: '#/components/messages/ocr_result' + +operations: + OCR_Result: + action: receive + channel: + $ref: '#/channels/pn_sqs' + summary: >- + Send OCR result from the queue + messages: + - $ref: '#/channels/pn_sqs/messages/ocr_result' + +components: + messages: + ocr_result: + name: ocr_result + title: OCR result + summary: >- + Retrieve information about OCR data result + contentType: application/json + payload: + $ref: '#/components/schemas/ocrDataResultPayload' + + schemas: + ocrDataResultPayload: + type: object + properties: + version: + type: string + description: Version of the schema + example: "1.0.0" + commandId: + type: string + description: Command unique ID + example: "1234567890" + commandType: + type: string + description: OCR command + enum: + - postal + example: "postal" + data: + type: object + properties: + validationType: + type: string + description: Validation type + enum: + - operator + - ai + example: "ai" + validationStatus: + type: string + description: Validation status + enum: + - OK + - KO + - PENDING + example: "OK" + description: + type: string + description: Description of the validation status + example: "The document has been validated" + predictedRefinementType: + type: string + enum: + - PRE10 + - POST10 \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/ms/ArchitetturaInterna.md b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/ms/ArchitetturaInterna.md new file mode 100644 index 000000000..a49c11898 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/ms/ArchitetturaInterna.md @@ -0,0 +1,148 @@ +# Logica di business + +## Inizializzazione della spedizione tramite API initTracking +Il flusso operativo di pn-paper-tracker ha inizio con la chiamata all’API `initTracking`, esposta dal controller +[`PaperTrackerTrackingController`](../../src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingController.java) e +invocata dal microservizio pn-paper-channel. + +Questa API viene utilizzata per inizializzare una nuova spedizione, salvando un oggetto `PaperTrackings` su DynamoDB. +I dati inizializzati comprendono: +- **trackingId**: identificativo univoco della spedizione cartacea +- **productType**: tipologia di prodotto (AR, RIR, 890, RS, RIS) +- **unifiedDeliveryDriver**: recapitista +- **analogRequestClientId**: identificativo del client che ha effettuato la richiesta di spedizione +- **altri metadati**: configurazioni ed eventuali dati aggiuntivi utili al tracciamento e alla gestione della spedizione + +Mentre l'`analogRequestClientId` viene ricevuto tramite header, gli altri dati vengono ricevuti tramite il payload della richiesta (`TrackingCreationRequest`) e +salvati tramite il servizio [`PaperTrackerTrackingService`](../../src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerTrackingService.java). +L’inizializzazione della spedizione è un prerequisito per la corretta gestione degli eventi successivi relativi alla stessa spedizione. + + +La classe [`PnEventInboundService`](../../src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundService.java) +gestisce la ricezione dei messaggi da tre code distinte: `pn-external_channel_to_paper_channel`, `pn-external_channel_to_paper_tracker` e `pn-ocr_outputs`. +Ogni coda segue un flusso separato, descritto di seguito. + +## Consumer pn-external_channel_to_paper_channel +I messaggi ricevuti vengono inoltrati, in definitiva, alla classe +[`SourceQueueProxyService`](../../src/main/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImpl.java), +che si occupa di gestire il routing degli eventi provenienti da pn-ec in base alla modalità operativa associata alla spedizione +(attributo `processingMode` della classe [`PaperTrackings`](../../src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackings.java)). + +La logica applicata è la seguente: +- **Spedizione NON presente su pn-PaperTrackings**: l'evento viene inoltrato solo a pn-paper-channel, unicamente se non è un duplicato (`isDuplicate == false` oppure `isDuplicate == null`). +- **Spedizione presente e modalità DRY**: l'evento viene inoltrato a pn-paper-tracker e a pn-paper-channel; l'inoltro a pn-paper-channel avviene solo se l'evento non è un duplicato (`isDuplicate == false` oppure `isDuplicate == null`). +- **Spedizione presente e modalità RUN**: l'evento viene inoltrato solo a pn-paper-tracker. +- **Spedizione con processingMode null**: l'evento viene gestito come in modalità DRY (inoltro a pn-paper-tracker e, solo se non duplicato, a pn-paper-channel). + +Il messaggio viene arricchito con header e flag dry-run, e inoltrato ai consumer appropriati tramite i producer dedicati. + +## Consumer pn-external_channel_to_paper_tracker +I messaggi ricevuti vengono inoltrati alla classe +[`ExternalChannelHandler`](../../src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandler.java). +Qui, in base al `productType` e all' `eventType` (ricavato tramite lo `statusCode` e l’enum +[`EventStatusCodeEnum`](../../src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java)), il messaggio +viene smistato, tramite l’[`HandlersRegistry`](../../src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/HandlersRegistry.java), +verso il relativo handler, definito nella classe astratta +[`AbstractHandlersFactory`](../../src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/AbstractHandlersFactory.java) +o sue estensioni (es. +[`HandlersFactory890`](../src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890.java)). + +Ogni handler esegue una sequenza di step (classi che implementano l’interfaccia +[`HandlerStep`](../src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerStep.java)), +utilizzando le informazioni condivise tramite la classe +[`HandlerContext`](../src/main/java/it/pagopa/pn/papertracker/model/HandlerContext.java). + +### Esempio di sequence e gestione degli eventi +Esempio di configurazione di una sequence: + +```json +{ + "sequenceName": "OK_AR", + "sequence": "@sequence.5s-CON080.5s-CON020[DOC:7ZIP;PAGES:3].5s-CON018.5s-RECRN001A.5s-RECRN001B[DOC:AR].5s-RECRN001C" +} +``` + +In questo esempio del prodotto `AR`, i primi tre `statusCode` (`CON080`, `CON020`, `CON018`), +essendo definiti nell’enum come `INTERMEDIATE_EVENT`, vengono processati dal rispettivo handler `buildIntermediateEventsHandler`. +Gli eventi `RECRN001A` e `RECRN001B`, essendo anch’essi eventi intermedi, vengono gestiti dallo stesso handler. +Diversamente, l’evento `RECRN001C`, essendo di tipo `EventTypeEnum.FINAL_EVENT`, viene processato dall’handler `buildFinalEventsHandler`. + +```mermaid +flowchart LR + + %% Eventi → Handler + A[CON080] -->|INTERMEDIATE_EVENT| INT + B[CON020] -->|INTERMEDIATE_EVENT| INT + C[CON018] -->|INTERMEDIATE_EVENT| INT + D[RECRN001A] -->|INTERMEDIATE_EVENT| INT + E[RECRN001B] -->|INTERMEDIATE_EVENT| INT + + F[RECRN001C] -->|FINAL_EVENT| FIN + + %% Intermediate Handler + subgraph INT[buildIntermediateEventsHandler] + H1[metadataUpserter] --> + H2[checkTrackingState] --> + H3[duplicatedEventFiltering] --> + H4[intermediateEventsBuilder] --> + H5[outputTargetSender] + end + + %% Final Handler + subgraph FIN[buildFinalEventsHandler] + I1[metadataUpserter] --> + I2[checkTrackingState] --> + I3[sequenceValidator] --> + I4[dematValidator] --> + I5[finalEventBuilder] --> + I6[outputTargetSender] + end +``` + +### Giacenza 890 +Per quanto riguarda la giacenza 890, si tiene conto di due flussi paralleli: il perfezionamento della spedizione e la chiusura fascicolo. +Come mostrato nel diagramma sotto, il perfezionamento si conclude con l'invio del feedback `RECAG012`, qualora la condizione +di refinement sia soddisfatta (ricezione del documento 23L e del `RECAG012`), +mentre, la chiusura fascicolo, termina con l'invio del progress `RECAG005C`, una volta validato l'ARCAD. + +```mermaid +sequenceDiagram +participant pn-ec +participant pn-paper-tracker +participant OCR +participant pn-delivery-push + + pn-ec->>pn-paper-tracker: RECAG011B[23L, ARCAD] + pn-ec->>pn-paper-tracker: RECAG005A + pn-ec->>pn-paper-tracker: RECAG012 + pn-ec->>pn-paper-tracker: RECAG005C + + pn-paper-tracker->>pn-delivery-push: PROGRESS - RECAG011B + pn-paper-tracker->>pn-delivery-push: PROGRESS - RECAG005A + pn-paper-tracker->>OCR: 23L + OCR->>pn-paper-tracker: 23L - OCR_OK + pn-paper-tracker->>pn-delivery-push: FEEDBACK - RECAG012 + pn-paper-tracker->>OCR: ARCAD + OCR->>pn-paper-tracker: ARCAD - OCR_OK + pn-paper-tracker->>pn-delivery-push: PROGRESS - RECAG005C +``` + +## Consumer pn-ocr_outputs +I messaggi ricevuti vengono gestiti dalla classe +[`OcrEventHandler`](../../src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandler.java), +che recupera l’oggetto `PaperTrackings` da DynamoDB tramite il `commandId` presente nel payload. +Successivamente, come per la coda precedente, il messaggio viene smistato al relativo handler in base al `productType` +e all’`EventTypeEnum.OCR_RESPONSE_EVENT`. + +```mermaid +flowchart LR + + F[EVENTXXX] -->|OCR_RESPONSE_EVENT| OCR + + %% Ocr response handler + subgraph OCR[buildOcrResponseHandler] + I1[checkOcrResponse] --> + I2[finalEventBuilder] --> + I3[outputTargetSender] + end +``` diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/api-internal-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/api-internal-v1.yaml new file mode 100644 index 000000000..a9b0b4140 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/api-internal-v1.yaml @@ -0,0 +1,709 @@ +openapi: 3.0.1 +info: + title: Pn-paper-tracker + termsOfService: https://termofservice.it + x-api-id: api-paper-tracker-private + x-summary: OpenAPI servizio Paper tracker + description: |- + ## Abstract + Questo servizio ha il compito di: + - Ricevere gli aggiornamenti di spedizione provenienti dal sistema pn-external-channels (consolidatore); + - Validare gli eventi ricevuti; + - Validare i documenti allegati tramite un servizio OCR/AI; + - Tracciare ogni singolo tentativo di spedizione verso un destinatario; + - Inoltrare gli eventi validati al workflow analogico. + contact: + email: pn@pagopa.it + license: + name: PN software license + url: https://www.pn.pagopa.it/LICENSE + version: '1.0.0' +tags: + - name: HealthCheck + description: >- + Invocazioni per sapere lo stato del microservizio + - name: PaperTrackerTracking + - name: PaperTrackerAttempt + - name: PaperTrackerError + - name: PaperTrackerOutput + - name: NotificationRework +paths: + /status: + get: + summary: healthCheck path + description: health check path per verificare lo stato del micro servizio + tags: + - HealthCheck + operationId: status + responses: + '200': + description: Ok + '500': + description: Internal Server Error + '/paper-tracker-private/v1/init': + post: + summary: Inserimento tracker + description: >- + Permette l'inizializzazione di un'entità di tracking. + tags: + - PaperTrackerTracking + operationId: initTracking + parameters: + - name: X-Origin-Client-Id + in: header + description: Identificativo del client che ha fatto la richiesta di spedizione analogica + # TODO: da cambiare in true nella prossima release + required: false + schema: + type: string + minLength: 1 + maxLength: 64 + default: pn-delivery-push + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingCreationRequest' + required: true + responses: + '201': + description: Created - Tracking created + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '409': + description: Conflict + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/trackings': + post: + summary: Recupero eventi + description: >- + Permette il recupero delle entità di tracking da una lista di trackingId. + tags: + - PaperTrackerTracking + operationId: retrieveTrackings + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingsRequest' + required: true + responses: + '200': + description: returns related Tracking entity for each trackingId + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingsResponse' + '404': + description: Bad request + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/errors': + post: + summary: Recupero errori + description: >- + Permette il recupero degli errori presenti nella tabella PnPaperTrackingsErrors. + tags: + - PaperTrackerError + operationId: retrieveTrackingErrors + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingsRequest' + required: true + responses: + '200': + description: returns TrackingErrorsResponse entity for each trackingId + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingErrorsResponse' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/outputs': + post: + summary: Recupero output prodotto + description: >- + Permette il recupero degli oggetti in output nella tabella PnPaperTrackerDryRunOutputs. + tags: + - PaperTrackerOutput + operationId: retrieveTrackingOutputs + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingsRequest' + required: true + responses: + '200': + description: returns PnPaperTrackerDryRunOutputs entities for each trackingId + content: + application/json: + schema: + $ref: '#/components/schemas/PaperTrackerOutputsResponse' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/attempts/{attemptId}': + get: + summary: Oggetto tracking dato l'attemptId + description: >- + Recupera il tracking della spedizione dato l'attemptId. + tags: + - PaperTrackerTracking + operationId: retrieveTrackingsByAttemptId + parameters: + - $ref: '#/components/parameters/attemptId' + - name: pcRetry + in: query + required: false + description: Identificativo della richiesta + schema: + type: string + maxLength: 102 + responses: + '200': + description: returns Tracking entities using the attemptId + content: + application/json: + schema: + $ref: '#/components/schemas/TrackingsResponse' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/notification-rework/sequence': + get: + summary: Recupera le sequence e il finalStatus di una richiesta di rework + description: >- + Permette la verifica della possibilità di rework di una notifica + tags: + - NotificationRework + operationId: retrieveSequenceAndFinalStatus + parameters: + - $ref: '#/components/parameters/queryStatusCode' + - $ref: '#/components/parameters/deliveryFailureCause' + - $ref: '#/components/parameters/queryProductType' + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/SequenceResponse" + '400': + description: Bad request - Invalid status code + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '/paper-tracker-private/v1/notification-rework/{trackingId}/init': + put: + summary: Avvio processo di invalidazione timeline + description: Aggiorna lo stato dell'entità di tracking per accettare gli eventi di recapito correttivi + tags: + - NotificationRework + operationId: initNotificationRework + parameters: + - name: reworkId + in: query + required: true + schema: + type: string + - $ref: '#/components/parameters/trackingId' + responses: + '204': + description: Aggiornamento effettuato + '400': + description: Bad request + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '404': + description: Not Found + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' + '500': + description: Internal Server Error + content: + application/problem+json: + schema: + $ref: 'remote-refs.yaml#/components/schemas/Problem' +components: + parameters: + attemptId: + description: >- + Timeline id dell'elemento PREPARE_ANALOG_DOMICILE + name: attemptId + in: path + required: true + schema: + type: string + # ASCII printable characters + pattern: ^[ -~]*$ + maxLength: 1024 + example: "PREPARE_ANALOG_DOMICILE.IUN_LKXM-QMZH-KELD-202507-H-1.RECINDEX_0.ATTEMPT_0" + trackingId: + name: trackingId + in: path + required: true + schema: + type: string + queryStatusCode: + in: query + name: statusCode + required: true + schema: + type: string + queryProductType: + in: query + name: productType + required: true + schema: + type: string + deliveryFailureCause: + in: query + name: deliveryFailureCause + required: false + schema: + type: string + schemas: + TrackingsRequest: + type: object + properties: + trackingIds: + type: array + items: + type: string + required: + - trackingIds + TrackingsResponse: + type: object + required: + - trackings + properties: + trackings: + type: array + items: + $ref: '#/components/schemas/Tracking' + Tracking: + type: object + required: + - trackingId + - events + - productType + - unifiedDeliveryDriver + - state + - businessState + properties: + trackingId: + type: string + attemptId: + type: string + pcRetry: + type: string + events: + type: array + items: + $ref: '#/components/schemas/PaperEvent' + validationFlow: + $ref: '#/components/schemas/ValidationFlow' + validationConfig: + $ref: '#/components/schemas/ValidationConfig' + productType: + $ref: '#/components/schemas/ProductType' + paperStatus: + $ref: '#/components/schemas/PaperStatus' + nextRequestIdPcretry: + type: string + unifiedDeliveryDriver: + type: string + notificationReworkId: + type: string + notificationReworkTimestamp: + type: string + format: date-time + state: + type: string + enum: + - AWAITING_REFINEMENT + - AWAITING_REWORK_EVENTS + - AWAITING_OCR + - DONE + - KO + businessState: + type: string + enum: + - AWAITING_FINAL_STATUS_CODE + - AWAITING_OCR + - AWAITING_REFINEMENT_OCR + - AWAITING_REWORK_EVENTS + - DONE + - KO + createdAt: + type: string + format: date-time + updatedAt: + type: string + format: date-time + processingMode: + type: string + enum: + - DRY + - RUN + PaperEvent: + type: object + properties: + id: + type: string + requestTimestamp: + type: string + format: date-time + statusCode: + type: string + statusTimestamp: + type: string + format: date-time + statusDescription: + type: string + iun: + type: string + productType: + $ref: '#/components/schemas/ProductType' + deliveryFailureCause: + type: string + anonymizedDiscoveredAddressId: + type: string + attachments: + type: array + items: + $ref: '#/components/schemas/Attachment' + registeredLetterCode: + type: string + notificationReworkId: + type: string + createdAt: + type: string + format: date-time + dryRun: + type: boolean + printer: + type: string + du: + type: string + + ProductType: + type: string + Attachment: + type: object + properties: + id: + type: string + documentType: + type: string + uri: + type: string + date: + type: string + format: date-time + sha256: + type: string + sourceType: + type: string + originType: + type: string + ValidationFlow: + type: object + properties: + sequencesValidationTimestamp: + type: string + format: date-time + ocrRequests: + type: array + items: + $ref: '#/components/schemas/OcrRequest' + finalEventDematValidationTimestamp: + type: string + format: date-time + refinementDematValidationTimestamp: + type: string + format: date-time + finalEventBuilderTimestamp: + type: string + format: date-time + recag012StatusTimestamp: + type: string + format: date-time + OcrRequest: + type: object + properties: + documentType: + type: string + finalEventId: + type: string + attachmentEventId: + type: string + requestTimestamp: + type: string + format: date-time + responseTimestamp: + type: string + format: date-time + uri: + type: string + responseStatus: + type: string + ValidationConfig: + type: object + properties: + requiredAttachmentsRefinementStock890: + type: array + items: + type: string + sendOcrAttachmentsRefinementStock890: + type: array + items: + type: string + sendOcrAttachmentsFinalValidationStock890: + type: array + items: + type: string + sendOcrAttachmentsFinalValidation: + type: array + items: + type: string + strictFinalValidationStock890: + type: boolean + strictDeliveryFailureCause: + type: boolean + ocrEnabled: + type: string + enum: + - RUN + - DRY + - DISABLED + ocrFilterTemporal: + type: string + ocrFilterUnifiedDeliveryDriver: + type: array + items: + type: string + ocrFileTypes: + type: array + items: + type: string + PaperStatus: + type: object + properties: + registeredLetterCode: + type: string + description: Codice spedizione cartacea + deliveryFailureCause: + type: string + description: Causa del fallimento della consegna + anonymizedDiscoveredAddress: + type: string + description: Indirizzo scoperto durante la spedizione + finalStatusCode: + type: string + description: Codice di stato finale della spedizione + example: "RECRN005C" + validatedSequenceTimestamp: + type: string + format: date-time + description: Timestamp validato delle triplette (data di rendicontazione documento) + validatedEvents: + type: array + description: Lista di eventi validati + items: + type: string + finalDematFound: + type: boolean + description: Presenza evento demat finale + paperDeliveryTimestamp: + type: string + format: date-time + description: Timestamp di affido al consolidatore recuperato dallo statusCode P000 + TrackingErrorsResponse: + type: object + properties: + results: + type: array + items: + type: object + required: + - trackingId + - errors + properties: + trackingId: + type: string + errors: + type: array + items: + $ref: '#/components/schemas/TrackingError' + TrackingError: + type: object + properties: + trackingId: + type: string + created: + type: string + format: date-time + errorCategory: + type: string + details: + type: object + properties: + cause: + type: string + message: + type: string + additionalDetails: + type: object + additionalProperties: true + flowThrow: + type: string + enum: + - INIT_TRACKING + - NOT_RETRYABLE_EVENT_HANDLER + - DUPLICATED_EVENT_VALIDATION + - CHECK_TRACKING_PRODUCT + - SEQUENCE_VALIDATION + - DEMAT_VALIDATION + - FINAL_EVENT_BUILDING + - CHECK_TRACKING_STATE + - RETRY_PHASE + eventThrow: + type: string + eventIdThrow: + type: string + productType: + $ref: '#/components/schemas/ProductType' + type: + type: string + enum: + - ERROR + - WARNING + PaperTrackerOutputsResponse: + type: object + properties: + results: + type: array + items: + type: object + properties: + trackingId: + type: string + outputs: + type: array + items: + $ref: '#/components/schemas/PaperTrackerOutput' + PaperTrackerOutput: + type: object + properties: + created: + type: string + registeredLetterCode: + type: string + statusCode: + type: string + statusDetail: + type: string + statusDescription: + type: string + statusDateTime: + type: string + deliveryFailureCause: + type: string + attachments: + type: array + items: + $ref: '#/components/schemas/Attachment' + anonymizedDiscoveredAddressId: + type: string + clientRequestTimestamp: + type: string + TrackingCreationRequest: + type: object + properties: + productType: + type: string + description: Tipo prodotto + example: "AR" + unifiedDeliveryDriver: + type: string + description: unifiedDeliveryDriver pn-paper-tenders + attemptId: + type: string + description: Identificativo tentativo di spedizione + example: "PREPARE_ANALOG_DOMICILE.IUN_LKHJ-HKGV-HQUP-202402-Q-1.RECINDEX_0.ATTEMPT_0" + pcRetry: + type: string + description: Identificativo retry di spedizione + example: "PCRETRY_1" + required: + - productType + - unifiedDeliveryDriver + - attemptId + - pcRetry + SequenceResponse: + type: object + properties: + finalStatusCode: + type: string + enum: + - OK + - KO + sequence: + type: array + items: + $ref: '#/components/schemas/SequenceItem' + SequenceItem: + type: object + properties: + statusCode: + type: string + attachments: + type: array + items: + type: string \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/pn-external-channel.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/pn-external-channel.yaml new file mode 100644 index 000000000..01e9b825e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/pn-external-channel.yaml @@ -0,0 +1,468 @@ +openapi: 3.0.3 +info: + title: ExternalChannel (AKA CarrierPigeon) + description: >- + ## Abstract + Questo servizio permette di inviare messaggi in modo asyncrono e ricevere aggiornamenti + sul loro stato di avanzamento. I canali gestiti sono i seguenti: + + - __Messaggi digitali a valore legale__: PEC.
+ - __Messaggi digitali "di cortesia"__: eMail, SMS
+ - __Messaggi cartacei__, nello specifico:
+ - Raccomandata Internazionale,
+ - Raccomandata Semplice,
+ - Raccomandata con ricevuta di ritorno,
+ - Raccomandata a norma di legge 890/1982.
+ license: + name: PN software license + url: 'https://www.pn.pagopa.it/LICENSE' + version: v1.0 +servers: + - url: >- + https://api.externalchannel.pagopa.local + description: Server url +tags: + - name: DigitalLegalMessages + description: Operazioni per inviare e monitorare messaggi digitali a valore legale + - name: DigitalCourtesyMessages + description: Operazioni per inviare e monitorare messaggi digitali senza valore legale + - name: PaperMessages + description: Operazioni per inviare e monitorare messaggi di corrispondenza cartacea + - name: Configurations + description: Operazioni per le configurazioni dei clients +paths: + + ############################################################################################# + ### DIGITAL LEGAL MESSAGES ### + ############################################################################################# + /external-channels/v1/digital-deliveries/legal-full-message-requests/{requestIdx}: + parameters: + - $ref: '#/components/parameters/requestIdx' + - $ref: '#/components/parameters/xPagopaExtchCxId' # NO EXTERNAL + put: + tags: + - DigitalLegalMessages + operationId: sendDigitalLegalMessage + summary: Invio messaggio digitale legale + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DigitalNotificationRequest' + required: true + responses: + '204': + $ref: '#/components/responses/putDeliveryOk' + '400': + $ref: '#/components/responses/putDeliveryBad' + '409': + $ref: '#/components/responses/putDeliveryDuplicated' + callbacks: + deliveryStatusPushUpdates: + 'indirizzo_webhook_oppure_coda_sqs_legato_al_valore_header_xPagopaExtchCxId': + post: + summary: Eventi avanzamento spediti ad SQS + requestBody: + content: + application/json: + schema: + type: array + minItems: 1 + maxItems: 1000 + items: + $ref: '#/components/schemas/SingleStatusUpdate' + required: true + responses: + default: + description: Error processing the update, the update must be re-sended + '200': + description: Update correctly received + '400': + description: Malformed update status + get: + tags: + - DigitalLegalMessages + operationId: getDigitalLegalMessageStatus + summary: Pull avanzamenti messaggi digitali legali + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/LegalMessageSentDetails' + '404': + $ref: '#/components/responses/getDeliveryStatusHistoryNotFound' + + + ############################################################################################# + ### DIGITAL COURTESY MESSAGES ### + ############################################################################################# + + /external-channels/v1/digital-deliveries/courtesy-full-message-requests/{requestIdx}: + parameters: + - $ref: '#/components/parameters/requestIdx' + - $ref: '#/components/parameters/xPagopaExtchCxId' # NO EXTERNAL + put: + tags: + - DigitalCourtesyMessages + operationId: sendDigitalCourtesyMessage + summary: Invio messaggio digitale di cortesia + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DigitalCourtesyMailRequest' + required: true + responses: + '204': + $ref: '#/components/responses/putDeliveryOk' + '400': + $ref: '#/components/responses/putDeliveryBad' + '409': + $ref: '#/components/responses/putDeliveryDuplicated' + callbacks: + deliveryStatusPushUpdates: + 'indirizzo_webhook_oppure_coda_sqs_legato_al_valore_header_xPagopaExtchCxId': + post: + summary: Eventi avanzamento spediti ad SQS + requestBody: + content: + application/json: + schema: + type: array + minItems: 1 + maxItems: 1000 + items: + $ref: '#/components/schemas/SingleStatusUpdate' + required: true + responses: + default: + description: Error processing the update, the update must be re-sended + '200': + description: Update correctly received + '400': + description: Malformed update status + get: + tags: + - DigitalCourtesyMessages + operationId: getDigitalCourtesyMessageStatus + summary: Pull avanzamenti messaggi digitali di cortesia + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CourtesyMessageProgressEvent' + '404': + $ref: '#/components/responses/getDeliveryStatusHistoryNotFound' + + ############################################################################################# + ### DIGITAL COURTESY SHORT MESSAGES ### + ############################################################################################# + + /external-channels/v1/digital-deliveries/courtesy-simple-message-requests/{requestIdx}: + parameters: + - $ref: '#/components/parameters/requestIdx' + - $ref: '#/components/parameters/xPagopaExtchCxId' # NO EXTERNAL + put: + tags: + - DigitalCourtesyMessages + operationId: sendCourtesyShortMessage + summary: Invio messaggio digitale di cortesia breve + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DigitalCourtesySmsRequest' + required: true + responses: + '204': + $ref: '#/components/responses/putDeliveryOk' + '400': + $ref: '#/components/responses/putDeliveryBad' + '409': + $ref: '#/components/responses/putDeliveryDuplicated' + callbacks: + deliveryStatusPushUpdates: + 'indirizzo_webhook_oppure_coda_sqs_legato_al_valore_header_xPagopaExtchCxId': + post: + summary: Eventi avanzamento spediti ad SQS + requestBody: + content: + application/json: + schema: + type: array + minItems: 1 + maxItems: 1000 + items: + $ref: '#/components/schemas/SingleStatusUpdate' + required: true + responses: + default: + description: Error processing the update, the update must be re-sended + '200': + description: Update correctly received + '400': + description: Malformed update status + get: + tags: + - DigitalCourtesyMessages + operationId: getCourtesyShortMessageStatus + summary: Pull avanzamenti messaggi digitali di cortesia brevi + responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/CourtesyMessageProgressEvent' + '404': + $ref: '#/components/responses/getDeliveryStatusHistoryNotFound' + + + + ############################################################################################# + ### PAPER MAIL MESSAGES ### + ############################################################################################# + /external-channels/v1/paper-deliveries-engagements/{requestIdx}: + parameters: + - $ref: '#/components/parameters/requestIdx' + - $ref: '#/components/parameters/xPagopaExtchCxId' # NO EXTERNAL + put: + operationId: sendPaperEngageRequest + tags: + - PaperMessages + summary: Invio di corrispondenza cartacea + description: >- + Questa operazione sottomette ad external-channel una richiesta di invio di corrispondenza + cartacea.
+ External channel deve validare la sintatticamente la richiesta e, se tale validazione ha + successo, registrare la richiesta in maniera sincrona. Se vengono inviate molteplici + richieste con lo stesso requestId solo una deve avere successo (status code HTTP 204, le + altre devono ricevere lo status code 409). + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PaperEngageRequest' + required: true + responses: + '204': + $ref: '#/components/responses/putDeliveryOk' + '400': + $ref: '#/components/responses/putDeliveryBad' + '409': + $ref: '#/components/responses/putDeliveryDuplicated' + callbacks: + deliveryStatusPushUpdates: + 'indirizzo_webhook_oppure_coda_sqs_legato_al_valore_header_xPagopaExtchCxId': + post: + summary: Eventi avanzamento spediti ad SQS + requestBody: + content: + application/json: + schema: + type: array + minItems: 1 + maxItems: 1000 + items: + $ref: '#/components/schemas/SingleStatusUpdate' + required: true + responses: + default: + description: Error processing the update, the update must be re-sended + '200': + description: Update correctly received + '400': + description: Malformed update status + + get: + operationId: getPaperEngageProgresses + tags: + - PaperMessages + summary: Pull avanzamenti messaggi cartacei + description: >- + Questa richiesta permette di ottenere l'elenco degli eventi salienti + riguardanti un processo di postalizzazione.
+ Oltre all'elenco degli eventi si ottengono informazioni sulle cause di tali eventi + e URL per effettuare il download delle scansioni digitali dei documenti prodotti + durante il processo di postalizzazione.
+ responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/PaperProgressStatusEvent' + '404': + $ref: '#/components/responses/getDeliveryStatusHistoryNotFound' + + ############################################################################################# + ### CONFIGURAZIONI CLIENTS ### + ############################################################################################# + /external-channels/v1/configurations: + get: + tags: + - Configurations + operationId: getConfigurations + summary: Configurazioni dei client + description: >- + __Per ora in sola lettura__
+ + Gestione delle configurazioni di un client, per ogni client si definiscono i + seguenti campi:
+ - __cxId__: identificativo del client,
+ - __sqsArn__: arn della coda SQS su cui il client riceverà gli esiti,
+ - __sqsName__: nome della coda SQS su cui ricevere,
+ - __pecReplyTo__ (facoltativo): indirizzo di risposta delle PEC,
+ - __mailReplyTo__ (facoltativo): indirizzo di risposta delle eMail,
+ - __senderPhysicalAddress__: campo complesso contenente l'indirizzo che risulterà + come mittente dei messaggi cartacei.
+ - _name_: ragione sociale del mittente
+ - _address_: indirizzo (casella postale) del mittente
+ - _cap_: cap
+ - _city_: comune
+ - _pr_: provincia
+ responses: + '200': + description: OK + content: + application/json: + schema: + type: array + items: + type: object + additionalProperties: true + example: + - cxId: pn-delivery-push + sqsArn: 'un ARN della coda' + sqsName: 'pn-delivery-push-extch-progress' + pecReplyTo: null + mailReplyTo: null + senderPhysicalAddress: + name: PagoPA SpA + address: Via non lo so 23 + cap: '0100' + city: Roma + pr: ROMA + - cxId: pn-user-attributes + sqsArn: 'un ARN della coda' + sqsName: 'pn-user-attributes-extch-progress' + pecReplyTo: null + mailReplyTo: null + senderPhysicalAddress: null + '400': + description: Bad Request + + +components: + + ############################################################################################# + ### PARAMETRI E RISPOSTE IN COMUNE PER TUTTI I TIPI DI MESSAGGIO ### + ############################################################################################# + parameters: + + xPagopaExtchCxId: + name: x-pagopa-extch-cx-id + in: header + required: true + schema: + type: string + + requestIdx: + name: requestIdx + in: path + required: true + schema: + type: string + # pattern: '[0-9A-Za-z_-]' + minLength: 5 + maxLength: 100 + + responses: + + putDeliveryOk: + description: OK + + putDeliveryBad: + description: Errore di validazione sintattica della richiesta + content: + application/json: + schema: + $ref: 'schemas-pn-errors-v1.yaml#/components/schemas/Problem' + + putDeliveryDuplicated: + description: >- + Indica che la richiesta è già stata effettuata e non può essere sovrascritta. + content: + application/json: + schema: + $ref: 'schemas-pn-errors-v1.yaml#/components/schemas/Problem' + + getDeliveryStatusHistoryNotFound: + description: requestIdNotFound + content: + application/json: + schema: + $ref: 'schemas-pn-errors-v1.yaml#/components/schemas/Problem' + + schemas: + + ### - DTO PER RICEZIONE ASINCRONA AVANZAMENTI MESSAGGI + ###################################################### + + SingleStatusUpdate: + type: object + properties: + digitalCourtesy: + $ref: '#/components/schemas/CourtesyMessageProgressEvent' + digitalLegal: + $ref: '#/components/schemas/LegalMessageSentDetails' + analogMail: + $ref: '#/components/schemas/PaperProgressStatusEvent' + clientId: + type: string + eventTimestamp: + type: string + format: date-time + description: >- + Data di produzione dell'evento. + + + ### - RIFERIMENTI AD ALTRI FILE + ###################################################### + DigitalNotificationRequest: + $ref: 'schemas-digital-v1.yaml#/components/schemas/DigitalNotificationRequest' + DigitalCourtesyMailRequest: + $ref: 'schemas-digital-v1.yaml#/components/schemas/DigitalCourtesyMailRequest' + DigitalCourtesySmsRequest: + $ref: 'schemas-digital-v1.yaml#/components/schemas/DigitalCourtesySmsRequest' + LegalMessageSentDetails: + $ref: 'schemas-digital-v1.yaml#/components/schemas/LegalMessageSentDetails' + CourtesyMessageProgressEvent: + $ref: 'schemas-digital-v1.yaml#/components/schemas/CourtesyMessageProgressEvent' + PaperEngageRequest: + $ref: 'schemas-paper-v1.yaml#/components/schemas/PaperEngageRequest' + PaperProgressStatusEvent: + $ref: 'schemas-paper-v1.yaml#/components/schemas/PaperProgressStatusEvent' + + + + # securitySchemes: # ONLY EXTERNAL + # ApiKeyAuth: # ONLY EXTERNAL + # type: apiKey # ONLY EXTERNAL + # in: header # ONLY EXTERNAL + # name: x-api-key # ONLY EXTERNAL + + #security: # ONLY EXTERNAL + # - ApiKeyAuth: [] # use the same name as under securitySchemes # ONLY EXTERNAL diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-digital-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-digital-v1.yaml new file mode 100644 index 000000000..1eefac8fe --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-digital-v1.yaml @@ -0,0 +1,233 @@ +components: + schemas: + + ############################################################################################# + ### RICHIESTE DI INVIO DI MESSAGGISTICA DIGITALE ### + ############################################################################################# + BaseDigitalMessageRequest: + title: Schema base per i messaggi digitali + required: + - requestId + - eventType + - qos + - clientRequestTimeStamp + - channel + - receiverDigitalAddress + - messageText + type: object + properties: + requestId: + type: string + description: >- + Identificativo della richiesta. + correlationId: + type: string + description: >- + Id di correlazione, permette al sender di correlare eventualmente la response. Se assente viene inizializzato con il requestId + eventType: + type: string + description: >- + Tipologia di richiesta. Permette di identificare il tipo di informazione che viene richiesto. + Permette di clusterizzare le tipologie di comunicazione in ingresso + (se sender diversi usano EventType diversi, a fini ad es di fatturazione diventa semplice individuare gli oggetti). + qos: + type: string + enum: + - INTERACTIVE + - BATCH + description: >- + Interactive/Batch (quality of service, "entro quanto tempo" devo rispondere, con che livello di servizio) + # TODO: visto che da problemi con openapi generator 5.4.0, essendo opzionale, per ora lo commentiamo + # provare a decommentarlo al passaggio a openapi generator 6.0.0 + #tags: + # type: object + # properties: + # iun: + # type: string + # description: >- + # Identificativo Unico della Notifica. + # Non è obbligatorio (ad es in una richiesta di verifica indirizzi non abbiamo un identificativo di notifica). + # additionalProperties: true + clientRequestTimeStamp: + type: string + format: date-time + description: >- + Timestamp della richiesta in UTC + receiverDigitalAddress: + type: string + description: >- + Indirizzo PEC del destinatario (o in genere recapito digitale certificato a valore legale). + L’indirizzo si assume valido ed attivo: i servizi erogatori non eseguono ulteriori validazioni sullo stesso. + Non sono previste mail con più destinatari. + In caso di comunicazioni a più destinatari saranno richieste più comunicazioni (in questo modo avremo un requestId univoco per ogni comunicazione/evento/pec). + messageText: + type: string + description: >- + Testo del corpo della comunicazione digitale. + Può essere a discrezione del chiamante in plain text od html (un campo ad hoc che discrimini il formato è opportuno?). + senderDigitalAddress: + type: string + description: >- + Indirizzo PEC (o analoga comunicazione digitale a valore legale) del mittente della comunicazione. + Se non passato va recuperato da configurazione sulla base del sistema chiamante (i.e. X-PagoPA-EXTCH-CX), + va censito in configurazione (obbligatorio). + + ### - PEC, REM, SERCQ, .... + ########################################### + DigitalNotificationRequest: + title: schema per notifiche a valore legale, con allegati + allOf: + - $ref: '#/components/schemas/BaseDigitalMessageRequest' + - type: object + required: + - channel + - subjectText + - messageContentType + properties: + channel: + type: string + enum: + - PEC + - REM + description: >- + Canale di recapito con cui il Sender chiede l’erogazione del servizio. In un primo momento sarà PEC, + ma il dominio dovrà prevedere a breve SERQ, PEC_REM, ed in futuro ogni forma di recapito digitale a valore legale. + subjectText: + type: string + description: >- + Oggetto del corpo della comunicazione digitale. + messageContentType: + type: string + enum: + - 'text/plain' + - 'text/html' + description: >- + Formato: HTML o PLAIN + attachmentUrls: + type: array + items: + type: string + description: >- + Path in cui si trova il documento da allegare alla comunicazione digitale + (i.e. url del file dentro Safe Storage che si occuperà di crypt/decrypt dei documenti). + Il Safe Storge si occuperà di calcolare la presigned url per il recupero dell'allegato che sarà decifrato. + documentUrl può rispondere (alla GET) con un 403 per redirect vs servizio (i.e. lambda, safe storage, presigned url vs bucket s3 non cifrato). + + ### - EMAIL + ########################################### + DigitalCourtesyMailRequest: + title: schema per notifiche __senza__ valore legale, con allegati. + allOf: + - $ref: '#/components/schemas/DigitalNotificationRequest' + - type: object + required: + - channel + properties: + channel: + type: string + enum: + - EMAIL + description: >- + Canale di recapito con cui il Sender chiede l’erogazione del servizio. Per ora solo email + + ### - SMS + ########################################### + DigitalCourtesySmsRequest: + title: schema per notifiche brevi __senza__ valore legale. + allOf: + - $ref: '#/components/schemas/BaseDigitalMessageRequest' + - type: object + required: + - channel + properties: + channel: + type: string + enum: + - SMS + description: >- + Canale di recapito con cui il Sender chiede l’erogazione del servizio. In un primo momento sarà PEC, + ma il dominio dovrà prevedere a breve SERQ, PEC_REM, ed in futuro ogni forma di recapito digitale a valore legale. + + + ############################################################################################# + ### EVENTI DI PROGRESSIONE MESSAGGISTICA DIGITALE ### + ############################################################################################# + + ProgressEventCategory: + type: string + enum: + - PROGRESS + - OK + - ERROR + + DigitalMessageReference: + type: object + required: + - system + - id + properties: + system: + type: string + id: + type: string + location: + type: string + + BaseMessageProgressEvent: + title: Schema base per gli eventi di avanzamento messaggi digitali + type: object + required: + - requestId + - eventTimestamp + - status + - eventCode + properties: + requestId: + type: string + eventTimestamp: + type: string + format: date-time + status: + $ref: '#/components/schemas/ProgressEventCategory' + eventCode: + type: string + enum: + - C000 + - C001 + - C002 + - C003 + - C004 + - C005 + - C006 + - C007 + - C008 + - C009 + - C010 + description: >- + * STATUS EVENTCODE + * PROGRESS C000 = PREACCETTAZIONE (Conferma avvenuta comunicazione con Wrapper Pec) + * PROGRESS C001 = StatusPec.ACCETTAZIONE + * PROGRESS C005 = StatusPec.PRESA_IN_CARICO + * PROGRESS C007 = StatusPec.PREAVVISO_ERRORE_CONSEGNA + * ERROR C002 = StatusPec.NON_ACCETTAZIONE + * ERROR C004 = StatusPec.ERRORE_CONSEGNA + * ERROR C006 = StatusPec.RILEVAZIONE_VIRUS + * ERROR C008 = ERRORE_COMUNICAZIONE_SERVER_PEC + * ERROR C009 = ERRORE_DOMINIO_PEC_NON_VALIDO + * ERROR C010 = ERROR_INVIO_PEC + * OK C003 = StatusPec.AVVENUTA_CONSEGNA + eventDetails: + type: string + generatedMessage: + $ref: '#/components/schemas/DigitalMessageReference' + + + CourtesyMessageProgressEvent: + title: Avanzamento per messaggi di cortesia + allOf: + - $ref: '#/components/schemas/BaseMessageProgressEvent' + + LegalMessageSentDetails: + title: Avanzamento per messaggi legali + allOf: + - $ref: '#/components/schemas/BaseMessageProgressEvent' \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-paper-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-paper-v1.yaml new file mode 100644 index 000000000..4f12080f8 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-paper-v1.yaml @@ -0,0 +1,423 @@ +components: + schemas: + + ########################################################################## + ### RICHIESTA DI POSTALIZZAZIONE ### + ########################################################################## + + ### - RICHIESTA + ################## + + PaperEngageRequest: + required: + - requestId + - requestSenderId + - requestPAId + - clientRequestTimeStamp + - eventType + - productType + - attachments + - printType + - receiverName + - receiverAddress + - receiverCity + - senderName + - senderAddress + - senderCity + - senderPr + type: object + properties: + iun: + type: string + example: 'ABCD-HILM-YKWX-202202-1' + description: >- + Identificativo Unico della Notifica. Può essere usato per migliorare il servizio + di archiviazione degli originali cartacei. Permettendo alle + Pubbliche Amministrazioni di ricercare anche per Identificativo Univoco Notifica. + requestId: + type: string + example: 'ABCD-HILM-YKWX-202202-1_rec0_try1' + description: >- + Identificativo della richiesta. + requestPaId: + type: string + example: '00414580183' + description: >- + Identificativo della PA che ha richiesto il recapito. Utile per autorizzare il + recupero, da parte delle pubbliche amministrazioni, degli originali cartacei + clientRequestTimeStamp: + type: string + format: date-time + description: >- + Timestamp della richiesta in UTC + productType: + description: >- + Tipo prodotto di cui viene chiesto il recapito:
+ - __AR__: Raccomandata Andata e Ritorno,
+ - __890__: Recapito a norma della legge 890/1982,
+ - __RI__: Raccomandata Internazionale,
+ - __RS__: Raccomandata Semplice (per Avviso di mancato Recapito).
+ - ... ulteriori prodotti + type: string + example: 'AR' + attachments: + type: array + items: + type: object + required: + - uri + - order + - documentType + - sha256 + properties: + uri: + type: string + description: URI indicante + example: safestorage://PN_EXTERNAL_LEGALFACT_.... + minLength: 5 + maxLength: 2000 + order: + type: number + description: Ordine di stampa, intero positivo, continuo, inizia da 0 + example: 0 + documentType: + type: string + minLength: 3 + maxLength: 4 + description: >- + Tipo di documento:
+ - __AAR__: Avviso di avvenuta ricezione, tipicamente associato a campo _order_ valorizzato a 0 + - __ATTO__: Documento inviato dalla pubblica amministrazione. + example: AAR + sha256: + type: string + description: >- + sha256, codificato in base 64, del contenuto del file riferenziato dal campo uri + minLength: 40 + maxLength: 50 + printType: + type: string + description: >- + Indica il tipo di stampa richiesto al Consolidatore
+ - __BN_FRONTE__: bianco e nero solo fronte
+ - __BN_FRONTE_RETRO__: bianco e nero fronte e retro
+ - ... ulteriori modalità previste dal contratto + example: 'BN_FRONTE_RETRO' + receiverName: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Cognome e nome o ragione sociale del destinatario + example: 'Mario Rossi' + receiverNameRow2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Seconda riga sulla busta. + example: 'c/o famiglia Bianchi' + receiverAddress: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Indirizzo del destinatario. + example: 'via senza nome 610106' + receiverAddressRow2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Specifica dell’indirizzo di residenza del destinatario (seconda riga indirizzo sulla busta). + example: 'scala Z interno 400' + receiverCap: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Cap del destinatario; in caso di invio estero diventa facoltativo. + example: '40050' + receiverCity: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Comune del destinatario. + example: Argelato + receiverCity2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Frazione del destinatario. Potrebbe essere utile se il chiamante non fornisce il cap. + example: 'fraz. malacappa' + receiverPr: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Provincia del destinatario; in caso di invio estero diventa facoltativo. + example: 'BO' + receiverCountry: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + In caso di destinatario estero, diventa obbligatoria l’indicazione della nazione di destinazione, + in standard UPU o altro standard condiviso. + receiverFiscalCode: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Potrebbe servire ai recapitisti in caso di offerte migliorative per i destinatari (servizi a valore aggiunto basati su cf). + senderName: + type: string + description: >- + Ragione sociale del mittente (PagoPA). + senderAddress: + type: string + description: >- + Indirizzo del mittente. + senderCity: + type: string + description: >- + Città del mittente + senderPr: + type: string + description: >- + Provincia del mittente. + senderDigitalAddress: + type: string + description: >- + Indirizzo PEC del mittente. + arName: + type: string + description: >- + Nominativo di riferimento per l’Avviso di Ritorno. + arAddress: + type: string + description: >- + Indirizzo per AR. + arCap: + type: string + description: >- + CAP AR. + arCity: + type: string + description: >- + Città per AR. + vas: + type: object + additionalProperties: + type: string + description: >- + Servizi a valore aggiunto + applyRasterization: + type: boolean + example: true + description: >- + Flag che indica se bisogna attivare la rasterizzazione per i documenti oppure no. + + ########################################################################## + ### NOTIFICHE DI AVANZAMENTO DEL PROCESSO DI POSTALIZZAZIONE ### + ########################################################################## + + ### - EVENTO SINGOLO + ##################### + + PaperProgressStatusEvent: + required: + - requestId + - statusCode + - statusDescription + - statusDateTime + - productType + - clientRequestTimeStamp + type: object + properties: + requestId: + type: string + description: >- + Identificativo della richiesta. + example: 'ABCD-HILM-YKWX-202202-1_rec0_try1' + registeredLetterCode: + type: string + description: >- + Il codice di tracciatura obbligatorio per i prodotti di corrispondenza tracciata. + example: '123456789abc' + productType: + description: >- + Tipo prodotto di cui viene chiesto il recapito:
+ - __AR__: Raccomandata Andata e Ritorno,
+ - __890__: Recapito a norma della legge 890/1982,
+ - __RI__: Raccomandata Internazionale,
+ - __RS__: Raccomandata Semplice (per Avviso di mancato Recapito).
+ - ... ulteriori prodotti concordati con il consolidatore
+ type: string + iun: + type: string + description: >- + Identificativo Unico della Notifica. Proviene dalla richiesta originaria di PN. + example: 'ABCD-HILM-YKWX-202202-1' + statusCode: + type: string + description: >- + _Codifica sintetica dello stato dell'esito._
+ - __001__ Stampato
+ - __002__ Disponibile al recapitista
+ - __003__ Preso in carico dal recapitista
+ - __004__ Consegnata
+ - __005__ Mancata consegna
+ - __006__ Furto/Smarrimanto/deterioramento
+ - __007__ Consegnato Ufficio Postale
+ - __008__ Mancata consegna Ufficio Postale
+ - __009__ Compiuta giacenza
+ - ... Stati aggiuntivi concordati con il consolidatore + statusDescription: + type: string + example: 'Stampato' + description: >- + Descrizione dello stato del delivery cartaceo che viene notificato. + statusDateTime: + type: string + format: date-time + description: >- + Data stato con timezone + deliveryFailureCause: + description: >- + _Motivazione di mancata consegna_ obbligtorie negli stati di mancata consegna
+ - __01__ destinatario irreperibile
+ - __02__ destinatario deceduto
+ - __03__ destinatario sconosciuto
+ - __04__ destinatario trasferito
+ - __05__ invio rifiutato
+ - __06__ indirizzo inesatto
+ - __07__ indirizzo inesistente
+ - __08__ indirizzo insufficiente
+ - ... Motivazioni aggiuntive concordate con il consolidatore + type: string + attachments: + description: >- + elenco dei documenti prodotti che attestano quanto accaduto durante il processo + di postalizzazione + type: array + items: + $ref: '#/components/schemas/AttachmentDetails' + discoveredAddress: + $ref: '#/components/schemas/DiscoveredAddress' + clientRequestTimeStamp: + type: string + format: date-time + description: >- + Timestamp della richiesta in UTC + isDuplicate: + type: boolean + nullable: true + description: >- + Indica se l'evento risulta duplicato rispetto agli eventi già presenti sulla richiesta. + Valorizzato sempre da pn-ec per gli eventi analogici. + printer: + type: string + description: >- + Identificativo dello stampatore. + example: '123456789abc' + du: + type: string + description: >- + Distinta Unica, raggruppamento di spedizioni in un unico lotto. + example: '123456789abc' + + + AttachmentDetails: + title: dettagli allegato a un evento del processo postale + type: object + required: + - id + - documentType + - uri + - sha256 + - date + properties: + id: + type: string + description: >- + Identificativo di riga. + documentType: + type: string + description: >- + La descrizione della tipologia di oggetto. + uri: + type: string + description: >- + Le coordinate del documento correlato allo stato. + sha256: + type: string + description: >- + sha256, codificato in base 64, del contenuto del file riferenziato dal campo uri + date: + type: string + format: date-time + description: >- + Data di produzione del documento. + sourceType: + type: string + description: >- + Indica se il documento è stato prodotto tramite scansione cartacea (`SCANNED`) oppure generato digitalmente (`DIGITAL`). + - __SCANNED__
+ - __DIGITAL__
+ In caso di assenza del campo, la piattaforma considererà DIGITAL gli allegati con MIME/Type application/zip. + originType: + type: string + description: >- + Specifica l'origine del documento + - __ORIGINAL__
+ - __DUPLICATED__
+ - altri valori da specificare in fase di approfondimento tecnico + In caso di assenza del campo la piattaforma considererà come originale (`ORIGINAL`) il documento + + DiscoveredAddress: + description: >- + Indirizzo del destinatario desunto dalle indagini del personale postale. + required: + - name + - address + - city + properties: + name: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Cognome e nome o ragione sociale del destinatario + nameRow2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Seconda riga sulla busta. + address: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Indirizzo del destinatario. + addressRow2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Specifica dell’indirizzo di residenza del destinatario (seconda riga indirizzo sulla busta). + cap: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Cap del destinatario; in caso di invio estero diventa facoltativo. + city: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Comune del destinatario. + city2: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Frazione del destinatario. Potrebbe essere utile se il chiamante non fornisce il cap. + pr: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + Provincia del destinatario; in caso di invio estero diventa facoltativo. + country: + x-field-extra-annotation: "@lombok.ToString.Exclude" + type: string + description: >- + In caso di destinatario estero, diventa obbligatoria l’indicazione della nazione di destinazione, + in standard UPU o altro standard condiviso. \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-pn-errors-v1.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-pn-errors-v1.yaml new file mode 100644 index 000000000..a0949cb07 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/external-channel/schemas-pn-errors-v1.yaml @@ -0,0 +1,61 @@ + +components: + schemas: + Problem: + properties: + status: + description: The HTTP status code generated by the origin server for this occurrence of the problem. + type: integer + format: int32 + example: 503 + maximum: 600 + minimum: 100 + exclusiveMaximum: true + title: + description: A short, summary of the problem type. Written in english and readable + example: Service Unavailable + maxLength: 64 + pattern: ^[ -~]{0,64}$ + type: string + detail: + description: A human readable explanation of the problem. + example: Request took too long to complete. + maxLength: 4096 + pattern: ^.{0,1024}$ + type: string + traceId: + description: Internal support identifier associated to error + example: 123e4567-e89b-12d3-a456-426614174000 + type: string + errors: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ProblemError' + additionalProperties: false + required: + - type + - status + - title + - errors + ProblemError: + properties: + code: + description: Internal code of the error + example: 123-4567 + type: string + pattern: ^[0-9]{3}-[0-9]{4}$ + minLength: 8 + maxLength: 8 + element: + description: Parameter or request body field name for validation error + example: 'body.order.item[2].quantity' + type: string + detail: + description: A human readable explanation specific to this occurrence of the problem. + example: Parameter not valid + maxLength: 1024 + type: string + required: + - code + - detail \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/remote-refs.yaml b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/remote-refs.yaml new file mode 100644 index 000000000..b6049d9ee --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/docs/openapi/remote-refs.yaml @@ -0,0 +1,38 @@ +info: + version: v1.0 +components: + + parameters: + + ############################################################################################ + ### PARAMETRI DI AUTENTICAZIONE E AUTORIZZAZIONE ### + ############################################################################################ + cxTypeAuthFleet: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-auth-fleet/a1f457ddc112983ec79be0be93256476dd11102c/docs/openapi/authenticationParameters-v1.yaml#/components/parameters/cxTypeAuthFleet' + cxIdAuthFleet: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-auth-fleet/a1f457ddc112983ec79be0be93256476dd11102c/docs/openapi/authenticationParameters-v1.yaml#/components/parameters/cxIdAuthFleet' + cxGroupsAuthFleet: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-auth-fleet/a1f457ddc112983ec79be0be93256476dd11102c/docs/openapi/authenticationParameters-v1.yaml#/components/parameters/cxGroups' + uidAuthFleet: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-auth-fleet/a1f457ddc112983ec79be0be93256476dd11102c/docs/openapi/authenticationParameters-v1.yaml#/components/parameters/uidAuthFleet' + cxTaxIdAuthFleet: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-auth-fleet/a1f457ddc112983ec79be0be93256476dd11102c/docs/openapi/authenticationParameters-v1.yaml#/components/parameters/cxTaxIdAuthFleet' + + schemas: + ############################################################################################ + ### PARAMETRI NOTIFICA ### + ############################################################################################ + IUN: + $ref: "https://raw.githubusercontent.com/pagopa/pn-delivery/1750230e82ea6e03516e9f4bfae09c1737c1d5e7/docs/openapi/schemas-pn-notification.yaml#/components/schemas/IUN" + NotificationFeePolicy: + $ref: "https://raw.githubusercontent.com/pagopa/pn-delivery/1750230e82ea6e03516e9f4bfae09c1737c1d5e7/docs/openapi/schemas-pn-notification.yaml#/components/schemas/NotificationFeePolicy" + PaTaxId: + $ref: "https://raw.githubusercontent.com/pagopa/pn-delivery/1750230e82ea6e03516e9f4bfae09c1737c1d5e7/docs/openapi/schemas-pn-notification.yaml#/components/schemas/paTaxId" + NoticeCode: + $ref: "https://raw.githubusercontent.com/pagopa/pn-delivery/1750230e82ea6e03516e9f4bfae09c1737c1d5e7/docs/openapi/schemas-pn-notification.yaml#/components/schemas/noticeCode" + ############################################################################################ + ### STRUTTURE DATI DI PN-ERROR ### + ############################################################################################ + Problem: + $ref: 'https://raw.githubusercontent.com/pagopa/pn-commons/61cdf0712f133c8c69e056abfad6ce5223242ba0/docs/openapi/pn-errors.yaml#/components/schemas/Problem' + \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/index.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/index.js new file mode 100644 index 000000000..ec2540a1b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/index.js @@ -0,0 +1,8 @@ +const { handleEvent } = require("./src/app/eventHandler.js"); + +async function handler(event, context) { + console.info("New Execution scheduled ", event); + return handleEvent(event, context); +} + +exports.handler = handler; diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package-lock.json b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package-lock.json new file mode 100644 index 000000000..7f435789b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package-lock.json @@ -0,0 +1,5620 @@ +{ + "name": "notificationReworkEventsValidation", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "notificationReworkEventsValidation", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@aws-sdk/client-sqs": "3.995.0", + "@aws-sdk/lib-dynamodb": "3.995.0", + "@aws-sdk/node-http-handler": "3.370.0", + "@aws-sdk/util-dynamodb": "3.995.0", + "axios": "^1.6.8", + "config": "^3.3.11", + "pn-action-common": "file:../../functionsLib/actionCommon", + "uuid": "^9.0.1" + }, + "devDependencies": { + "aws-sdk-client-mock": "^2.2.0", + "axios-mock-adapter": "^1.22.0", + "chai": "^4.4.1", + "chai-as-promised": "^7.1.1", + "eslint": "^8.57.0", + "lambda-tester": "^4.0.1", + "mocha": "^10.3.0", + "mocha-lcov-reporter": "^1.3.0", + "nyc": "^15.1.0", + "proxyquire": "^2.1.3", + "sinon": "^17.0.1" + } + }, + "../../functionsLib/actionCommon": {}, + "node_modules/@aws-crypto/sha256-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", + "dependencies": { + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-js": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", + "dependencies": { + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-crypto/supports-web-crypto": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", + "dependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", + "dependencies": { + "@aws-sdk/types": "^3.222.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/abort-controller": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/abort-controller/-/abort-controller-3.370.0.tgz", + "integrity": "sha512-/W4arzC/+yVW/cvEXbuwvG0uly4yFSZnnIA+gkqgAm+0HVfacwcPpNf4BjyxjnvIdh03l7w2DriF6MlKUfiQ3A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.370.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/abort-controller/node_modules/@aws-sdk/types": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.370.0.tgz", + "integrity": "sha512-8PGMKklSkRKjunFhzM2y5Jm0H2TBu7YRNISdYzXLUHKSP9zlMEYagseKVdmox0zKHf1LXVNuSlUV2b6SRrieCQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/abort-controller/node_modules/@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/client-dynamodb": { + "version": "3.1005.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.1005.0.tgz", + "integrity": "sha512-lPkeRwkXhXEjyO3YENmxseFMfAQQAjecT9BjohoZqurvceLrqTml94Dt84OYtJpAvAVQua5SK7rOrjk2vEeU5A==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/credential-provider-node": "^3.972.19", + "@aws-sdk/dynamodb-codec": "^3.972.20", + "@aws-sdk/middleware-endpoint-discovery": "^3.972.7", + "@aws-sdk/middleware-host-header": "^3.972.7", + "@aws-sdk/middleware-logger": "^3.972.7", + "@aws-sdk/middleware-recursion-detection": "^3.972.7", + "@aws-sdk/middleware-user-agent": "^3.972.20", + "@aws-sdk/region-config-resolver": "^3.972.7", + "@aws-sdk/types": "^3.973.5", + "@aws-sdk/util-endpoints": "^3.996.4", + "@aws-sdk/util-user-agent-browser": "^3.972.7", + "@aws-sdk/util-user-agent-node": "^3.973.5", + "@smithy/config-resolver": "^4.4.10", + "@smithy/core": "^3.23.9", + "@smithy/fetch-http-handler": "^5.3.13", + "@smithy/hash-node": "^4.2.11", + "@smithy/invalid-dependency": "^4.2.11", + "@smithy/middleware-content-length": "^4.2.11", + "@smithy/middleware-endpoint": "^4.4.23", + "@smithy/middleware-retry": "^4.4.40", + "@smithy/middleware-serde": "^4.2.12", + "@smithy/middleware-stack": "^4.2.11", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/node-http-handler": "^4.4.14", + "@smithy/protocol-http": "^5.3.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/url-parser": "^4.2.11", + "@smithy/util-base64": "^4.3.2", + "@smithy/util-body-length-browser": "^4.2.2", + "@smithy/util-body-length-node": "^4.2.3", + "@smithy/util-defaults-mode-browser": "^4.3.39", + "@smithy/util-defaults-mode-node": "^4.2.42", + "@smithy/util-endpoints": "^3.3.2", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-retry": "^4.2.11", + "@smithy/util-utf8": "^4.2.2", + "@smithy/util-waiter": "^4.2.11", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/client-sqs": { + "version": "3.995.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sqs/-/client-sqs-3.995.0.tgz", + "integrity": "sha512-vGE9tY5m+eCarVFRHo4Me/49531+Tp3qpTV8Ka4/AOwv/zWkJNG+zQhBUHHibnxepZcTkpoPRMro4wk7fCA9og==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "^3.973.11", + "@aws-sdk/credential-provider-node": "^3.972.10", + "@aws-sdk/middleware-host-header": "^3.972.3", + "@aws-sdk/middleware-logger": "^3.972.3", + "@aws-sdk/middleware-recursion-detection": "^3.972.3", + "@aws-sdk/middleware-sdk-sqs": "^3.972.8", + "@aws-sdk/middleware-user-agent": "^3.972.11", + "@aws-sdk/region-config-resolver": "^3.972.3", + "@aws-sdk/types": "^3.973.1", + "@aws-sdk/util-endpoints": "3.995.0", + "@aws-sdk/util-user-agent-browser": "^3.972.3", + "@aws-sdk/util-user-agent-node": "^3.972.10", + "@smithy/config-resolver": "^4.4.6", + "@smithy/core": "^3.23.2", + "@smithy/fetch-http-handler": "^5.3.9", + "@smithy/hash-node": "^4.2.8", + "@smithy/invalid-dependency": "^4.2.8", + "@smithy/md5-js": "^4.2.8", + "@smithy/middleware-content-length": "^4.2.8", + "@smithy/middleware-endpoint": "^4.4.16", + "@smithy/middleware-retry": "^4.4.33", + "@smithy/middleware-serde": "^4.2.9", + "@smithy/middleware-stack": "^4.2.8", + "@smithy/node-config-provider": "^4.3.8", + "@smithy/node-http-handler": "^4.4.10", + "@smithy/protocol-http": "^5.3.8", + "@smithy/smithy-client": "^4.11.5", + "@smithy/types": "^4.12.0", + "@smithy/url-parser": "^4.2.8", + "@smithy/util-base64": "^4.3.0", + "@smithy/util-body-length-browser": "^4.2.0", + "@smithy/util-body-length-node": "^4.2.1", + "@smithy/util-defaults-mode-browser": "^4.3.32", + "@smithy/util-defaults-mode-node": "^4.2.35", + "@smithy/util-endpoints": "^3.2.8", + "@smithy/util-middleware": "^4.2.8", + "@smithy/util-retry": "^4.2.8", + "@smithy/util-utf8": "^4.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/client-sqs/node_modules/@aws-sdk/util-endpoints": { + "version": "3.995.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.995.0.tgz", + "integrity": "sha512-aym/pjB8SLbo9w2nmkrDdAAVKVlf7CM71B9mKhjDbJTzwpSFBPHqJIMdDyj0mLumKC0aIVDr1H6U+59m9GvMFw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.1", + "@smithy/types": "^4.12.0", + "@smithy/url-parser": "^4.2.8", + "@smithy/util-endpoints": "^3.2.8", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/core": { + "version": "3.973.19", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.973.19.tgz", + "integrity": "sha512-56KePyOcZnKTWCd89oJS1G6j3HZ9Kc+bh/8+EbvtaCCXdP6T7O7NzCiPuHRhFLWnzXIaXX3CxAz0nI5My9spHQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@aws-sdk/xml-builder": "^3.972.10", + "@smithy/core": "^3.23.9", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/property-provider": "^4.2.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/signature-v4": "^5.3.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/util-base64": "^4.3.2", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-env": { + "version": "3.972.17", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.972.17.tgz", + "integrity": "sha512-MBAMW6YELzE1SdkOniqr51mrjapQUv8JXSGxtwRjQV0mwVDutVsn22OPAUt4RcLRvdiHQmNBDEFP9iTeSVCOlA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.972.19", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.972.19.tgz", + "integrity": "sha512-9EJROO8LXll5a7eUFqu48k6BChrtokbmgeMWmsH7lBb6lVbtjslUYz/ShLi+SHkYzTomiGBhmzTW7y+H4BxsnA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/types": "^3.973.5", + "@smithy/fetch-http-handler": "^5.3.13", + "@smithy/node-http-handler": "^4.4.14", + "@smithy/property-provider": "^4.2.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/util-stream": "^4.5.17", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-ini": { + "version": "3.972.18", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.972.18.tgz", + "integrity": "sha512-vthIAXJISZnj2576HeyLBj4WTeX+I7PwWeRkbOa0mVX39K13SCGxCgOFuKj2ytm9qTlLOmXe4cdEnroteFtJfw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/credential-provider-env": "^3.972.17", + "@aws-sdk/credential-provider-http": "^3.972.19", + "@aws-sdk/credential-provider-login": "^3.972.18", + "@aws-sdk/credential-provider-process": "^3.972.17", + "@aws-sdk/credential-provider-sso": "^3.972.18", + "@aws-sdk/credential-provider-web-identity": "^3.972.18", + "@aws-sdk/nested-clients": "^3.996.8", + "@aws-sdk/types": "^3.973.5", + "@smithy/credential-provider-imds": "^4.2.11", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-login": { + "version": "3.972.18", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-login/-/credential-provider-login-3.972.18.tgz", + "integrity": "sha512-kINzc5BBxdYBkPZ0/i1AMPMOk5b5QaFNbYMElVw5QTX13AKj6jcxnv/YNl9oW9mg+Y08ti19hh01HhyEAxsSJQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/nested-clients": "^3.996.8", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-node": { + "version": "3.972.19", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.972.19.tgz", + "integrity": "sha512-yDWQ9dFTr+IMxwanFe7+tbN5++q8psZBjlUwOiCXn1EzANoBgtqBwcpYcHaMGtn0Wlfj4NuXdf2JaEx1lz5RaQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/credential-provider-env": "^3.972.17", + "@aws-sdk/credential-provider-http": "^3.972.19", + "@aws-sdk/credential-provider-ini": "^3.972.18", + "@aws-sdk/credential-provider-process": "^3.972.17", + "@aws-sdk/credential-provider-sso": "^3.972.18", + "@aws-sdk/credential-provider-web-identity": "^3.972.18", + "@aws-sdk/types": "^3.973.5", + "@smithy/credential-provider-imds": "^4.2.11", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-process": { + "version": "3.972.17", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.972.17.tgz", + "integrity": "sha512-c8G8wT1axpJDgaP3xzcy+q8Y1fTi9A2eIQJvyhQ9xuXrUZhlCfXbC0vM9bM1CUXiZppFQ1p7g0tuUMvil/gCPg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-sso": { + "version": "3.972.18", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.972.18.tgz", + "integrity": "sha512-YHYEfj5S2aqInRt5ub8nDOX8vAxgMvd84wm2Y3WVNfFa/53vOv9T7WOAqXI25qjj3uEcV46xxfqdDQk04h5XQA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/nested-clients": "^3.996.8", + "@aws-sdk/token-providers": "3.1005.0", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-web-identity": { + "version": "3.972.18", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.972.18.tgz", + "integrity": "sha512-OqlEQpJ+J3T5B96qtC1zLLwkBloechP+fezKbCH0sbd2cCc0Ra55XpxWpk/hRj69xAOYtHvoC4orx6eTa4zU7g==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/nested-clients": "^3.996.8", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/dynamodb-codec": { + "version": "3.972.20", + "resolved": "https://registry.npmjs.org/@aws-sdk/dynamodb-codec/-/dynamodb-codec-3.972.20.tgz", + "integrity": "sha512-MQ2W0zeBMNaQYgHcQ7aul7g5783qFdP2AKcJnpaID0ekl2QbiKF+St1JMx5lgOXHlnERD9X3exr2B0SIg35oOA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@smithy/core": "^3.23.9", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/util-base64": "^4.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/endpoint-cache": { + "version": "3.972.4", + "resolved": "https://registry.npmjs.org/@aws-sdk/endpoint-cache/-/endpoint-cache-3.972.4.tgz", + "integrity": "sha512-GdASDnWanLnHxKK0hqV97xz23QmfA/C8yGe0PiuEmWiHSe+x+x+mFEj4sXqx9IbfyPncWz8f4EhNwBSG9cgYCg==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "mnemonist": "0.38.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/lib-dynamodb": { + "version": "3.995.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/lib-dynamodb/-/lib-dynamodb-3.995.0.tgz", + "integrity": "sha512-Z8MW7b8jrdP+0BMMy7ruft6/7aJFyOpS4nGMJ/0JfhppPyIpIfMead1BkJKkakB3T+p9UU9GXSQkGhkdlyASwQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.11", + "@aws-sdk/util-dynamodb": "3.995.0", + "@smithy/core": "^3.23.2", + "@smithy/smithy-client": "^4.11.5", + "@smithy/types": "^4.12.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-dynamodb": "^3.995.0" + } + }, + "node_modules/@aws-sdk/middleware-endpoint-discovery": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-endpoint-discovery/-/middleware-endpoint-discovery-3.972.7.tgz", + "integrity": "sha512-ZeFfgAVOGR+fDq/JAPsVA3P07ba74hIppoGfmQyfzZMfAQAzc9Lbg5pndZU8EanzfKnlXbv6y09OMrSkTsUuOg==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@aws-sdk/endpoint-cache": "^3.972.4", + "@aws-sdk/types": "^3.973.5", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-host-header": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.972.7.tgz", + "integrity": "sha512-aHQZgztBFEpDU1BB00VWCIIm85JjGjQW1OG9+98BdmaOpguJvzmXBGbnAiYcciCd+IS4e9BEq664lhzGnWJHgQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-logger": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.972.7.tgz", + "integrity": "sha512-LXhiWlWb26txCU1vcI9PneESSeRp/RYY/McuM4SpdrimQR5NgwaPb4VJCadVeuGWgh6QmqZ6rAKSoL1ob16W6w==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-recursion-detection": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.972.7.tgz", + "integrity": "sha512-l2VQdcBcYLzIzykCHtXlbpiVCZ94/xniLIkAj0jpnpjY4xlgZx7f56Ypn+uV1y3gG0tNVytJqo3K9bfMFee7SQ==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@aws/lambda-invoke-store": "^0.2.2", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-sdk-sqs": { + "version": "3.972.14", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-sqs/-/middleware-sdk-sqs-3.972.14.tgz", + "integrity": "sha512-MmN/j0D3MLkR0cca8/V2GXjGAkcgp1tlrQZZduLb6G+UhfOJuzFW3rSrCeiXTBgiXSIIZ6sc/gsuACpg/5TL1Q==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/util-hex-encoding": "^4.2.2", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/middleware-user-agent": { + "version": "3.972.20", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.972.20.tgz", + "integrity": "sha512-3kNTLtpUdeahxtnJRnj/oIdLAUdzTfr9N40KtxNhtdrq+Q1RPMdCJINRXq37m4t5+r3H70wgC3opW46OzFcZYA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/types": "^3.973.5", + "@aws-sdk/util-endpoints": "^3.996.4", + "@smithy/core": "^3.23.9", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "@smithy/util-retry": "^4.2.11", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/nested-clients": { + "version": "3.996.8", + "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.996.8.tgz", + "integrity": "sha512-6HlLm8ciMW8VzfB80kfIx16PBA9lOa9Dl+dmCBi78JDhvGlx3I7Rorwi5PpVRkL31RprXnYna3yBf6UKkD/PqA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/middleware-host-header": "^3.972.7", + "@aws-sdk/middleware-logger": "^3.972.7", + "@aws-sdk/middleware-recursion-detection": "^3.972.7", + "@aws-sdk/middleware-user-agent": "^3.972.20", + "@aws-sdk/region-config-resolver": "^3.972.7", + "@aws-sdk/types": "^3.973.5", + "@aws-sdk/util-endpoints": "^3.996.4", + "@aws-sdk/util-user-agent-browser": "^3.972.7", + "@aws-sdk/util-user-agent-node": "^3.973.5", + "@smithy/config-resolver": "^4.4.10", + "@smithy/core": "^3.23.9", + "@smithy/fetch-http-handler": "^5.3.13", + "@smithy/hash-node": "^4.2.11", + "@smithy/invalid-dependency": "^4.2.11", + "@smithy/middleware-content-length": "^4.2.11", + "@smithy/middleware-endpoint": "^4.4.23", + "@smithy/middleware-retry": "^4.4.40", + "@smithy/middleware-serde": "^4.2.12", + "@smithy/middleware-stack": "^4.2.11", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/node-http-handler": "^4.4.14", + "@smithy/protocol-http": "^5.3.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/url-parser": "^4.2.11", + "@smithy/util-base64": "^4.3.2", + "@smithy/util-body-length-browser": "^4.2.2", + "@smithy/util-body-length-node": "^4.2.3", + "@smithy/util-defaults-mode-browser": "^4.3.39", + "@smithy/util-defaults-mode-node": "^4.2.42", + "@smithy/util-endpoints": "^3.3.2", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-retry": "^4.2.11", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/node-http-handler": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/node-http-handler/-/node-http-handler-3.370.0.tgz", + "integrity": "sha512-v2mCtrbzbsK5YFopIeD7oIl+aEHtyFeNDq2ODkNlO0HPYBRbvFHFKFeUsyR991tfmffPonae4oeI9RI8eZQu2A==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/abort-controller": "3.370.0", + "@aws-sdk/protocol-http": "3.370.0", + "@aws-sdk/querystring-builder": "3.370.0", + "@aws-sdk/types": "3.370.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/node-http-handler/node_modules/@aws-sdk/types": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.370.0.tgz", + "integrity": "sha512-8PGMKklSkRKjunFhzM2y5Jm0H2TBu7YRNISdYzXLUHKSP9zlMEYagseKVdmox0zKHf1LXVNuSlUV2b6SRrieCQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/node-http-handler/node_modules/@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/protocol-http": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/protocol-http/-/protocol-http-3.370.0.tgz", + "integrity": "sha512-MfZCgSsVmir+4kJps7xT0awOPNi+swBpcVp9ZtAP7POduUVV6zVLurMNLXsppKsErggssD5E9HUgQFs5w06U4Q==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.370.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/protocol-http/node_modules/@aws-sdk/types": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.370.0.tgz", + "integrity": "sha512-8PGMKklSkRKjunFhzM2y5Jm0H2TBu7YRNISdYzXLUHKSP9zlMEYagseKVdmox0zKHf1LXVNuSlUV2b6SRrieCQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/protocol-http/node_modules/@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/querystring-builder": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/querystring-builder/-/querystring-builder-3.370.0.tgz", + "integrity": "sha512-yrDWn3AtXArHWXh9NATcf+aaF6SPBxgroSIHYKKDA7B0UlSEpCOroz7anj0Lvewwo1D3hLlXcJlBSGVtWI0Xyg==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "3.370.0", + "@aws-sdk/util-uri-escape": "3.310.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/querystring-builder/node_modules/@aws-sdk/types": { + "version": "3.370.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.370.0.tgz", + "integrity": "sha512-8PGMKklSkRKjunFhzM2y5Jm0H2TBu7YRNISdYzXLUHKSP9zlMEYagseKVdmox0zKHf1LXVNuSlUV2b6SRrieCQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^1.1.0", + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/querystring-builder/node_modules/@smithy/types": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-1.2.0.tgz", + "integrity": "sha512-z1r00TvBqF3dh4aHhya7nz1HhvCg4TRmw51fjMrh5do3h+ngSstt/yKlNbHeb9QxJmFbmN8KEVSWgb1bRvfEoA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/region-config-resolver": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.972.7.tgz", + "integrity": "sha512-/Ev/6AI8bvt4HAAptzSjThGUMjcWaX3GX8oERkB0F0F9x2dLSBdgFDiyrRz3i0u0ZFZFQ1b28is4QhyqXTUsVA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/config-resolver": "^4.4.10", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/token-providers": { + "version": "3.1005.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.1005.0.tgz", + "integrity": "sha512-vMxd+ivKqSxU9bHx5vmAlFKDAkjGotFU56IOkDa5DaTu1WWwbcse0yFHEm9I537oVvodaiwMl3VBwgHfzQ2rvw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/core": "^3.973.19", + "@aws-sdk/nested-clients": "^3.996.8", + "@aws-sdk/types": "^3.973.5", + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/types": { + "version": "3.973.5", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.973.5.tgz", + "integrity": "sha512-hl7BGwDCWsjH8NkZfx+HgS7H2LyM2lTMAI7ba9c8O0KqdBLTdNJivsHpqjg9rNlAlPyREb6DeDRXUl0s8uFdmQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/util-dynamodb": { + "version": "3.995.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-dynamodb/-/util-dynamodb-3.995.0.tgz", + "integrity": "sha512-ErHBnAaxlPAn/TCBY8+Alr/IF9E3tFeK6NCY1GdRUl6Lz2PFZnZeoh7GrLZZn0jvlX4OirXlhwAds6mqp+NKoA==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-dynamodb": "^3.995.0" + } + }, + "node_modules/@aws-sdk/util-endpoints": { + "version": "3.996.4", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.996.4.tgz", + "integrity": "sha512-Hek90FBmd4joCFj+Vc98KLJh73Zqj3s2W56gjAcTkrNLMDI5nIFkG9YpfcJiVI1YlE2Ne1uOQNe+IgQ/Vz2XRA==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/types": "^4.13.0", + "@smithy/url-parser": "^4.2.11", + "@smithy/util-endpoints": "^3.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws-sdk/util-locate-window": { + "version": "3.893.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.893.0.tgz", + "integrity": "sha512-T89pFfgat6c8nMmpI8eKjBcDcgJq36+m9oiXbcUzeU55MP9ZuGgBomGjGnHaEyF36jenW9gmg3NfZDm0AO2XPg==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@aws-sdk/util-uri-escape": { + "version": "3.310.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-uri-escape/-/util-uri-escape-3.310.0.tgz", + "integrity": "sha512-drzt+aB2qo2LgtDoiy/3sVG8w63cgLkqFIa2NFlGpUgHFWTXkqtbgf4L5QdjRGKWhmZsnqkbtL7vkSWEcYDJ4Q==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-sdk/util-user-agent-browser": { + "version": "3.972.7", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.972.7.tgz", + "integrity": "sha512-7SJVuvhKhMF/BkNS1n0QAJYgvEwYbK2QLKBrzDiwQGiTRU6Yf1f3nehTzm/l21xdAOtWSfp2uWSddPnP2ZtsVw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/types": "^3.973.5", + "@smithy/types": "^4.13.0", + "bowser": "^2.11.0", + "tslib": "^2.6.2" + } + }, + "node_modules/@aws-sdk/util-user-agent-node": { + "version": "3.973.5", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.973.5.tgz", + "integrity": "sha512-Dyy38O4GeMk7UQ48RupfHif//gqnOPbq/zlvRssc11E2mClT+aUfc3VS2yD8oLtzqO3RsqQ9I3gOBB4/+HjPOw==", + "license": "Apache-2.0", + "dependencies": { + "@aws-sdk/middleware-user-agent": "^3.972.20", + "@aws-sdk/types": "^3.973.5", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "aws-crt": ">=1.0.0" + }, + "peerDependenciesMeta": { + "aws-crt": { + "optional": true + } + } + }, + "node_modules/@aws-sdk/xml-builder": { + "version": "3.972.10", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.972.10.tgz", + "integrity": "sha512-OnejAIVD+CxzyAUrVic7lG+3QRltyja9LoNqCE/1YVs8ichoTbJlVSaZ9iSMcnHLyzrSNtvaOGjSDRP+d/ouFA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "fast-xml-parser": "5.4.1", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@aws/lambda-invoke-store": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@aws/lambda-invoke-store/-/lambda-invoke-store-0.2.3.tgz", + "integrity": "sha512-oLvsaPMTBejkkmHhjf09xTgk71mOqyr/409NKhRIL08If7AhVfUsJhVsx386uJaqNd42v9kWamQ9lFbkoC2dYw==", + "license": "Apache-2.0", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.28.3", + "@babel/helpers": "^7.28.4", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true + }, + "node_modules/@babel/generator": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", + "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.28.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", + "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "dev": true, + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.28.5" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.6.0", + "globals": "^13.19.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/js": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@extra-number/significant-digits": { + "version": "1.3.9", + "resolved": "https://registry.npmjs.org/@extra-number/significant-digits/-/significant-digits-1.3.9.tgz", + "integrity": "sha512-E5PY/bCwrNqEHh4QS6AQBinLZ+sxM1lT8tsSVYk8VwhWIPp6fCU/BMRVq0V8iJ8LwS3FHmaA4vUzb78s4BIIyA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dev": true + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "deprecated": "Use @eslint/config-array instead", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^2.0.3", + "debug": "^4.3.1", + "minimatch": "^3.0.5" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", + "deprecated": "Use @eslint/object-schema instead", + "dev": true + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "dev": true, + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/load-nyc-config/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/commons/node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "11.3.1", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-11.3.1.tgz", + "integrity": "sha512-EVJO7nW5M/F5Tur0Rf2z/QoMo+1Ia963RiMtapiQrEWvY0iBUvADo8Beegwjpnle5BHkyHuoxSTW3jF43H1XRA==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.1" + } + }, + "node_modules/@sinonjs/samsam": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-8.0.3.tgz", + "integrity": "sha512-hw6HbX+GyVZzmaYNh82Ecj1vdGZrqVIn/keDTg63IgAwiQPO+xCz99uG6Woqgb4tM0mUiFENKZ4cqd7IX94AXQ==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.1", + "type-detect": "^4.1.0" + } + }, + "node_modules/@sinonjs/text-encoding": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz", + "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", + "dev": true + }, + "node_modules/@smithy/abort-controller": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-4.2.11.tgz", + "integrity": "sha512-Hj4WoYWMJnSpM6/kchsm4bUNTL9XiSyhvoMb2KIq4VJzyDt7JpGHUZHkVNPZVC7YE1tf8tPeVauxpFBKGW4/KQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/config-resolver": { + "version": "4.4.10", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.4.10.tgz", + "integrity": "sha512-IRTkd6ps0ru+lTWnfnsbXzW80A8Od8p3pYiZnW98K2Hb20rqfsX7VTlfUwhrcOeSSy68Gn9WBofwPuw3e5CCsg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.3.11", + "@smithy/types": "^4.13.0", + "@smithy/util-config-provider": "^4.2.2", + "@smithy/util-endpoints": "^3.3.2", + "@smithy/util-middleware": "^4.2.11", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/core": { + "version": "3.23.9", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.23.9.tgz", + "integrity": "sha512-1Vcut4LEL9HZsdpI0vFiRYIsaoPwZLjAxnVQDUMQK8beMS+EYPLDQCXtbzfxmM5GzSgjfe2Q9M7WaXwIMQllyQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/middleware-serde": "^4.2.12", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "@smithy/util-base64": "^4.3.2", + "@smithy/util-body-length-browser": "^4.2.2", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-stream": "^4.5.17", + "@smithy/util-utf8": "^4.2.2", + "@smithy/uuid": "^1.1.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/credential-provider-imds": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.2.11.tgz", + "integrity": "sha512-lBXrS6ku0kTj3xLmsJW0WwqWbGQ6ueooYyp/1L9lkyT0M02C+DWwYwc5aTyXFbRaK38ojALxNixg+LxKSHZc0g==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.3.11", + "@smithy/property-provider": "^4.2.11", + "@smithy/types": "^4.13.0", + "@smithy/url-parser": "^4.2.11", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/fetch-http-handler": { + "version": "5.3.13", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.3.13.tgz", + "integrity": "sha512-U2Hcfl2s3XaYjikN9cT4mPu8ybDbImV3baXR0PkVlC0TTx808bRP3FaPGAzPtB8OByI+JqJ1kyS+7GEgae7+qQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.3.11", + "@smithy/querystring-builder": "^4.2.11", + "@smithy/types": "^4.13.0", + "@smithy/util-base64": "^4.3.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/hash-node": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.2.11.tgz", + "integrity": "sha512-T+p1pNynRkydpdL015ruIoyPSRw9e/SQOWmSAMmmprfswMrd5Ow5igOWNVlvyVFZlxXqGmyH3NQwfwy8r5Jx0A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "@smithy/util-buffer-from": "^4.2.2", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/invalid-dependency": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.2.11.tgz", + "integrity": "sha512-cGNMrgykRmddrNhYy1yBdrp5GwIgEkniS7k9O1VLB38yxQtlvrxpZtUVvo6T4cKpeZsriukBuuxfJcdZQc/f/g==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/is-array-buffer": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-4.2.2.tgz", + "integrity": "sha512-n6rQ4N8Jj4YTQO3YFrlgZuwKodf4zUFs7EJIWH86pSCWBaAtAGBFfCM7Wx6D2bBJ2xqFNxGBSrUWswT3M0VJow==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/md5-js": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-4.2.11.tgz", + "integrity": "sha512-350X4kGIrty0Snx2OWv7rPM6p6vM7RzryvFs6B/56Cux3w3sChOb3bymo5oidXJlPcP9fIRxGUCk7GqpiSOtng==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-content-length": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.2.11.tgz", + "integrity": "sha512-UvIfKYAKhCzr4p6jFevPlKhQwyQwlJ6IeKLDhmV1PlYfcW3RL4ROjNEDtSik4NYMi9kDkH7eSwyTP3vNJ/u/Dw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-endpoint": { + "version": "4.4.23", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.4.23.tgz", + "integrity": "sha512-UEFIejZy54T1EJn2aWJ45voB7RP2T+IRzUqocIdM6GFFa5ClZncakYJfcYnoXt3UsQrZZ9ZRauGm77l9UCbBLw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.23.9", + "@smithy/middleware-serde": "^4.2.12", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "@smithy/url-parser": "^4.2.11", + "@smithy/util-middleware": "^4.2.11", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-retry": { + "version": "4.4.40", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.4.40.tgz", + "integrity": "sha512-YhEMakG1Ae57FajERdHNZ4ShOPIY7DsgV+ZoAxo/5BT0KIe+f6DDU2rtIymNNFIj22NJfeeI6LWIifrwM0f+rA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.3.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/service-error-classification": "^4.2.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-retry": "^4.2.11", + "@smithy/uuid": "^1.1.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-serde": { + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-4.2.12.tgz", + "integrity": "sha512-W9g1bOLui7Xn5FABRVS0o3rXL0gfN37d/8I/W7i0N7oxjx9QecUmXEMSUMADTODwdtka9cN43t5BI2CodLJpng==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/middleware-stack": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-4.2.11.tgz", + "integrity": "sha512-s+eenEPW6RgliDk2IhjD2hWOxIx1NKrOHxEwNUaUXxYBxIyCcDfNULZ2Mu15E3kwcJWBedTET/kEASPV1A1Akg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-config-provider": { + "version": "4.3.11", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-4.3.11.tgz", + "integrity": "sha512-xD17eE7kaLgBBGf5CZQ58hh2YmwK1Z0O8YhffwB/De2jsL0U3JklmhVYJ9Uf37OtUDLF2gsW40Xwwag9U869Gg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.2.11", + "@smithy/shared-ini-file-loader": "^4.4.6", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/node-http-handler": { + "version": "4.4.14", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.4.14.tgz", + "integrity": "sha512-DamSqaU8nuk0xTJDrYnRzZndHwwRnyj/n/+RqGGCcBKB4qrQem0mSDiWdupaNWdwxzyMU91qxDmHOCazfhtO3A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/abort-controller": "^4.2.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/querystring-builder": "^4.2.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/property-provider": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-4.2.11.tgz", + "integrity": "sha512-14T1V64o6/ndyrnl1ze1ZhyLzIeYNN47oF/QU6P5m82AEtyOkMJTb0gO1dPubYjyyKuPD6OSVMPDKe+zioOnCg==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/protocol-http": { + "version": "5.3.11", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-5.3.11.tgz", + "integrity": "sha512-hI+barOVDJBkNt4y0L2mu3Ugc0w7+BpJ2CZuLwXtSltGAAwCb3IvnalGlbDV/UCS6a9ZuT3+exd1WxNdLb5IlQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-builder": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-4.2.11.tgz", + "integrity": "sha512-7spdikrYiljpket6u0up2Ck2mxhy7dZ0+TDd+S53Dg2DHd6wg+YNJrTCHiLdgZmEXZKI7LJZcwL3721ZRDFiqA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "@smithy/util-uri-escape": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/querystring-parser": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-4.2.11.tgz", + "integrity": "sha512-nE3IRNjDltvGcoThD2abTozI1dkSy8aX+a2N1Rs55en5UsdyyIXgGEmevUL3okZFoJC77JgRGe99xYohhsjivQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/service-error-classification": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-4.2.11.tgz", + "integrity": "sha512-HkMFJZJUhzU3HvND1+Yw/kYWXp4RPDLBWLcK1n+Vqw8xn4y2YiBhdww8IxhkQjP/QlZun5bwm3vcHc8AqIU3zw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/shared-ini-file-loader": { + "version": "4.4.6", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-4.4.6.tgz", + "integrity": "sha512-IB/M5I8G0EeXZTHsAxpx51tMQ5R719F3aq+fjEB6VtNcCHDc0ajFDIGDZw+FW9GxtEkgTduiPpjveJdA/CX7sw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/signature-v4": { + "version": "5.3.11", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.3.11.tgz", + "integrity": "sha512-V1L6N9aKOBAN4wEHLyqjLBnAz13mtILU0SeDrjOaIZEeN6IFa6DxwRt1NNpOdmSpQUfkBj0qeD3m6P77uzMhgQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.2.2", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "@smithy/util-hex-encoding": "^4.2.2", + "@smithy/util-middleware": "^4.2.11", + "@smithy/util-uri-escape": "^4.2.2", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/smithy-client": { + "version": "4.12.3", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-4.12.3.tgz", + "integrity": "sha512-7k4UxjSpHmPN2AxVhvIazRSzFQjWnud3sOsXcFStzagww17j1cFQYqTSiQ8xuYK3vKLR1Ni8FzuT3VlKr3xCNw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/core": "^3.23.9", + "@smithy/middleware-endpoint": "^4.4.23", + "@smithy/middleware-stack": "^4.2.11", + "@smithy/protocol-http": "^5.3.11", + "@smithy/types": "^4.13.0", + "@smithy/util-stream": "^4.5.17", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/types": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.13.0.tgz", + "integrity": "sha512-COuLsZILbbQsdrwKQpkkpyep7lCsByxwj7m0Mg5v66/ZTyenlfBc40/QFQ5chO0YN/PNEH1Bi3fGtfXPnYNeDw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/url-parser": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-4.2.11.tgz", + "integrity": "sha512-oTAGGHo8ZYc5VZsBREzuf5lf2pAurJQsccMusVZ85wDkX66ojEc/XauiGjzCj50A61ObFTPe6d7Pyt6UBYaing==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/querystring-parser": "^4.2.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-base64": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-4.3.2.tgz", + "integrity": "sha512-XRH6b0H/5A3SgblmMa5ErXQ2XKhfbQB+Fm/oyLZ2O2kCUrwgg55bU0RekmzAhuwOjA9qdN5VU2BprOvGGUkOOQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.2.2", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-browser": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-4.2.2.tgz", + "integrity": "sha512-JKCrLNOup3OOgmzeaKQwi4ZCTWlYR5H4Gm1r2uTMVBXoemo1UEghk5vtMi1xSu2ymgKVGW631e2fp9/R610ZjQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-body-length-node": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-4.2.3.tgz", + "integrity": "sha512-ZkJGvqBzMHVHE7r/hcuCxlTY8pQr1kMtdsVPs7ex4mMU+EAbcXppfo5NmyxMYi2XU49eqaz56j2gsk4dHHPG/g==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-buffer-from": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-4.2.2.tgz", + "integrity": "sha512-FDXD7cvUoFWwN6vtQfEta540Y/YBe5JneK3SoZg9bThSoOAC/eGeYEua6RkBgKjGa/sz6Y+DuBZj3+YEY21y4Q==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/is-array-buffer": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-config-provider": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-4.2.2.tgz", + "integrity": "sha512-dWU03V3XUprJwaUIFVv4iOnS1FC9HnMHDfUrlNDSh4315v0cWyaIErP8KiqGVbf5z+JupoVpNM7ZB3jFiTejvQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-browser": { + "version": "4.3.39", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.3.39.tgz", + "integrity": "sha512-ui7/Ho/+VHqS7Km2wBw4/Ab4RktoiSshgcgpJzC4keFPs6tLJS4IQwbeahxQS3E/w98uq6E1mirCH/id9xIXeQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/property-provider": "^4.2.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-defaults-mode-node": { + "version": "4.2.42", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.2.42.tgz", + "integrity": "sha512-QDA84CWNe8Akpj15ofLO+1N3Rfg8qa2K5uX0y6HnOp4AnRYRgWrKx/xzbYNbVF9ZsyJUYOfcoaN3y93wA/QJ2A==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/config-resolver": "^4.4.10", + "@smithy/credential-provider-imds": "^4.2.11", + "@smithy/node-config-provider": "^4.3.11", + "@smithy/property-provider": "^4.2.11", + "@smithy/smithy-client": "^4.12.3", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-endpoints": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-3.3.2.tgz", + "integrity": "sha512-+4HFLpE5u29AbFlTdlKIT7jfOzZ8PDYZKTb3e+AgLz986OYwqTourQ5H+jg79/66DB69Un1+qKecLnkZdAsYcA==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/node-config-provider": "^4.3.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-hex-encoding": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-4.2.2.tgz", + "integrity": "sha512-Qcz3W5vuHK4sLQdyT93k/rfrUwdJ8/HZ+nMUOyGdpeGA1Wxt65zYwi3oEl9kOM+RswvYq90fzkNDahPS8K0OIg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-middleware": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-4.2.11.tgz", + "integrity": "sha512-r3dtF9F+TpSZUxpOVVtPfk09Rlo4lT6ORBqEvX3IBT6SkQAdDSVKR5GcfmZbtl7WKhKnmb3wbDTQ6ibR2XHClw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-retry": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-4.2.11.tgz", + "integrity": "sha512-XSZULmL5x6aCTTii59wJqKsY1l3eMIAomRAccW7Tzh9r8s7T/7rdo03oektuH5jeYRlJMPcNP92EuRDvk9aXbw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/service-error-classification": "^4.2.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-stream": { + "version": "4.5.17", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-4.5.17.tgz", + "integrity": "sha512-793BYZ4h2JAQkNHcEnyFxDTcZbm9bVybD0UV/LEWmZ5bkTms7JqjfrLMi2Qy0E5WFcCzLwCAPgcvcvxoeALbAQ==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/fetch-http-handler": "^5.3.13", + "@smithy/node-http-handler": "^4.4.14", + "@smithy/types": "^4.13.0", + "@smithy/util-base64": "^4.3.2", + "@smithy/util-buffer-from": "^4.2.2", + "@smithy/util-hex-encoding": "^4.2.2", + "@smithy/util-utf8": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-uri-escape": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-4.2.2.tgz", + "integrity": "sha512-2kAStBlvq+lTXHyAZYfJRb/DfS3rsinLiwb+69SstC9Vb0s9vNWkRwpnj918Pfi85mzi42sOqdV72OLxWAISnw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-utf8": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.2.2.tgz", + "integrity": "sha512-75MeYpjdWRe8M5E3AW0O4Cx3UadweS+cwdXjwYGBW5h/gxxnbeZ877sLPX/ZJA9GVTlL/qG0dXP29JWFCD1Ayw==", + "license": "Apache-2.0", + "dependencies": { + "@smithy/util-buffer-from": "^4.2.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/util-waiter": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-4.2.11.tgz", + "integrity": "sha512-x7Rh2azQPs3XxbvCzcttRErKKvLnbZfqRf/gOjw2pb+ZscX88e5UkRPCB67bVnsFHxayvMvmePfKTqsRb+is1A==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@smithy/abort-controller": "^4.2.11", + "@smithy/types": "^4.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@smithy/uuid": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@smithy/uuid/-/uuid-1.1.2.tgz", + "integrity": "sha512-O/IEdcCUKkubz60tFbGA7ceITTAJsty+lBjNoorP4Z6XRqaFb/OjQjZODophEcuq68nKm6/0r+6/lLQ+XVpk8g==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@types/sinon": { + "version": "10.0.20", + "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-10.0.20.tgz", + "integrity": "sha512-2APKKruFNCAZgx3daAyACGzWuJ028VVCUDk6o2rw/Z4PXT0ogwdV4KUegW0MwVs0Zu59auPXbbuBJHF12Sx1Eg==", + "dev": true, + "dependencies": { + "@types/sinonjs__fake-timers": "*" + } + }, + "node_modules/@types/sinonjs__fake-timers": { + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-15.0.1.tgz", + "integrity": "sha512-Ko2tjWJq8oozHzHV+reuvS5KYIRAokHnGbDwGh/J64LntgpbuylF74ipEL24HCyRjf9FOlBiBHWBR1RlVKsI1w==", + "dev": true + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "dev": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/app-root-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", + "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", + "dev": true, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/append-transform": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", + "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", + "dev": true, + "dependencies": { + "default-require-extensions": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", + "dev": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/aws-sdk-client-mock": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/aws-sdk-client-mock/-/aws-sdk-client-mock-2.2.0.tgz", + "integrity": "sha512-Kq2N+6gHRDedbrgTA0NMMfyN1XDWEA5Kbpm9/M/cenSxoNjfvQBOtBawI1lQe5h4UziLl///E7u17K9PBoHEKA==", + "dev": true, + "dependencies": { + "@types/sinon": "^10.0.10", + "sinon": "^14.0.2", + "tslib": "^2.1.0" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/@sinonjs/commons": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-2.0.0.tgz", + "integrity": "sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/@sinonjs/fake-timers": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz", + "integrity": "sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^1.7.0" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": { + "version": "1.8.6", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", + "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "dev": true, + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/@sinonjs/samsam": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-7.0.1.tgz", + "integrity": "sha512-zsAk2Jkiq89mhZovB2LLOdTCxJF4hqqTToGP0ASWlhp4I1hqOjcfmZGafXntCN7MDC6yySH0mFHrYtHceOeLmw==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^2.0.0", + "lodash.get": "^4.4.2", + "type-detect": "^4.0.8" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/sinon": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-14.0.2.tgz", + "integrity": "sha512-PDpV0ZI3ZCS3pEqx0vpNp6kzPhHrLx72wA0G+ZLaaJjLIYeE0n8INlgaohKuGy7hP0as5tbUd23QWu5U233t+w==", + "deprecated": "16.1.1", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^2.0.0", + "@sinonjs/fake-timers": "^9.1.2", + "@sinonjs/samsam": "^7.0.1", + "diff": "^5.0.0", + "nise": "^5.1.2", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/aws-sdk-client-mock/node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/axios": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.1.tgz", + "integrity": "sha512-hU4EGxxt+j7TQijx1oYdAjw4xuIp1wRQSsbMFwSthCWeBQur1eF+qJ5iQ5sN3Tw8YRzQNKb8jszgBdMDVqwJcw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/axios-mock-adapter": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/axios-mock-adapter/-/axios-mock-adapter-1.22.0.tgz", + "integrity": "sha512-dmI0KbkyAhntUR05YY96qg2H6gg0XMl2+qTW0xmYg6Up+BFBAJYRLROMXRdDEL06/Wqwa0TJThAYvFtSFdRCZw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3", + "is-buffer": "^2.0.5" + }, + "peerDependencies": { + "axios": ">= 0.17.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/baseline-browser-mapping": { + "version": "2.8.21", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.21.tgz", + "integrity": "sha512-JU0h5APyQNsHOlAM7HnQnPToSDQoEBZqzu/YBlqDnEeymPnZDREeXJA3KBMQee+dKteAxZ2AtvQEvVYdZf241Q==", + "dev": true, + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bowser": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.14.1.tgz", + "integrity": "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/browserslist": { + "version": "4.27.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.27.0.tgz", + "integrity": "sha512-AXVQwdhot1eqLihwasPElhX2tAZiBjWdJ9i/Zcj2S6QYIjkx62OKSfnobkriB81C3l4w0rVy3Nt4jaTBltYEpw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "baseline-browser-mapping": "^2.8.19", + "caniuse-lite": "^1.0.30001751", + "electron-to-chromium": "^1.5.238", + "node-releases": "^2.0.26", + "update-browserslist-db": "^1.1.4" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/caching-transform": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", + "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", + "dev": true, + "dependencies": { + "hasha": "^5.0.0", + "make-dir": "^3.0.0", + "package-hash": "^4.0.0", + "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001751", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001751.tgz", + "integrity": "sha512-A0QJhug0Ly64Ii3eIqHu5X51ebln3k4yTUkY1j8drqpWHVreg/VLijN48cZ1bYPiqOQuqpkIKnzr/Ul8V+p6Cw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ] + }, + "node_modules/chai": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.3", + "deep-eql": "^4.1.3", + "get-func-name": "^2.0.2", + "loupe": "^2.3.6", + "pathval": "^1.1.1", + "type-detect": "^4.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chai-as-promised": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.2.tgz", + "integrity": "sha512-aBDHZxRzYnUYuIAIPBH2s511DjlKPzXNlXSGFC8CwmroWQLfrW0LtE1nK3MAwwNhJPa9raEjNCmRoFpG0Hurdw==", + "dev": true, + "dependencies": { + "check-error": "^1.0.2" + }, + "peerDependencies": { + "chai": ">= 2.1.2 < 6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/check-error": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", + "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.2" + }, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/config": { + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/config/-/config-3.3.12.tgz", + "integrity": "sha512-Vmx389R/QVM3foxqBzXO8t2tUikYZP64Q6vQxGrsMpREeJc/aWRnPRERXWsYzOHAumx/AOoILWe6nU3ZJL+6Sw==", + "dependencies": { + "json5": "^2.2.3" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-eql": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.4.tgz", + "integrity": "sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/default-require-extensions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.1.tgz", + "integrity": "sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==", + "dev": true, + "dependencies": { + "strip-bom": "^4.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dotenv": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.6.0.tgz", + "integrity": "sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/dotenv-json": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/dotenv-json/-/dotenv-json-1.0.0.tgz", + "integrity": "sha512-jAssr+6r4nKhKRudQ0HOzMskOFFi9+ubXWwmrSGJFgTvpjyPXCXsCsYbjif6mXp7uxA7xY3/LGaiTQukZzSbOQ==", + "dev": true + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.243", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.243.tgz", + "integrity": "sha512-ZCphxFW3Q1TVhcgS9blfut1PX8lusVi2SvXQgmEEnK4TCmE1JhH2JkjJN+DNt0pJJwfBri5AROBnz2b/C+YU9g==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es6-error": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", + "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", + "dev": true + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "8.57.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz", + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.4", + "@eslint/js": "8.57.1", + "@humanwhocodes/config-array": "^0.13.0", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3", + "strip-ansi": "^6.0.1", + "text-table": "^0.2.0" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-scope": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "9.6.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dev": true, + "dependencies": { + "acorn": "^8.9.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true + }, + "node_modules/fast-xml-builder": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.0.0.tgz", + "integrity": "sha512-fpZuDogrAgnyt9oDDz+5DBz0zgPdPZz6D4IR7iESxRXElrlGTRkHJ9eEt+SACRJwT0FNFrt71DFQIUFBJfX/uQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/fast-xml-parser": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.4.1.tgz", + "integrity": "sha512-BQ30U1mKkvXQXXkAGcuyUA/GA26oEB7NzOtsxCDtyu62sjGw5QraKFhx2Em3WQNjPw9PG6MQ9yuIIgkSDfGu5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "fast-xml-builder": "^1.0.0", + "strnum": "^2.1.2" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", + "integrity": "sha512-tcgI872xXjwFF4xgQmLxi76GnwJG3g/3isB1l4/G5Z4zrbddGpBjqZCO9oEAcB5wX0Hj/5iQB3toxfO7in1hHA==", + "dev": true, + "dependencies": { + "is-object": "~1.0.1", + "merge-descriptors": "~1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dev": true, + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/form-data": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fromentries": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", + "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasha": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", + "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", + "dev": true, + "dependencies": { + "is-stream": "^2.0.0", + "type-fest": "^0.8.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hasha/node_modules/type-fest": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "engines": { + "node": ">=4" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-object": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", + "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", + "dev": true + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-hook": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", + "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", + "dev": true, + "dependencies": { + "append-transform": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", + "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", + "dev": true, + "dependencies": { + "@babel/core": "^7.7.5", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.0.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-processinfo": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", + "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==", + "dev": true, + "dependencies": { + "archy": "^1.0.0", + "cross-spawn": "^7.0.3", + "istanbul-lib-coverage": "^3.2.0", + "p-map": "^3.0.0", + "rimraf": "^3.0.0", + "uuid": "^8.3.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-processinfo/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz", + "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/just-extend": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-6.2.0.tgz", + "integrity": "sha512-cYofQu2Xpom82S6qD778jBDpwvvy39s1l/hrYij2u9AMdQcGRpaBu6kY4mVhuno5kJVi1DAz4aiphA2WI1/OAw==", + "dev": true + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lambda-event-mock": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lambda-event-mock/-/lambda-event-mock-1.5.0.tgz", + "integrity": "sha512-vx1d+vZqi7FF6B3+mAfHnY/6Tlp6BheL2ta0MJS0cIRB3Rc4I5cviHTkiJxHdE156gXx3ZjlQRJrS4puXvtrhA==", + "dev": true, + "dependencies": { + "@extra-number/significant-digits": "^1.1.1", + "clone-deep": "^4.0.1", + "uuid": "^3.3.3", + "vandium-utils": "^1.2.0" + }, + "engines": { + "node": ">=12.13" + } + }, + "node_modules/lambda-event-mock/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/lambda-event-mock/node_modules/vandium-utils": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vandium-utils/-/vandium-utils-1.2.0.tgz", + "integrity": "sha512-yxYUDZz4BNo0CW/z5w4mvclitt5zolY7zjW97i6tTE+sU63cxYs1A6Bl9+jtIQa3+0hkeqY87k+7ptRvmeHe3g==", + "dev": true + }, + "node_modules/lambda-leak": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lambda-leak/-/lambda-leak-2.0.0.tgz", + "integrity": "sha512-2c9jwUN3ZLa2GEiOhObbx2BMGQplEUCDHSIkhDtYwUjsTfiV/3jCF6ThIuEXfsvqbUK+0QpZcugIKB8YMbSevQ==", + "dev": true, + "engines": { + "node": ">=6.10.0" + } + }, + "node_modules/lambda-tester": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lambda-tester/-/lambda-tester-4.0.1.tgz", + "integrity": "sha512-ft6XHk84B6/dYEzyI3anKoGWz08xQ5allEHiFYDUzaYTymgVK7tiBkCEbuWx+MFvH7OpFNsJXVtjXm0X8iH3Iw==", + "dev": true, + "dependencies": { + "app-root-path": "^3.0.0", + "dotenv": "^8.0.0", + "dotenv-json": "^1.0.0", + "lambda-event-mock": "^1.5.0", + "lambda-leak": "^2.0.0", + "semver": "^6.1.1", + "uuid": "^3.3.3", + "vandium-utils": "^2.0.0" + }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/lambda-tester/node_modules/uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.flattendeep": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", + "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", + "dev": true + }, + "node_modules/lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", + "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/loupe": { + "version": "2.3.7", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", + "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", + "dev": true, + "dependencies": { + "get-func-name": "^2.0.1" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mnemonist": { + "version": "0.38.3", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.3.tgz", + "integrity": "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw==", + "license": "MIT", + "peer": true, + "dependencies": { + "obliterator": "^1.6.1" + } + }, + "node_modules/mocha": { + "version": "10.8.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.8.2.tgz", + "integrity": "sha512-VZlYo/WE8t1tstuRmqgeyBgCbJc/lEdopaa+axcKzTBJ+UIdlAB9XnmvTCAH4pwR4ElNInaedhEBmZD8iCSVEg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.3", + "browser-stdout": "^1.3.1", + "chokidar": "^3.5.3", + "debug": "^4.3.5", + "diff": "^5.2.0", + "escape-string-regexp": "^4.0.0", + "find-up": "^5.0.0", + "glob": "^8.1.0", + "he": "^1.2.0", + "js-yaml": "^4.1.0", + "log-symbols": "^4.1.0", + "minimatch": "^5.1.6", + "ms": "^2.1.3", + "serialize-javascript": "^6.0.2", + "strip-json-comments": "^3.1.1", + "supports-color": "^8.1.1", + "workerpool": "^6.5.1", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.9", + "yargs-unparser": "^2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha-lcov-reporter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/mocha-lcov-reporter/-/mocha-lcov-reporter-1.3.0.tgz", + "integrity": "sha512-/5zI2tW4lq/ft8MGpYQ1nIH6yePPtIzdGeUEwFMKfMRdLfAQ1QW2c68eEJop32tNdN5srHa/E2TzB+erm3YMYA==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/module-not-found-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", + "integrity": "sha512-pEk4ECWQXV6z2zjhRZUongnLJNUeGQJ3w6OQ5ctGwD+i5o93qjRQUk2Rt6VdNeu3sEP0AB4LcfvdebpxBRVr4g==", + "dev": true + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true + }, + "node_modules/nise": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/nise/-/nise-5.1.9.tgz", + "integrity": "sha512-qOnoujW4SV6e40dYxJOb3uvuoPHtmLzIk4TFo+j0jPJoC+5Z9xja5qH5JZobEPsa8+YYphMrOSwnrshEhG2qww==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/text-encoding": "^0.7.2", + "just-extend": "^6.2.0", + "path-to-regexp": "^6.2.1" + } + }, + "node_modules/node-preload": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", + "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", + "dev": true, + "dependencies": { + "process-on-spawn": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/nyc": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", + "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", + "dev": true, + "dependencies": { + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "caching-transform": "^4.0.0", + "convert-source-map": "^1.7.0", + "decamelize": "^1.2.0", + "find-cache-dir": "^3.2.0", + "find-up": "^4.1.0", + "foreground-child": "^2.0.0", + "get-package-type": "^0.1.0", + "glob": "^7.1.6", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-hook": "^3.0.0", + "istanbul-lib-instrument": "^4.0.0", + "istanbul-lib-processinfo": "^2.0.2", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.0.2", + "make-dir": "^3.0.0", + "node-preload": "^0.2.1", + "p-map": "^3.0.0", + "process-on-spawn": "^1.0.0", + "resolve-from": "^5.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "spawn-wrap": "^2.0.0", + "test-exclude": "^6.0.0", + "yargs": "^15.0.2" + }, + "bin": { + "nyc": "bin/nyc.js" + }, + "engines": { + "node": ">=8.9" + } + }, + "node_modules/nyc/node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/nyc/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/nyc/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/nyc/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "node_modules/nyc/node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/nyc/node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/obliterator": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-1.6.1.tgz", + "integrity": "sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig==", + "license": "MIT", + "peer": true + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", + "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "dev": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/package-hash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", + "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.15", + "hasha": "^5.0.0", + "lodash.flattendeep": "^4.4.0", + "release-zalgo": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pn-action-common": { + "resolved": "../../functionsLib/actionCommon", + "link": true + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process-on-spawn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.1.0.tgz", + "integrity": "sha512-JOnOPQ/8TZgjs1JIH/m9ni7FfimjNa/PRx7y/Wb5qdItsnhO0jE4AT7fC0HjC28DUQWDr50dwSYZLdRMlqDq3Q==", + "dev": true, + "dependencies": { + "fromentries": "^1.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "node_modules/proxyquire": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", + "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==", + "dev": true, + "dependencies": { + "fill-keys": "^1.0.2", + "module-not-found-error": "^1.0.1", + "resolve": "^1.11.1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/release-zalgo": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", + "integrity": "sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA==", + "dev": true, + "dependencies": { + "es6-error": "^4.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", + "dev": true + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/sinon": { + "version": "17.0.1", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-17.0.1.tgz", + "integrity": "sha512-wmwE19Lie0MLT+ZYNpDymasPHUKTaZHUH/pKEubRXIzySv9Atnlw+BUMGCzWgV7b7wO+Hw6f1TEOr0IUnmU8/g==", + "dev": true, + "dependencies": { + "@sinonjs/commons": "^3.0.0", + "@sinonjs/fake-timers": "^11.2.2", + "@sinonjs/samsam": "^8.0.0", + "diff": "^5.1.0", + "nise": "^5.1.5", + "supports-color": "^7.2.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/sinon" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/spawn-wrap": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", + "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", + "dev": true, + "dependencies": { + "foreground-child": "^2.0.0", + "is-windows": "^1.0.2", + "make-dir": "^3.0.0", + "rimraf": "^3.0.0", + "signal-exit": "^3.0.2", + "which": "^2.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strnum": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.0.tgz", + "integrity": "sha512-Y7Bj8XyJxnPAORMZj/xltsfo55uOiyHcU2tnAVzHUnSJR/KsEX+9RoDeXEnsXtl/CX4fAcrt64gZ13aGaWPeBg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/test-exclude/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "dev": true + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.4.tgz", + "integrity": "sha512-q0SPT4xyU84saUX+tomz1WLkxUbuaJnR1xWt17M7fJtEJigJeWUNGUqrauFXsHnqev9y9JTRGwk13tFBuKby4A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/vandium-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vandium-utils/-/vandium-utils-2.0.0.tgz", + "integrity": "sha512-XWbQ/0H03TpYDXk8sLScBEZpE7TbA0CHDL6/Xjt37IBYKLsHUQuBlL44ttAUs9zoBOLFxsW7HehXcuWCNyqOxQ==", + "dev": true, + "engines": { + "node": ">=10.16" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-module": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz", + "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==", + "dev": true + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/workerpool": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.5.1.tgz", + "integrity": "sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yargs-unparser/node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package.json b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package.json new file mode 100644 index 000000000..f2c8c6c0e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/package.json @@ -0,0 +1,37 @@ +{ + "name": "notificationReworkEventsValidation", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test-build": "npm run-script test && npm run-script coverage && npm run-script build", + "build": "npm prune --production && rm -f ./function.zip && zip -r ./function.zip . -x './src/test/*' -x '*.md' -x '*.env' -x './coverage/*' -x './.nyc_output/*' -x './.scannerwork/*'", + "test": "nyc --reporter=html --reporter=text mocha './src/test/**/*.test.js' --recursive --timeout=3000 --exit -r dotenv/config", + "coverage": "nyc report --reporter=lcov" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "aws-sdk-client-mock": "^2.2.0", + "axios-mock-adapter": "^1.22.0", + "chai": "^4.4.1", + "chai-as-promised": "^7.1.1", + "eslint": "^8.57.0", + "lambda-tester": "^4.0.1", + "mocha": "^10.3.0", + "mocha-lcov-reporter": "^1.3.0", + "nyc": "^15.1.0", + "proxyquire": "^2.1.3", + "sinon": "^17.0.1" + }, + "dependencies": { + "@aws-sdk/client-sqs": "3.995.0", + "@aws-sdk/lib-dynamodb": "3.995.0", + "@aws-sdk/node-http-handler": "3.370.0", + "@aws-sdk/util-dynamodb": "3.995.0", + "axios": "^1.6.8", + "config": "^3.3.11", + "pn-action-common": "file:../../functionsLib/actionCommon", + "uuid": "^9.0.1" + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/dynamo.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/dynamo.js new file mode 100644 index 000000000..2c755569b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/dynamo.js @@ -0,0 +1,102 @@ +const { DynamoDBClient } = require("@aws-sdk/client-dynamodb"); +const { + DynamoDBDocumentClient, + QueryCommand, + UpdateCommand, + PutCommand +} = require("@aws-sdk/lib-dynamodb"); + +const client = new DynamoDBClient({}); +const docClient = DynamoDBDocumentClient.from(client); + +const NOTIFICATION_REWORK_TABLE = process.env.NOTIFICATION_REWORK_TABLE; +const EVENTS_ERROR_TABLE = process.env.NOTIFICATION_REWORK_EVENTS_ERROR_TABLE; + +async function getLatestReworkRequestByIun(iun, requestId) { + const params = { + TableName: NOTIFICATION_REWORK_TABLE, + KeyConditionExpression: "iun = :iun", + ExpressionAttributeValues: { + ":iun": iun + }, + ScanIndexForward: false + }; + + const result = await docClient.send(new QueryCommand(params)); + const recIndex = getRecIndexFromRequestId(requestId); + if (!result.Items || result.Items.length === 0) { + return null; + } + + return result.Items.reduce((latest, item) => { + if (item.recIndex !== recIndex || !item.createdAt) { + return latest; + } + + if (!latest) { + return item; + } + + return Date.parse(item.createdAt) > Date.parse(latest.createdAt) + ? item + : latest; + }, null); +} + +function getRecIndexFromRequestId(requestId){ + if (!requestId) return null; + const match = requestId.match(/(RECINDEX_\d+)/); + return match ? match[1] : null; +} + +async function appendReceivedStatusCode(iun, reworkId, receivedStatusCodesEntry, analogMail) { + try { + await docClient.send(new UpdateCommand({ + TableName: NOTIFICATION_REWORK_TABLE, + Key: { iun, reworkId }, + UpdateExpression: "SET receivedStatusCodes = list_append(if_not_exists(receivedStatusCodes, :empty), :new)", + ConditionExpression: "NOT contains(receivedStatusCodes, :check)", + ExpressionAttributeValues: { + ":new": [receivedStatusCodesEntry], + ":check": receivedStatusCodesEntry, + ":empty": [] + } + })); + } catch (error) { + if (error.name === 'ConditionalCheckFailedException') { + // Elemento già presente, non è un errore + console.log(`Status code ${receivedStatusCodesEntry} già presente per iun=${iun}, reworkId=${reworkId}`); + await insertEventsError(iun, reworkId, analogMail, "Evento duplicato"); + } + } +} + +async function insertEventsError(iun, reworkId, analogMail, errorMessage) { + const now = new Date().toISOString(); + const uniqueReworkId = reworkId ? `${reworkId}~${crypto.randomUUID()}` : crypto.randomUUID(); + + const item = { + iun, + reworkId: uniqueReworkId, + requestId: analogMail.requestId, + statusCode: analogMail.statusCode, + statusDateTime: analogMail.statusDateTime, + productType: analogMail.productType, + deliveryFailureCause: analogMail.deliveryFailureCause, + attachments: analogMail.attachments, + errorMessage, + created: now + }; + + const command = new PutCommand({ + TableName: EVENTS_ERROR_TABLE, + Item: item + }); + await docClient.send(command); +} + +module.exports = { + getLatestReworkRequestByIun, + appendReceivedStatusCode, + insertEventsError +}; \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/eventHandler.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/eventHandler.js new file mode 100644 index 000000000..821f955f9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/eventHandler.js @@ -0,0 +1,140 @@ +const { getLatestReworkRequestByIun, appendReceivedStatusCode, insertEventsError } = require("./dynamo"); +const { sendToQueue, createMessageAttributes } = require("./sqs"); +const { logOperation } = require("./log"); +const {checkRejectedStatusCode, checkAlreadyReceived, checkExpected, checkAttachments, checkDeliveryFailureCause, buildReceivedStatusCodeEntry} = require("./utils"); + +async function handleEvent(event){ + const batchItemFailures = []; + // Processa tutti i record, collezionando i fallimenti + for (const record of event.Records) { + try { + await processRecord(record); + } catch (error) { + batchItemFailures.push({ itemIdentifier: record.messageId}); + logOperation("ERROR", record.messageId, { message: "Record added to batch failures for retry", error: error.message,}); + } + } + + if (batchItemFailures.length > 0) { + return { + batchItemFailures: batchItemFailures + }; + } + return { status: "ok" }; +}; + +function parseBody(record) { + try { + return JSON.parse(record.body); + } catch (err) { + logOperation("ERROR", messageId, { + error: "Invalid JSON", + rawBody: record.body, + }); + throw err; + } +} + +/** + * Processa un singolo record SQS + */ +const processRecord = async (record) => { + const { messageId } = record; + logOperation("INFO", messageId, { message: "Processing message",record }); + + let body = parseBody(record); + + const analogMail = body?.analogMail; + + const statusCode = analogMail.statusCode; + const statusDateTime = analogMail.statusDateTime; + const attachments = analogMail.attachments?.map(att => att.documentType) || []; + const deliveryFailureCause = analogMail.deliveryFailureCause; + const iun = analogMail.iun; + const requestId = analogMail.requestId; + + const reworkEntry = await getLatestReworkRequestByIun(iun, requestId); + if (!reworkEntry) { + logOperation("FATAL", messageId, { message: "No notification rework request found for IUN", iun }); + await insertEventsError(iun, null, analogMail, "Richiesta di rework non presente"); + return; + } + + if(reworkEntry.status != "READY" && reworkEntry.status != "IN_PROGRESS"){ + logOperation("FATAL", messageId, { message: "Rework request is in invalid status", reworkStatus: reworkEntry.status }); + const reworkId = reworkEntry?.reworkId; + await insertEventsError(iun, reworkId, analogMail, `La richiesta di rework è in uno stato non valido: ${reworkEntry.status}`); + return; + } + + const reworkId = reworkEntry?.reworkId; + let continueProcessing = await checkStatusCode(messageId, reworkEntry, analogMail, statusCode, statusDateTime, attachments, deliveryFailureCause); + if(continueProcessing){ + const attributes = await createMessageAttributes(record.messageAttributes, reworkId); + await sendToQueue(body, attributes); + const receivedStatusCodeEntry = buildReceivedStatusCodeEntry(statusCode, attachments, statusDateTime); + await appendReceivedStatusCode(iun, reworkId, receivedStatusCodeEntry, analogMail); + } + + logOperation("DEBUG", messageId, { message: "Message processed successfully" }); +} + +async function checkStatusCode(messageId, reworkEntry, analogMail, statusCode, statusDateTime, attachments, deliveryFailureCause){ + const reworkId = reworkEntry?.reworkId; + const iun = reworkEntry?.iun; + const rejected = checkRejectedStatusCode(statusCode); + if (rejected) { + logOperation("FATAL", messageId, { message: "Scartato in quanto evento di furto, smarrimento o deterioramento"}); + await insertEventsError(iun, reworkId, analogMail, "Evento di furto, smarrimento o deterioramento"); + return false; + } + + const expected = checkExpected(reworkEntry, statusCode); + + if(!expected){ + const message = "Evento non atteso. Gli eventi accettati sono: " + JSON.stringify(reworkEntry.expectedStatusCodes); + logOperation("ERROR", messageId, { + message: message, + expectedStatusCodes: JSON.stringify(reworkEntry.expectedStatusCode) + }); + await insertEventsError(iun, reworkId, analogMail, message); + return false; + } + + const attachment = checkAttachments(reworkEntry, statusCode, attachments); + if(!attachment){ + const message = "Allegati non validi. Gli eventi accettati sono: " + JSON.stringify(reworkEntry.expectedStatusCodes); + logOperation("ERROR", messageId, { + message: message, + expectedStatusCodes: JSON.stringify(reworkEntry.expectedStatusCode) + }); + await insertEventsError(iun, reworkId, analogMail, message); + return false; + } + + if(statusCode.endsWith("A") || statusCode.endsWith("D")){ + const deliveryFailureCauseValidation = checkDeliveryFailureCause(reworkEntry, deliveryFailureCause); + if(!deliveryFailureCauseValidation){ + const message = "DeliveryFailureCause non valida."; + logOperation("ERROR", messageId, { + message: message + }); + await insertEventsError(iun, reworkId, analogMail, message); + return false; + } + } + + + const alreadyReceived = checkAlreadyReceived(reworkEntry, statusCode, attachments, statusDateTime); + + if(alreadyReceived){ + logOperation("ERROR", messageId, { message: "Evento duplicato"}); + await insertEventsError(iun, reworkId, analogMail, "Evento duplicato"); + return false; + } + return true +} + +module.exports = { + handleEvent +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/log.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/log.js new file mode 100644 index 000000000..d7690266d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/log.js @@ -0,0 +1,27 @@ +/** + * Log strutturato per operazioni + * @param {string} level - Livello di log + * @param {string} messageId - ID del messaggio + * @param {object} details - Dettagli aggiuntivi + */ +function logOperation(level, messageId, details = {}){ + const logData = { + level, + messageId, + ...details, + }; + if(level === "FATAL"){ + console.fatal(JSON.stringify(logData)); + } + else if (level === "ERROR") { + console.error(JSON.stringify(logData)); + } else if (level === "DEBUG") { + console.debug(JSON.stringify(logData)); + } else { + console.log(JSON.stringify(logData)); + } +} + +module.exports = { + logOperation +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/sqs.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/sqs.js new file mode 100644 index 000000000..3226bb62c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/sqs.js @@ -0,0 +1,52 @@ +const { SQSClient, SendMessageCommand } = require("@aws-sdk/client-sqs"); + +const SQS_QUEUE_URL = process.env.EXTERNAL_TO_PAPER_QUEUE_URL; +const sqsClient = new SQSClient({}); + +/** + * Invia un messaggio a una coda SQS + * @param {string} queueUrl - URL della coda + * @param {object} messageBody - Corpo del messaggio + * @param {object} messageAttributes - Attributi del messaggio + * @returns {Promise} Promise dell'invio + */ +async function sendToQueue (messageBody, messageAttributes) { + return await sqsClient.send( + new SendMessageCommand({ + QueueUrl: SQS_QUEUE_URL, + MessageBody: JSON.stringify(messageBody), + MessageAttributes: messageAttributes, + }) + ); +}; + +/** + * Crea gli attributi del messaggio copiando quelli originali + * @param {object} originalAttributes - Attributi originali del record SQS + * @param {boolean} addDryRun - Se aggiungere l'attributo dryRun + * @returns {object} Attributi del messaggio + */ +async function createMessageAttributes (originalAttributes = {}, reworkId) { + const attributes = {}; + // Copia attributi originali + for (const [key, attr] of Object.entries(originalAttributes)) { + // Saltiamo reworkId qui perché verrà sovrascritto esplicitamente dopo + if (key === 'reworkId') continue; + + attributes[key] = { + DataType: attr.dataType || attr.DataType || 'String', // Gestisce sia input camelCase che PascalCase + StringValue: attr.stringValue || attr.StringValue + }; + } + + attributes["reworkId"] = { + DataType: "String", + StringValue: reworkId, + }; + return attributes; +} + +module.exports = { + sendToQueue, + createMessageAttributes +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/utils.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/utils.js new file mode 100644 index 000000000..23dddf39a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/app/utils.js @@ -0,0 +1,95 @@ +function checkExpected(reworkEntry, statusCode){ + if (!reworkEntry?.expectedStatusCodes || !Array.isArray(reworkEntry.expectedStatusCodes)) { + return false; + } + return reworkEntry.expectedStatusCodes.some(item => { + if (item.statusCode !== statusCode) return false; + return true; + }); +} + +function checkAttachments(reworkEntry, statusCode, attachments){ + return reworkEntry.expectedStatusCodes + .filter(item => item.statusCode == statusCode) + .some(item => { + const hasInputAttachments = attachments && attachments.length > 0; + const hasItemAttachments = item.attachments && item.attachments.length > 0; + + if ((hasItemAttachments && !hasInputAttachments) || (!hasItemAttachments && hasInputAttachments)) return false; + + // Caso: item ha allegati → controlla corrispondenza parziale (input ⊆ item) + if (hasItemAttachments) { + const isSubset = attachments.every(att => item.attachments.includes(att)); + const sameLength = item.attachments.length === attachments.length; + + // true solo se uguali o se input ⊂ item (come [a] vs [a,b]) + return isSubset && (sameLength || item.attachments.length > attachments.length); + } + return true; + }); +} + +function checkDeliveryFailureCause(reworkEntry, deliveryFailureCause){ + if(reworkEntry.expectedDeliveryFailureCause && !deliveryFailureCause){ + return false; + } + + if(!reworkEntry.expectedDeliveryFailureCause && deliveryFailureCause){ + return false; + } + + if(reworkEntry.expectedDeliveryFailureCause && deliveryFailureCause){ + return reworkEntry.expectedDeliveryFailureCause == deliveryFailureCause; + } + + return true; +} + +function checkAlreadyReceived(reworkEntry, statusCode, attachments, statusDateTime){ + if (!reworkEntry?.receivedStatusCodes || !Array.isArray(reworkEntry.receivedStatusCodes)) { + return false; + } + return reworkEntry.receivedStatusCodes.some(item => { + if (item.statusCode !== statusCode || item.statusDateTime !== statusDateTime) { + return false; + } + + const hasInputAttachments = attachments && attachments.length > 0; + const hasItemAttachments = item.attachments && item.attachments.length > 0; + + if (hasInputAttachments !== hasItemAttachments) { + return false; + } + + if (hasInputAttachments && hasItemAttachments) { + return item.attachments.length === attachments.length && + item.attachments.every(att => attachments.includes(att)); + } + return true; + }); +} + +function checkRejectedStatusCode(statusCode){ + const INVALID_STATUS_CODE = process.env.INVALID_STATUS_CODE ? process.env.INVALID_STATUS_CODE.split(",") : []; + if (INVALID_STATUS_CODE.includes(statusCode)) { + return true; + } + return false; +} + +function buildReceivedStatusCodeEntry(statusCode, attachments, statusDateTime){ + return { + statusCode, + attachments: attachments && attachments.length > 0 ? attachments : [], + statusDateTime + } +} + +module.exports = { + checkExpected, + checkAttachments, + checkDeliveryFailureCause, + checkAlreadyReceived, + checkRejectedStatusCode, + buildReceivedStatusCodeEntry +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/dynamo.test.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/dynamo.test.js new file mode 100644 index 000000000..137e5468c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/dynamo.test.js @@ -0,0 +1,92 @@ +const { getLatestReworkRequestByIun, appendReceivedStatusCode, insertEventsError } = require('../app/dynamo'); +const { DynamoDBDocumentClient, QueryCommand, UpdateCommand, PutCommand } = require("@aws-sdk/lib-dynamodb"); +const { mockClient } = require('aws-sdk-client-mock'); +const assert = require('assert'); + +const ddbMock = mockClient(DynamoDBDocumentClient); + +describe("getLatestReworkRequestByIun", () => { + beforeEach(() => { + ddbMock.reset(); + }); + + it("returns the latest rework request when items are found", async () => { + ddbMock.on(QueryCommand).resolves({ + Items: [{ iun: "test-iun", reworkId: "rework-123" , recIndex: "RECINDEX_0", createdAt: "2025-11-27T11:48:17.194069270Z" }, + { iun: "test-iun", reworkId: "rework-124" , recIndex: "RECINDEX_0", createdAt: "2025-11-27T14:52:17.194069270Z" }, + { iun: "test-iun", reworkId: "rework-125" , recIndex: "RECINDEX_0", createdAt: "2025-11-27T19:48:17.194069270Z"}, + ] + }); + + const result = await getLatestReworkRequestByIun("test-iun", "PREPARE_ANALOG_DOMICILE.IUN_12345.RECINDEX_0.ATTEMPT_0"); + + assert(ddbMock.commandCalls(QueryCommand).length == 1); + assert.deepStrictEqual(result.reworkId, "rework-125"); + }); + + it("returns null when no items are found", async () => { + ddbMock.on(QueryCommand).resolves({ Items: [] }); + + const result = await getLatestReworkRequestByIun("test-iun"); + + assert(ddbMock.commandCalls(QueryCommand).length == 1); + assert.strictEqual(result, null); + }); +}); + +describe("appendReceivedStatusCode", () => { + beforeEach(() => { + ddbMock.reset(); + }); + + it("appends a new received status code entry", async () => { + ddbMock.on(UpdateCommand).resolves({}); + + await appendReceivedStatusCode( "test-iun", "rework-123",{ statusCode: "RECRN001A", attachments: [], statusDateTime: '2025-05-01'}, null); + + assert(ddbMock.commandCalls(UpdateCommand).length == 1); + }); + + it("appends a new received status code entry with error", async () => { + const analogMail = { + requestId: "req-123", + clientRequestTimeStamp: "2023-01-01T00:00:00Z", + statusCode: 500, + statusDateTime: "2023-01-01T00:00:00Z", + productType: "type-a", + deliveryFailureCause: "cause-a", + attachments: ["file1"], + registeredLetterCode: "code-123" + }; + ddbMock.on(UpdateCommand).rejects({ name: "ConditionalCheckFailedException" }); + await appendReceivedStatusCode( "test-iun", "rework-123",{ statusCode: "RECRN001A", attachments: [], statusDateTime: '2025-05-01'}, analogMail); + + assert(ddbMock.commandCalls(UpdateCommand).length == 1); + assert(ddbMock.commandCalls(PutCommand).length == 1); + }); +}); + +describe("insertEventsError", () => { + beforeEach(() => { + ddbMock.reset(); + }); + + it("inserts an event error into the table", async () => { + ddbMock.on(PutCommand).resolves({}); + + const analogMail = { + requestId: "req-123", + clientRequestTimeStamp: "2023-01-01T00:00:00Z", + statusCode: 500, + statusDateTime: "2023-01-01T00:00:00Z", + productType: "type-a", + deliveryFailureCause: "cause-a", + attachments: ["file1"], + registeredLetterCode: "code-123" + }; + + await insertEventsError("test-iun", "rework-123", analogMail, "Error message"); + + assert(ddbMock.commandCalls(PutCommand).length == 1); + }); +}); diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/eventHandler.test.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/eventHandler.test.js new file mode 100644 index 000000000..7b4a66b66 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/eventHandler.test.js @@ -0,0 +1,439 @@ +const assert = require('assert'); +const proxyquire = require('proxyquire'); + +// Mock modules +let mockDynamo = {}; +let mockSqs = {}; +let mockLog = {}; +let handleEvent; + +// Setup mocks before requiring handler +function setupMocks() { + // Reset mocks + mockDynamo = { + getLatestReworkRequestByIun: async () => null, + appendReceivedStatusCode: async () => {}, + insertEventsError: async () => {} + }; + + mockSqs = { + sendToQueue: async () => {}, + createMessageAttributes: () => ({}) + }; + + mockLog = { + logOperation: () => {} + }; +} + +// Helper functions +function createValidRecord(overrides = {}) { + const record = { + messageId: 'test-message-id', + body: JSON.stringify({ + analogMail: { + statusCode: 'RECAG001', + statusDateTime: '2025-01-15T10:00:00Z', + iun: 'TEST-IUN-123', + attachments: [{ documentType: 'AR' }], + deliveryFailureCause: null + } + }), + messageAttributes: {} + }; + + if (overrides.messageId) record.messageId = overrides.messageId; + if (overrides.body) record.body = overrides.body; + if (overrides.analogMail) { + const body = JSON.parse(record.body); + body.analogMail = { ...body.analogMail, ...overrides.analogMail }; + record.body = JSON.stringify(body); + } + + return record; +} + +function createInvalidRecord(overrides = {}) { + const record = { + messageId: 'test-message-id', + body: JSON.stringify({ + analogMail: { + statusCode: 'RECAG003', + statusDateTime: '2025-01-15T10:00:00Z', + iun: 'TEST-IUN-123', + attachments: [{ documentType: 'AR' }], + deliveryFailureCause: null + } + }), + messageAttributes: {} + }; + + if (overrides.messageId) record.messageId = overrides.messageId; + if (overrides.body) record.body = overrides.body; + if (overrides.analogMail) { + const body = JSON.parse(record.body); + body.analogMail = { ...body.analogMail, ...overrides.analogMail }; + record.body = JSON.stringify(body); + } + + return record; +} + +function createReworkEntry(overrides = {}) { + return { + iun: 'TEST-IUN-123', + reworkId: 'rework-123', + status: 'READY', + expectedStatusCodes: [ + { statusCode: 'RECAG001', attachments: ['AR'] }, + { statusCode: 'RECAG002', attachments: [] } + ], + receivedStatusCodes: [], + ...overrides + }; +} + +describe("handleEvent - Successful Processing", () => { + beforeEach(() => { + setupMocks(); }); + + it("should process valid record successfully", async () => { + let appendCalled = false; + let queueCalled = false; + + // Set up mocks before loading handler + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return createReworkEntry(); + }; + + mockDynamo.appendReceivedStatusCode = async () => { + appendCalled = true; + }; + + mockSqs.sendToQueue = async () => { + queueCalled = true; + }; + + mockSqs.createMessageAttributes = () => ({ reworkId: 'rework-123' }); + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { Records: [createValidRecord()] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, { status: 'ok' }); + assert.strictEqual(appendCalled, true, 'appendReceivedStatusCode should be called'); + assert.strictEqual(queueCalled, true, 'sendToQueue should be called'); + }); + + it("should process multiple records successfully", async () => { + let sqsCounter = 0; + let appendCounter = 0; + + // Set up mocks before loading handler + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return createReworkEntry(); + }; + + mockDynamo.appendReceivedStatusCode = async () => { + appendCounter++; + }; + + mockSqs.sendToQueue = async () => { + sqsCounter++; + }; + + mockSqs.createMessageAttributes = () => ({ reworkId: 'rework-123' }); + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { + Records: [ + createValidRecord({ messageId: 'msg-1' }), + createValidRecord({ messageId: 'msg-2' }), + createValidRecord({ messageId: 'msg-3' }) + ] + }; + + const result = await handleEvent(event); + + assert.deepStrictEqual(result, { status: 'ok' }); + assert.strictEqual(appendCounter, 3, 'appendReceivedStatusCode should be called 3 times'); + assert.strictEqual(sqsCounter, 3, 'sendToQueue should be called 3 times'); + }); +}); + +describe("handleEvent - Error Cases", () => { + beforeEach(() => { + setupMocks(); + }); + + it("should handle missing rework entry", async () => { + let callAppend = false; + let callSqs = false; + + mockDynamo.appendReceivedStatusCode = async () => { + callAppend = true; + }; + + mockSqs.sendToQueue = async () => { + callSqs = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { Records: [createValidRecord()] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], 'Richiesta di rework non presente'); + assert.strictEqual(callAppend,false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(callSqs, false, 'sendToQueue should not be called'); + }); + + it("should reject rework with COMPLETED status", async () => { + let callAppend = false; + let callSqs = false; + let reworkEntry = createReworkEntry(); + reworkEntry.status = "DONE"; + + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return reworkEntry; + }; + + mockDynamo.appendReceivedStatusCode = async () => { + callAppend = true; + }; + + mockSqs.sendToQueue = async () => { + callSqs = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { Records: [createValidRecord()] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], `La richiesta di rework è in uno stato non valido: DONE`); + assert.strictEqual(callAppend,false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(callSqs, false, 'sendToQueue should not be called'); + }); + + it("should reject rework with ERROR status", async () => { + let callAppend = false; + let callSqs = false; + let reworkEntry = createReworkEntry(); + reworkEntry.status = "ERROR"; + + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return reworkEntry; + }; + + mockDynamo.appendReceivedStatusCode = async () => { + callAppend = true; + }; + + mockSqs.sendToQueue = async () => { + callSqs = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { Records: [createValidRecord()] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], `La richiesta di rework è in uno stato non valido: ERROR`); + assert.strictEqual(callAppend,false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(callSqs, false, 'sendToQueue should not be called'); + }); + + it("should reject rework with DeliveryFailureCause not valid", async () => { + let callAppend = false; + let callSqs = false; + let errorInserted = false; + let capturedArgs = []; + let reworkEntry = createReworkEntry(); + reworkEntry.expectedStatusCodes.push({ statusCode: 'RECAG011A', attachments: ['AR'] }); + + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return reworkEntry; + }; + + mockDynamo.appendReceivedStatusCode = async () => { + callAppend = true; + }; + + mockSqs.sendToQueue = async () => { + callSqs = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const record = createValidRecord({ + analogMail: { + statusCode: 'RECAG011A', + deliveryFailureCause: 'INVALID_CAUSE' + } + }); + const event = { Records: [record] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], 'DeliveryFailureCause non valida.'); + assert.strictEqual(callAppend, false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(callSqs, false, 'sendToQueue should not be called'); + }); +}); + +describe("handleEvent - Status Code Validation", () => { + beforeEach(() => { + setupMocks(); + }); + + it("should reject unexpected status codes", async () => { + let appendCalled = false; + let queueCalled = false; + let errorInserted = false; + const reworkEntry = createReworkEntry(); + const message = "Evento non atteso. Gli eventi accettati sono: " + JSON.stringify(reworkEntry.expectedStatusCodes); + + // Set up mocks before loading handler + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return reworkEntry; + }; + + mockDynamo.appendReceivedStatusCode = async () => { + appendCalled = true; + }; + + mockSqs.sendToQueue = async () => { + queueCalled = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + const event = { Records: [createInvalidRecord()] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], message); + assert.strictEqual(appendCalled,false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(queueCalled, false, 'sendToQueue should not be called'); + }); + + it("should reject stolen/lost/damaged events", async () => { + let appendCalled = false; + let queueCalled = false; + let errorInserted = false; + const reworkEntry = createReworkEntry(); + process.env.INVALID_STATUS_CODE = 'RECAG001'; + + // Set up mocks before loading handler + mockDynamo.getLatestReworkRequestByIun = async (iun) => { + assert.strictEqual(iun, 'TEST-IUN-123'); + return reworkEntry; + }; + + mockDynamo.appendReceivedStatusCode = async () => { + appendCalled = true; + }; + + mockSqs.sendToQueue = async () => { + queueCalled = true; + }; + + mockDynamo.insertEventsError = async (...args) => { + errorInserted = true; + capturedArgs = args; + }; + + // Reload handler with updated mocks + handleEvent = proxyquire('../app/eventHandler', { + './dynamo': mockDynamo, + './sqs': mockSqs, + './log': mockLog + }).handleEvent; + + let record = createValidRecord(); + const event = { Records: [record] }; + const result = await handleEvent(event); + + assert.deepStrictEqual(result, {"status": "ok"}); + assert.strictEqual(errorInserted, true); + assert.strictEqual(capturedArgs[3], "Evento di furto, smarrimento o deterioramento"); + assert.strictEqual(appendCalled,false, 'appendReceivedStatusCode should not be called'); + assert.strictEqual(queueCalled, false, 'sendToQueue should not be called'); + }); +}); \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/sqs.test.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/sqs.test.js new file mode 100644 index 000000000..2732c360e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/sqs.test.js @@ -0,0 +1,79 @@ +const { test, describe, beforeEach, mock } = require('node:test'); +const assert = require('node:assert'); +const { sendToQueue, createMessageAttributes } = require('../app/sqs'); +const { SQSClient } = require("@aws-sdk/client-sqs"); + +describe("sendToQueue", () => { + test("sends a message to the specified SQS queue", async () => { + const queueUrl = "https://example-queue-url"; + const messageBody = { key: "value" }; + const messageAttributes = { attr: { DataType: "String", StringValue: "test" } }; + + const sendMock = mock.fn(); + sendMock.mock.mockImplementation(() => Promise.resolve({ MessageId: "12345" })); + SQSClient.prototype.send = sendMock; + + const result = await sendToQueue(queueUrl, messageBody, messageAttributes); + + assert.strictEqual(sendMock.mock.callCount(), 1); + const callArgs = sendMock.mock.calls[0].arguments[0]; + assert.strictEqual(callArgs.input.QueueUrl, queueUrl); + assert.strictEqual(callArgs.input.MessageBody, JSON.stringify(messageBody)); + assert.deepStrictEqual(callArgs.input.MessageAttributes, messageAttributes); + assert.deepStrictEqual(result, { MessageId: "12345" }); + }); + + test("throws an error if the SQS client fails", async () => { + const queueUrl = "https://example-queue-url"; + const messageBody = { key: "value" }; + const messageAttributes = { attr: { DataType: "String", StringValue: "test" } }; + + const sendMock = mock.fn(); + sendMock.mock.mockImplementation(() => Promise.reject(new Error("SQS error"))); + SQSClient.prototype.send = sendMock; + + await assert.rejects( + () => sendToQueue(queueUrl, messageBody, messageAttributes), + { message: "SQS error" } + ); + }); +}); + +describe("createMessageAttributes", () => { + test("creates message attributes with reworkId", async () => { + const originalAttributes = { + attr1: { DataType: "String", StringValue: "value1" }, + }; + const reworkId = "rework-123"; + + const result = await createMessageAttributes(originalAttributes, reworkId); + + assert.deepStrictEqual(result, { + attr1: { DataType: "String", StringValue: "value1" }, + reworkId: { DataType: "String", StringValue: "rework-123" }, + }); + }); + + test("returns an empty object if no original attributes are provided", async () => { + const reworkId = "rework-123"; + + const result = await createMessageAttributes({}, reworkId); + + assert.deepStrictEqual(result, { + reworkId: { DataType: "String", StringValue: "rework-123" }, + }); + }); + + test("overrides existing reworkId attribute if present in original attributes", async () => { + const originalAttributes = { + reworkId: { DataType: "String", StringValue: "old-rework-id" }, + }; + const reworkId = "new-rework-id"; + + const result = await createMessageAttributes(originalAttributes, reworkId); + + assert.deepStrictEqual(result, { + reworkId: { DataType: "String", StringValue: "new-rework-id" }, + }); + }); +}); diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/utils.test.js b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/utils.test.js new file mode 100644 index 000000000..70f2586cb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/functions/notificationReworkEventsValidation/src/test/utils.test.js @@ -0,0 +1,169 @@ +const assert = require('assert'); +const { checkExpected, checkAlreadyReceived, checkAttachments, checkDeliveryFailureCause, checkRejectedStatusCode, buildReceivedStatusCodeEntry } = require('../app/utils'); + +describe("checkExpected", () => { + it("returns false if reworkEntry has no expectedStatusCodes", () => { + const result = checkExpected({}, "RECRN001A", [], null); + assert.strictEqual(result, false); + }); + + it("returns true if statusCode matches and attachments are a subset", () => { + const reworkEntry = { + expectedStatusCodes: [ + { statusCode: "RECRN001B", attachments: ["a", "b"] } + ] + }; + const result = checkAttachments(reworkEntry, "RECRN001B", ["a"]); + assert.strictEqual(result, true); + }); + + it("returns false if statusCode matches but attachments is not present in entity", () => { + const reworkEntry = { + expectedStatusCodes: [ + { statusCode: "RECRN001B", attachments: [] } + ] + }; + const result = checkAttachments(reworkEntry, "RECRN001B", ["c"]); + assert.strictEqual(result, false); + }); + + it("returns false if statusCode matches but attachments is not present in entity and there is another expected status code", () => { + const reworkEntry = { + expectedStatusCodes: [ + { statusCode: "RECRN001B", attachments: ["Plico"] }, + { statusCode: "RECRN001A", attachments: [] } + ] + }; + const result = checkAttachments(reworkEntry, "RECRN001B", []); + assert.strictEqual(result, false); + }); + + it("returns false if statusCode matches but attachments are not a subset", () => { + const reworkEntry = { + expectedStatusCodes: [ + { statusCode: "RECRN001B", attachments: ["a", "b"] } + ] + }; + const result = checkAttachments(reworkEntry, "RECRN001B", ["c"]); + assert.strictEqual(result, false); + }); + + it("returns false if statusCode matches but attachments are not a subset 2", () => { + const reworkEntry = { + expectedStatusCodes: [ + { statusCode: "RECRN001B", attachments: ["a", "b"] } + ] + }; + const result = checkAttachments(reworkEntry, "RECRN001B", ["a", "b", "c"]); + assert.strictEqual(result, false); + }); + + it("returns true if deliveryFailureCause matches", () => { + const reworkEntry = { + expectedStatusCodes: [{ statusCode: "RECRN002A" }], + expectedDeliveryFailureCause: "M02" + }; + const result = checkDeliveryFailureCause(reworkEntry, "M02"); + assert.strictEqual(result, true); + }); + + it("returns false if deliveryFailureCause not matches", () => { + const reworkEntry = { + expectedStatusCodes: [{ statusCode: "RECRN002A" }], + expectedDeliveryFailureCause: "M05" + }; + const result = checkDeliveryFailureCause(reworkEntry, "M02"); + assert.strictEqual(result, false); + }); +}); + +describe("checkAlreadyReceived", () => { + it("returns false if reworkEntry has no receivedStatusCodes", () => { + const result = checkAlreadyReceived({}, "RECRN002A", [], "2023-01-01T00:00:00Z"); + assert.strictEqual(result, false); + }); + + it("returns true if statusCode, statusDateTime, and attachments match", () => { + const reworkEntry = { + receivedStatusCodes: [ + { statusCode: "RECRN002B", statusDateTime: "2023-01-01T00:00:00Z", attachments: ["a"] } + ] + }; + const result = checkAlreadyReceived(reworkEntry, "RECRN002B", ["a"], "2023-01-01T00:00:00Z"); + assert.strictEqual(result, true); + }); + + it("returns false if statusDateTime does not match", () => { + const reworkEntry = { + receivedStatusCodes: [ + { statusCode: "RECRN002B", statusDateTime: "2023-01-01T00:00:00Z", attachments: ["a"] } + ] + }; + const result = checkAlreadyReceived(reworkEntry, "RECRN002B", ["a"], "2023-01-02T00:00:00Z"); + assert.strictEqual(result, false); + }); + + it("returns false if attachments do not match", () => { + const reworkEntry = { + receivedStatusCodes: [ + { statusCode: "RECRN002B", statusDateTime: "2023-01-01T00:00:00Z", attachments: ["b"] } + ] + }; + const result = checkAlreadyReceived(reworkEntry, "RECRN002B", ["a"], "2023-01-01T00:00:00Z"); + assert.strictEqual(result, false); + }); + + it("returns false if attachments do not match2", () => { + const reworkEntry = { + receivedStatusCodes: [ + { statusCode: "RECRN002B", statusDateTime: "2023-01-01T00:00:00Z", attachments: ["a"] } + ] + }; + const result = checkAlreadyReceived(reworkEntry, "RECRN002B", ["a", "b"], "2023-01-01T00:00:00Z"); + assert.strictEqual(result, false); + }); + + it("returns false if attachments do not match3", () => { + const reworkEntry = { + receivedStatusCodes: [ + { statusCode: "RECRN002B", statusDateTime: "2023-01-01T00:00:00Z", attachments: ["a", "b"] } + ] + }; + const result = checkAlreadyReceived(reworkEntry, "RECRN002B", ["b"], "2023-01-01T00:00:00Z"); + assert.strictEqual(result, false); + }); +}); + +describe("checkRejectedStatusCode", () => { + it("returns true if statusCode is in INVALID_STATUS_CODE", () => { + process.env.INVALID_STATUS_CODE = "RECRN006,RECRI005"; + const result = checkRejectedStatusCode("RECRN006"); + assert.strictEqual(result, true); + }); + + it("returns false if statusCode is not in INVALID_STATUS_CODE", () => { + process.env.INVALID_STATUS_CODE = "RECRN006,RECRI005"; + const result = checkRejectedStatusCode("RECRN002A"); + assert.strictEqual(result, false); + }); +}); + +describe("buildReceivedStatusCodeEntry", () => { + it("creates an entry with statusCode, attachments, and statusDateTime", () => { + const result = buildReceivedStatusCodeEntry("RECRN002B", ["a"], "2023-01-01T00:00:00Z"); + assert.deepStrictEqual(result, { + statusCode: "RECRN002B", + attachments: ["a"], + statusDateTime: "2023-01-01T00:00:00Z" + }); + }); + + it("creates an entry with empty attachments if none are provided", () => { + const result = buildReceivedStatusCodeEntry("RECRN002B", [], "2023-01-01T00:00:00Z"); + assert.deepStrictEqual(result, { + statusCode: "RECRN002B", + attachments: [], + statusDateTime: "2023-01-01T00:00:00Z" + }); + }); +}); diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/lombok.config b/jdk_21_maven/cs/rest/pn-paper-tracker/lombok.config new file mode 100644 index 000000000..864f2e5d2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/lombok.config @@ -0,0 +1,2 @@ +lombok.addLombokGeneratedAnnotation = true +lombok.log.custom.declaration = it.pagopa.pn.commons.log.PnLogger it.pagopa.pn.commons.log.PnLogger.getLogger(NAME) \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw b/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw new file mode 100644 index 000000000..a16b5431b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw.cmd b/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw.cmd new file mode 100644 index 000000000..c8d43372c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/pom.xml b/jdk_21_maven/cs/rest/pn-paper-tracker/pom.xml new file mode 100644 index 000000000..2a17c50b7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/pom.xml @@ -0,0 +1,440 @@ + + + 4.0.0 + + it.pagopa.pn + pn-parent + 2.3.1-SPRINGBOOT3 + + + pn-paper-tracker + 1.8.0-SNAPSHOT + pn-paper-tracker + PN paper-tracker Microservice + + ${git.conn} + ${git.devConn} + ${git.url} + HEAD + + + + + + it.pagopa.pn + pn-commons + 2.18.0-SPRINGBOOT3 + + + + it.pagopa.pn + pn-model + 2.11.0 + + + + org.mapstruct + mapstruct + + + + commons-io + commons-io + 2.15.1 + + + + io.swagger + swagger-annotations + 1.6.5 + + + + org.projectlombok + lombok + provided + + + + org.springframework.boot + spring-boot-starter-aop + + + + software.amazon.awssdk + sqs + + + + software.amazon.awssdk + bom + 2.31.77 + pom + runtime + + + + io.awspring.cloud + spring-cloud-aws-dependencies + 3.4.0 + pom + + + + io.awspring.cloud + spring-cloud-aws-starter-sqs + 3.4.0 + + + + software.amazon.awssdk + regions + 2.30.26 + + + + software.amazon.awssdk + kms + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + net.logstash.logback + logstash-logback-encoder + + + + io.projectreactor + reactor-test + test + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework + spring-test + + + + org.testcontainers + localstack + + 1.20.6 + test + + + + org.testcontainers + junit-jupiter + test + + + + io.swagger.parser.v3 + swagger-parser-core + 2.1.20 + + + + io.swagger.core.v3 + swagger-annotations-jakarta + 2.2.20 + + + + jakarta.validation + jakarta.validation-api + 3.0.2 + + + + javax.validation + validation-api + 2.0.1.Final + + + + com.asyncapi + asyncapi-plugin-core + 1.0.0-EAP-1 + + + + io.micrometer + micrometer-tracing-bridge-otel + + + io.opentelemetry + opentelemetry-exporter-otlp + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-dependency-plugin + 3.8.1 + + + unpack-dependencies + generate-resources + + unpack-dependencies + + + pn-commons + ${project.build.directory}/dependency-resources + + + + + + org.jacoco + jacoco-maven-plugin + + + **/generated/** + **it/pagopa/pn/template/rest/v1/** + + + + + org.openapitools + openapi-generator-maven-plugin + 7.13.0 + + + generate-paper-tracker-server + + generate + + generate-resources + + ${project.basedir}/docs/openapi/api-internal-v1.yaml + spring + spring-boot + + java8 + true + true + true + none + source + false + true + false + true + true + false + true + ${project.groupId}.papertracker.generated.openapi.server.v1 + ${project.groupId}.papertracker.generated.openapi.server.v1.dto + ${project.groupId}.papertracker.generated.openapi.server.v1.api + ${project.groupId}.papertracker.generated.openapi.server.v1.config + + + date-time=Instant + DateTime=Instant + date=LocalDate + + + Instant=java.time.Instant + LocalDate=java.time.LocalDate + + + false + false + false + + + + generate-client-pn-safe-storage + + generate + + generate-resources + + https://raw.githubusercontent.com/pagopa/pn-safe-storage/59b1c5255759262e4eb645ad3e8345bc810d03e1/docs/openapi/pn-safestorage-v1-api.yaml + java + webclient + false + false + false + true + + true + false + + @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY) + + + @lombok.Builder(toBuilder = true); + @lombok.AllArgsConstructor + + + + ${project.groupId}.papertracker.generated.openapi.msclient.safestorage.api + + + ${project.groupId}.papertracker.generated.openapi.msclient.safestorage.model + + + + + generate-resources + generate-client-pn-paper-channel + + generate + + + + + https://raw.githubusercontent.com/pagopa/pn-paper-channel/3690259216c94bb7402c9641d0344e222048a191/docs/openapi/api-internal-v1.yaml + + java + webclient + false + false + false + true + + true + false + + @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY) + + + @lombok.Builder(toBuilder = true); + @lombok.AllArgsConstructor + + + + ${project.groupId}.papertracker.generated.openapi.msclient.paperchannel.api + + + ${project.groupId}.papertracker.generated.openapi.msclient.paperchannel.model + + + + + generate-resources + generate-client-pn-external-channel + + generate + + + + + ${project.basedir}/docs/openapi/external-channel/pn-external-channel.yaml + + java + webclient + false + false + false + true + + true + false + + @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY) + + + @lombok.Builder(toBuilder = true); + @lombok.AllArgsConstructor + + + + ${project.groupId}.papertracker.generated.openapi.msclient.externalchannel.api + + + ${project.groupId}.papertracker.generated.openapi.msclient.externalchannel.model + + + + + generate-client-pn-data-vault + + generate + + generate-resources + + https://raw.githubusercontent.com/pagopa/pn-data-vault/f6d07290faf645f0769b5d53901b0123c11a594f/docs/openapi/pn-datavault-api-v1.yaml + java + webclient + false + false + false + true + + true + false + + @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY) + + + @lombok.Builder(toBuilder = true); + @lombok.AllArgsConstructor + + + ${project.groupId}.papertracker.generated.openapi.msclient.pndatavault.model + ${project.groupId}.papertracker.generated.openapi.msclient.pndatavault.api + + + + + + com.sngular + scs-multiapi-maven-plugin + 6.7.3 + + + generate-sources + + asyncapi-generation + + + + + docs/asyncapi/external-datalake-v1.yaml + + OCR_Command + CustomConsumer + DTO + com.sngular.apigenerator.asyncapi.business_model.model.event.consumer + com.sngular.apigenerator.asyncapi.business_model.model.event + + + + docs/asyncapi/internal-datalake-v1.yaml + + OCR_Result + com.sngular.apigenerator.asyncapi.business_model.model.event.producer + com.sngular.apigenerator.asyncapi.business_model.model.event + + + + generated-sources + + + + + + + \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/application-dev.env b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/application-dev.env new file mode 100644 index 000000000..5be5e3cdd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/application-dev.env @@ -0,0 +1,93 @@ +# Abilita l'OCR per singolo prodotto +# Valori ammessi per prodotto: [RUN, DRY] +# Formato: data_attivazione1;PRODOTTO1:MODALITA1;PRODOTTO2:MODALITA2,data_attivazione2;PRODOTTO1:MODALITA1;PRODOTTO2:MODALITA2 +PN_PAPERTRACKER_ENABLEOCRVALIDATIONFOR=1970-01-01;AR:DRY;890:DRY + +# Abilita l'OCR in modalità RUN per tutte le spedizioni che soddisfano un intervallo temporale specifico +# Valori ammessi: CRON_EXPRESSION, DISABLED +PN_PAPERTRACKER_OCRFILTERTEMPORAL=* * 9-18 * * MON + +# Abilita l'OCR in modalità RUN per tutte le spedizioni che soddisfano un determinato recapitista +# Valori ammessi: [Fulmine, Poste, Sailpost, PostAndService, DISABLED] +# Formato: CommaDelimitedList +PN_PAPERTRACKER_OCRFILTERUNIFIEDDELIVERYDRIVER=Poste + +PN_PAPERTRACKER_ENABLEOCRVALIDATIONFORFILE=PDF + +# StatusCode che non invia a pn-delivery-push ma vengono +# salvati nel tracking +# Formato: CommaDelimitedList +PN_PAPERTRACKER_SAVEANDNOTSENDTODELIVERYPUSH=CON018,CON09A,CON010,CON011,CON012,CON016 + + +PN_PAPERTRACKER_COMPIUTAGIACENZAARDURATION=80s + +# Abilita il troncamento delle date nel calcolo della giacenza +PN_PAPERTRACKER_ENABLETRUNCATEDDATEFORREFINEMENTCHECK=false + +PN_PAPERTRACKER_REFINEMENTDURATION=1m + +# TTL oggetto tracking +PN_PAPERTRACKER_PAPERTRACKINGSTTLDURATION=3650d + +# TTL oggetto errors +PN_PAPERTRACKER_PAPERTRACKINGSERRORSTTLDURATION=3650d + +# Max PC_RETRY prima di restituire errore in modalità DRY-RUN +PN_PAPERTRACKER_MAXPCRETRYMOCK=3 + +# Allegati necessari al processo di perfezionamento della giacenza 890. +# Allegati ammessi: [23L, ARCAD, CAD] +# Formato: data_attivazione1;ALLEGATO1;ALLEGATO2,data_attivazione2;ALLEGATO1;ALLEGATO2 +PN_PAPERTRACKER_REQUIREDATTACHMENTSREFINEMENTSTOCK890=1970-01-01;23L + +# Allegati validati dall'OCR nel processo di perfezionamento della giacenza 890. +# Questi devono essere un sottoinsieme di quelli necessari al perfezionamento. +# Allegati ammessi: [23L, ARCAD] +# Formato: data_attivazione1;ALLEGATO1;ALLEGATO2,data_attivazione2;ALLEGATO1;ALLEGATO2 +PN_PAPERTRACKER_SENDOCRATTACHMENTSREFINEMENTSTOCK890=1970-01-01;23L + +# IMPORTANTE feature flag IN-PROGRESS - PARAMETRO NON UTILIZZATO +# Allegati da inviare all'OCR necessari alla chiusura fascicolo della giacenza 890 +# Allegati ammessi: [ARCAD, Plico] +# Formato: data_attivazione1;ALLEGATO1;ALLEGATO2,data_attivazione2;ALLEGATO1;ALLEGATO2 +PN_PAPERTRACKER_SENDOCRATTACHMENTSFINALVALIDATIONSTOCK890=1970-01-01; + +# Allegati da inviare all'OCR necessari al processo di perfezionamento di tutti +# i prodotti, ad eccezione della giacenza 890. +# Valori ammessi: [AR, Plico, 23L] +# Formato: data_attivazione1;ALLEGATO1;ALLEGATO2,data_attivazione2;ALLEGATO1;ALLEGATO2 +PN_PAPERTRACKER_SENDOCRATTACHMENTSFINALVALIDATION=1970-01-01;Plico;AR;23L + +# Specifica se, per l’evento finale di giacenza che determina +# la chiusura del fascicolo, eventuali errori di validazione +# debbano essere ignorati (registrati come WARNING nella tabella +# degli errori, con relativo PROGRESS nella timeline) oppure se +# debbano bloccare la spedizione, impostando lo stato su KO e +# registrando un ERROR. +# Valori ammessi: [true, false] +# Formato: data_attivazione1;valore1,data_attivazione2;valore2 +PN_PAPERTRACKER_STRICTFINALVALIDATIONSTOCK890=1970-01-01;true + +# Specifica se, per la verifica della deliveryFailureCause, la presenza della stessa +# su tutti gli eventi della sequence debba essere considerata obbligatoria o meno +# Valori ammessi: [true, false] +# Formato: data_attivazione1;valore1,data_attivazione2;valore2 +PN_PAPERTRACKER_STRICTDELIVERYFAILURECAUSE=1970-01-01;false + +# Statuscode interni gestiti +# Formato: CommaDelimitedList +PN_PAPERTRACKER_INTERNALEVENTS=P000,P001,P011,P012,P013 + +# Modalità di processamento per prodotto +# Valori ammessi per prodotto: [RUN, DRY] +# Formato: data_attivazione1;PRODOTTO1:MODALITA1;PRODOTTO2:MODALITA2,data_attivazione2;PRODOTTO1:MODALITA1;PRODOTTO2:MODALITA2 +PN_PAPERTRACKER_PRODUCTSPROCESSINGMODES=1970-01-01;AR:RUN;890:DRY,2026-02-02;AR:RUN;RIR:RUN;890:RUN;RS:RUN;RIS:RUN + +# Categorie degli ERROR da inoltrare al consolidatore quando il contratto sara definito. +# Formato: CommaDelimitedList +PN_PAPERTRACKER_SENDTOCONSOLIDATOREERRORCATEGORIES= + +# Domini con i quali confrontare il senderId per capire se si tratta di un redrive manuale +# Formato: CommaDelimitedList +PN_PAPERTRACKER_REDRIVEENABLEDDOMAINS=@pagopa.it,@external.pagopa.it \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality-dev-cfg.json b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality-dev-cfg.json new file mode 100644 index 000000000..7b5b76777 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality-dev-cfg.json @@ -0,0 +1,6 @@ +{ + "Parameters" : { + "PaperTrackingsGlueTableName": "pn_paper_trackings", + "PaperTrackingsErrorsGlueTableName": "pn_paper_trackings_errors" + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality.yml b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality.yml new file mode 100644 index 000000000..bacd7e28b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/data-quality.yml @@ -0,0 +1,170 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: Data quality template, creates a nested stack for Glue Table and Crawler + +Parameters: + TemplateBucketBaseUrl: + Type: String + Description: The S3 bucket from which to fetch the templates used by this stack. + + GlueServiceRoleArn: + Type: String + Description: Service role for the Glue Crawler. + + LogsBucketName: + Type: String + Description: Logs bucket name + + GlueDatabaseName: + Type: String + Description: Name of the Glue Database + + PaperTrackingsTableName: + Type: String + Description: DynamoDB table name for paper trackings + + PaperTrackingsGlueTableName: + Type: String + Description: Glue table name for paper trackings + AllowedPattern: ^[a-z_]+$ + ConstraintDescription: Glue table name must contain only lowercase letters and underscores. + Default: pn_paper_trackings + + PaperTrackingsErrorsTableName: + Type: String + Description: DynamoDB table name for paper trackings errors + + PaperTrackingsErrorsGlueTableName: + Type: String + Description: Glue table name for paper trackings errors + AllowedPattern: ^[a-z_]+$ + ConstraintDescription: Glue table name must contain only lowercase letters and underscores. + Default: pn_paper_trackings_errors + +Resources: + PaperTrackingsDataQualityStack: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: !Sub ${TemplateBucketBaseUrl}/fragments/cdc-glue.yaml + Parameters: + DynamoTableName: !Ref PaperTrackingsTableName + GlueTableName: !Ref PaperTrackingsGlueTableName + GlueServiceRoleArn: !Ref GlueServiceRoleArn + LogsBucketName: !Ref LogsBucketName + GlueDatabaseName: !Ref GlueDatabaseName + DynamoDBKeysStructure: | + struct< + trackingId:struct + > + DynamoDBNewImageStructure: | + struct< + trackingId:struct, + attemptId:struct, + pcRetry:struct, + productType:struct, + unifiedDeliveryDriver:struct, + events:struct, + iun:struct, + requestTimestamp:struct, + statusCode:struct, + statusDescription:struct, + statusTimestamp:struct, + productType:struct, + deliveryFailureCause:struct, + anonymizedDiscoveredAddressId:struct, + attachments:struct, + documentType:struct, + uri:struct, + date:struct, + sha256:struct + >>>>, + registeredLetterCode:struct, + dryRun:struct, + createdAt:struct, + notificationReworkId:struct + >>>>, + paperStatus:struct, + deliveryFailureCause:struct, + anonymizedDiscoveredAddress:struct, + finalStatusCode:struct, + validatedSequenceTimestamp:struct, + validatedEvents:struct>>, + finalDematFound:struct, + paperDeliveryTimestamp:struct, + actualPaperDeliveryTimestamp:struct, + predictedRefinementType:struct + >>, + validationFlow:struct, + finalEventDematValidationTimestamp:struct, + refinementDematValidationTimestamp:struct, + finalEventBuilderTimestamp:struct, + recag012StatusTimestamp:struct, + ocrRequests:struct, + finalEventId:struct, + attachmentEventId:struct, + responseTimestamp:struct, + requestTimestamp:struct, + uri:struct + >>>> + >>, + validationConfig:struct, + requiredAttachmentsRefinementStock890:struct>>, + sendOcrAttachmentsRefinementStock890:struct>>, + sendOcrAttachmentsFinalValidationStock890:struct>>, + sendOcrAttachmentsFinalValidation:struct>>, + strictFinalValidationStock890:struct, + ocrFilterTemporal:struct, + ocrFilterUnifiedDeliveryDriver:struct>>, + ocrFileTypes:struct>> + >>, + nextRequestIdPcretry:struct, + state:struct, + businessState:struct, + pendingFinalEventId:struct, + createdAt:struct, + updatedAt:struct, + ttl:struct, + notificationReworkRequestTimestamp:struct, + notificationReworkId:struct, + processingMode:struct + > + + PaperTrackingsErrorsDataQualityStack: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: !Sub ${TemplateBucketBaseUrl}/fragments/cdc-glue.yaml + Parameters: + DynamoTableName: !Ref PaperTrackingsErrorsTableName + GlueTableName: !Ref PaperTrackingsErrorsGlueTableName + GlueServiceRoleArn: !Ref GlueServiceRoleArn + LogsBucketName: !Ref LogsBucketName + GlueDatabaseName: !Ref GlueDatabaseName + DynamoDBKeysStructure: | + struct< + trackingId:struct, + created:struct + > + DynamoDBNewImageStructure: | + struct< + trackingId:struct, + created:struct, + category:struct, + details:struct, + message:struct, + additionalDetails:struct + >>, + flowThrow:struct, + eventThrow:struct, + eventIdThrow:struct, + productType:struct, + type:struct, + ttl:struct, + unifiedDeliveryDriver:struct, + registeredLetterCode:struct + > \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice-dev-cfg.json b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice-dev-cfg.json new file mode 100644 index 000000000..51ed39592 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice-dev-cfg.json @@ -0,0 +1,23 @@ +{ + "Parameters" : { + "MinTasksNumber": "2", + "MaxTasksNumber": "10", + "AutoscalingThreshold": "1200", + "ConsumedQueueMessagePerMinute": "3300", + "PnCronAnalyzer": "-", + "WireTapLogActivation": "false", + "MountEfs": "false", + "SafeStorageCxId": "pn-cons-000", + "PnOcrInputsQueueARN": "arn:aws:sqs:eu-south-1:830192246553:pn-mock_ocr_inputs", + "PnOcrInputsQueueURL": "https://sqs.eu-south-1.amazonaws.com/830192246553/pn-mock_ocr_inputs", + "PnOcrInputsQueueRegion": "eu-south-1", + "OcrAwsRoleARN": "arn:aws:iam::830192246553:role/pn-external-channels-TaskRole", + "OcrAwsAccountId": "830192246553", + "PaperTrackerExternalChannelUser": "pn-cons-000", + "DataVaultBaseUrl": "http://alb.confidential.pn.internal:8080", + "ExternalChannelsToPaperChannelDryrunQueueName": "pn-external_channel_to_paper_channel_dry_run", + "NotificationReworkInvalidStatusCode": "RECRN006,RECRN013,RECRI005,CON996,RECAG013,RECAG004", + "DisableAllConsumers": "false", + "MetricFormatType": "EMF" + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice.yml b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice.yml new file mode 100644 index 000000000..9b4a9a89c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/microservice.yml @@ -0,0 +1,998 @@ +AWSTemplateFormatVersion: 2010-09-09 +Description: 'Microservice deploy for pn-paper-tracker' + +Parameters: + ProjectName: + Type: String + Description: 'Usually pn can be pnXYZ where XYZ are the feature number, useful to create experimental environments without crash official development environment' + + AlarmSNSTopicArn: + Type: String + Description: ARN of alarm topic + + WebApiDnsName: + Type: String + Description: 'The DNS name used for WEB rest API.' + + CorsAllowedDomains: + Type: String + Description: 'Comma separated list of domains allowed to make cross origin request' + + ContainerImageUri: + Type: String + Description: 'Exact container image URI with full repository and image digest' + + MicroserviceNumber: + Type: Number + Description: 'Disambiguation useful for load balancer rules' + + MicroserviceBucketName: + Type: String + Default: '' + Description: 'Name of the bucket where the microservice files are copied during deploy' + + MicroserviceBucketBaseKey: + Type: String + Default: '' + Description: 'Base key of the microservice in the s3 bucket' + + TemplateBucketBaseUrl: + Type: String + Description: 'The S3 bucket from which to fetch the templates used by this stack.' + + ECSClusterName: + Type: String + Description: 'The name of the ECS cluster where the microservice is going to be deployed' + + SubnetsIds: + Type: String + Description: 'Subnets id list' + + VpcEgressSubnetsIds: + Type: String + Description: 'Egress subnets' + + VpcId: + Type: String + Description: 'VpcId where the microservice is going to be deployed' + + AlbSecurityGroup: + Type: String + Description: "Application load balancer security group" + + EcsDefaultSecurityGroup: + Type: String + Description: 'Default security group required by infrastructure' + + ApplicationLoadBalancerListenerArn: + Type: String + Description: 'Load balancer listener where HTTP endpoints are going to be registered' + + ApplicationLoadBalancerDomain: + Type: String + Description: 'Base URL of the load balancer where the service is going to be reachable' + + NetworkLoadBalancerLink: + Type: String + Description: 'network load balancer link for API-GW' + + LogsKinesisSourceStreamArn: + Type: String + Description: 'Kinesis stream that receives logs' + + Version: + Type: String + Description: 'keep track of used projects commitIds' + + EcsLogGroup: + Type: String + Description: 'ECS log group name' + + WireTapLogActivation: + Type: String + Default: false + Description: Activation of wire logs + AllowedValues: + - true + - false + + MountEfs: + Type: String + Default: "false" + AllowedValues: + - "true" + - "false" + + FargateEFSFileSystemID: + Type: String + Description: "EFS Filesystem" + + # Instance parameters + # 256 (.25 vCPU) - Available memory values: 0.5GB, 1GB, 2GB + # 512 (.5 vCPU) - Available memory values: 1GB, 2GB, 3GB, 4GB + # 1024 (1 vCPU) - Available memory values: 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB + # 2048 (2 vCPU) - Available memory values: Between 4GB and 16GB in 1GB increments + # 4096 (4 vCPU) - Available memory values: Between 8GB and 30GB in 1GB increments + CpuValue: + Type: Number + Default: 1024 + Description: Fargate virtual CPU quantity 1024 equals one vCPU + + # 0.5GB, 1GB, 2GB - Available cpu values: 256 (.25 vCPU) + # 1GB, 2GB, 3GB, 4GB - Available cpu values: 512 (.5 vCPU) + # 2GB, 3GB, 4GB, 5GB, 6GB, 7GB, 8GB - Available cpu values: 1024 (1 vCPU) + # Between 4GB and 16GB in 1GB increments - Available cpu values: 2048 (2 vCPU) + # Between 8GB and 30GB in 1GB increments - Available cpu values: 4096 (4 vCPU) + MemoryAmount: + Type: String + Default: 2GB + Description: memory amount reserved to the task pod. + AllowedValues: [ 2GB, 4GB, 6GB, 8GB ] + + JavaToolOptions: + Type: String + Default: '-XX:MaxDirectMemorySize=256m' + Description: JavaToolOptions + + MinTasksNumber: + Default: 1 + Type: Number + Description: minimum autoscaling number of tasks + + MaxTasksNumber: + Default: 1 + Type: Number + Description: maximum autoscaling number of tasks + + PnCronAnalyzer: + Type: String + Default: '-' + Description: Cron for which you send the metric to CloudWatch + + LogAlarmStrategy: + Type: String + Default: 'FATAL' + + # Autoscaling parameters + AutoscalingCheckPeriod: + Default: 60 + Type: Number + Description: minimum autoscaling number of tasks\ + + AutoscalingDataPointN: + Default: 1 + Type: Number + Description: activate when N datapoint on M + + AutoscalingDataPointM: + Default: 1 + Type: Number + Description: activate when N datapoint on M + + AutoscalingThreshold: + Default: 70 + Type: String + + ConsumedQueueMessagePerMinute: + Type: Number + Default: 0 + Description: Weight to assign to queue number of visible messages metric + + HealthCheckTimeout: + Description: health check timeout seconds + Type: Number + Default: 5 + + HealthCheckInterval: + Description: Seconds between two health check + Type: Number + Default: 60 + + HealthyThresholdCount: + Description: | + The number of consecutive health checks successes required before considering + an unhealthy target healthy. + Type: Number + Default: 5 + + UnhealthyThresholdCount: + Description: | + The number of consecutive health check failures required before considering a target unhealthy. + Type: Number + Default: 2 + + ApplicationLoadBalancerMetricsDimensionName: + Type: String + Default: '' + Description: Application load balancer dimension name + + PnOcrOutputsQueueName: + Type: String + Description: 'Name of the SQS queue where OCR outputs are sent' + + PnOcrOutputsQueueARN: + Type: String + Description: 'ARN of the SQS queue where OCR outputs are sent' + + ExternalChannelToPaperTrackerQueueName: + Type: String + Description: 'Name of the SQS queue where external channel messages are sent' + + ExternalChannelToPaperTrackerQueueARN: + Type: String + Description: 'ARN of the SQS queue where external channel messages are sent' + + ExternalChannels2PaperChannelQueueName: + Type: String + Description: 'Pull external-channel messages from this Queue' + + ExternalChannels2PaperChannelQueueARN: + Type: String + Description: 'Pull external-channel messages from this Queue' + + ExternalChannels2PaperChannelQueueURL: + Type: String + Description: 'Pull external-channel messages from this Queue' + + ExternalChannelsToPaperChannelDryrunQueueName: + Type: String + Description: 'Write paper-channel messages to this Queue' + + PaperTrackingsErrorsTableName: + Type: String + Description: 'DynamoDB table name for PaperTrackingsErrors' + + PaperTrackingsErrorsTableArn: + Type: String + Description: 'DynamoDB table ARN for PaperTrackingsErrors' + + PaperTrackingsTableName: + Type: String + Description: 'DynamoDB table name for PaperTrackings' + + PaperTrackingsTableArn: + Type: String + Description: 'DynamoDB table ARN for PaperTrackings' + + PaperTrackerDryRunOutputsTableName: + Type: String + Description: 'DynamoDB table name for PaperTrackerDryRunOutputs' + + PaperTrackerDryRunOutputsTableArn: + Type: String + Description: 'DynamoDB table ARN for PaperTrackerDryRunOutputs' + + NotificationReworkEventsErrorTableName: + Type: String + Description: 'DynamoDB table name for NotificationReworkEventsError' + + NotificationReworkEventsErrorTableArn: + Type: String + Description: 'DynamoDB table ARN for NotificationReworkEventsError' + + ExternalChannelsOutputsQueueName: + Type: String + Description: 'Name of the SQS queue where external channel outputs are sent' + + ExternalChannelsOutputsQueueARN: + Type: String + Description: 'ARN of the SQS queue where external channel outputs are sent' + + SandboxSafeStorageBaseUrl: + Type: String + Description: 'URL to the SafeStorage microservice' + + SafeStorageCxId: + Type: String + Description: 'CxId for the SafeStorage microservice' + + PnOcrInputsQueueARN: + Type: String + Description: 'ARN of the SQS queue where OCR inputs are sent' + + PnOcrInputsQueueURL: + Type: String + Description: 'URL of the SQS queue where OCR inputs are sent' + + PnOcrInputsQueueRegion: + Type: String + Description: 'Region of the SQS queue where OCR inputs are sent' + + PnOcrOutputsQueueURL: + Type: String + Description: 'URL of the SQS queue where OCR outputs are sent' + + OcrAwsRoleARN: + Type: String + Description: 'ARN of the IAM role in the OCR AWS account that can send messages to the PnOcrOutputsQueue' + + OcrAwsAccountId: + Type: String + Description: 'AWS account ID of the OCR service' + + PaperTrackerExternalChannelUser: + Type: String + Description: 'The clientId used by ExternalChannel to send events to PaperTracker' + + DataVaultBaseUrl: + Type: String + Description: 'DataVault BaseUrl' + + ExternalChannelToReworkEventValidationQueueName: + Type: String + Description: 'Name of the SQS queue where external channel rework validation events are sent' + + ExternalChannelToReworkEventValidationQueueARN: + Type: String + Description: 'ARN of the SQS queue where external channel rework validation events are sent' + + ExternalChannelToReworkEventValidationQueueURL: + Type: String + Description: 'URL of the SQS queue where external channel rework validation events are sent' + + NotificationReworkEventsValidationLambdaName: + Type: String + Description: 'Name of the NotificationReworkEventsValidation Lambda.' + + NotificationReworkEventsValidationLambdaBatchSize: + Type: Number + Description: "Batch size of the NotificationReworkEventsValidation Lambda." + Default: 10 + + ApplicativeEnvFileChecksum: + Type: String + Default: '' + Description: 'Applicative environment variable file checksum' + + NotificationReworkInvalidStatusCode: + Type: String + Description: 'Comma separated list of invalid status codes for notification rework events' + + DisableAllConsumers: + Type: String + AllowedValues: [ "true", "false" ] + Default: "false" + + MetricFormatType: + Type: String + Description: 'Metric format type' + Default: 'EMF' + + 890ErrorThreshold: + Type: Number + Description: 'Threshold for 890 errors to trigger the alarm' + Default: 300 + + 890EvaluationPeriods: + Type: Number + Description: 'Number of evaluation periods for 890 errors alarm' + Default: 12 + + 890DatapointsToAlarm: + Type: Number + Description: 'Number of datapoints to alarm for 890 errors alarm' + Default: 1 + + 890TreatMissingData: + Type: String + Description: 'TreatMissingData for 890 errors alarm' + Default: 'ignore' + + ARTreatMissingData: + Type: String + Description: 'TreatMissingData for AR errors alarm' + Default: 'ignore' + + RSTreatMissingData: + Type: String + Description: 'TreatMissingData for RS errors alarm' + Default: 'ignore' + + RIRTreatMissingData: + Type: String + Description: 'TreatMissingData for RIR errors alarm' + Default: 'ignore' + + RISTreatMissingData: + Type: String + Description: 'TreatMissingData for RIS errors alarm' + Default: 'ignore' + + 890WhereClause: + Type: String + Description: 'Where clause to filter 890 errors in the custom metric query' + Default: "errorCategory != 'OCR_VALIDATION'" + + ARErrorThreshold: + Type: Number + Description: 'Threshold for AR errors to trigger the alarm' + Default: 300 + + AREvaluationPeriods: + Type: Number + Description: 'Number of evaluation periods for AR errors alarm' + Default: 12 + + ARDatapointsToAlarm: + Type: Number + Description: 'Number of datapoints to alarm for AR errors alarm' + Default: 1 + + ARWhereClause: + Type: String + Description: 'Where clause to filter AR errors in the custom metric query' + Default: "errorCategory != 'OCR_VALIDATION'" + + RSErrorThreshold: + Type: Number + Description: 'Threshold for RS errors to trigger the alarm' + Default: 300 + + RSEvaluationPeriods: + Type: Number + Description: 'Number of evaluation periods for RS errors alarm' + Default: 12 + + RSDatapointsToAlarm: + Type: Number + Description: 'Number of datapoints to alarm for RS errors alarm' + Default: 1 + + RSWhereClause: + Type: String + Description: 'Where clause to filter RS errors in the custom metric query' + Default: "errorCategory != 'OCR_VALIDATION'" + + RIRErrorThreshold: + Type: Number + Description: 'Threshold for RIR errors to trigger the alarm' + Default: 300 + + RIREvaluationPeriods: + Type: Number + Description: 'Number of evaluation periods for RIR errors alarm' + Default: 12 + + RIRDatapointsToAlarm: + Type: Number + Description: 'Number of datapoints to alarm for RIR errors alarm' + Default: 1 + + RIRWhereClause: + Type: String + Description: 'Where clause to filter RIR errors in the custom metric query' + Default: "errorCategory != 'OCR_VALIDATION'" + + RISErrorThreshold: + Type: Number + Description: 'Threshold for RIS errors to trigger the alarm' + Default: 300 + + RISEvaluationPeriods: + Type: Number + Description: 'Number of evaluation periods for RIS errors alarm' + Default: 12 + + RISDatapointsToAlarm: + Type: Number + Description: 'Number of datapoints to alarm for RIS errors alarm' + Default: 1 + + RISWhereClause: + Type: String + Description: 'Where clause to filter RIS errors in the custom metric query' + Default: "errorCategory != 'OCR_VALIDATION'" + + CpuArchitecture: + Type: String + Default: 'ARM' + Description: CPU architecture for the Fargate tasks + +Resources: + + PaperTrackerMicroservice: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/ecs-service.yaml" + Parameters: + MicroServiceUniqueName: !Sub '${ProjectName}-paper-tracker' + CpuValue: !Ref CpuValue + MemoryAmount: !Ref MemoryAmount + MinTasksNumber: !Ref MinTasksNumber + MaxTasksNumber: !Ref MaxTasksNumber + HealthCheckPath: /actuator/health + HealthCheckTimeout: !Ref HealthCheckTimeout + HealthCheckInterval: !Ref HealthCheckInterval + HealthyThresholdCount: !Ref HealthyThresholdCount + UnhealthyThresholdCount: !Ref UnhealthyThresholdCount + AutoscalingStrategy: CUSTOM + AutoscalingThreshold: !Ref AutoscalingThreshold + AutoscalingCheckPeriod: !Ref AutoscalingCheckPeriod + EfsFilesystem: !Ref FargateEFSFileSystemID + MountEfs: !Ref MountEfs + WireTapLogActivation: !Ref WireTapLogActivation + AutoscalingDataPointN: !Ref AutoscalingDataPointN + AutoscalingDataPointM: !Ref AutoscalingDataPointM + AlarmSNSTopicArn: !Ref AlarmSNSTopicArn + JavaToolOptions: !Ref JavaToolOptions + ContainerImageURI: !Sub '${ContainerImageUri}' + ContainerEnvEntry1: !Sub 'AWS_REGIONCODE=${AWS::Region}' + ContainerEnvEntry2: !Sub 'PN_CRON_ANALYZER=${PnCronAnalyzer}' + ContainerEnvEntry3: !Sub 'WIRE_TAP_LOG=${WireTapLogActivation}' + ContainerEnvEntry4: !Sub 'PN_PAPERTRACKER_DAO_PAPERTRACKERDRYRUNOUTPUTSTABLE=${PaperTrackerDryRunOutputsTableName}' + ContainerEnvEntry5: !Sub 'PN_PAPERTRACKER_DAO_PAPERTRACKINGSERRORSTABLE=${PaperTrackingsErrorsTableName}' + ContainerEnvEntry6: !Sub 'PN_PAPERTRACKER_DAO_PAPERTRACKINGSTABLE=${PaperTrackingsTableName}' + ContainerEnvEntry7: !Sub 'PN_PAPERTRACKER_PAPERCHANNELBASEURL=http://${ApplicationLoadBalancerDomain}:8080' + ContainerEnvEntry9: !Sub 'PN_PAPERTRACKER_TOPICS_EXTERNALCHANNELTOPAPERTRACKERQUEUE=${ExternalChannelToPaperTrackerQueueName}' + ContainerEnvEntry10: !Sub 'PN_PAPERTRACKER_TOPICS_QUEUEOCRINPUTSURL=${PnOcrInputsQueueURL}' + ContainerEnvEntry11: !Sub 'PN_PAPERTRACKER_TOPICS_QUEUEOCRINPUTSREGION=${PnOcrInputsQueueRegion}' + ContainerEnvEntry12: !Sub 'PN_PAPERTRACKER_TOPICS_EXTERNALCHANNELOUTPUTSQUEUE=${ExternalChannelsOutputsQueueName}' + ContainerEnvEntry16: !Sub 'PN_PAPERTRACKER_SAFESTORAGEBASEURL=${SandboxSafeStorageBaseUrl}' + ContainerEnvEntry17: !Sub 'PN_PAPERTRACKER_SAFESTORAGECXID=${SafeStorageCxId}' + ContainerEnvEntry18: !Sub 'PN_PAPERTRACKER_TOPICS_PNOCROUTPUTSQUEUE=${PnOcrOutputsQueueName}' + ContainerEnvEntry19: !Sub 'PN_PAPERTRACKER_DATAVAULTBASEURL=${DataVaultBaseUrl}' + ContainerEnvEntry20: !Sub 'PN_PAPERTRACKER_DISABLEALLCONSUMERS=${DisableAllConsumers}' + ContainerEnvEntry21: !Sub 'PN_PAPERTRACKER_TOPICS_EXTERNALCHANNELTOPAPERCHANNELQUEUE=${ExternalChannels2PaperChannelQueueName}' + ContainerEnvEntry22: !Sub 'PN_PAPERTRACKER_TOPICS_EXTERNALCHANNELTOPAPERCHANNELDRYRUNQUEUE=${ExternalChannelsToPaperChannelDryrunQueueName}' + ContainerEnvEntry23: !Sub 'METRIC_FORMAT_TYPE=${MetricFormatType}' + ContainerEnvEntry24: !Sub 'PN_PAPERTRACKER_EVENTBUS_NAME=arn:aws:events:${AWS::Region}:${AWS::AccountId}:event-bus/${ProjectName}-CoreEventBus' + ApplicativeEnvFileChecksum: !Ref ApplicativeEnvFileChecksum + MappedPaths: '/paper-tracker/*,/paper-tracker-private/*' + ECSClusterName: !Ref ECSClusterName + Subnets: !Ref VpcEgressSubnetsIds + VpcId: !Ref VpcId + AlbSecurityGroup: !Ref AlbSecurityGroup + EcsDefaultSecurityGroup: !Ref EcsDefaultSecurityGroup + LoadBalancerListenerArn: !Ref ApplicationLoadBalancerListenerArn + LoadbalancerRulePriority: !Ref MicroserviceNumber + TaskRoleManagedPolicyArn: !Ref PaperTrackerMicroserviceTaskPolicy + EcsLogGroup: !Ref EcsLogGroup + LogAlarmStrategyV1: !Ref LogAlarmStrategy + CpuArchitecture: !Ref CpuArchitecture + + PnOcrOutputsQueuePolicy: + Type: AWS::SQS::QueuePolicy + Properties: + Queues: + - !Ref PnOcrOutputsQueueURL + PolicyDocument: + Statement: + - Sid: AllowCrossAccountSend + Effect: Allow + Principal: + AWS: !Sub "arn:aws:iam::${OcrAwsAccountId}:root" + Action: + - sqs:SendMessage + Resource: + - !Ref PnOcrOutputsQueueARN + Condition: + StringEquals: + aws:PrincipalArn: !Ref OcrAwsRoleARN + + PaperTrackerMicroserviceCloudWatchDashboard: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/microservice-cloudwatch-dashboard.yaml" + Parameters: + DashboardName: !Sub "${ProjectName}-paper-tracker" + AlarmArns: !Join + - ',' + - - !GetAtt PaperTrackerMicroservice.Outputs.FatalLogsMetricAlarmArn + DynamoDBTableNames: !Join + - ',' + - - !Ref PaperTrackingsTableName + - !Ref PaperTrackingsErrorsTableName + - !Ref PaperTrackerDryRunOutputsTableName + QueueArns: !Join + - ',' + - - !Ref ExternalChannelToPaperTrackerQueueARN + - !Ref PnOcrOutputsQueueARN + LogGroupsNames: !Join + - ',' + - - !Sub '/aws/ecs/${ProjectName}-paper-tracker' + + PaperTrackerMicroserviceTaskPolicy: + Type: AWS::IAM::ManagedPolicy + Properties: + PolicyDocument: + Version: 2012-10-17 + Statement: + - Effect: Allow + Action: + - dynamodb:GetItem + - dynamodb:PutItem + - dynamodb:UpdateItem + - dynamodb:Query + - dynamodb:BatchGetItem + Resource: + - !Sub "${PaperTrackingsTableArn}" + - !Sub "${PaperTrackerDryRunOutputsTableArn}" + - !Sub "${PaperTrackingsErrorsTableArn}" + - !Sub "${PaperTrackingsTableArn}/*" + - !Sub "${PaperTrackerDryRunOutputsTableArn}/*" + - !Sub "${PaperTrackingsErrorsTableArn}/*" + - Effect: Allow + Action: + - sqs:ChangeMessageVisibility + - sqs:ChangeMessageVisibilityBatch + - sqs:DeleteMessage + - sqs:DeleteMessageBatch + - sqs:GetQueueAttributes + - sqs:GetQueueUrl + - sqs:ReceiveMessage + - sqs:SendMessage + - sqs:SendMessageBatch + Resource: + - !Ref ExternalChannelToPaperTrackerQueueARN + - !Ref PnOcrOutputsQueueARN + - !Ref PnOcrInputsQueueARN + - !Ref ExternalChannelsOutputsQueueARN + - !Ref ExternalChannels2PaperChannelQueueARN + - !Sub 'arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:${ExternalChannelsToPaperChannelDryrunQueueName}' + - Effect: Allow + Action: + - events:PutEvents + Resource: + - !Sub arn:aws:events:${AWS::Region}:${AWS::AccountId}:event-bus/${ProjectName}-CoreEventBus + + ########################################################################## + ### NotificationReworkEventsValidationLambda ### + ########################################################################## + NotificationReworkEventsValidationLambdaSecGroup: + Type: AWS::EC2::SecurityGroup + Properties: + GroupDescription: !Sub '${NotificationReworkEventsValidationLambdaName}-sec-group' + VpcId: !Ref VpcId + + # Lambda function + NotificationReworkEventsValidationLambda: + Type: AWS::Lambda::Function + Properties: + FunctionName: !Ref NotificationReworkEventsValidationLambdaName + Runtime: nodejs22.x + Handler: "index.handler" + Code: + S3Bucket: !Ref MicroserviceBucketName + S3Key: !Sub "${MicroserviceBucketBaseKey}/functions_zip/notificationReworkEventsValidation.zip" + Role: !GetAtt NotificationReworkEventsValidationLambdaRole.Arn + Environment: + Variables: + REGION: !Sub ${AWS::Region} + NOTIFICATION_REWORK_TABLE: !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${ProjectName}-NotificationReworks + NOTIFICATION_REWORK_EVENTS_ERROR_TABLE: !Ref NotificationReworkEventsErrorTableName + INVALID_STATUS_CODE: !Ref NotificationReworkInvalidStatusCode + EXTERNAL_TO_PAPER_QUEUE_URL: !Ref ExternalChannels2PaperChannelQueueURL + TracingConfig: + Mode: Active + Layers: + - !Sub "arn:aws:lambda:${AWS::Region}:339249233099:layer:LambdaInsightsExtension:13" + Timeout: 10 + + # Lambda function role + NotificationReworkEventsValidationLambdaRole: + Type: AWS::IAM::Role + Properties: + RoleName: !Sub ${ProjectName}-NotificationReworkEventsValidationLambdaRole + AssumeRolePolicyDocument: + Version: 2012-10-17 + Statement: + - Effect: Allow + Principal: + Service: + - lambda.amazonaws.com + Action: + - sts:AssumeRole + ManagedPolicyArns: + - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole + + # Lambda function IAM policy + NotificationReworkEventsValidationLambdaPolicy: + Type: AWS::IAM::Policy + Properties: + PolicyName: !Sub ${ProjectName}-NotificationReworkEventsValidationLambdaPolicy + Roles: + - !Ref NotificationReworkEventsValidationLambdaRole + PolicyDocument: + Version: 2012-10-17 + Statement: + - Effect: Allow + Action: + - "dynamodb:updateItem" + - "dynamodb:putItem" + - "dynamodb:getItem" + - "dynamodb:query" + Resource: + - !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/pn-NotificationReworks + - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/pn-NotificationReworks/*" + - !Sub arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/pn-NotificationReworkEventsError + - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/pn-NotificationReworkEventsError/*" + - Effect: Allow + Action: + - sqs:ChangeMessageVisibility + - sqs:GetQueueAttributes + - sqs:GetQueueUrl + - sqs:SendMessage + Resource: !Ref ExternalChannels2PaperChannelQueueARN + - Effect: Allow + Action: + - sqs:ReceiveMessage + - sqs:ChangeMessageVisibility + - sqs:DeleteMessage + - sqs:GetQueueAttributes + - sqs:GetQueueUrl + Resource: !Ref ExternalChannelToReworkEventValidationQueueARN + + # CDC to NotificationReworkEventsValidationLambda + NotificationReworkEventsValidationLambdaSource: + Type: AWS::Lambda::EventSourceMapping + DependsOn: NotificationReworkEventsValidationLambdaPolicy + Properties: + BatchSize: !Sub ${NotificationReworkEventsValidationLambdaBatchSize} + EventSourceArn: !Ref ExternalChannelToReworkEventValidationQueueARN + FunctionName: !Ref NotificationReworkEventsValidationLambda + MaximumBatchingWindowInSeconds: 60 + Enabled: true + + NotificationReworkEventsValidationLambdaAlarms: + Type: AWS::CloudFormation::Stack + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/lambda-alarms.yaml" + Parameters: + FunctionName: !Ref NotificationReworkEventsValidationLambda + AlarmSNSTopicArn: !Ref AlarmSNSTopicArn + + #### Alarm for custom metric Autoscaling + AlarmCustomAutoscaling: + Type: "AWS::CloudWatch::Alarm" + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-autoscaling-custom" + AlarmDescription: "Trigger scaling based on custom metric" + DatapointsToAlarm: !Ref AutoscalingDataPointN + ComparisonOperator: "GreaterThanOrEqualToThreshold" + Metrics: + - Id: m1 + MetricStat: + Metric: + Dimensions: + - Name: QueueName + Value: !Ref "ExternalChannelToPaperTrackerQueueName" + Namespace: "AWS/SQS" + MetricName: "ApproximateNumberOfMessagesVisible" + Period: !Ref AutoscalingCheckPeriod + Stat: Average + ReturnData: False + - Id: m2 + MetricStat: + Metric: + Dimensions: + - Name: QueueName + Value: !Ref "PnOcrOutputsQueueName" + Namespace: "AWS/SQS" + MetricName: "ApproximateNumberOfMessagesVisible" + Period: !Ref AutoscalingCheckPeriod + Stat: Average + ReturnData: False + - Id: m3 + MetricStat: + Metric: + Dimensions: + - Name: TargetGroup + Value: !GetAtt PaperTrackerMicroservice.Outputs.TargetGroupName + Namespace: "AWS/ApplicationELB" + MetricName: "RequestCountPerTarget" + Period: !Ref AutoscalingCheckPeriod + Stat: Sum + ReturnData: False + - Id: m4 + MetricStat: + Metric: + Dimensions: + - Name: TargetGroup + Value: !GetAtt PaperTrackerMicroservice.Outputs.TargetGroupName + - Name: LoadBalancer + Value: !Ref ApplicationLoadBalancerMetricsDimensionName + Namespace: "AWS/ApplicationELB" + MetricName: "HealthyHostCount" + Period: !Ref AutoscalingCheckPeriod + Stat: Average + ReturnData: False + - Id: code + Expression: !Sub "IF(m4==0, 101, (100*(m1+m2)) / (${ConsumedQueueMessagePerMinute} * m4) )" + Label: !Sub "${ProjectName}-paper-tracker-queue-custom-metric" + ReturnData: False + - Id: http + Expression: !Sub "(100 * m3) / ${AutoscalingThreshold}" + Label: !Sub "${ProjectName}-paper-tracker-http-custom-metric" + ReturnData: False + - Id: e1 + Expression: "IF( code, + "ruleArn": , + "ruleName": , + "ingestionTime": , + "originalEvent": + } + - Id: !Sub '${ProjectName}-CoreEventBus-ExtCh2PaperChannel' + Arn: !Ref ExternalChannelToReworkEventValidationQueueARN + InputPath: $.detail + DeadLetterConfig: + Arn: !Sub arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:pn-CoreEventBus-DLQ + + EventBusEnqueueRole: + Type: AWS::IAM::Role + Properties: + AssumeRolePolicyDocument: + Statement: + - Action: sts:AssumeRole + Effect: Allow + Principal: + Service: events.amazonaws.com + Version: "2012-10-17" + Policies: + - PolicyName: !Sub ${ProjectName}-paper-tracker-eventBusRuleQueuePolicy + PolicyDocument: + Statement: + - Sid: putEvents + Action: + - sqs:ChangeMessageVisibility + - sqs:ChangeMessageVisibilityBatch + - sqs:GetQueueAttributes + - sqs:GetQueueUrl + - sqs:SendMessage + - sqs:SendMessageBatch + Effect: Allow + Resource: + - !Ref ExternalChannelToReworkEventValidationQueueARN + + ExternalChannelToReworkPolicy: + Type: AWS::SQS::QueuePolicy + Properties: + Queues: + - !Ref ExternalChannelToReworkEventValidationQueueURL + PolicyDocument: + Statement: + - Sid: "SendEventsToDLQ" + Effect: "Allow" + Principal: + Service: + - "events.amazonaws.com" + Action: + - "SQS:SendMessage" + Resource: + - !Ref ExternalChannelToReworkEventValidationQueueARN + + PaperTracker890ErrorsAlarm: + Type: AWS::CloudWatch::Alarm + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-890Errors-Alarm" + ComparisonOperator: GreaterThanOrEqualToThreshold + Threshold: !Ref 890ErrorThreshold + OKActions: + - !Ref AlarmSNSTopicArn + AlarmActions: + - !Ref AlarmSNSTopicArn + EvaluationPeriods: !Ref 890EvaluationPeriods + DatapointsToAlarm: !Ref 890DatapointsToAlarm + TreatMissingData: !Ref 890TreatMissingData + Metrics: + - Id: q1 + Expression: !Sub | + SELECT SUM(ERROR_COUNT) + FROM SCHEMA("paper-tracker-errors", errorCategory, productType) + WHERE ${890WhereClause} AND productType = '890' + ReturnData: true + Period: 600 + + PaperTrackerRISErrorsAlarm: + Type: AWS::CloudWatch::Alarm + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-RISErrors-Alarm" + ComparisonOperator: GreaterThanOrEqualToThreshold + Threshold: !Ref RISErrorThreshold + OKActions: + - !Ref AlarmSNSTopicArn + AlarmActions: + - !Ref AlarmSNSTopicArn + EvaluationPeriods: !Ref RISEvaluationPeriods + DatapointsToAlarm: !Ref RISDatapointsToAlarm + TreatMissingData: !Ref RISTreatMissingData + Metrics: + - Id: q1 + Expression: !Sub | + SELECT SUM(ERROR_COUNT) + FROM SCHEMA("paper-tracker-errors", errorCategory, productType) + WHERE ${RISWhereClause} AND productType = 'RIS' + ReturnData: true + Period: 600 + + PaperTrackerARErrorsAlarm: + Type: AWS::CloudWatch::Alarm + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-ARErrors-Alarm" + ComparisonOperator: GreaterThanOrEqualToThreshold + Threshold: !Ref ARErrorThreshold + OKActions: + - !Ref AlarmSNSTopicArn + AlarmActions: + - !Ref AlarmSNSTopicArn + EvaluationPeriods: !Ref AREvaluationPeriods + DatapointsToAlarm: !Ref ARDatapointsToAlarm + TreatMissingData: !Ref ARTreatMissingData + Metrics: + - Id: q1 + Expression: !Sub | + SELECT SUM(ERROR_COUNT) + FROM SCHEMA("paper-tracker-errors", errorCategory, productType) + WHERE ${ARWhereClause} AND productType = 'AR' + ReturnData: true + Period: 600 + + PaperTrackerRSErrorsAlarm: + Type: AWS::CloudWatch::Alarm + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-RSErrors-Alarm" + ComparisonOperator: GreaterThanOrEqualToThreshold + Threshold: !Ref RSErrorThreshold + OKActions: + - !Ref AlarmSNSTopicArn + AlarmActions: + - !Ref AlarmSNSTopicArn + EvaluationPeriods: !Ref RSEvaluationPeriods + DatapointsToAlarm: !Ref RSDatapointsToAlarm + TreatMissingData: !Ref RSTreatMissingData + Metrics: + - Id: q1 + Expression: !Sub | + SELECT SUM(ERROR_COUNT) + FROM SCHEMA("paper-tracker-errors", errorCategory, productType) + WHERE ${RSWhereClause} AND productType = 'RS' + ReturnData: true + Period: 600 + + PaperTrackerRIRErrorsAlarm: + Type: AWS::CloudWatch::Alarm + Properties: + AlarmName: !Sub "${ProjectName}-paper-tracker-RIRErrors-Alarm" + ComparisonOperator: GreaterThanOrEqualToThreshold + Threshold: !Ref RIRErrorThreshold + OKActions: + - !Ref AlarmSNSTopicArn + AlarmActions: + - !Ref AlarmSNSTopicArn + EvaluationPeriods: !Ref RIREvaluationPeriods + DatapointsToAlarm: !Ref RIRDatapointsToAlarm + TreatMissingData: !Ref RIRTreatMissingData + Metrics: + - Id: q1 + Expression: !Sub | + SELECT SUM(ERROR_COUNT) + FROM SCHEMA("paper-tracker-errors", errorCategory, productType) + WHERE ${RIRWhereClause} AND productType = 'RIR' + ReturnData: true + Period: 600 diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/storage.yml b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/storage.yml new file mode 100644 index 000000000..2c15d7161 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/scripts/aws/cfn/storage.yml @@ -0,0 +1,251 @@ +AWSTemplateFormatVersion: '2010-09-09' +Description: Some storage with input and output + +Parameters: + ProjectName: + Type: String + Description: Nome dell'ambiente destinazione + + # Unused but required by CD pipeline + MicroserviceNumber: + Type: Number + Description: An unique number that identify the microservice inside the ECS cluster. + + # Unused but required by CD pipeline + TemplateBucketBaseUrl: + Type: String + Description: URL da cui caricare i frammenti di template di infrastruttura + + Version: + Type: String + Description: 'keep track of used projects commitIds' + + CdcKinesisSourceStreamArn: + Type: String + Description: 'Where to send CDC' + + LogsKinesisSourceStreamArn: + Type: String + Description: 'Where to send Logs' + + LogRetention: + Type: Number + Default: 14 + + AlarmSNSTopicName: + Type: String + +Resources: + PnPaperTrackerLogGroup: + Type: AWS::CloudFormation::Stack + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/log-group.yaml" + Parameters: + LogGroupName: !Sub '${ProjectName}-paper-tracker' + LogGroupRetention: !Ref LogRetention + LogsKinesisSourceStreamArn: !Ref LogsKinesisSourceStreamArn + + NotificationReworkEventsValidationLambdaLogGroup: + Type: AWS::CloudFormation::Stack + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TemplateURL: !Sub ${TemplateBucketBaseUrl}/fragments/log-group.yaml + Parameters: + LogGroupName: !Sub ${ProjectName}-NotificationReworkEventsValidationLambda + LogGroupRetention: !Ref LogRetention + LogGroupPrefix: /aws/lambda + + PaperTrackingsErrorsTable: + Type: AWS::DynamoDB::Table + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TableName: !Sub '${ProjectName}-PaperTrackingsErrors' + AttributeDefinitions: + - AttributeName: "trackingId" + AttributeType: "S" + - AttributeName: "created" + AttributeType: "S" + KeySchema: + - AttributeName: "trackingId" + KeyType: "HASH" + - AttributeName: "created" + KeyType: "RANGE" + BillingMode: "PAY_PER_REQUEST" + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + StreamSpecification: + StreamViewType: NEW_IMAGE + KinesisStreamSpecification: + StreamArn: !Ref CdcKinesisSourceStreamArn + + PaperTrackerDryRunOutputsTable: + Type: AWS::DynamoDB::Table + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TableName: !Sub '${ProjectName}-PaperTrackerDryRunOutputs' + AttributeDefinitions: + - AttributeName: "trackingId" + AttributeType: "S" + - AttributeName: "created" + AttributeType: "S" + KeySchema: + - AttributeName: "trackingId" + KeyType: "HASH" + - AttributeName: "created" + KeyType: "RANGE" + BillingMode: "PAY_PER_REQUEST" + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + + PaperTrackingsTable: + Type: AWS::DynamoDB::Table + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TableName: !Sub '${ProjectName}-PaperTrackings' + AttributeDefinitions: + - AttributeName: "trackingId" + AttributeType: "S" + - AttributeName: "attemptId" + AttributeType: "S" + - AttributeName: "pcRetry" + AttributeType: "S" + KeySchema: + - AttributeName: "trackingId" + KeyType: "HASH" + GlobalSecondaryIndexes: + - IndexName: "attemptId-pcRetry-index" + KeySchema: + - AttributeName: "attemptId" + KeyType: "HASH" + - AttributeName: "pcRetry" + KeyType: "RANGE" + Projection: + ProjectionType: "ALL" + TimeToLiveSpecification: + AttributeName: "ttl" + Enabled: true + BillingMode: "PAY_PER_REQUEST" + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + StreamSpecification: + StreamViewType: NEW_IMAGE + KinesisStreamSpecification: + StreamArn: !Ref CdcKinesisSourceStreamArn + + NotificationReworkEventsErrorTable: + Type: AWS::DynamoDB::Table + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TableName: !Sub '${ProjectName}-NotificationReworkEventsError' + AttributeDefinitions: + - AttributeName: "iun" + AttributeType: "S" + - AttributeName: "reworkId" + AttributeType: "S" + KeySchema: + - AttributeName: "iun" + KeyType: "HASH" + - AttributeName: "reworkId" + KeyType: "RANGE" + BillingMode: "PAY_PER_REQUEST" + PointInTimeRecoverySpecification: + PointInTimeRecoveryEnabled: true + + PnOcrOutputsQueue: + Type: AWS::CloudFormation::Stack + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/sqs-queue.yaml" + Parameters: + QueueName: !Sub '${ProjectName}-paper_tracker_ocr_outputs' + AlarmSNSTopicName: !Ref AlarmSNSTopicName + VisibilityTimeout: 60 + DelaySeconds: 1 + + ExternalChannelToPaperTrackerQueue: + Type: AWS::CloudFormation::Stack + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/sqs-queue.yaml" + Parameters: + QueueName: !Sub '${ProjectName}-external_channel_to_paper_tracker' + AlarmSNSTopicName: !Ref AlarmSNSTopicName + VisibilityTimeout: 60 + DelaySeconds: 1 + + ExternalChannelToReworkEventValidationQueue: + Type: AWS::CloudFormation::Stack + UpdateReplacePolicy: Retain + DeletionPolicy: Retain + Properties: + TemplateURL: !Sub "${TemplateBucketBaseUrl}/fragments/sqs-queue.yaml" + Parameters: + QueueName: !Sub '${ProjectName}-external_channel_to_rework_event_validation' + AlarmSNSTopicName: !Ref AlarmSNSTopicName + VisibilityTimeout: 1800 + DelaySeconds: 1 + +Outputs: + EcsLogGroup: + Value: !GetAtt PnPaperTrackerLogGroup.Outputs.LogGroupName + + # Lambda functions + NotificationReworkEventsValidationLambdaName: + Value: !Sub ${ProjectName}-NotificationReworkEventsValidationLambda + + PaperTrackingsErrorsTableName: + Description: Name of dynamodb table containing trackings errors + Value: !Ref PaperTrackingsErrorsTable + PaperTrackingsErrorsTableArn: + Description: ARN of dynamodb table containing trackings errors + Value: !Sub '${PaperTrackingsErrorsTable.Arn}' + + PaperTrackerDryRunOutputsTableName: + Description: Name of dynamodb table containing trackings outputs + Value: !Ref PaperTrackerDryRunOutputsTable + PaperTrackerDryRunOutputsTableArn: + Description: ARN of dynamodb table containing trackings outputs + Value: !Sub '${PaperTrackerDryRunOutputsTable.Arn}' + + PaperTrackingsTableName: + Description: Name of dynamodb table containing trackings + Value: !Ref PaperTrackingsTable + PaperTrackingsTableArn: + Description: ARN of dynamodb table containing trackings + Value: !Sub '${PaperTrackingsTable.Arn}' + + NotificationReworkEventsErrorTableName: + Description: Name of dynamodb table containing rework events errors + Value: !Ref NotificationReworkEventsErrorTable + + NotificationReworkEventsErrorTableArn: + Description: ARN of dynamodb table containing rework events errors + Value: !Sub '${NotificationReworkEventsErrorTable.Arn}' + + PnOcrOutputsQueueName: + Value: !GetAtt PnOcrOutputsQueue.Outputs.QueueName + PnOcrOutputsQueueARN: + Value: !GetAtt PnOcrOutputsQueue.Outputs.QueueARN + PnOcrOutputsQueueURL: + Value: !GetAtt PnOcrOutputsQueue.Outputs.QueueURL + + ExternalChannelToPaperTrackerQueueName: + Value: !GetAtt ExternalChannelToPaperTrackerQueue.Outputs.QueueName + ExternalChannelToPaperTrackerQueueARN: + Value: !GetAtt ExternalChannelToPaperTrackerQueue.Outputs.QueueARN + + ExternalChannelToReworkEventValidationQueueName: + Value: !GetAtt ExternalChannelToReworkEventValidationQueue.Outputs.QueueName + ExternalChannelToReworkEventValidationQueueARN: + Value: !GetAtt ExternalChannelToReworkEventValidationQueue.Outputs.QueueARN + ExternalChannelToReworkEventValidationQueueURL: + Value: !GetAtt ExternalChannelToReworkEventValidationQueue.Outputs.QueueURL \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/PaperTrackerApplication.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/PaperTrackerApplication.java new file mode 100644 index 000000000..decbc1a7c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/PaperTrackerApplication.java @@ -0,0 +1,14 @@ +package it.pagopa.pn.papertracker; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class PaperTrackerApplication { + + + public static void main(String[] args) { + SpringApplication.run(PaperTrackerApplication.class, args); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigs.java new file mode 100644 index 000000000..3b8713efc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigs.java @@ -0,0 +1,102 @@ +package it.pagopa.pn.papertracker.config; + +import it.pagopa.pn.commons.conf.SharedAutoConfiguration; +import it.pagopa.pn.papertracker.model.FileType; +import jakarta.annotation.PostConstruct; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +import java.time.Duration; +import java.util.ArrayList; +import java.util.List; + +@Configuration +@ConfigurationProperties(prefix = "pn.paper-tracker") +@Data +@Import({SharedAutoConfiguration.class}) +@Slf4j +public class PnPaperTrackerConfigs { + + private Dao dao; + private String paperChannelBaseUrl; + private String dataVaultBaseUrl; + private String safeStorageBaseUrl; + public String safeStorageCxId; + private Duration paperTrackingsTtlDuration; + private Duration paperTrackingsErrorsTtlDuration; + private Topics topics; + private int maxPcRetryMock; + + private List enableOcrValidationFor = new ArrayList<>(); + private List enableOcrValidationForFile = new ArrayList<>(); + private List saveAndNotSendToDeliveryPush = new ArrayList<>(); + private List requiredAttachmentsRefinementStock890 = new ArrayList<>(); + private List sendOcrAttachmentsRefinementStock890 = new ArrayList<>(); + private List sendOcrAttachmentsFinalValidationStock890 = new ArrayList<>(); + private List sendOcrAttachmentsFinalValidation = new ArrayList<>(); + private List strictFinalValidationStock890; + private List strictDeliveryFailureCause; + private List internalEvents = new ArrayList<>(); + private List productsProcessingModes = new ArrayList<>(); + private List redriveEnabledDomains = new ArrayList<>(); + private List sendToConsolidatoreErrorCategories = new ArrayList<>(); + private String ocrFilterTemporal; + private List ocrFilterUnifiedDeliveryDriver = new ArrayList<>(); + + private Duration compiutaGiacenzaArDuration; + private boolean enableTruncatedDateForRefinementCheck; + private Duration refinementDuration; + + private EventBus eventBus; + + @Data + public static class Dao { + private String paperTrackingsErrorsTable; + private String paperTrackerDryRunOutputsTable; + private String paperTrackingsTable; + } + + @Data + public static class Topics { + // Consumer + Producer + private String externalChannelToPaperTrackerQueue; + // Consumer + private String externalChannelToPaperChannelQueue; + private String pnOcrOutputsQueue; + // Producer + private String queueOcrInputsUrl; + private String queueOcrInputsRegion; + private String externalChannelOutputsQueue; + private String externalChannelToPaperChannelDryRunQueue; + } + + @Data + public static class EventBus { + private String name; + private String detailType; + private String source; + } + + @PostConstruct + public void init() { + validateSendOcrAttachmentsFinalValidationStock890(); + + log.info("CONFIGURATIONS: {}", this); + } + + + public void validateSendOcrAttachmentsFinalValidationStock890() { + List expected = List.of("1970-01-01;"); + + if (!expected.equals(sendOcrAttachmentsFinalValidationStock890)) { + throw new IllegalStateException( + "Invalid configuration for sendOcrAttachmentsFinalValidationStock890. " + + "Expected exactly: " + expected + + ", but found: " + sendOcrAttachmentsFinalValidationStock890 + ); + } + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/TrackerConfigUtils.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/TrackerConfigUtils.java new file mode 100644 index 000000000..69a834561 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/TrackerConfigUtils.java @@ -0,0 +1,353 @@ +package it.pagopa.pn.papertracker.config; + +import it.pagopa.pn.papertracker.exception.ConfigNotFound; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProcessingMode; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import jakarta.annotation.PostConstruct; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.support.CronExpression; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import java.time.*; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.stream.Collectors; + +@Slf4j +@Component +public class TrackerConfigUtils { + + private static final String SEPARATOR = ";"; + private static final String CONFIG_ERROR_CODE = "REQUIRED_CONFIG_NOT_FOUND"; + private static final String OCR_FILTER_DISABLED = "DISABLED"; + + + @Getter + public abstract static class ConfigWithDate { + + protected final LocalDate startConfigurationTime; + protected final List stringConfigs; + + protected ConfigWithDate(String configWithDate) { + var splitted = configWithDate.split(SEPARATOR); + + this.startConfigurationTime = LocalDate.parse(splitted[0]); + this.stringConfigs = List.copyOf( + Arrays.asList(Arrays.copyOfRange(splitted, 1, splitted.length)) + ); + } + + public abstract T getConfig(); + } + + public static final class ListStringConfig extends ConfigWithDate> { + + public ListStringConfig(String configWithDate) { + super(configWithDate); + } + + @Override + public List getConfig() { + return stringConfigs; + } + } + + public static final class BooleanConfig extends ConfigWithDate { + + public BooleanConfig(String configWithDate) { + super(configWithDate); + } + + @Override + public Boolean getConfig() { + if (stringConfigs.isEmpty()) + return Boolean.FALSE; + return Boolean.parseBoolean(stringConfigs.getFirst()); + } + } + + public static final class ActivationModeConfig + extends ConfigWithDate> { + + public ActivationModeConfig(String configWithDate) { + super(configWithDate); + } + + @Override + public Map getConfig() { + return stringConfigs.stream() + .map(pm -> pm.split(":")) + .collect(Collectors.toUnmodifiableMap( + pm -> ProductType.fromValue(pm[0]), + pm -> ProcessingMode.valueOf(pm[1]) + )); + } + } + + public static final class OcrActivationModeConfig + extends ConfigWithDate> { + + public OcrActivationModeConfig(String configWithDate) { + super(configWithDate); + } + + @Override + public Map getConfig() { + return stringConfigs.stream() + .map(pm -> pm.split(":")) + .collect(Collectors.toUnmodifiableMap( + pm -> ProductType.fromValue(pm[0]), + pm -> OcrStatusEnum.valueOf(pm[1]) + )); + } + } + + public record OcrFilterUnifiedDeliveryDriverConfigRecord(List drivers, boolean isDisabled) { + public OcrFilterUnifiedDeliveryDriverConfigRecord(List drivers) { + this(drivers, drivers.stream().anyMatch(OCR_FILTER_DISABLED::equalsIgnoreCase)); + } + } + + public static final class CronTemporalConfig { + + private CronExpression cronExpression; + private boolean isValidConfig; + private boolean isDisabled; + + public CronTemporalConfig(String config) { + initConfig(config); + } + + private void initConfig(String config) { + if (!StringUtils.hasText(config)) { + log.info("Cron configuration is empty or null"); + isValidConfig = false; + return; + } + if (OCR_FILTER_DISABLED.equalsIgnoreCase(config)) { + log.info("Cron configuration is set to DISABLED"); + isDisabled = true; + isValidConfig = true; + return; + } + try { + cronExpression = CronExpression.parse(config); + log.info("Parsed cron expression: {}", this.cronExpression); + isValidConfig = true; + isDisabled = false; + } catch (IllegalArgumentException e) { + log.error("Invalid cron expression: {}", config, e); + isValidConfig = false; + } + } + + public boolean isActive(Instant now) { + if (!isValidConfig || isDisabled || cronExpression == null) { + return false; + } + + ZoneId zoneId = ZoneId.of("Europe/Rome"); + + // Converto l'Instant nel fuso orario corretto + ZonedDateTime currentZdt = now.atZone(zoneId); + + // Tronco al secondo spaccato (i cron non gestiscono i millisecondi) + ZonedDateTime currentSecond = currentZdt.truncatedTo(ChronoUnit.SECONDS); + + // Calcolo la prossima esecuzione partendo da "un secondo fa" + ZonedDateTime nextExecution = cronExpression.next(currentSecond.minusSeconds(1)); + log.debug("Next execution time according to cron: {}", nextExecution); + + // Se la prossima esecuzione rispetto a un secondo fa è proprio adesso, + // significa che il pattern cron include il secondo corrente (è ATTIVO). + return currentSecond.equals(nextExecution); + } + } + + private final List requiredAttachmentsRefinementStock890Configs; + private final List sendOcrAttachmentsRefinementStock890Configs; + private final List sendOcrAttachmentsFinalValidationStock890Configs; + private final List sendOcrAttachmentsFinalValidationConfigs; + private final List strictFinalValidationStock890Config; + private final List strictDeliveryFailureCauseConfig; + private final List productsProcessingModesConfig; + private final List enableOcrValidationForConfig; + private final CronTemporalConfig ocrFilterTemporalConfig; + private final OcrFilterUnifiedDeliveryDriverConfigRecord ocrFilterUnifiedDeliveryDriverConfig; + private final PnPaperTrackerConfigs cfg; + + public TrackerConfigUtils(PnPaperTrackerConfigs cfg) { + this.requiredAttachmentsRefinementStock890Configs = buildListStringConfig(cfg.getRequiredAttachmentsRefinementStock890()); + this.sendOcrAttachmentsRefinementStock890Configs = buildListStringConfig(cfg.getSendOcrAttachmentsRefinementStock890()); + this.sendOcrAttachmentsFinalValidationConfigs = buildListStringConfig(cfg.getSendOcrAttachmentsFinalValidation()); + this.sendOcrAttachmentsFinalValidationStock890Configs = buildListStringConfig(cfg.getSendOcrAttachmentsFinalValidationStock890()); + this.strictFinalValidationStock890Config = buildListBooleanConfig(cfg.getStrictFinalValidationStock890()); + this.strictDeliveryFailureCauseConfig = buildListBooleanConfig(cfg.getStrictDeliveryFailureCause()); + this.productsProcessingModesConfig = buildListActivationModeConfig(cfg.getProductsProcessingModes()); + this.enableOcrValidationForConfig = buildListOcrActivationModeConfig(cfg.getEnableOcrValidationFor()); + this.ocrFilterTemporalConfig = buildOcrFilterTemporalConfig(cfg.getOcrFilterTemporal()); + this.ocrFilterUnifiedDeliveryDriverConfig = new OcrFilterUnifiedDeliveryDriverConfigRecord(cfg.getOcrFilterUnifiedDeliveryDriver()); + this.cfg = cfg; + } + + @PostConstruct + public void init() { + log.info("TrackerConfigUtils PostConstruct initialization started"); + checkIfOcrFilterTemporalIsValid(); + checkIfOcrFilterDriverIsValid(); + } + + private void checkIfOcrFilterTemporalIsValid() { + if (!ocrFilterTemporalConfig.isValidConfig) { + throw new ConfigNotFound( + CONFIG_ERROR_CODE, + "OcrFilterTemporal config not found"); + } + } + + private void checkIfOcrFilterDriverIsValid() { + if (ocrFilterUnifiedDeliveryDriverConfig.drivers().isEmpty()) { + throw new ConfigNotFound( + CONFIG_ERROR_CODE, + "OcrFilterUnifiedDeliveryDriver config not found"); + } + } + + public List buildListStringConfig(List configList) { + return Optional.ofNullable(configList) + .orElse(List.of()) + .stream() + .map(ListStringConfig::new) + .toList(); + } + + public List buildListBooleanConfig(List configList) { + return Optional.ofNullable(configList) + .orElse(List.of()) + .stream() + .map(BooleanConfig::new) + .toList(); + } + + public List buildListActivationModeConfig(List configList) { + return Optional.ofNullable(configList) + .orElse(List.of()) + .stream() + .map(ActivationModeConfig::new) + .toList(); + } + + public List buildListOcrActivationModeConfig(List configList) { + return Optional.ofNullable(configList) + .orElse(List.of()) + .stream() + .map(OcrActivationModeConfig::new) + .toList(); + } + + public CronTemporalConfig buildOcrFilterTemporalConfig(String config) { + return new CronTemporalConfig(config); + } + + public T getActualConfig( + List> configs, + LocalDate date, + String configName + ) { + return configs.stream() + .sorted(Comparator.comparing( + (ConfigWithDate c) -> c.getStartConfigurationTime() + ).reversed()) + .filter(c -> !date.isBefore(c.getStartConfigurationTime())) + .findFirst() + .map(ConfigWithDate::getConfig) + .orElseThrow(() -> new ConfigNotFound( + CONFIG_ERROR_CODE, + configName + " not found for date: " + date + )); + } + + public List getActualRequiredAttachmentsRefinementStock890(LocalDate date) { + return getActualConfig( + requiredAttachmentsRefinementStock890Configs, + date, + "RequiredAttachmentsRefinementStock890" + ); + } + + public List getActualSendOcrAttachmentsRefinementStock890(LocalDate date) { + return getActualConfig( + sendOcrAttachmentsRefinementStock890Configs, + date, + "SendOcrAttachmentsRefinementStock890" + ); + } + + public List getActualSendOcrAttachmentsFinalValidationStock890(LocalDate date) { + return getActualConfig( + sendOcrAttachmentsFinalValidationStock890Configs, + date, + "SendOcrAttachmentsFinalValidationStock890" + ); + } + + public List getActualSendOcrAttachmentsFinalValidation(LocalDate date) { + return getActualConfig( + sendOcrAttachmentsFinalValidationConfigs, + date, + "SendOcrAttachmentsFinalValidation" + ); + } + + public Boolean getActualStrictFinalValidationStock890(LocalDate date) { + return getActualConfig( + strictFinalValidationStock890Config, + date, + "StrictFinalValidationStock890" + ); + } + + public Boolean getActualStrictDeliveryFailureCause(LocalDate date) { + return getActualConfig( + strictDeliveryFailureCauseConfig, + date, + "StrictDeliveryFailureCause" + ); + } + + public Map getActualProductsProcessingModes(LocalDate date) { + return getActualConfig( + productsProcessingModesConfig, + date, + "ProductsProcessingModes" + ); + } + + public Map getActualEnableOcrValidationFor(LocalDate date) { + return getActualConfig( + enableOcrValidationForConfig, + date, + "EnableOcrValidationFor" + ); + } + + public boolean isOcrFilterTemporalActive(Instant now) { + return ocrFilterTemporalConfig.isActive(now); + } + + public boolean isOcrFilterTemporalDisabled() { + return ocrFilterTemporalConfig.isDisabled; + } + + public boolean isOcrFilterDriverActive(String unifiedDeliveryDriver) { + return ocrFilterUnifiedDeliveryDriverConfig.drivers().contains(unifiedDeliveryDriver); + } + + public boolean isOcrFilterDriverDisabled() { + return ocrFilterUnifiedDeliveryDriverConfig.isDisabled(); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/DataVaultClientConfigurator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/DataVaultClientConfigurator.java new file mode 100644 index 000000000..244c417d9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/DataVaultClientConfigurator.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.config.msclient; + +import it.pagopa.pn.commons.pnclients.CommonBaseClient; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.ApiClient; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.api.PaperAddressesApi; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class DataVaultClientConfigurator extends CommonBaseClient { + + @Bean + public PaperAddressesApi paperAddressesApi(PnPaperTrackerConfigs cfg) { + return new PaperAddressesApi(getNewApiClient(cfg)); + } + + @NotNull + private ApiClient getNewApiClient(PnPaperTrackerConfigs cfg) { + ApiClient newApiClient = new ApiClient(initWebClient(ApiClient.buildWebClientBuilder())); + newApiClient.setBasePath(cfg.getDataVaultBaseUrl()); + return newApiClient; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/PaperChannelClientConfigurator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/PaperChannelClientConfigurator.java new file mode 100644 index 000000000..29a8cf397 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/PaperChannelClientConfigurator.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.config.msclient; + +import it.pagopa.pn.commons.pnclients.CommonBaseClient; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.ApiClient; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.api.PcRetryApi; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class PaperChannelClientConfigurator extends CommonBaseClient { + + @Bean + public PcRetryApi pcRetryApi(PnPaperTrackerConfigs cfg) { + return new PcRetryApi(getNewApiClient(cfg)); + } + + @NotNull + private ApiClient getNewApiClient(PnPaperTrackerConfigs cfg) { + ApiClient newApiClient = new ApiClient( initWebClient(ApiClient.buildWebClientBuilder()) ); + newApiClient.setBasePath( cfg.getPaperChannelBaseUrl() ); + return newApiClient; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/SafeStorageClientConfigurator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/SafeStorageClientConfigurator.java new file mode 100644 index 000000000..0f0d9ae08 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/msclient/SafeStorageClientConfigurator.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.config.msclient; + +import it.pagopa.pn.commons.pnclients.CommonBaseClient; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.safestorage.ApiClient; +import it.pagopa.pn.papertracker.generated.openapi.msclient.safestorage.api.FileDownloadApi; +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SafeStorageClientConfigurator extends CommonBaseClient { + + @Bean + public FileDownloadApi getSafeStorageClient (PnPaperTrackerConfigs paperTrackerConfigs){ + return new FileDownloadApi(getNewApiClient(paperTrackerConfigs)); + } + + @NotNull + private ApiClient getNewApiClient(PnPaperTrackerConfigs cfg) { + ApiClient newApiClient = new ApiClient( initWebClient(ApiClient.buildWebClientBuilder()) ); + newApiClient.setBasePath( cfg.getSafeStorageBaseUrl() ); + return newApiClient; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsConfigsActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsConfigsActivation.java new file mode 100644 index 000000000..a15913a38 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsConfigsActivation.java @@ -0,0 +1,10 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import it.pagopa.pn.commons.configs.aws.AwsConfigs; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties("aws") +public class AwsConfigsActivation extends AwsConfigs { +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsServicesClientsConfigActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsServicesClientsConfigActivation.java new file mode 100644 index 000000000..78e90d87e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/AwsServicesClientsConfigActivation.java @@ -0,0 +1,14 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import it.pagopa.pn.commons.configs.RuntimeMode; +import it.pagopa.pn.commons.configs.aws.AwsConfigs; +import it.pagopa.pn.commons.configs.aws.AwsServicesClientsConfig; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class AwsServicesClientsConfigActivation extends AwsServicesClientsConfig { + + public AwsServicesClientsConfigActivation(AwsConfigs props) { + super(props, RuntimeMode.PROD); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ClientAspectLoggingActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ClientAspectLoggingActivation.java new file mode 100644 index 000000000..24abf5810 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ClientAspectLoggingActivation.java @@ -0,0 +1,8 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import it.pagopa.pn.commons.utils.ClientAspectLogging; +import org.springframework.stereotype.Component; + +@Component +public class ClientAspectLoggingActivation extends ClientAspectLogging { +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/MDCTraceIdWebFilter.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/MDCTraceIdWebFilter.java new file mode 100644 index 000000000..0005b7041 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/MDCTraceIdWebFilter.java @@ -0,0 +1,10 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + + +import it.pagopa.pn.commons.log.MDCWebFilter; +import org.springframework.stereotype.Component; + +@Component +public class MDCTraceIdWebFilter extends MDCWebFilter { + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnErrorWebExceptionHandlerActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnErrorWebExceptionHandlerActivation.java new file mode 100644 index 000000000..43fc25ecb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnErrorWebExceptionHandlerActivation.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + + +import it.pagopa.pn.commons.exceptions.ExceptionHelper; +import it.pagopa.pn.commons.exceptions.PnErrorWebExceptionHandler; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.core.annotation.Order; + +@Configuration +@Order(-2) +@Import(ExceptionHelper.class) +public class PnErrorWebExceptionHandlerActivation extends PnErrorWebExceptionHandler { + public PnErrorWebExceptionHandlerActivation(ExceptionHelper exceptionHelper) { + super(exceptionHelper); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnResponseEntityExceptionHandlerActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnResponseEntityExceptionHandlerActivation.java new file mode 100644 index 000000000..bcf522f9f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/PnResponseEntityExceptionHandlerActivation.java @@ -0,0 +1,14 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + + +import it.pagopa.pn.commons.exceptions.ExceptionHelper; +import it.pagopa.pn.commons.exceptions.PnResponseEntityExceptionHandler; +import org.springframework.context.annotation.Import; + +@org.springframework.web.bind.annotation.ControllerAdvice +@Import(ExceptionHelper.class) +public class PnResponseEntityExceptionHandlerActivation extends PnResponseEntityExceptionHandler { + public PnResponseEntityExceptionHandlerActivation(ExceptionHelper exceptionHelper) { + super(exceptionHelper); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ServerAspectLoggingActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ServerAspectLoggingActivation.java new file mode 100644 index 000000000..e8d1d18fd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/ServerAspectLoggingActivation.java @@ -0,0 +1,8 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import it.pagopa.pn.commons.utils.ServerAspectLogging; +import org.springframework.stereotype.Component; + +@Component +public class ServerAspectLoggingActivation extends ServerAspectLogging { +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerActivation.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerActivation.java new file mode 100644 index 000000000..a08bf288f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerActivation.java @@ -0,0 +1,24 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import io.micrometer.core.instrument.MeterRegistry; +import it.pagopa.pn.commons.utils.metrics.SpringAnalyzer; +import it.pagopa.pn.commons.utils.metrics.cloudwatch.CloudWatchMetricHandler; +import lombok.CustomLog; +import org.springframework.boot.actuate.metrics.MetricsEndpoint; +import org.springframework.context.annotation.Import; +import org.springframework.stereotype.Component; + +@Component +@CustomLog +@Import(CloudWatchMetricHandler.class) +public class SpringAnalyzerActivation extends SpringAnalyzer { + + MeterRegistry meterRegistry; + CloudWatchMetricHandler cloudWatchMetricHandler; + + public SpringAnalyzerActivation(CloudWatchMetricHandler cloudWatchMetricHandler, MetricsEndpoint metricsEndpoint, MeterRegistry meterRegistry) { + super(cloudWatchMetricHandler, metricsEndpoint); + this.cloudWatchMetricHandler = cloudWatchMetricHandler; + this.meterRegistry = meterRegistry; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerClientConfig.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerClientConfig.java new file mode 100644 index 000000000..41b9f9f60 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SpringAnalyzerClientConfig.java @@ -0,0 +1,7 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import it.pagopa.pn.commons.configs.SpringAnalyzerConfiguration; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SpringAnalyzerClientConfig extends SpringAnalyzerConfiguration {} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SqsTracingConfig.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SqsTracingConfig.java new file mode 100644 index 000000000..9304d4101 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/config/springbootcfg/SqsTracingConfig.java @@ -0,0 +1,35 @@ +package it.pagopa.pn.papertracker.config.springbootcfg; + +import io.awspring.cloud.sqs.config.SqsListenerConfigurer; +import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; +import io.awspring.cloud.sqs.operations.SqsTemplate; +import io.micrometer.observation.ObservationRegistry; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import software.amazon.awssdk.services.sqs.SqsAsyncClient; + +@Configuration +public class SqsTracingConfig { + private static final String DEFAULT_LISTENER_CONTAINER_FACTORY_BEAN_NAME = "tracedMessagesListenerContainerFactory"; + + @Bean + SqsListenerConfigurer configurer() { + return registrar -> registrar.setDefaultListenerContainerFactoryBeanName(DEFAULT_LISTENER_CONTAINER_FACTORY_BEAN_NAME); + } + + @Bean + SqsTemplate sqsTemplate(SqsAsyncClient sqsAsyncClient, ObservationRegistry observationRegistry) { + return SqsTemplate.builder() + .sqsAsyncClient(sqsAsyncClient) + .configure(options -> options.observationRegistry(observationRegistry)) + .build(); + } + + @Bean(name = DEFAULT_LISTENER_CONTAINER_FACTORY_BEAN_NAME) + SqsMessageListenerContainerFactory factory(SqsAsyncClient sqsAsyncClient, ObservationRegistry observationRegistry) { + return SqsMessageListenerContainerFactory.builder() + .sqsAsyncClient(sqsAsyncClient) + .configure(options -> options.observationRegistry(observationRegistry)) + .build(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/ConfigNotFound.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/ConfigNotFound.java new file mode 100644 index 000000000..a6884ff29 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/ConfigNotFound.java @@ -0,0 +1,11 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.commons.exceptions.PnInternalException; +import org.springframework.http.HttpStatus; + +public class ConfigNotFound extends PnInternalException { + + public ConfigNotFound(String errorCode, String message) { + super(message, HttpStatus.INTERNAL_SERVER_ERROR.value(), errorCode); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerException.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerException.java new file mode 100644 index 000000000..b67bc8b3e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerException.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.exception; + +public class PaperTrackerException extends RuntimeException { + + public PaperTrackerException(String message, Throwable throwable) { + super(message, throwable); + } + + public PaperTrackerException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandler.java new file mode 100644 index 000000000..f8b40d58a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandler.java @@ -0,0 +1,73 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Objects; + +import static it.pagopa.pn.papertracker.utils.TrackerUtility.setDematValidationTimestamp; +import static it.pagopa.pn.papertracker.utils.TrackerUtility.setNewStatus; + +@Component +@RequiredArgsConstructor +@Slf4j +public class PaperTrackerExceptionHandler { + + private final PaperTrackerErrorService paperTrackerErrorService; + private final PaperTrackerTrackingService paperTrackerTrackingService; + + /** + * Intercetta le eccezioni di tipo {@link PnPaperTrackerValidationException}. + *

+ * Per ogni eccezione intercettata, effettua una putItem sulla tabella PaperTrackingsError + */ + public Mono handleInternalException(final PnPaperTrackerValidationException ex, Long messageReceiveCount) { + return handleError(ex.getError(), messageReceiveCount, ex); + } + + public Mono handleRetryError(PaperTrackingsErrors paperTrackingsErrors) { + return handleError(paperTrackingsErrors, null, null); + } + + public Mono handleError(PaperTrackingsErrors paperTrackingsErrors, Long messageReceiveCount, PnPaperTrackerValidationException ex) { + boolean isStatusCodeError = Objects.nonNull(paperTrackingsErrors.getDetails()) && ErrorCause.VALUES_NOT_FOUND.equals(paperTrackingsErrors.getDetails().getCause()); + + if (isStatusCodeError) { + if (messageReceiveCount < 5) { + // Retry SQS + return Mono.error(ex); + } + log.error("Max retries reached for status code error, inserting error and updating PaperTrackings state to KO for trackingId: {}", paperTrackingsErrors.getTrackingId()); + } + + // Salva l'errore + return insertErrorAndUpdateTrackingsEntity(paperTrackingsErrors); + } + + private Mono insertErrorAndUpdateTrackingsEntity(PaperTrackingsErrors paperTrackingsErrors){ + return paperTrackerErrorService.insertPaperTrackingsError(paperTrackingsErrors) + .filter(errors -> paperTrackingsErrors.getType().equals(ErrorType.ERROR)) + .doOnDiscard(PaperTrackingsErrors.class, errors -> log.info("Skipped updating PaperTrackings entity for error with type Warning")) + .map(unused -> { + PaperTrackings paperTrackingsToUpdate = new PaperTrackings(); + String statusCode = paperTrackingsErrors.getEventThrow(); + setNewStatus(paperTrackingsToUpdate,statusCode, BusinessState.KO, PaperTrackingsState.KO); + setDematValidationTimestampIfNeeded(paperTrackingsErrors, paperTrackingsToUpdate,statusCode); + return paperTrackingsToUpdate; + }) + .flatMap(paperTrackingsToUpdate -> paperTrackerTrackingService.updatePaperTrackingsStatus(paperTrackingsErrors.getTrackingId(), paperTrackingsToUpdate)) + .doOnError(throwable -> log.error("Error inserting entity into PaperTrackingsErrors: {}", throwable.getMessage(), throwable)); + } + + private static void setDematValidationTimestampIfNeeded(PaperTrackingsErrors paperTrackingsErrors, PaperTrackings paperTrackingsToUpdate, String statusCode) { + if (Objects.nonNull(paperTrackingsErrors.getDetails().getCause()) && paperTrackingsErrors.getDetails().getCause().equals(ErrorCause.OCR_KO)) { + setDematValidationTimestamp(paperTrackingsToUpdate, statusCode); + } + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerBadRequestException.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerBadRequestException.java new file mode 100644 index 000000000..eb8bc5657 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerBadRequestException.java @@ -0,0 +1,13 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.commons.exceptions.PnRuntimeException; +import org.springframework.http.HttpStatus; + +public class PnPaperTrackerBadRequestException extends PnRuntimeException { + + private static final String DEFAULT_ERROR_CODE = "PN_PAPER_TRACKER_BAD_REQUEST"; + + public PnPaperTrackerBadRequestException(String errorCode, String message) { + super(message, DEFAULT_ERROR_CODE, HttpStatus.BAD_REQUEST.value(), errorCode, null, message); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerConflictException.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerConflictException.java new file mode 100644 index 000000000..1af7a3a81 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerConflictException.java @@ -0,0 +1,11 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.commons.exceptions.PnInternalException; +import org.springframework.http.HttpStatus; + +public class PnPaperTrackerConflictException extends PnInternalException { + + public PnPaperTrackerConflictException(String errorCode, String message) { + super(message, HttpStatus.CONFLICT.value(), errorCode); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerNotFoundException.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerNotFoundException.java new file mode 100644 index 000000000..ad6eb1f6e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerNotFoundException.java @@ -0,0 +1,11 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.commons.exceptions.PnInternalException; +import org.springframework.http.HttpStatus; + +public class PnPaperTrackerNotFoundException extends PnInternalException { + + public PnPaperTrackerNotFoundException(String errorCode, String message) { + super(message, HttpStatus.NOT_FOUND.value(), errorCode); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerValidationException.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerValidationException.java new file mode 100644 index 000000000..def4fbb0b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/exception/PnPaperTrackerValidationException.java @@ -0,0 +1,15 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import lombok.Getter; + +@Getter +public class PnPaperTrackerValidationException extends RuntimeException { + + private final PaperTrackingsErrors error; + + public PnPaperTrackerValidationException(String message, PaperTrackingsErrors error) { + super(message); + this.error = error; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperProgressStatusEventMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperProgressStatusEventMapper.java new file mode 100644 index 000000000..57a8fdbaa --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperProgressStatusEventMapper.java @@ -0,0 +1,97 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class PaperProgressStatusEventMapper { + + /** + * Rimappa l'oggetto PaperProgressStatusEvent nell'entity PaperTrackings in modo da effettuare l'upsert + * + * @param paperProgressStatusEvent evento da rimappare + * @param anonymizedDiscoveredAddressId l'id dell'indirizzo anonimizzato + * @return PaperTrackings contenente il nuovo evento + */ + public static PaperTrackings toPaperTrackings(String reworkId, PaperProgressStatusEvent paperProgressStatusEvent, + String anonymizedDiscoveredAddressId, + String eventId, boolean dryRunEnabled, + boolean isFinalDemat, boolean isP000event, + boolean isInternalEvent, boolean isRecag012event) { + Instant now = Instant.now(); + PaperTrackings paperTrackings = new PaperTrackings(); + Event event = new Event(); + event.setId(eventId); + event.setIun(paperProgressStatusEvent.getIun()); + if (!CollectionUtils.isEmpty(paperProgressStatusEvent.getAttachments())) { + event.setAttachments(paperProgressStatusEvent.getAttachments().stream() + .map(PaperProgressStatusEventMapper::buildAttachmentFromAttachmentDetail) + .toList()); + }else{ + event.setAttachments(new ArrayList<>()); + } + + if(isFinalDemat) { + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setFinalDematFound(true); + paperTrackings.setPaperStatus(paperStatus); + } + + if (isP000event) { + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setPaperDeliveryTimestamp(paperProgressStatusEvent.getStatusDateTime().toInstant()); + paperTrackings.setPaperStatus(paperStatus); + } + + if (!isInternalEvent){ + event.setRequestTimestamp(paperProgressStatusEvent.getClientRequestTimeStamp().toInstant()); + } + + if(isRecag012event){ + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setRecag012StatusTimestamp(now); + paperTrackings.setValidationFlow(validationFlow); + } + + event.setStatusCode(paperProgressStatusEvent.getStatusCode()); + event.setStatusTimestamp(paperProgressStatusEvent.getStatusDateTime().toInstant()); + + event.setDeliveryFailureCause(paperProgressStatusEvent.getDeliveryFailureCause()); + event.setRegisteredLetterCode(paperProgressStatusEvent.getRegisteredLetterCode()); + event.setNotificationReworkId(reworkId); + if(StringUtils.hasText(paperProgressStatusEvent.getProductType())) { + event.setProductType(paperProgressStatusEvent.getProductType()); + } + event.setAnonymizedDiscoveredAddressId(anonymizedDiscoveredAddressId); + event.setDryRun(dryRunEnabled); + event.setStatusDescription(paperProgressStatusEvent.getStatusDescription()); + event.setCreatedAt(now); + event.setPrinter(paperProgressStatusEvent.getPrinter()); + event.setDu(paperProgressStatusEvent.getDu()); + + paperTrackings.setEvents(List.of(event)); + return paperTrackings; + } + + public static Attachment buildAttachmentFromAttachmentDetail(AttachmentDetails attachmentDetails) { + Attachment attachment = new Attachment(); + attachment.setDate(attachmentDetails.getDate().toInstant()); + attachment.setId(attachmentDetails.getId()); + attachment.setDocumentType(attachmentDetails.getDocumentType()); + attachment.setUri(attachmentDetails.getUri()); + attachment.setSha256(attachmentDetails.getSha256()); + attachment.setSourceType(attachmentDetails.getSourceType()); + attachment.setOriginType(attachmentDetails.getOriginType()); + return attachment; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapper.java new file mode 100644 index 000000000..6b3cd82be --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapper.java @@ -0,0 +1,56 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.util.CollectionUtils; + +import java.time.Instant; +import java.util.Objects; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class PaperTrackerDryRunOutputsMapper { + + public static PaperTrackerDryRunOutputs dtoToEntity(SendEvent event, String anonymizedDiscoveredAddressId) { + PaperTrackerDryRunOutputs dryRunOutput = new PaperTrackerDryRunOutputs(); + dryRunOutput.setTrackingId(event.getRequestId()); + dryRunOutput.setCreated(Instant.now()); + dryRunOutput.setRegisteredLetterCode(event.getRegisteredLetterCode()); + dryRunOutput.setStatusDetail(event.getStatusDetail()); + dryRunOutput.setStatusDescription(event.getStatusDescription()); + dryRunOutput.setDeliveryFailureCause(event.getDeliveryFailureCause()); + dryRunOutput.setAnonymizedDiscoveredAddressId(anonymizedDiscoveredAddressId); + + if(Objects.nonNull(event.getStatusCode())) { + dryRunOutput.setStatusCode(event.getStatusCode().name()); + } + + if(Objects.nonNull(event.getStatusDateTime())) { + dryRunOutput.setStatusDateTime(event.getStatusDateTime().toString()); + } + + if(!CollectionUtils.isEmpty(event.getAttachments())) { + dryRunOutput.setAttachments((event.getAttachments().stream() + .map(PaperTrackerDryRunOutputsMapper::buildAttachmentForExternalChannelOutputEvent) + .toList())); + } + + if(Objects.nonNull(event.getClientRequestTimeStamp())) { + dryRunOutput.setClientRequestTimestamp(event.getClientRequestTimeStamp().toString()); + } + + return dryRunOutput; + } + + private static Attachment buildAttachmentForExternalChannelOutputEvent(AttachmentDetails attachment) { + Attachment attachmentEntity = new Attachment(); + attachmentEntity.setId(attachment.getId()); + attachmentEntity.setDate(attachment.getDate().toInstant()); + attachmentEntity.setDocumentType(attachment.getDocumentType()); + attachmentEntity.setUri(attachment.getUrl()); + return attachmentEntity; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerMapStructMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerMapStructMapper.java new file mode 100644 index 000000000..4be8c1048 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackerMapStructMapper.java @@ -0,0 +1,75 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutput; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.Tracking; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingError; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.BusinessState; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorType; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.ReportingPolicy; +import java.time.Instant; + +@Mapper( + componentModel = "spring", + unmappedTargetPolicy = ReportingPolicy.ERROR, + unmappedSourcePolicy = ReportingPolicy.IGNORE +) +public interface PaperTrackerMapStructMapper { + + @Mapping(target = "notificationReworkTimestamp", source = "notificationReworkRequestTimestamp") + Tracking toTracking(PaperTrackings paperTrackings); + + TrackingError toTrackingError(PaperTrackingsErrors paperTrackingsErrors); + + PaperTrackerOutput toDtoPaperTrackerOutput(PaperTrackerDryRunOutputs entity); + + default String map(Instant instant) { + return instant != null ? instant.toString() : null; + } + + default Tracking.StateEnum map(PaperTrackingsState state) { + if (state == null) { + return null; + } + + return switch (state) { + case AWAITING_FINAL_STATUS_CODE, AWAITING_REFINEMENT -> Tracking.StateEnum.AWAITING_REFINEMENT; + case AWAITING_REWORK_EVENTS -> Tracking.StateEnum.AWAITING_REWORK_EVENTS; + case AWAITING_OCR -> Tracking.StateEnum.AWAITING_OCR; + case DONE -> Tracking.StateEnum.DONE; + case KO -> Tracking.StateEnum.KO; + }; + } + + default Tracking.BusinessStateEnum map(BusinessState businessState) { + if (businessState == null) { + return null; + } + + return switch (businessState) { + case AWAITING_FINAL_STATUS_CODE -> Tracking.BusinessStateEnum.AWAITING_FINAL_STATUS_CODE; + case AWAITING_REFINEMENT_OCR -> Tracking.BusinessStateEnum.AWAITING_OCR; + case AWAITING_REWORK_EVENTS -> Tracking.BusinessStateEnum.AWAITING_REWORK_EVENTS; + case AWAITING_OCR -> Tracking.BusinessStateEnum.AWAITING_REFINEMENT_OCR; + case DONE -> Tracking.BusinessStateEnum.DONE; + case KO -> Tracking.BusinessStateEnum.KO; + }; + } + + default TrackingError.TypeEnum map(ErrorType errorType) { + if (errorType == null) { + return null; + } + + return switch (errorType) { + case ERROR -> TrackingError.TypeEnum.ERROR; + case INFO, WARNING -> TrackingError.TypeEnum.WARNING; + }; + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsErrorsMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsErrorsMapper.java new file mode 100644 index 000000000..a7f24d6f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsErrorsMapper.java @@ -0,0 +1,44 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingError; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; + +import java.time.Instant; +import java.util.Map; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class PaperTrackingsErrorsMapper { + + public static PaperTrackingsErrors buildPaperTrackingsError(PaperTrackings paperTrackings, + String statusCode, + ErrorCategory errorCategory, + ErrorCause errorCause, + String errorMessage, + Map additionalDetails, + FlowThrow flowThrow, + ErrorType errorType, + String eventIdThrow) { + return PaperTrackingsErrors.builder() + .trackingId(paperTrackings.getTrackingId()) + .created(Instant.now()) + .errorCategory(errorCategory) + .details(ErrorDetails.builder() + .cause(errorCause) + .message(errorMessage) + .additionalDetails(additionalDetails) + .build()) + .flowThrow(flowThrow) + .eventThrow(statusCode) + .productType(paperTrackings.getProductType()) + .unifiedDeliveryDriver(paperTrackings.getUnifiedDeliveryDriver()) + .registeredLetterCode(paperTrackings.getPaperStatus() != null + ? paperTrackings.getPaperStatus().getRegisteredLetterCode() + : null) + .type(errorType) + .eventIdThrow(eventIdThrow) + .build(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapper.java new file mode 100644 index 000000000..4f2e6f699 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapper.java @@ -0,0 +1,105 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.config.TrackerConfigUtils; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.Tracking; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.FileType; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.util.List; +import java.util.Objects; + +@Slf4j +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class PaperTrackingsMapper { + + public static PaperTrackings toPaperTrackings(TrackingCreationRequest trackingCreationRequest, + TrackerConfigUtils trackerConfigUtils, + PnPaperTrackerConfigs pnPaperTrackerConfigs, + Instant now, + String xOriginClientId) { + ProductType productType = ProductType.fromValue(trackingCreationRequest.getProductType()); + LocalDate localDate = LocalDate.now(ZoneId.of("Europe/Rome")); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(String.join(".", trackingCreationRequest.getAttemptId(), trackingCreationRequest.getPcRetry())); + paperTrackings.setUnifiedDeliveryDriver(trackingCreationRequest.getUnifiedDeliveryDriver()); + paperTrackings.setProductType(trackingCreationRequest.getProductType()); + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + paperTrackings.setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + paperTrackings.setAttemptId(trackingCreationRequest.getAttemptId()); + paperTrackings.setPcRetry(trackingCreationRequest.getPcRetry()); + paperTrackings.setCreatedAt(now); + paperTrackings.setProcessingMode(trackerConfigUtils.getActualProductsProcessingModes(localDate).get(productType)); + paperTrackings.setAnalogRequestClientId(xOriginClientId); + PaperStatus paperStatus = new PaperStatus(); + paperTrackings.setPaperStatus(paperStatus); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setOcrRequests(List.of()); + paperTrackings.setValidationFlow(validationFlow); + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setOcrFilterTemporal(pnPaperTrackerConfigs.getOcrFilterTemporal()); + validationConfig.setOcrFilterUnifiedDeliveryDriver(pnPaperTrackerConfigs.getOcrFilterUnifiedDeliveryDriver()); + validationConfig.setOcrEnabled(evaluateIfOcrIsEnabled(trackerConfigUtils, productType, now, trackingCreationRequest, localDate)); + validationConfig.setOcrFileTypes(pnPaperTrackerConfigs.getEnableOcrValidationForFile().stream().map(FileType::getValue).toList()); + validationConfig.setRequiredAttachmentsRefinementStock890(trackerConfigUtils.getActualRequiredAttachmentsRefinementStock890(localDate)); + validationConfig.setSendOcrAttachmentsRefinementStock890(trackerConfigUtils.getActualSendOcrAttachmentsRefinementStock890(localDate)); + validationConfig.setSendOcrAttachmentsFinalValidation(trackerConfigUtils.getActualSendOcrAttachmentsFinalValidation(localDate)); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(trackerConfigUtils.getActualSendOcrAttachmentsFinalValidationStock890(localDate)); + validationConfig.setStrictFinalValidationStock890(trackerConfigUtils.getActualStrictFinalValidationStock890(localDate)); + validationConfig.setStrictDeliveryFailureCause(trackerConfigUtils.getActualStrictDeliveryFailureCause(localDate)); + paperTrackings.setValidationConfig(validationConfig); + return paperTrackings; + } + + private static OcrStatusEnum evaluateIfOcrIsEnabled(TrackerConfigUtils trackerConfigUtils, + ProductType productType, + Instant now, + TrackingCreationRequest trackingCreationRequest, + LocalDate localDate) { + + OcrStatusEnum ocrStatusEnum = trackerConfigUtils.getActualEnableOcrValidationFor(localDate).get(productType); + + if (Objects.isNull(ocrStatusEnum) || OcrStatusEnum.DISABLED.equals(ocrStatusEnum)) { + return OcrStatusEnum.DISABLED; + } + + if (OcrStatusEnum.DRY.equals(ocrStatusEnum)) { + return OcrStatusEnum.DRY; + } + + // Siamo in modalità OCR:RUN + + boolean isTemporalFilterConfigured = !trackerConfigUtils.isOcrFilterTemporalDisabled(); + boolean isUnifiedDeliveryDriverFilterConfigured = !trackerConfigUtils.isOcrFilterDriverDisabled(); + + // Caso 1: entrambi i filtri disattivi + if (!isTemporalFilterConfigured && !isUnifiedDeliveryDriverFilterConfigured) { + log.info("Both OCR filters are disabled. OCR will be enabled in RUN mode"); + return OcrStatusEnum.RUN; + } + + boolean isTemporalFilterActive = isTemporalFilterConfigured && trackerConfigUtils.isOcrFilterTemporalActive(now); + boolean isUnifiedDeliveryDriverFilterActive = isUnifiedDeliveryDriverFilterConfigured && + trackerConfigUtils.isOcrFilterDriverActive(trackingCreationRequest.getUnifiedDeliveryDriver()); + + log.info("Temporal filter is active: {}", isTemporalFilterActive); + log.info("UnifiedDeliveryDriver {} is filtered: {}", trackingCreationRequest.getUnifiedDeliveryDriver(), isUnifiedDeliveryDriverFilterActive); + + // Caso 2: entrambi i filtri sono configurati + if (isTemporalFilterConfigured && isUnifiedDeliveryDriverFilterConfigured) { + return (isTemporalFilterActive && isUnifiedDeliveryDriverFilterActive) ? OcrStatusEnum.RUN : OcrStatusEnum.DRY; + } + + // Caso 3: solo uno dei due filtri è configurato + return (isTemporalFilterActive || isUnifiedDeliveryDriverFilterActive) ? OcrStatusEnum.RUN : OcrStatusEnum.DRY; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/SendEventMapper.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/SendEventMapper.java new file mode 100644 index 000000000..0c6df62f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/mapper/SendEventMapper.java @@ -0,0 +1,153 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.AnalogAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +@Slf4j +public class SendEventMapper { + + /** + * Crea l'evento dalla classe PaperProgressStatusEvent e lo inserisce dentro SendEvent per l'invio a delivery-push. + * Se si tratta di un evento intermedio senza allegati ed è un final demat, non viene inviato a delivery-push. + * + * @param paperProgressStatusEvent evento intermedio ricevuto + * @return SendEvent contenente l'evento rimappato da inviare a delivery-push + */ + public static Flux createSendEventsFromPaperProgressStatusEvent(PaperProgressStatusEvent paperProgressStatusEvent) { + boolean isFinalDemat = TrackerUtility.checkIfIsFinalDemat(paperProgressStatusEvent.getStatusCode()); + return Mono.just(paperProgressStatusEvent) + .flatMapMany(progressEvent -> { + if (!CollectionUtils.isEmpty(progressEvent.getAttachments())) { + return Flux.fromIterable(progressEvent.getAttachments().stream() + .map(attachmentDetails -> buildSendEvent(progressEvent, attachmentDetails)) + .collect(Collectors.toList())); + } else if(!isFinalDemat) + return Flux.just(buildSendEvent(progressEvent, null)); + + log.info("Event with statusCode {} is a final demat without attachments, skipping sending to delivery-push", progressEvent.getStatusCode()); + return Flux.empty(); + } + ); + } + + public static SendEvent buildSendEvent(PaperProgressStatusEvent progressEvent, it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails attachmentDetails) { + SendEvent.SendEventBuilder builder = SendEvent.builder() + .requestId(progressEvent.getRequestId()) + .statusCode(StatusCodeEnum.valueOf(EventStatusCodeEnum.valueOf(progressEvent.getStatusCode()).getStatus().name())) + .statusDetail(progressEvent.getStatusCode()) + .statusDescription(progressEvent.getProductType() + " - " + progressEvent.getStatusCode() + " - " + progressEvent.getStatusDescription()) + .deliveryFailureCause(progressEvent.getDeliveryFailureCause()) + .registeredLetterCode(progressEvent.getRegisteredLetterCode()) + .statusDateTime(progressEvent.getStatusDateTime()) + .clientRequestTimeStamp(progressEvent.getClientRequestTimeStamp()); + + if(Objects.nonNull(progressEvent.getDiscoveredAddress())){ + builder.discoveredAddress(toAnalogAddress(progressEvent.getDiscoveredAddress())); + } + if(Objects.nonNull(attachmentDetails)){ + builder.attachments(buildPaperAttachmentDetailsFromExternalChannels(List.of(attachmentDetails))); + } + + return builder.build(); + } + + public static Flux createSendEventsFromEventEntity(String requestId, Event event, StatusCodeEnum statusCode, String statusDetail, OffsetDateTime statusDateTime) { + return Mono.just(event) + .flatMapMany(progressEvent -> { + if (!CollectionUtils.isEmpty(progressEvent.getAttachments())) { + return Flux.fromIterable(progressEvent.getAttachments().stream() + .map(attachmentDetails -> toSendEvent(requestId, event, statusCode, statusDetail, statusDateTime, attachmentDetails)) + .collect(Collectors.toList())); + } + return Flux.just(toSendEvent(requestId, event, statusCode, statusDetail, statusDateTime, null)); + } + ); + } + + public static SendEvent toSendEvent(String requestId, Event event, StatusCodeEnum statusCode, String statusDetail, OffsetDateTime statusDateTime, Attachment attachmentDetails) { + SendEvent.SendEventBuilder builder = SendEvent.builder() + .requestId(requestId) + .statusCode(statusCode) + .statusDetail(statusDetail) + .statusDescription(event.getProductType() + " - " + statusDetail + " - " + event.getStatusDescription()) + .deliveryFailureCause(event.getDeliveryFailureCause()) + .registeredLetterCode(event.getRegisteredLetterCode()) + .statusDateTime(statusDateTime) + .clientRequestTimeStamp(event.getRequestTimestamp().atOffset(ZoneOffset.UTC)); + + if(Objects.nonNull(attachmentDetails)){ + builder.attachments(buildAttachmentDetails(event.getAttachments())); + } + + return builder.build(); + } + + private static List buildAttachmentDetails(List attachments) { + return attachments.stream().map(attachment -> AttachmentDetails.builder() + .documentType(attachment.getDocumentType()) + .date(attachment.getDate().atOffset(ZoneOffset.UTC)) + .id(attachment.getId()) + .url(attachment.getUri()) + .build()).toList(); + } + + private static List buildPaperAttachmentDetailsFromExternalChannels(List attachments) { + return attachments.stream().map(attachment -> AttachmentDetails.builder() + .documentType(attachment.getDocumentType()) + .date(attachment.getDate()) + .id(attachment.getId()) + .url(attachment.getUri()) + .build()).toList(); + } + + public static AnalogAddress toAnalogAddress(DiscoveredAddress discoveredAddress) { + return AnalogAddress.builder() + .address(discoveredAddress.getAddress()) + .addressRow2(discoveredAddress.getAddressRow2()) + .cap(discoveredAddress.getCap()) + .pr(discoveredAddress.getPr()) + .city(discoveredAddress.getCity()) + .city2(discoveredAddress.getCity2()) + .country(discoveredAddress.getCountry()) + .fullname(discoveredAddress.getName()) + .nameRow2(discoveredAddress.getNameRow2()) + .build(); + } + + public static AnalogAddress toAnalogAddress(PaperAddress paperAddress) { + return AnalogAddress.builder() + .address(paperAddress.getAddress()) + .addressRow2(paperAddress.getAddressRow2()) + .cap(paperAddress.getCap()) + .pr(paperAddress.getPr()) + .city(paperAddress.getCity()) + .city2(paperAddress.getCity2()) + .country(paperAddress.getCountry()) + .fullname(paperAddress.getName()) + .nameRow2(paperAddress.getNameRow2()) + .build(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackerDryRunOutputsDAO.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackerDryRunOutputsDAO.java new file mode 100644 index 000000000..4b91c4e08 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackerDryRunOutputsDAO.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.middleware.dao; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public interface PaperTrackerDryRunOutputsDAO { + + Flux retrieveOutputEvents(String requestId); + + Mono insertOutputEvent(PaperTrackerDryRunOutputs paperTrackerDryRunOutputs); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsDAO.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsDAO.java new file mode 100644 index 000000000..7b1fe580f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsDAO.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.middleware.dao; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +public interface PaperTrackingsDAO { + + Mono putIfAbsent(PaperTrackings entity); + + Mono retrieveEntityByTrackingId(String trackingId); + + Flux retrieveEntityByAttemptId(String attemptId, String pcRetry); + + Mono updateItem(String requestId, PaperTrackings paperTrackings); + + Mono updateItemForRework(String trackingId, PaperTrackings paperTrackings); + + Mono updateOcrRequests(Integer ocrRequestIndex, String trackingId, Data.ValidationStatus validationStatus); + + Flux retrieveAllByTrackingIds(List trackingIds); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsErrorsDAO.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsErrorsDAO.java new file mode 100644 index 000000000..cf5bd2b19 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/PaperTrackingsErrorsDAO.java @@ -0,0 +1,13 @@ +package it.pagopa.pn.papertracker.middleware.dao; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public interface PaperTrackingsErrorsDAO { + + Mono insertError(PaperTrackingsErrors entity); + + Flux retrieveErrors(String requestId); + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/AdditionalDetailsConverter.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/AdditionalDetailsConverter.java new file mode 100644 index 000000000..ca73d2b7a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/AdditionalDetailsConverter.java @@ -0,0 +1,95 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import software.amazon.awssdk.enhanced.dynamodb.AttributeConverter; +import software.amazon.awssdk.enhanced.dynamodb.AttributeValueType; +import software.amazon.awssdk.enhanced.dynamodb.EnhancedType; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; + +public class AdditionalDetailsConverter implements AttributeConverter> { + + @Override + public AttributeValue transformFrom(Map value) { + if (Objects.isNull(value)) { + return AttributeValue.builder().nul(true).build(); + } + return AttributeValue.builder().m(value.entrySet().stream() + .collect(java.util.stream.Collectors.toMap( + Map.Entry::getKey, + e -> toAttr(e.getValue()) + ))).build(); + } + + @Override + public Map transformTo(AttributeValue attributeValue) { + if (Boolean.TRUE.equals(attributeValue.nul())) { + return null; + } + if (Objects.isNull(attributeValue.m())) { + return Map.of(); + } + return attributeValue.m().entrySet().stream().collect(java.util.stream.Collectors.toMap( + Map.Entry::getKey, + e -> Optional.ofNullable(fromAttr(e.getValue())).orElse("") + )); + } + + @Override + public AttributeValueType attributeValueType() { + return AttributeValueType.M; + } + + @Override + public EnhancedType> type() { + return EnhancedType.mapOf(EnhancedType.of(String.class), EnhancedType.of(Object.class)); + } + + /* -------- conversioni -------- */ + + private AttributeValue toAttr(Object v) { + return switch (v) { + case String s -> AttributeValue.builder().s(s).build(); + case Number n -> AttributeValue.builder().n(n.toString()).build(); + case Boolean b -> AttributeValue.builder().bool(b).build(); + case Map m -> AttributeValue.builder().m(m.entrySet().stream() + .collect(Collectors.toMap(e -> e.getKey().toString(), e -> toAttr(e.getValue())))) + .build(); + case List l -> AttributeValue.builder().l(l.stream().map(this::toAttr).toList()).build(); + case null -> AttributeValue.builder().nul(true).build(); + default -> throw new IllegalArgumentException("Unsupported type in additionalDetails: " + v.getClass()); + }; + } + + private Object fromAttr(AttributeValue attributeValue) { + switch (attributeValue.type()) { + case S -> { + if (Objects.nonNull(attributeValue.s())) return attributeValue.s(); + } + case N -> { + if (Objects.nonNull(attributeValue.n())) return attributeValue.n(); + } + case BOOL -> { + if (Objects.nonNull(attributeValue.bool())) return attributeValue.bool(); + } + case M -> { + if (Objects.nonNull(attributeValue.m())) { + return attributeValue.m().entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> Optional.ofNullable(fromAttr(e.getValue())).orElse(""))); + } + } + case L -> { + if (Objects.nonNull(attributeValue.l())) { + return attributeValue.l().stream() + .map(this::fromAttr) + .toList(); + } + } + } + return null; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/BaseDao.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/BaseDao.java new file mode 100644 index 000000000..e9da3a8f6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/BaseDao.java @@ -0,0 +1,184 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import lombok.extern.slf4j.Slf4j; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.enhanced.dynamodb.*; +import software.amazon.awssdk.enhanced.dynamodb.model.*; +import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; +import software.amazon.awssdk.services.dynamodb.model.UpdateItemRequest; +import software.amazon.awssdk.services.dynamodb.model.UpdateItemResponse; + +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; + +@Slf4j +public class BaseDao { + private final DynamoDbAsyncTable tableAsync; + private final Class tClass; + private final DynamoDbAsyncClient dynamoDbAsyncClient; + private final DynamoDbEnhancedAsyncClient dynamoDbEnhancedAsyncClient; + + protected BaseDao( + DynamoDbEnhancedAsyncClient dynamoDbEnhancedAsyncClient, + DynamoDbAsyncClient dynamoDbAsyncClient, + String tableName, + Class tClass + ) { + this.tableAsync = dynamoDbEnhancedAsyncClient.table(tableName, TableSchema.fromBean(tClass)); + this.tClass = tClass; + this.dynamoDbAsyncClient = dynamoDbAsyncClient; + this.dynamoDbEnhancedAsyncClient = dynamoDbEnhancedAsyncClient; + } + + protected Mono putItem(T entity) { + return Mono.fromFuture(this.tableAsync.putItem(entity)) + .thenReturn(entity); + } + + public Flux retrieveByRequestId(String pk) { + log.info("retrieve Items from [{}] table, for requestId={}", tableAsync.tableName(), pk); + return Flux.from(tableAsync.query(r -> r.queryConditional( + QueryConditional.keyEqualTo(Key.builder().partitionValue(pk).build())))) + .flatMap(page -> Flux.fromIterable(page.items())) + .doOnError(e -> log.error("Error retrieving items for requestId {}: {}", pk, e.getMessage())); + } + + public Mono getByKey(Key key) { + return Mono.fromFuture(tableAsync.getItem(key)); + } + + public Flux queryByIndex(Key build, String indexName) { + QueryEnhancedRequest request = QueryEnhancedRequest.builder() + .queryConditional(QueryConditional.keyEqualTo(build)) + .build(); + + return Mono.from(tableAsync.index(indexName).query(request)) + .map(Page::items) + .flatMapMany(Flux::fromIterable) + .doOnError(e -> log.error("Error querying index {}: {}", indexName, e.getMessage())); + } + + public Flux retrieveFromIndex(String indexName, QueryConditional queryConditional) { + return Mono.from(tableAsync.index(indexName) + .query(QueryEnhancedRequest.builder().queryConditional(queryConditional).build())) + .map(Page::items) + .flatMapMany(Flux::fromIterable); + } + + public Mono putIfAbsent(String expression, T entity) { + + Expression conditionExpressionPut = Expression.builder() + .expression(expression) + .build(); + + PutItemEnhancedRequest request = PutItemEnhancedRequest.builder(tClass) + .item(entity) + .conditionExpression(conditionExpressionPut) + .build(); + + return Mono.fromFuture(tableAsync.putItem(request)) + .thenReturn(entity); + } + + public Mono updateIfExists(Map key, String updateExpression, Map expressionValues, Map expressionNames, String conditionExpression) { + UpdateItemRequest updateItemRequest = UpdateItemRequest.builder() + .tableName(tableAsync.tableName()) + .key(key) + .updateExpression(updateExpression) + .expressionAttributeValues(expressionValues) + .expressionAttributeNames(expressionNames) + .conditionExpression(conditionExpression) + .returnValues("ALL_NEW") + .build(); + + return Mono.fromFuture(dynamoDbAsyncClient.updateItem(updateItemRequest)); + } + + protected Flux findAllByKeys(List partitionKeys) { + ReadBatch.Builder builder = ReadBatch.builder(tClass) + .mappedTableResource(this.tableAsync); + + partitionKeys.forEach(partitionKey -> + builder.addGetItem(Key.builder().partitionValue(partitionKey).build()) + ); + + BatchGetItemEnhancedRequest request = BatchGetItemEnhancedRequest.builder() + .readBatches(builder.build()) + .build(); + + return Flux.from(dynamoDbEnhancedAsyncClient.batchGetItem(request) + .map(result -> result.resultsForTable(tableAsync))) + .flatMap(Flux::fromIterable); + } + + /** + * Costruisce updateExpression per DynamoDB in base al tipo di attributo fornito. + * Per gli attributi di tipo lista, genera un'espressione per aggiungere alla lista utilizzando {@code list_append} e {@code if_not_exists}. + * Per gli attributi di tipo mappa (oggetto annidato), genera espressioni per aggiornare ciascuna coppia chiave-valore interna. + * Per altri tipi di attributo, genera una semplice espressione di assegnazione. + * + * @param key La chiave dell'attributo da aggiornare + * @param value Il valore dell'attributo da aggiornare + * @param counter Un contatore atomico utilizzato per generare indici univoci per i parametri + * @param names Mappa dei nomi degli attributi per l'espressione DynamoDB + * @param values Mappa dei valori degli attributi per l'espressione DynamoDB + * @return Una lista di espressioni di aggiornamento da utilizzare in una richiesta di update su DynamoDB + */ + protected List buildUpdateExpressions(String key, AttributeValue value, AtomicInteger counter, Map names, Map values) { + List expressions = new ArrayList<>(); + + if(key.equalsIgnoreCase("validationConfig")){ + return expressions; + } + + if (isListAttributeType(value)) { + int idx = counter.getAndIncrement(); + names.put("#k" + idx, key); + values.put(":v" + idx, AttributeValue.builder().l(value.l()).build()); + values.put(":empty" + idx, AttributeValue.builder().l(Collections.emptyList()).build()); + expressions.add("#k" + idx + " = list_append(if_not_exists(" + "#k" + idx + ", " + ":empty" + idx + "), " + ":v" + idx + ")"); + + } else if (isInnerObjectAttributeType(value)) { + value.m().forEach((innerKey, innerVal) -> { + int idx = counter.getAndIncrement(); + if(key.equalsIgnoreCase("paperStatus")){ + names.put("#paperStatus", key); + names.put("#paperStatus_" + idx + "_inner", innerKey); + values.put(":v" + idx, innerVal); + expressions.add("#paperStatus.#paperStatus_" + idx + "_inner" + " = " + ":v" + idx); + } + else if(key.equalsIgnoreCase("validationFlow")){ + names.put("#validationFlow" , key); + names.put("#validationFlow_" + idx + "_inner", innerKey); + values.put(":v" + idx, innerVal); + expressions.add("#validationFlow.#validationFlow_" + idx + "_inner" + " = " + ":v" + idx); + } + else { + names.put("#k" + idx, key); + names.put("#k" + idx + "_inner", innerKey); + values.put(":v" + idx, innerVal); + expressions.add("#k" + idx + "." + "#k" + idx + "_inner" + " = " + ":v" + idx); + } + }); + } else { + if(!key.equalsIgnoreCase("paperStatus") && !key.equalsIgnoreCase("validationFlow")){ + int idx = counter.getAndIncrement(); + names.put("#k" + idx, key); + values.put(":v" + idx, value); + expressions.add("#k" + idx + " = " + ":v" + idx); + } + } + return expressions; + } + + private static boolean isInnerObjectAttributeType(AttributeValue value) { + return value.m() != null && !value.m().isEmpty(); + } + + private boolean isListAttributeType(AttributeValue value) { + return value.l() != null && !value.l().isEmpty(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDAOImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDAOImpl.java new file mode 100644 index 000000000..d4544c929 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDAOImpl.java @@ -0,0 +1,35 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient; +import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; + +@Slf4j +@Component +public class PaperTrackerDryRunOutputsDAOImpl extends BaseDao implements PaperTrackerDryRunOutputsDAO { + + public PaperTrackerDryRunOutputsDAOImpl(DynamoDbEnhancedAsyncClient dynamoDbEnhancedClient, PnPaperTrackerConfigs cfg, DynamoDbAsyncClient dynamoDbAsyncClient) { + super(dynamoDbEnhancedClient, + dynamoDbAsyncClient, + cfg.getDao().getPaperTrackerDryRunOutputsTable(), + PaperTrackerDryRunOutputs.class + ); + } + + @Override + public Flux retrieveOutputEvents(String requestId) { + log.info("retrieving output events for requestId={}", requestId); + return retrieveByRequestId(requestId); + } + + @Override + public Mono insertOutputEvent(PaperTrackerDryRunOutputs paperTrackerDryRunOutputs) { + return putItem(paperTrackerDryRunOutputs); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDAOImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDAOImpl.java new file mode 100644 index 000000000..41bf94309 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDAOImpl.java @@ -0,0 +1,206 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerConflictException; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient; +import software.amazon.awssdk.enhanced.dynamodb.Key; +import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; +import software.amazon.awssdk.services.dynamodb.model.ConditionalCheckFailedException; + +import java.time.Instant; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; + +import static it.pagopa.pn.commons.abstractions.impl.AbstractDynamoKeyValueStore.ATTRIBUTE_NOT_EXISTS; +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings.ATTEMPT_ID_PCRETRY_INDEX; + +@Component +@Slf4j +public class PaperTrackingsDAOImpl extends BaseDao implements PaperTrackingsDAO { + + private final String ERROR_CODE_PAPER_TRACKER_DUPLICATED_ITEM = "PN_PAPER_TRACKER_DUPLICATED_ITEM"; + private final String ERROR_CODE_PAPER_TRACKER_NOT_FOUND = "PN_PAPER_TRACKER_NOT_FOUND"; + + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + + public PaperTrackingsDAOImpl(DynamoDbEnhancedAsyncClient dynamoDbEnhancedClient, PnPaperTrackerConfigs cfg, DynamoDbAsyncClient dynamoDbAsyncClient) { + super(dynamoDbEnhancedClient, + dynamoDbAsyncClient, + cfg.getDao().getPaperTrackingsTable(), + PaperTrackings.class + ); + this.pnPaperTrackerConfigs = cfg; + } + + @Override + public Mono retrieveEntityByTrackingId(String trackingId) { + return getByKey(Key.builder().partitionValue(trackingId).build()); + } + + @Override + public Flux retrieveEntityByAttemptId(String attemptId, String pcRetry) { + Key.Builder key = Key.builder().partitionValue(attemptId); + + if(StringUtils.hasText(pcRetry)){ + key.sortValue(pcRetry); + } + + return queryByIndex(key.build(), ATTEMPT_ID_PCRETRY_INDEX); + } + + @Override + public Mono putIfAbsent(PaperTrackings entity) { + String expression = String.format("%s(%s)", ATTRIBUTE_NOT_EXISTS, PaperTrackings.COL_TRACKING_ID); + entity.setTtl(Instant.now().plus(pnPaperTrackerConfigs.getPaperTrackingsTtlDuration()).getEpochSecond()); + + return putIfAbsent(expression, entity) + .onErrorMap(ConditionalCheckFailedException.class, ex -> { + log.error("Conditional check exception on PaperTrackingsDAOImpl putTrackings trackingId={} exmessage={}", entity.getTrackingId(), ex.getMessage()); + log.warn("Duplicate trackingId detected in putIfAbsent: {}", entity.getTrackingId()); + return new PnPaperTrackerConflictException(ERROR_CODE_PAPER_TRACKER_DUPLICATED_ITEM, String.format("RequestId %s already exists", entity.getTrackingId())); + }); + } + + public Mono updateOcrRequests(Integer ocrRequestIndex, String trackingId, Data.ValidationStatus validationStatus) { + log.debug("updateOcrRequests for item with trackingId: {}", trackingId); + Instant now = Instant.now(); + Map expressionAttributeNames = new HashMap<>(); + Map expressionAttributeValues = new HashMap<>(); + + String updateExpr = "SET #updatedAt = :updatedAt"; + + expressionAttributeNames.put("#updatedAt", PaperTrackings.COL_UPDATED_AT); + expressionAttributeNames.put("#validationFlow", PaperTrackings.COL_VALIDATION_FLOW); + expressionAttributeNames.put("#ocr", ValidationFlow.COL_OCR_REQUESTS); + + expressionAttributeValues.put(":updatedAt", AttributeValue.builder().s(now.toString()).build()); + + if (Objects.nonNull(ocrRequestIndex) && ocrRequestIndex >= 0) { + expressionAttributeNames.put("#responseTimestamp", OcrRequest.COL_RESPONSE_TIMESTAMP); + expressionAttributeValues.put(":responseTimestamp", AttributeValue.builder().s(now.toString()).build()); + expressionAttributeNames.put("#responseStatus", OcrRequest.COL_RESPONSE_STATUS); + expressionAttributeValues.put(":responseStatus", AttributeValue.builder().s(validationStatus.getValue()).build()); + updateExpr += ", #validationFlow.#ocr[" + ocrRequestIndex + "].#responseStatus = :responseStatus, " + + "#validationFlow.#ocr[" + ocrRequestIndex + "].#responseTimestamp = :responseTimestamp"; + } + + String conditionExpression = String.format("%s(%s)", "attribute_exists", PaperTrackings.COL_TRACKING_ID); + return updateIfExists(trackingId, updateExpr, expressionAttributeValues, expressionAttributeNames, conditionExpression); + + } + + @Override + public Mono updateItem(String trackingId, PaperTrackings paperTrackings) { + return updateItem(trackingId, paperTrackings, false); + } + + @Override + public Mono updateItemForRework(String trackingId, PaperTrackings paperTrackings) { + return updateItem(trackingId, paperTrackings, true); + } + + /** + * Aggiorna un elemento PaperTrackings nel database DynamoDB, identificato dal trackingId. + * L'aggiornamento viene eseguito solo se l'elemento esiste (condizione attribute_exists). + * Viene aggiornato anche il campo "updatedAt" con il timestamp corrente. + * + * @param trackingId pk dell'oggetto PaperTrackings da aggiornare + * @param paperTrackings l'oggetto PaperTrackings con i nuovi valori da aggiornare + * @return un Mono contenente l'oggetto PaperTrackings aggiornato + * @throws PnPaperTrackerNotFoundException se l'elemento con il trackingId specificato non esiste + */ + public Mono updateItem(String trackingId, PaperTrackings paperTrackings, boolean resetPaperStatus) { + log.debug("Updating item with trackingId: {}", trackingId); + + Map expressionAttributeNames = new HashMap<>(); + Map expressionAttributeValues = new HashMap<>(); + List updateExpressions = new ArrayList<>(); + + expressionAttributeNames.put("#updatedAt", PaperTrackings.COL_UPDATED_AT); + expressionAttributeValues.put(":updatedAt", AttributeValue.builder().s(Instant.now().toString()).build()); + updateExpressions.add("#updatedAt = :updatedAt"); + + String updateExpr = "SET "; + + Optional.ofNullable(paperTrackings.getValidationFlow()) + .ifPresent(flow -> { + List requests = flow.getOcrRequests(); + if (!CollectionUtils.isEmpty(requests)) { + expressionAttributeNames.put("#validationFlow", PaperTrackings.COL_VALIDATION_FLOW); + expressionAttributeNames.put("#ocr", ValidationFlow.COL_OCR_REQUESTS); + expressionAttributeValues.put(":requests", AttributeValue.builder() + .l(PaperTrackings.paperTrackingsToAttributeValueMap(paperTrackings).get("validationFlow").m().get("ocrRequests").l()).build()); + updateExpressions.add("#validationFlow.#ocr = list_append(#validationFlow.#ocr, :requests) "); + } + + flow.setOcrRequests(null); + }); + + + Map attributeValueMap = new HashMap<>(PaperTrackings.paperTrackingsToAttributeValueMap(paperTrackings)); + + /* + * Reset completo di paperStatus. + * In questo modo DynamoDB sovrascrive l'intero attributo paperStatus + * con una mappa vuota, eliminando tutti i campi precedenti. + */ + if (resetPaperStatus) { + expressionAttributeNames.put("#paperStatus", PaperTrackings.COL_PAPER_STATUS); + expressionAttributeValues.put(":emptyPaperStatus", AttributeValue.builder() + .m(Collections.emptyMap()) + .build()); + + updateExpressions.add("#paperStatus = :emptyPaperStatus"); + attributeValueMap.remove(PaperTrackings.COL_PAPER_STATUS); + } + + AtomicInteger counter = new AtomicInteger(0); + + attributeValueMap.forEach((key, value) -> { + List expressions = buildUpdateExpressions( + key, value, counter, expressionAttributeNames, expressionAttributeValues + ); + updateExpressions.addAll(expressions); + }); + + updateExpr += String.join(", ", updateExpressions); + + String conditionExpression = String.format("%s(%s)", "attribute_exists", PaperTrackings.COL_TRACKING_ID); + + log.debug("updateExpr {}", updateExpr); + log.debug("expressionAttributeValues {}", expressionAttributeValues); + log.debug("expressionAttributeNames {}", expressionAttributeNames); + + return updateIfExists(trackingId, updateExpr, expressionAttributeValues, expressionAttributeNames, conditionExpression); + } + + private Mono updateIfExists(String trackingId, String updateExpr, Map expressionAttributeValues, Map expressionAttributeNames, String conditionExpression) { + return updateIfExists(Map.of(PaperTrackings.COL_TRACKING_ID, AttributeValue.builder().s(trackingId).build()), updateExpr, expressionAttributeValues, expressionAttributeNames, conditionExpression) + .map(updateItemResponse -> PaperTrackings.attributeValueMapToPaperTrackings(updateItemResponse.attributes())) + .doOnError(e -> log.error("Error updating item with trackingId {}: {}", trackingId, e.getMessage())) + .onErrorMap(ConditionalCheckFailedException.class, e -> { + log.info("Item with trackingId {} not found — cannot update", trackingId); + return new PnPaperTrackerNotFoundException( + ERROR_CODE_PAPER_TRACKER_NOT_FOUND, + String.format("PaperTracking with trackingId %s not found", trackingId) + ); + }); + } + + @Override + public Flux retrieveAllByTrackingIds(List trackingIds) { + return findAllByKeys(trackingIds); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDAOImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDAOImpl.java new file mode 100644 index 000000000..8615538eb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDAOImpl.java @@ -0,0 +1,53 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import it.pagopa.pn.commons.log.dto.metrics.GeneralMetric; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import it.pagopa.pn.papertracker.utils.MetricUtils; +import lombok.CustomLog; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedAsyncClient; +import software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient; + +import java.time.Instant; +import java.util.List; + +@Component +@CustomLog +public class PaperTrackingsErrorsDAOImpl extends BaseDao implements PaperTrackingsErrorsDAO { + + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + + public PaperTrackingsErrorsDAOImpl(DynamoDbEnhancedAsyncClient dynamoDbEnhancedClient, PnPaperTrackerConfigs cfg, DynamoDbAsyncClient dynamoDbAsyncClient) { + super(dynamoDbEnhancedClient, + dynamoDbAsyncClient, + cfg.getDao().getPaperTrackingsErrorsTable(), + PaperTrackingsErrors.class + ); + this.pnPaperTrackerConfigs = cfg; + } + + public Mono insertError(PaperTrackingsErrors paperTrackingsErrors) { + String logMessage = "Logging metrics: " + MetricUtils.MetricName.ERROR_COUNT +"; Dimensions: " + MetricUtils.DimensionName.ERROR_CATEGORY.getValue() + ", " + MetricUtils.DimensionName.PRODUCT_TYPE.getValue(); + GeneralMetric errorCountMetric = MetricUtils.generateGeneralMetric( + MetricUtils.MetricName.ERROR_COUNT, + 1, + List.of( + MetricUtils.generateDimension(MetricUtils.DimensionName.ERROR_CATEGORY, paperTrackingsErrors.getErrorCategory().name()), + MetricUtils.generateDimension(MetricUtils.DimensionName.PRODUCT_TYPE, paperTrackingsErrors.getProductType()) + ) + ); + + log.logMetric(List.of(errorCountMetric), logMessage); + + paperTrackingsErrors.setTtl(Instant.now().plus(pnPaperTrackerConfigs.getPaperTrackingsErrorsTtlDuration()).getEpochSecond()); + return putItem(paperTrackingsErrors); + } + + public Flux retrieveErrors(String requestId) { + return retrieveByRequestId(requestId); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Attachment.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Attachment.java new file mode 100644 index 000000000..82bc5b32e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Attachment.java @@ -0,0 +1,43 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; + +import java.time.Instant; + +@DynamoDbBean +@Data +public class Attachment { + + public static final String COL_ID = "id"; + public static final String COL_DOCUMENT_TYPE = "documentType"; + public static final String COL_URI = "uri"; + public static final String COL_DATE = "date"; + public static final String COL_SHA256 = "sha256"; + public static final String COL_SOURCE_TYPE = "sourceType"; + public static final String COL_ORIGIN_TYPE = "originType"; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ID)})) + private String id; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DOCUMENT_TYPE)})) + private String documentType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_URI)})) + private String uri; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DATE)})) + private Instant date; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SHA256)})) + private String sha256; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SOURCE_TYPE)})) + private String sourceType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ORIGIN_TYPE)})) + private String originType; + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/BusinessState.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/BusinessState.java new file mode 100644 index 000000000..69258ae87 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/BusinessState.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +public enum BusinessState { + AWAITING_FINAL_STATUS_CODE, + AWAITING_REFINEMENT_OCR, + AWAITING_REWORK_EVENTS, + AWAITING_OCR, + DONE, + KO + +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCategory.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCategory.java new file mode 100644 index 000000000..6a3b13fd4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCategory.java @@ -0,0 +1,36 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Getter; + +@Getter +public enum ErrorCategory { + + TRACKING_ID_NOT_FOUND("TrackingId non trovato"), + NOT_RETRYABLE_EVENT_ERROR("Evento not retryable ricevuto"), + RENDICONTAZIONE_SCARTATA("Rendicontazione scartata"), + DATE_ERROR("Errore nella validazione delle date della sequenza."), + LAST_EVENT_EXTRACTION_ERROR("Errore nell'estrazione della sequenza dall'ultimo evento."), + REGISTERED_LETTER_CODE_ERROR("Errore nella validazione del registered letter code"), + DELIVERY_FAILURE_CAUSE_ERROR("Errore nella validazione del delivery Failure Cause"), + ATTACHMENTS_ERROR("Errore nella validazione degli allegati della sequenza"), + MAX_RETRY_REACHED_ERROR("Numero massimo di retry raggiunto"), + OCR_VALIDATION("Errore nella validazione OCR"), + DEMAT_EMPTY_EVENT("Errore evento per demat non trovato"), + DEMAT_ATTACHMENT_NUMBER_ERROR("Errore nel numero di attachment trovati per demat"), + DUPLICATED_EVENT("Errore nella validazione della presenza di eventi duplicati"), + INVALID_STATE_FOR_STOCK_890("Stato non valido per giacenza 890"), + INCONSISTENT_STATE("Tracking completato o in attesa validazione OCR"), + /** + * @deprecated Non utilizzare. Campo mantenuto solo per retrocompatibilità. + */ + @Deprecated + STATUS_CODE_ERROR("Errore nella validazione della presenza degli elementi della sequenza."), + REGISTERED_LETTER_CODE_NOT_FOUND("Registered letter code non trovato"); + + private final String value; + + ErrorCategory(String value) { + this.value = value; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCause.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCause.java new file mode 100644 index 000000000..41cdd0c22 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorCause.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum ErrorCause { + + GIACENZA_DATE_ERROR("Date di inizio e fine giacenza non coerenti"), + OCR_DUPLICATED_EVENT("Evento di risposta duplicato"), + OCR_DRY_RUN_MODE("Evento di risposta ignorato in quanto attiva la modalità dry-run per l'OCR"), + OCR_KO( "Errore nella validazione dell'OCR"), + OCR_UNSUPPORTED_PRODUCT("Prodotto non supportato per la validazione OCR"), + STOCK_890_REFINEMENT_MISSING("Spedizione 890 non perfezionata"), + STOCK_890_REFINEMENT_ERROR("Errore nel perfezionamento della spedizione 890"), + VALUE_AFTER_REFINEMENT("Evento arrivato dopo la conclusione della spedizione o mentre si stava aspettando l’OCR (DONE o AWAITING_OCR)"), + VALUES_NOT_MATCHING("Errore nella validazione degli allegati della sequenza: mancano degli allegati"), + INVALID_VALUES("Errore nella validazione"), + VALUES_NOT_FOUND("Errore nella validazione dei statusCode della sequenza: non sono presenti tutti gli statusCode previsti dalla macchina a stati"), + SOURCETYPE_FILETYPE_INCOHERENT("Il sourceType e il fileType dell'allegato non sono coerenti"); + + private final String description; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorDetails.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorDetails.java new file mode 100644 index 000000000..88936d373 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorDetails.java @@ -0,0 +1,26 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.AdditionalDetailsConverter; +import lombok.*; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbConvertedBy; + +import java.util.Map; + +@Setter +@Getter +@DynamoDbBean +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class ErrorDetails { + + public static final String COL_CAUSE = "cause"; + public static final String COL_MESSAGE = "message"; + public static final String COL_ADDITIONAL_DETAILS = "additionalDetails"; + + private ErrorCause cause; + private String message; + @Getter(onMethod = @__({ @DynamoDbConvertedBy(AdditionalDetailsConverter.class) })) + private Map additionalDetails; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorType.java new file mode 100644 index 000000000..375287ecc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ErrorType.java @@ -0,0 +1,9 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +public enum ErrorType { + + ERROR, + INFO, + WARNING + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Event.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Event.java new file mode 100644 index 000000000..fa1eecbc2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/Event.java @@ -0,0 +1,83 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbIgnoreNulls; + +import java.time.Instant; +import java.util.List; + +@DynamoDbBean +@Data +public class Event { + + public static final String COL_REQUEST_TIMESTAMP = "requestTimestamp"; + public static final String COL_STATUS_CODE = "statusCode"; + public static final String COL_STATUS_DESCRIPTION = "statusDescription"; + public static final String COL_STATUS_TIMESTAMP = "statusTimestamp"; + public static final String COL_PRODUCT_TYPE = "productType"; + public static final String COL_DELIVERY_FAILURE_CAUSE = "deliveryFailureCause"; + public static final String COL_DISCOVERED_ADDRESS = "discoveredAddress"; + public static final String COL_ANONYMIZED_DISCOVERED_ADDRESS_ID = "anonymizedDiscoveredAddressId"; + public static final String COL_ATTACHMENTS = "attachments"; + public static final String COL_REGISTERED_LETTER_CODE = "registeredLetterCode"; + public static final String COL_ID = "id"; + public static final String COL_DRY_RUN = "dryRun"; + public static final String COL_IUN = "iun"; + public static final String COL_CREATED_AT = "createdAt"; + public static final String COL_REWORK_ID = "reworkId"; + public static final String COL_PRINTER = "printer"; + public static final String COL_DU = "du"; + + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ID)})) + private String id; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_IUN)})) + private String iun; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REQUEST_TIMESTAMP)})) + private Instant requestTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_CODE)})) + private String statusCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_DESCRIPTION)})) + private String statusDescription; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_TIMESTAMP)})) + private Instant statusTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PRODUCT_TYPE)})) + private String productType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DELIVERY_FAILURE_CAUSE)})) + private String deliveryFailureCause; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ANONYMIZED_DISCOVERED_ADDRESS_ID)})) + private String anonymizedDiscoveredAddressId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ATTACHMENTS), @DynamoDbIgnoreNulls})) + private List attachments; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REGISTERED_LETTER_CODE)})) + private String registeredLetterCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DRY_RUN)})) + private Boolean dryRun; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_CREATED_AT)})) + private Instant createdAt; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REWORK_ID)})) + private String notificationReworkId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PRINTER)})) + private String printer; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DU)})) + private String du; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/FlowThrow.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/FlowThrow.java new file mode 100644 index 000000000..8f7e3590f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/FlowThrow.java @@ -0,0 +1,15 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +public enum FlowThrow { + + INIT_TRACKING, + NOT_RETRYABLE_EVENT_HANDLER, + DUPLICATED_EVENT_VALIDATION, + CHECK_TRACKING_PRODUCT, + SEQUENCE_VALIDATION, + DEMAT_VALIDATION, + FINAL_EVENT_BUILDING, + CHECK_TRACKING_STATE, + RETRY_PHASE; + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/OcrRequest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/OcrRequest.java new file mode 100644 index 000000000..0bf976c34 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/OcrRequest.java @@ -0,0 +1,42 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; + +import java.time.Instant; + +@DynamoDbBean +@Data +public class OcrRequest { + + public static final String COL_REQUEST_TIMESTAMP = "requestTimestamp"; + public static final String COL_RESPONSE_TIMESTAMP = "responseTimestamp"; + public static final String COL_DOCUMENT_TYPE = "documentType"; + public static final String COL_FINAL_EVENT_ID = "finalEventId"; + public static final String COL_ATTACHMENT_EVENT_ID = "attachmentEventId"; + public static final String COL_URI = "uri"; + public static final String COL_RESPONSE_STATUS = "responseStatus"; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DOCUMENT_TYPE)})) + private String documentType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FINAL_EVENT_ID)})) + private String finalEventId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ATTACHMENT_EVENT_ID)})) + private String attachmentEventId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_RESPONSE_TIMESTAMP)})) + private Instant responseTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REQUEST_TIMESTAMP)})) + private Instant requestTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_URI)})) + private String uri; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_RESPONSE_STATUS)})) + private String responseStatus; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperStatus.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperStatus.java new file mode 100644 index 000000000..8b40f09fc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperStatus.java @@ -0,0 +1,53 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbIgnoreNulls; + +import java.time.Instant; +import java.util.List; + +@DynamoDbBean +@Data +public class PaperStatus { + + public static final String COL_REGISTERED_LETTER_CODE = "registeredLetterCode"; + public static final String COL_DELIVERY_FAILURE_CAUSE = "deliveryFailureCause"; + public static final String COL_ANONYMIZED_DISCOVERED_ADDRESS = "anonymizedDiscoveredAddress"; + public static final String COL_FINAL_STATUS_CODE = "finalStatusCode"; + public static final String COL_VALIDATED_SEQUENCE_TIMESTAMP = "validatedSequenceTimestamp"; + public static final String COL_VALIDATED_EVENTS = "validatedEvents"; + public static final String COL_FINAL_DEMAT_FOUND = "finalDematFound"; + public static final String COL_PAPER_DELIVERY_TIMESTAMP = "paperDeliveryTimestamp"; + public static final String COL_PREDICTED_REFINEMENT_TYPE = "predictedRefinementType"; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REGISTERED_LETTER_CODE)})) + private String registeredLetterCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DELIVERY_FAILURE_CAUSE)})) + private String deliveryFailureCause; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ANONYMIZED_DISCOVERED_ADDRESS)})) + private String anonymizedDiscoveredAddress; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FINAL_STATUS_CODE)})) + private String finalStatusCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_VALIDATED_SEQUENCE_TIMESTAMP)})) + private Instant validatedSequenceTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_VALIDATED_EVENTS), @DynamoDbIgnoreNulls})) + private List validatedEvents; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FINAL_DEMAT_FOUND)})) + private Boolean finalDematFound; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PAPER_DELIVERY_TIMESTAMP)})) + private Instant paperDeliveryTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PREDICTED_REFINEMENT_TYPE)})) + private String predictedRefinementType; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackerDryRunOutputs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackerDryRunOutputs.java new file mode 100644 index 000000000..2a0df0c62 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackerDryRunOutputs.java @@ -0,0 +1,61 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSortKey; + +import java.time.Instant; +import java.util.List; + +@DynamoDbBean +@Data +public class PaperTrackerDryRunOutputs { + public static final String COL_TRACKING_ID = "trackingId"; + public static final String COL_CREATED = "created"; + public static final String COL_REGISTERED_LETTER_CODE = "registeredLetterCode"; + public static final String COL_STATUS_CODE = "statusCode"; + public static final String COL_STATUS_DETAIL = "statusDetail"; + public static final String COL_STATUS_DESCRIPTION = "statusDescription"; + public static final String COL_STATUS_DATE_TIME = "statusDateTime"; + public static final String COL_DELIVERY_FAILURE_CAUSE = "deliveryFailureCause"; + public static final String COL_ATTACHMENTS = "attachments"; + public static final String COL_DISCOVERED_ADDRESS = "discoveredAddress"; + public static final String COL_CLIENT_REQUEST_TIMESTAMP = "clientRequestTimestamp"; + + @Getter(onMethod = @__({@DynamoDbPartitionKey, @DynamoDbAttribute(COL_TRACKING_ID)})) + private String trackingId; + + @Getter(onMethod = @__({@DynamoDbSortKey, @DynamoDbAttribute(COL_CREATED)})) + private Instant created; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REGISTERED_LETTER_CODE)})) + private String registeredLetterCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_CODE)})) + private String statusCode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_DETAIL)})) + private String statusDetail; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_DESCRIPTION)})) + private String statusDescription; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATUS_DATE_TIME)})) + private String statusDateTime; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DELIVERY_FAILURE_CAUSE)})) + private String deliveryFailureCause; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ATTACHMENTS)})) + private List attachments; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DISCOVERED_ADDRESS)})) + private String anonymizedDiscoveredAddressId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_CLIENT_REQUEST_TIMESTAMP)})) + private String clientRequestTimestamp; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackings.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackings.java new file mode 100644 index 000000000..0e564239f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackings.java @@ -0,0 +1,119 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.TableSchema; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.*; +import software.amazon.awssdk.services.dynamodb.model.AttributeValue; + +import java.time.Instant; +import java.util.List; +import java.util.Map; + +@DynamoDbBean +@Data +public class PaperTrackings { + + public static final String COL_TRACKING_ID = "trackingId"; + public static final String COL_ATTEMPT_ID = "attemptId"; + public static final String COL_PC_RETRY = "pcRetry"; + public static final String COL_EVENTS = "events"; + public static final String COL_PAPER_STATUS = "paperStatus"; + public static final String COL_VALIDATION_FLOW = "validationFlow"; + public static final String COL_VALIDATION_CONFIG = "validationConfig"; + public static final String COL_PRODUCT_TYPE = "productType"; + public static final String COL_NEXT_REQUEST_ID_PC_RETRY = "nextRequestIdPcretry"; + public static final String COL_UNIFIED_DELIVERY_DRIVER = "unifiedDeliveryDriver"; + public static final String COL_CREATED_AT = "createdAt"; + public static final String COL_UPDATED_AT = "updatedAt"; + public static final String COL_STATE = "state"; + public static final String COL_BUSINESS_STATE = "businessState"; + public static final String COL_TTL = "ttl"; + public static final String COL_RECAG012_STATUS_TIMESTAMP = "recag012StatusTimestamp"; + public static final String COL_PENDING_FINAL_EVENT_ID = "pendingFinalEventId"; + public static final String ATTEMPT_ID_PCRETRY_INDEX = "attemptId-pcRetry-index"; + public static final String COL_REWORK_ID = "reworkId"; + public static final String COL_REWORK_REQUEST_TIMESTAMP = "reworkRequestTimestamp"; + public static final String COL_PROCESSING_MODE = "processingMode"; + public static final String COL_ANALOG_REQUEST_CLIENT_ID = "analogRequestClientId"; + + @Getter(onMethod = @__({@DynamoDbPartitionKey, @DynamoDbAttribute(COL_TRACKING_ID)})) + private String trackingId; + + @Getter(onMethod = @__({@DynamoDbSecondaryPartitionKey(indexNames = ATTEMPT_ID_PCRETRY_INDEX), @DynamoDbAttribute(COL_ATTEMPT_ID)})) + private String attemptId; + + @Getter(onMethod = @__({@DynamoDbSecondarySortKey(indexNames = ATTEMPT_ID_PCRETRY_INDEX), @DynamoDbAttribute(COL_PC_RETRY)})) + private String pcRetry; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PRODUCT_TYPE)})) + private String productType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_UNIFIED_DELIVERY_DRIVER)})) + private String unifiedDeliveryDriver; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_EVENTS), @DynamoDbIgnoreNulls})) + private List events; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PAPER_STATUS), @DynamoDbIgnoreNulls})) + private PaperStatus paperStatus; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_VALIDATION_FLOW), @DynamoDbIgnoreNulls})) + private ValidationFlow validationFlow; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_VALIDATION_CONFIG), @DynamoDbIgnoreNulls})) + private ValidationConfig validationConfig; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_NEXT_REQUEST_ID_PC_RETRY)})) + private String nextRequestIdPcretry; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STATE)})) + private PaperTrackingsState state; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_BUSINESS_STATE)})) + private BusinessState businessState; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PENDING_FINAL_EVENT_ID)})) + private String pendingFinalEventId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_CREATED_AT)})) + private Instant createdAt; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_UPDATED_AT)})) + private Instant updatedAt; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_TTL)})) + private Long ttl; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REWORK_REQUEST_TIMESTAMP)})) + private Instant notificationReworkRequestTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REWORK_ID)})) + private String notificationReworkId; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PROCESSING_MODE)})) + private ProcessingMode processingMode; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_ANALOG_REQUEST_CLIENT_ID)})) + private String analogRequestClientId; + + // Costruito UNA volta sola + private static final TableSchema SCHEMA = + TableSchema.fromBean(PaperTrackings.class); + + /** + * Converte l'entity PaperTrackings in una mappa {@code Map} utilizzata da DynamoDB. + */ + public static Map paperTrackingsToAttributeValueMap(PaperTrackings p) { + return SCHEMA.itemToMap(p, true); + } + + /** + * Converte una mappa {@code Map} utilizzata da DynamoDB in una entity PaperTrackings. + */ + public static PaperTrackings attributeValueMapToPaperTrackings(Map item) { + if (item == null || item.isEmpty()) return null; + return SCHEMA.mapToItem(item); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsErrors.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsErrors.java new file mode 100644 index 000000000..5392a5cfb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsErrors.java @@ -0,0 +1,70 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.*; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbPartitionKey; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbSortKey; + +import java.time.Instant; + +@Setter +@Getter +@ToString +@DynamoDbBean +@EqualsAndHashCode +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class PaperTrackingsErrors { + + public static final String COL_TRACKING_ID = "trackingId"; + public static final String COL_CREATED = "created"; + public static final String COL_CATEGORY = "category"; + public static final String COL_DETAILS = "details"; + public static final String COL_FLOW_THROW = "flowThrow"; + public static final String COL_EVENT_THROW = "eventThrow"; + public static final String COL_EVENT_ID_THROW = "eventIdThrow"; + public static final String COL_PRODUCT_TYPE = "productType"; + public static final String COL_TYPE = "type"; + public static final String COL_TTL = "ttl"; + public static final String COL_UNIFIED_DELIVERY_DRIVER = "unifiedDeliveryDriver"; + public static final String COL_REGISTERED_LETTER_CODE = "registeredLetterCode"; + + @Getter(onMethod = @__({@DynamoDbPartitionKey, @DynamoDbAttribute(COL_TRACKING_ID)})) + private String trackingId; + + @Getter(onMethod = @__({@DynamoDbSortKey, @DynamoDbAttribute(COL_CREATED)})) + private Instant created; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_CATEGORY)})) + private ErrorCategory errorCategory; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_DETAILS)})) + private ErrorDetails details; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FLOW_THROW)})) + private FlowThrow flowThrow; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_EVENT_THROW)})) + private String eventThrow; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_EVENT_ID_THROW)})) + private String eventIdThrow; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_PRODUCT_TYPE)})) + private String productType; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_TYPE)})) + private ErrorType type; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_TTL)})) + private Long ttl; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_UNIFIED_DELIVERY_DRIVER)})) + private String unifiedDeliveryDriver; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REGISTERED_LETTER_CODE)})) + private String registeredLetterCode; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsState.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsState.java new file mode 100644 index 000000000..091593be5 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/PaperTrackingsState.java @@ -0,0 +1,10 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +public enum PaperTrackingsState { + AWAITING_FINAL_STATUS_CODE, //mantenuto per retrocompatibilità + AWAITING_REFINEMENT, + AWAITING_REWORK_EVENTS, + AWAITING_OCR, + DONE, + KO +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProcessingMode.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProcessingMode.java new file mode 100644 index 000000000..c33f34cd7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProcessingMode.java @@ -0,0 +1,6 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +public enum ProcessingMode { + DRY, + RUN +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProductType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProductType.java new file mode 100644 index 000000000..e887d065d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ProductType.java @@ -0,0 +1,37 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Getter; + +@Getter +public enum ProductType { + + RS("RS"), + + AR("AR"), + + _890("890"), + + RIR("RIR"), + + RIS("RIS"), + + ALL("ALL"), + + UNKNOWN("UNKNOWN"); + + private final String value; + + ProductType(String value) { + this.value = value; + } + + public static ProductType fromValue(String value) { + for (ProductType type : ProductType.values()) { + if (type.getValue().equals(value)) { + return type; + } + } + throw new IllegalArgumentException("Unknown ProductType: " + value); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationConfig.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationConfig.java new file mode 100644 index 000000000..b9aaedd04 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationConfig.java @@ -0,0 +1,56 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import it.pagopa.pn.papertracker.model.FileType; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; + +import java.util.List; + +@DynamoDbBean +@Data +public class ValidationConfig { + + public static final String COL_OCR_ENABLED = "ocrEnabled"; + public static final String COL_OCR_FILE_TYPES = "ocrFileTypes"; + public static final String COL_REQUIRED_ATTACHMENTS_REFINEMENT_STOCK_890 = "requiredAttachmentsRefinementStock890"; + public static final String COL_SEND_OCR_REFINEMENT_STOCK_890 = "sendOcrAttachmentsRefinementStock890"; + public static final String COL_SEND_OCR_FINAL_VALIDATION_STOCK_890 = "sendOcrAttachmentsFinalValidationStock890"; + public static final String COL_SEND_OCR_FINAL_VALIDATION = "sendOcrAttachmentsFinalValidation"; + public static final String COL_STRICT_FINAL_VALIDATION_STOCK_890 = "strictFinalValidationStock890"; + public static final String COL_STRICT_DELIVERY_FAILURE_CAUSE = "strictDeliveryFailureCause"; + public static final String COL_OCR_FILTER_TEMPORAL = "ocrFilterTemporal"; + public static final String COL_OCR_FILTER_UNIFIED_DELIVERY_DRIVER = "ocrFilterUnifiedDeliveryDriver"; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_OCR_ENABLED)})) + private OcrStatusEnum ocrEnabled; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_OCR_FILE_TYPES)})) + private List ocrFileTypes; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REQUIRED_ATTACHMENTS_REFINEMENT_STOCK_890)})) + private List requiredAttachmentsRefinementStock890; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SEND_OCR_REFINEMENT_STOCK_890)})) + private List sendOcrAttachmentsRefinementStock890; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SEND_OCR_FINAL_VALIDATION_STOCK_890)})) + private List sendOcrAttachmentsFinalValidationStock890; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SEND_OCR_FINAL_VALIDATION)})) + private List sendOcrAttachmentsFinalValidation; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STRICT_FINAL_VALIDATION_STOCK_890)})) + private Boolean strictFinalValidationStock890; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_OCR_FILTER_TEMPORAL)})) + private String ocrFilterTemporal; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_OCR_FILTER_UNIFIED_DELIVERY_DRIVER)})) + private List ocrFilterUnifiedDeliveryDriver; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_STRICT_DELIVERY_FAILURE_CAUSE)})) + private Boolean strictDeliveryFailureCause; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationFlow.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationFlow.java new file mode 100644 index 000000000..53c04778e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/entity/ValidationFlow.java @@ -0,0 +1,40 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo.entity; + +import lombok.Data; +import lombok.Getter; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbAttribute; +import software.amazon.awssdk.enhanced.dynamodb.mapper.annotations.DynamoDbBean; + +import java.time.Instant; +import java.util.List; + +@DynamoDbBean +@Data +public class ValidationFlow { + + public static final String COL_SEQUENCES_VALIDATION_TIMESTAMP = "sequencesValidationTimestamp"; + public static final String COL_FINAL_EVENT_DEMAT_VALIDATION_TIMESTAMP = "finalEventDematValidationTimestamp"; + public static final String COL_REFINEMENT_DEMAT_VALIDATION_TIMESTAMP = "refinementDematValidationTimestamp"; + public static final String COL_FINAL_EVENT_BUILDER_TIMESTAMP = "finalEventBuilderTimestamp"; + public static final String COL_RECAG012_STATUS_TIMESTAMP = "recag012StatusTimestamp"; + public static final String COL_OCR_REQUESTS = "ocrRequests"; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_SEQUENCES_VALIDATION_TIMESTAMP)})) + private Instant sequencesValidationTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FINAL_EVENT_DEMAT_VALIDATION_TIMESTAMP)})) + private Instant finalEventDematValidationTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_REFINEMENT_DEMAT_VALIDATION_TIMESTAMP)})) + private Instant refinementDematValidationTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_FINAL_EVENT_BUILDER_TIMESTAMP)})) + private Instant finalEventBuilderTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_RECAG012_STATUS_TIMESTAMP)})) + private Instant recag012StatusTimestamp; + + @Getter(onMethod = @__({@DynamoDbAttribute(COL_OCR_REQUESTS)})) + private List ocrRequests; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisher.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisher.java new file mode 100644 index 000000000..882a20466 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisher.java @@ -0,0 +1,45 @@ +package it.pagopa.pn.papertracker.middleware.eventBridge; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.eventbridge.EventBridgeAsyncClient; +import software.amazon.awssdk.services.eventbridge.model.PutEventsRequest; +import software.amazon.awssdk.services.eventbridge.model.PutEventsRequestEntry; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +@Service +@RequiredArgsConstructor +@Slf4j +public class EventBridgePublisher { + + private final EventBridgeAsyncClient client; + private final ObjectMapper objectMapper; + private final PnPaperTrackerConfigs configs; + + public Mono publish(Object event) { + log.info("Sending event to EventBridge"); + return Mono.fromCallable(() -> + objectMapper.writeValueAsString(event)) + .flatMap(detail -> Mono.fromFuture(client.putEvents(createRequest(detail)))) + .doOnError(e -> log.error("EventBridge publish error: {}", e.getMessage())) + .doOnNext(response -> log.info("EventBridge publish response: {}", response.entries())); + } + + private PutEventsRequest createRequest(String detail) { + PutEventsRequestEntry entry = PutEventsRequestEntry.builder() + .eventBusName(configs.getEventBus().getName()) + .source(configs.getEventBus().getSource()) + .detailType(configs.getEventBus().getDetailType()) + .detail(detail) + .build(); + + return PutEventsRequest.builder() + .entries(entry) + .build(); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/DataVaultClient.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/DataVaultClient.java new file mode 100644 index 000000000..0ead3f9cd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/DataVaultClient.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.middleware.msclient; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import reactor.core.publisher.Mono; + +public interface DataVaultClient { + + Mono anonymizeDiscoveredAddress(String trackingId, DiscoveredAddress discoveredAddress); + + Mono deAnonymizeDiscoveredAddress(String trackingId, String anonymizeDiscoveredAddress); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/PaperChannelClient.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/PaperChannelClient.java new file mode 100644 index 000000000..27f0df380 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/PaperChannelClient.java @@ -0,0 +1,10 @@ +package it.pagopa.pn.papertracker.middleware.msclient; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.model.HandlerContext; +import reactor.core.publisher.Mono; + +public interface PaperChannelClient { + + Mono getPcRetry(HandlerContext context, Boolean checkApplyRasterization); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/SafeStorageClient.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/SafeStorageClient.java new file mode 100644 index 000000000..8e0ddea29 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/SafeStorageClient.java @@ -0,0 +1,8 @@ +package it.pagopa.pn.papertracker.middleware.msclient; + +import reactor.core.publisher.Mono; + +public interface SafeStorageClient { + + Mono getSafeStoragePresignedUrl(String safeStorageUri); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/DataVaultClientImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/DataVaultClientImpl.java new file mode 100644 index 000000000..101229cbd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/DataVaultClientImpl.java @@ -0,0 +1,46 @@ +package it.pagopa.pn.papertracker.middleware.msclient.impl; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.api.PaperAddressesApi; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.UUID; + +@Component +@RequiredArgsConstructor +public class DataVaultClientImpl implements DataVaultClient { + + private final PaperAddressesApi paperAddressesApi; + + @Override + public Mono anonymizeDiscoveredAddress(String trackingId, DiscoveredAddress discoveredAddress) { + String uuid = UUID.randomUUID().toString(); + String PREFIX_ANONYMIZED_ADDRESS_ID = "anonymized_addr_"; + String anonymizedDiscoveredAddressId = PREFIX_ANONYMIZED_ADDRESS_ID + uuid; + return paperAddressesApi.updatePaperAddress(trackingId, anonymizedDiscoveredAddressId, toPaperAddress(discoveredAddress)) + .thenReturn(anonymizedDiscoveredAddressId); + } + + @Override + public Mono deAnonymizeDiscoveredAddress(String trackingId, String anonymizeDiscoveredAddress) { + return paperAddressesApi.getPaperAddressByIds(trackingId, anonymizeDiscoveredAddress) + .switchIfEmpty(Mono.error(new IllegalArgumentException("No address found for the given anonymized ID: " + anonymizeDiscoveredAddress))); + } + + private PaperAddress toPaperAddress(DiscoveredAddress discoveredAddress) { + return new PaperAddress() + .name(discoveredAddress.getName()) + .nameRow2(discoveredAddress.getNameRow2()) + .address(discoveredAddress.getAddress()) + .addressRow2(discoveredAddress.getAddressRow2()) + .cap(discoveredAddress.getCap()) + .city(discoveredAddress.getCity()) + .city2(discoveredAddress.getCity2()) + .pr(discoveredAddress.getPr()) + .country(discoveredAddress.getCountry()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/PaperChannelClientImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/PaperChannelClientImpl.java new file mode 100644 index 000000000..bc1026405 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/PaperChannelClientImpl.java @@ -0,0 +1,44 @@ +package it.pagopa.pn.papertracker.middleware.msclient.impl; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.api.PcRetryApi; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.utils.PcRetryUtilsMock; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClientResponseException; +import reactor.core.publisher.Mono; + +@Component +@RequiredArgsConstructor +@Slf4j +public class PaperChannelClientImpl implements PaperChannelClient { + + private final PcRetryApi pcRetryApi; + private final PnPaperTrackerConfigs config; + + @Override + public Mono getPcRetry(HandlerContext context, Boolean checkApplyRasterization) { + if(!context.isDryRunEnabled()){ + return getPcRetryPaperChannel(context.getPaperTrackings().getTrackingId(), checkApplyRasterization); + } + log.debug("giving mock response..."); + return PcRetryUtilsMock.getPcRetryPaperMock(context.getPaperTrackings(), config.getMaxPcRetryMock(), context.getPaperProgressStatusEvent().getStatusCode()); + } + + private Mono getPcRetryPaperChannel(String trackingId, Boolean checkApplyRasterization) { + return pcRetryApi.getPcRetry(trackingId, checkApplyRasterization) + .onErrorResume(throwable -> { + if (throwable instanceof WebClientResponseException webEx && webEx.getStatusCode() == HttpStatus.NOT_FOUND) { + return Mono.error(new PnPaperTrackerNotFoundException("RequestId not found", webEx.getMessage())); + } + return Mono.error(throwable); + }); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/SafeStorageClientImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/SafeStorageClientImpl.java new file mode 100644 index 000000000..7764f6596 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/msclient/impl/SafeStorageClientImpl.java @@ -0,0 +1,59 @@ +package it.pagopa.pn.papertracker.middleware.msclient.impl; + +import it.pagopa.pn.commons.log.PnLogger; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.safestorage.api.FileDownloadApi; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.utils.AttachmentsConfigUtils; +import lombok.CustomLog; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.web.reactive.function.client.WebClientResponseException; +import reactor.core.publisher.Mono; +import reactor.util.retry.Retry; + +import java.net.ConnectException; +import java.time.Duration; +import java.util.concurrent.TimeoutException; + +@Component +@RequiredArgsConstructor +@CustomLog +public class SafeStorageClientImpl implements SafeStorageClient { + + private final FileDownloadApi fileDownloadApi; + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + + /** + * Retrieves the presigned download URL from the SafeStorage. + * + * @param fileKey the object key + * @return Mono containing the presigned URL + */ + public Mono getSafeStoragePresignedUrl(String fileKey) { + final String PN_SAFE_STORAGE_DESCRIPTION = "Safe Storage getFile"; + log.logInvokingAsyncExternalService(PnLogger.EXTERNAL_SERVICES.PN_SAFE_STORAGE, PN_SAFE_STORAGE_DESCRIPTION, null); + String reqFileKey = fileKey; + log.info("Getting file with {} key", fileKey); + fileKey = AttachmentsConfigUtils.cleanFileKey(fileKey); + log.debug("Req params : {}", fileKey); + + return fileDownloadApi.getFile(fileKey, this.pnPaperTrackerConfigs.getSafeStorageCxId(), false) + .retryWhen(Retry.backoff(2, Duration.ofMillis(500)).filter(throwable -> throwable instanceof TimeoutException || throwable instanceof ConnectException)) + .flatMap(response -> { + if(response.getDownload() != null && response.getDownload().getRetryAfter() != null) { + return Mono.error(new PaperTrackerException(String.valueOf(response.getDownload().getRetryAfter()))); + } + if (response.getDownload() == null || response.getDownload().getUrl() == null) { + log.error("File not found in Safe Storage for key: {}", reqFileKey); + return Mono.error(new PaperTrackerException("File not found in Safe Storage")); + } + return Mono.just(response.getDownload().getUrl()); + }) + .onErrorResume(WebClientResponseException.class, ex -> { + log.error(ex.getResponseBodyAsString()); + return Mono.error(ex); + }); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/PnPaperTrackerMiddlewareConfigs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/PnPaperTrackerMiddlewareConfigs.java new file mode 100644 index 000000000..c2bab40e1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/PnPaperTrackerMiddlewareConfigs.java @@ -0,0 +1,58 @@ +package it.pagopa.pn.papertracker.middleware.queue; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.queue.model.DeliveryPushEvent; +import it.pagopa.pn.papertracker.middleware.queue.model.ExternalChannelEvent; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelOutputsMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperChannelDryRunMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperTrackerMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import lombok.AllArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.sqs.SqsClient; + +@Configuration +@AllArgsConstructor +public class PnPaperTrackerMiddlewareConfigs { + private PnPaperTrackerConfigs pnPaperChannelConfigs; + + @Bean + public OcrMomProducer ocrMomProducer(ObjectMapper objMapper) { + SqsClient sqsClient = SqsClient.builder() + .region(Region.of(this.pnPaperChannelConfigs.getTopics().getQueueOcrInputsRegion())) + .build(); + return new OcrMomProducer(sqsClient, + this.pnPaperChannelConfigs.getTopics().getQueueOcrInputsUrl(), + this.pnPaperChannelConfigs.getTopics().getQueueOcrInputsUrl(), + objMapper, + OcrEvent.class); + } + + @Bean + public ExternalChannelOutputsMomProducer externalChannelOutputsMomProducer(SqsClient sqsClient, ObjectMapper objMapper) { + return new ExternalChannelOutputsMomProducer(sqsClient, + this.pnPaperChannelConfigs.getTopics().getExternalChannelOutputsQueue(), + objMapper, + DeliveryPushEvent.class); + } + + @Bean + public ExternalChannelToPaperTrackerMomProducer externalChannelToPaperTrackerMomProducer(SqsClient sqsClient, ObjectMapper objMapper) { + return new ExternalChannelToPaperTrackerMomProducer(sqsClient, + this.pnPaperChannelConfigs.getTopics().getExternalChannelToPaperTrackerQueue(), + objMapper, + ExternalChannelEvent.class); + } + + @Bean + public ExternalChannelToPaperChannelDryRunMomProducer externalChannelToPaperChannelDryRunMomProducer(SqsClient sqsClient, ObjectMapper objMapper) { + return new ExternalChannelToPaperChannelDryRunMomProducer(sqsClient, + this.pnPaperChannelConfigs.getTopics().getExternalChannelToPaperChannelDryRunQueue(), + objMapper, + ExternalChannelEvent.class); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundService.java new file mode 100644 index 000000000..8b405059a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundService.java @@ -0,0 +1,93 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import io.awspring.cloud.sqs.annotation.SqsListener; +import io.awspring.cloud.sqs.listener.SqsHeaders; +import it.pagopa.pn.commons.utils.MDCUtils; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelSourceEventsHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.utils.LogUtility; +import lombok.CustomLog; +import lombok.RequiredArgsConstructor; +import org.slf4j.MDC; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.messaging.Message; +import org.springframework.messaging.handler.annotation.Header; +import org.springframework.messaging.handler.annotation.Headers; +import org.springframework.messaging.handler.annotation.Payload; +import org.springframework.stereotype.Component; + +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +@CustomLog +@Component +@RequiredArgsConstructor +@ConditionalOnProperty( + prefix = "pn.paper-tracker.", + name = "disable-all-consumers", + havingValue = "false" +) +public class PnEventInboundService { + + private final ExternalChannelSourceEventsHandler externalChannelSourceEventsHandler; + private final ExternalChannelHandler externalChannelHandler; + private final OcrEventHandler ocrEventHandler; + private final LogUtility logUtility; + + @SqsListener("${pn.paper-tracker.topics.external-channel-to-paper-channel-queue}") + public void externalChannelSourceConsumer( + @Payload Message message, + @Headers Map headers, + @Header(name = SqsHeaders.SQS_SOURCE_DATA_HEADER) software.amazon.awssdk.services.sqs.model.Message sourceMessage + ) { + processMessage(() -> { + var messageAttributes = sourceMessage.messageAttributes(); + externalChannelSourceEventsHandler.handleExternalChannelMessage(message.getPayload(), messageAttributes); + }, "pn-external_channel_to_paper_channel", message, headers); + } + + @SqsListener("${pn.paper-tracker.topics.external-channel-to-paper-tracker-queue}") + public void externalChannelConsumer( + @Payload Message message, + @Header(name = "dryRun", required = false) Boolean dryRun, + @Header(name = "reworkId", required = false) String reworkId, + @Header(name = "id") String messageId, + @Header(name = SqsHeaders.MessageSystemAttributes.SQS_SENDER_ID, required = false) String senderId, + @Headers Map headers + ) { + processMessage(() -> externalChannelHandler.handleExternalChannelMessage( + message.getPayload(), Boolean.TRUE.equals(dryRun), reworkId, messageId, senderId), + "pn-external_channel_to_paper_tracker", message, headers); + } + + @SqsListener("${pn.paper-tracker.topics.pn-ocr-outputs-queue}") + public void ocrOutputsConsumer( + @Payload Message message, + @Headers Map headers + ) { + processMessage(() -> ocrEventHandler.handleOcrMessage(message.getPayload()), + "pn-ocr_outputs", message, headers); + } + + private void processMessage(Runnable handler, String source, Message message, Map headers) { + String anonymizedMessage = logUtility.messageToString(message, Set.of("discoveredAddress")); + try { + log.info("Handle message from {} with content {}", source, anonymizedMessage); + setMDCContext(headers); + handler.run(); + } catch (Exception ex) { + log.error("Error processing message from {}: {}", source, ex.getMessage(), ex); + throw ex; + } + } + + private void setMDCContext(Map headers) { + MDCUtils.clearMDCKeys(); + MDC.put(MDCUtils.MDC_PN_CTX_MESSAGE_ID, headers.getOrDefault("id", "").toString()); + MDC.put(MDCUtils.MDC_TRACE_ID_KEY, headers.getOrDefault("AWSTraceHeader", UUID.randomUUID().toString()).toString()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandler.java new file mode 100644 index 000000000..dbff4ee52 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandler.java @@ -0,0 +1,92 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import it.pagopa.pn.commons.utils.MDCUtils; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.HandlersRegistry; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.CustomLog; +import lombok.RequiredArgsConstructor; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; + +import java.util.Objects; +import java.util.Optional; + +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType.ALL; +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType.UNKNOWN; + +@Component +@RequiredArgsConstructor +@CustomLog +public class ExternalChannelHandler { + + private final PaperTrackerExceptionHandler paperTrackerExceptionHandler; + private final HandlersRegistry handlersRegistry; // contiene HandlersFactoryAr, HandlersFactoryRir, ecc. + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + + private static final String HANDLING_EVENT_LOG = "Handling {} event for productType: [{}] and event: [{}]"; + + /** + * Riceve i messaggi provenienti dalla coda pn-external_channel_to_paper_tracker e gestisce, invia l'evento all'handlersRegistry per lo + * smistamento allo specifico handler in base a productType ed eventType + * + * @param payload il SingleStatusUpdate contenente le informazioni da processare + */ + public void handleExternalChannelMessage(SingleStatusUpdate payload, boolean dryRunEnabled, String reworkId, String messageId, String senderId) { + if (Objects.isNull(payload) || Objects.isNull(payload.getAnalogMail())) { + log.error("Received null payload or analogMail in ExternalChannelHandler"); + throw new IllegalArgumentException("Payload or analogMail cannot be null"); + } + + String processName = "processExternalChannelMessage"; + MDC.put(MDCUtils.MDC_PN_CTX_REQUEST_ID, payload.getAnalogMail().getRequestId()); + log.logStartingProcess(processName); + HandlerContext context = initializeContext(payload, dryRunEnabled, reworkId, messageId, senderId); + + var statusCode = payload.getAnalogMail().getStatusCode(); + var productType = resolveProductType(statusCode, payload.getAnalogMail().getProductType()); + var eventType = Optional.ofNullable(EventStatusCodeEnum.fromKey(statusCode)).map(EventStatusCodeEnum::getCodeType).orElse(null); + + logStatusEvent(eventType, productType, statusCode); + + MDCUtils.addMDCToContextAndExecute(handlersRegistry.handleEvent(productType, eventType, context) + .doOnSuccess(unused -> log.logEndingProcess(processName)) + .onErrorResume(PnPaperTrackerValidationException.class, ex -> paperTrackerExceptionHandler.handleInternalException(ex, context.getMessageReceiveCount()))) + .block(); + } + + private HandlerContext initializeContext(SingleStatusUpdate payload, boolean dryRunEnabled, String reworkId, String messageId, String senderId) { + HandlerContext context = new HandlerContext(); + context.setTrackingId(payload.getAnalogMail().getRequestId()); + context.setPaperProgressStatusEvent(payload.getAnalogMail()); + context.setEventId(messageId); + context.setDryRunEnabled(dryRunEnabled); + context.setReworkId(reworkId); + context.setRedrive(TrackerUtility.checkIfIsRedrive(senderId, pnPaperTrackerConfigs.getRedriveEnabledDomains())); + return context; + } + + private ProductType resolveProductType(String statusCode, String payloadProductType) { + ProductType eventProductType = Optional.ofNullable(EventStatusCodeEnum.fromKey(statusCode)) + .map(EventStatusCodeEnum::getProductType) + .orElse(UNKNOWN); + + if (ALL.equals(eventProductType) && StringUtils.hasText(payloadProductType)) { + return ProductType.fromValue(payloadProductType); + } + return eventProductType; + } + + private void logStatusEvent(EventTypeEnum statusEvent, ProductType productType, String statusCode) { + log.info(HANDLING_EVENT_LOG, statusEvent, productType, statusCode); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandler.java new file mode 100644 index 000000000..bb48d77d7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandler.java @@ -0,0 +1,70 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import it.pagopa.pn.commons.utils.MDCUtils; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.service.SourceQueueProxyService; +import lombok.CustomLog; +import lombok.RequiredArgsConstructor; +import org.slf4j.MDC; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; +import java.util.Objects; + +/** + * Handler responsabile della gestione degli eventi provenienti da pn-external-channel (pn-ec). + *

+ * In fase di inizializzazione di una spedizione su pn-paper-tracker, viene determinata e persistita + * la modalità operativa (DRY o RUN) sull'entità della tabella {pn-PaperTrackings. + *

+ * + *

+ * Conseguentemente, alla ricezione di un evento da pn-ec, pn-paper-tracker determina la modalità + * operativa recuperando le informazioni di tracking dalla tabella pn-PaperTrackings + * e gestisce ciascun evento in base alla logica definita. + *

+ * + *
    + *
  • + * Spedizione non presente su pn-PaperTrackings
    + * L'evento viene inoltrato direttamente a pn-paper-channel. + *
  • + *
  • + * Spedizione presente su pn-PaperTrackings e modalità DRY
    + * L'evento viene inoltrato a pn-paper-channel (se non duplicato) e, in parallelo, processato internamente + * da pn-paper-tracker, con persistenza dell'output su tabella a fini di verifica. + *
  • + *
  • + * Spedizione presente su pn-PaperTrackings e modalità RUN
    + * L'evento viene processato internamente da pn-paper-tracker e l'output + * viene inviato a pn-delivery-push. + *
  • + *
+ * + * La gestione del flusso operativo effettivo è demandata al {@link SourceQueueProxyService}. + */ +@Component +@RequiredArgsConstructor +@CustomLog +public class ExternalChannelSourceEventsHandler { + private final SourceQueueProxyService sourceQueueProxyService; + + public void handleExternalChannelMessage( + SingleStatusUpdate message, + Map messageAttributes) { + if (Objects.isNull(message) || Objects.isNull(message.getAnalogMail())) { + log.error("Received null payload or analogMail in ExternalChannelHandler"); + throw new IllegalArgumentException("Payload or analogMail cannot be null"); + } + + String processName = "processExternalChannelSourceMessage"; + MDC.put(MDCUtils.MDC_PN_CTX_REQUEST_ID, message.getAnalogMail().getRequestId()); + log.logStartingProcess(processName); + + MDCUtils.addMDCToContextAndExecute(sourceQueueProxyService.handleExternalChannelMessage(message, messageAttributes) + .doOnSuccess(unused -> log.logEndingProcess(processName))) + .block(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandler.java new file mode 100644 index 000000000..687361643 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandler.java @@ -0,0 +1,60 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.commons.utils.MDCUtils; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.HandlersRegistry; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.CustomLog; +import lombok.RequiredArgsConstructor; +import org.slf4j.MDC; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Objects; + +@Component +@RequiredArgsConstructor +@CustomLog +public class OcrEventHandler { + + private final PaperTrackingsDAO paperTrackingsDAO; + private final PaperTrackerExceptionHandler paperTrackerExceptionHandler; + private final HandlersRegistry handlersRegistry; + + public void handleOcrMessage(OcrDataResultPayload ocrResultMessage) { + if (Objects.isNull(ocrResultMessage) || Objects.isNull(ocrResultMessage.getCommandId())) { + log.error("Received null payload or commandId in OcrResponse handler"); + throw new IllegalArgumentException("Payload or commandId cannot be null"); + } + + String processName = "processOcrResponseMessage"; + MDC.put(MDCUtils.MDC_PN_CTX_REQUEST_ID, ocrResultMessage.getCommandId()); + log.logStartingProcess(processName); + MDCUtils.addMDCToContextAndExecute(paperTrackingsDAO.retrieveEntityByTrackingId(TrackerUtility.getParsedOcrCommandId(ocrResultMessage.getCommandId())[0]) + .flatMap(paperTrackings -> callOcrResponseHandler(paperTrackings, ocrResultMessage)) + .onErrorResume(PnPaperTrackerValidationException.class, e -> paperTrackerExceptionHandler.handleInternalException(e, null)) + .then()) + .block(); + } + + private Mono callOcrResponseHandler(PaperTrackings paperTrackings, OcrDataResultPayload ocrResultMessage) { + HandlerContext context = buildContext(paperTrackings, ocrResultMessage); + return handlersRegistry.handleEvent(ProductType.fromValue(paperTrackings.getProductType()), EventTypeEnum.OCR_RESPONSE_EVENT, context); + } + + private HandlerContext buildContext(PaperTrackings paperTrackings, + OcrDataResultPayload ocrResultMessage) { + HandlerContext handlerContext = new HandlerContext(); + handlerContext.setTrackingId(paperTrackings.getTrackingId()); + handlerContext.setPaperTrackings(paperTrackings); + handlerContext.setOcrDataResultPayload(ocrResultMessage); + return handlerContext; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/CustomEventHeader.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/CustomEventHeader.java new file mode 100644 index 000000000..7f0436d40 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/CustomEventHeader.java @@ -0,0 +1,22 @@ +package it.pagopa.pn.papertracker.middleware.queue.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import lombok.*; +import lombok.experimental.SuperBuilder; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@EqualsAndHashCode(callSuper = true) +@ToString +@SuperBuilder +public class CustomEventHeader extends GenericEventHeader { + + @JsonProperty("messageAttributes") + private Map messageAttributes; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/DeliveryPushEvent.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/DeliveryPushEvent.java new file mode 100644 index 000000000..3461506d4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/DeliveryPushEvent.java @@ -0,0 +1,20 @@ +package it.pagopa.pn.papertracker.middleware.queue.model; + +import it.pagopa.pn.api.dto.events.GenericEvent; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Builder(toBuilder = true) +public class DeliveryPushEvent implements GenericEvent { + + private GenericEventHeader header; + private PaperChannelUpdate payload; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEvent.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEvent.java new file mode 100644 index 000000000..49d5fe473 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEvent.java @@ -0,0 +1,18 @@ +package it.pagopa.pn.papertracker.middleware.queue.model; + +import it.pagopa.pn.api.dto.events.GenericEvent; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import lombok.*; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Builder(toBuilder = true) +public class ExternalChannelEvent implements GenericEvent { + + private CustomEventHeader header; + private SingleStatusUpdate payload; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEventHeader.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEventHeader.java new file mode 100644 index 000000000..ed02d376a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/ExternalChannelEventHeader.java @@ -0,0 +1,20 @@ +package it.pagopa.pn.papertracker.middleware.queue.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import lombok.*; +import lombok.experimental.SuperBuilder; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@EqualsAndHashCode(callSuper = true) +@ToString +@SuperBuilder +public class ExternalChannelEventHeader extends GenericEventHeader { + + public static final String PN_EVENT_HEADER_DRYRUN = "dryRun"; + @JsonProperty("dryRun") + private Boolean dryRun; + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/OcrEvent.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/OcrEvent.java new file mode 100644 index 000000000..3de4fbaaf --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/model/OcrEvent.java @@ -0,0 +1,23 @@ +package it.pagopa.pn.papertracker.middleware.queue.model; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.api.dto.events.GenericEvent; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public class OcrEvent implements GenericEvent { + + private GenericEventHeader header; + private OcrDataPayloadDTO payload; + + @Override + public GenericEventHeader getHeader() { + return header; + } + + @Override + public OcrDataPayloadDTO getPayload() { + return payload; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelOutputsMomProducer.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelOutputsMomProducer.java new file mode 100644 index 000000000..cd2118744 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelOutputsMomProducer.java @@ -0,0 +1,16 @@ +package it.pagopa.pn.papertracker.middleware.queue.producer; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.api.dto.events.AbstractSqsMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.model.DeliveryPushEvent; +import lombok.extern.slf4j.Slf4j; +import software.amazon.awssdk.services.sqs.SqsClient; + +@Slf4j +public class ExternalChannelOutputsMomProducer extends AbstractSqsMomProducer { + + public ExternalChannelOutputsMomProducer(SqsClient sqsClient, String topic, ObjectMapper objectMapper, Class msgClass) { + super(sqsClient, topic, objectMapper, msgClass); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperChannelDryRunMomProducer.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperChannelDryRunMomProducer.java new file mode 100644 index 000000000..9503fe97b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperChannelDryRunMomProducer.java @@ -0,0 +1,30 @@ +package it.pagopa.pn.papertracker.middleware.queue.producer; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.api.dto.events.AbstractSqsMomProducer; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import it.pagopa.pn.papertracker.middleware.queue.model.CustomEventHeader; +import it.pagopa.pn.papertracker.middleware.queue.model.ExternalChannelEvent; +import lombok.extern.slf4j.Slf4j; +import software.amazon.awssdk.services.sqs.SqsClient; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; + +@Slf4j +public class ExternalChannelToPaperChannelDryRunMomProducer extends AbstractSqsMomProducer { + + public ExternalChannelToPaperChannelDryRunMomProducer(SqsClient sqsClient, String topic, ObjectMapper objectMapper, Class msgClass) { + super(sqsClient, topic, objectMapper, msgClass); + } + + @Override + protected Map getSqSHeader(GenericEventHeader header) { + Map map = super.getSqSHeader(header); + if (!(header instanceof CustomEventHeader headerCustom)) { + return map; + } + map.putAll(headerCustom.getMessageAttributes()); + return map; + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperTrackerMomProducer.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperTrackerMomProducer.java new file mode 100644 index 000000000..e0853f4eb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/ExternalChannelToPaperTrackerMomProducer.java @@ -0,0 +1,31 @@ +package it.pagopa.pn.papertracker.middleware.queue.producer; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.api.dto.events.AbstractSqsMomProducer; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import it.pagopa.pn.papertracker.middleware.queue.model.CustomEventHeader; +import it.pagopa.pn.papertracker.middleware.queue.model.ExternalChannelEvent; +import lombok.extern.slf4j.Slf4j; +import software.amazon.awssdk.services.sqs.SqsClient; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; + +@Slf4j +public class ExternalChannelToPaperTrackerMomProducer extends AbstractSqsMomProducer { + + public ExternalChannelToPaperTrackerMomProducer(SqsClient sqsClient, String topic, ObjectMapper objectMapper, Class msgClass) { + super(sqsClient, topic, objectMapper, msgClass); + } + + @Override + protected Map getSqSHeader(GenericEventHeader header) { + Map map = super.getSqSHeader(header); + if (!(header instanceof CustomEventHeader headerCustom)) { + return map; + } + map.putAll(headerCustom.getMessageAttributes()); + return map; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/OcrMomProducer.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/OcrMomProducer.java new file mode 100644 index 000000000..94ce4e76c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/middleware/queue/producer/OcrMomProducer.java @@ -0,0 +1,16 @@ +package it.pagopa.pn.papertracker.middleware.queue.producer; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.api.dto.events.AbstractSqsMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import lombok.extern.slf4j.Slf4j; +import software.amazon.awssdk.services.sqs.SqsClient; + +@Slf4j +public class OcrMomProducer extends AbstractSqsMomProducer { + + public OcrMomProducer(SqsClient sqsClient, String topic, String url, ObjectMapper objectMapper, Class msgClass) { + super(sqsClient, topic, url, objectMapper, msgClass); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DeliveryFailureCauseEnum.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DeliveryFailureCauseEnum.java new file mode 100644 index 000000000..84605e39e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DeliveryFailureCauseEnum.java @@ -0,0 +1,41 @@ +package it.pagopa.pn.papertracker.model; + +import lombok.Getter; + +import java.util.Optional; +import java.util.stream.Stream; + +@Getter +public enum DeliveryFailureCauseEnum { + + M01, + M02, + M03, + M04, + M05, + M06, + M07, + M08, + M09, + M10, + F01, + F02, + F03, + F04, + C01, + C02, + C03, + C04, + C05, + C06, + UNKNOWN, + CHECK_IF_REQUIRED; + + public static DeliveryFailureCauseEnum fromValue(String deliveryFailureCause) { + return Stream.of(values()) + .filter(value -> value.name().equalsIgnoreCase(Optional.ofNullable(deliveryFailureCause) + .map(String::toUpperCase).orElse(null))) + .findFirst() + .orElse(UNKNOWN); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DocumentTypeEnum.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DocumentTypeEnum.java new file mode 100644 index 000000000..cd1f9c30d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/DocumentTypeEnum.java @@ -0,0 +1,30 @@ +package it.pagopa.pn.papertracker.model; + +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import lombok.Getter; + +import java.util.Arrays; + +@Getter +public enum DocumentTypeEnum { + PLICO("Plico"), + AR("AR"), + INDAGINE("Indagine"), + _23L("23L"), + ARCAD("ARCAD"), + CAD("CAD"), + CAN("CAN"); + + private final String value; + + DocumentTypeEnum(String value) { + this.value = value; + } + + public static DocumentTypeEnum fromValue(String documentType) { + return Arrays.stream(DocumentTypeEnum.values()) + .filter(documentTypeEnum -> documentTypeEnum.getValue().equalsIgnoreCase(documentType)) + .findFirst() + .orElseThrow(() -> new PaperTrackerException("Invalid document type: " + documentType)); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatus.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatus.java new file mode 100644 index 000000000..1070da8f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatus.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.model; + +import lombok.Getter; + +@Getter +public enum EventStatus { + + KO("KO"), + PROGRESS("PROGRESS"), + OK("OK"); + + private final String value; + + EventStatus(String value) { + this.value = value; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java new file mode 100644 index 000000000..945780ba0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventStatusCodeEnum.java @@ -0,0 +1,168 @@ +package it.pagopa.pn.papertracker.model; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import lombok.Getter; + +import java.util.List; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.DeliveryFailureCauseEnum.*; + +@Getter +public enum EventStatusCodeEnum { + // AR + RECRN006(EventTypeEnum.RETRYABLE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(F01, F02, F03, F04), "Furto/Smarrimento/deterioramento", false), + RECRN013(EventTypeEnum.RETRYABLE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Non Rendicontabile ", false), + RECRN015(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(C01, C02, C03, C04, C05, C06), "Causa Forza Maggiore", false), + RECRN001C(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(),"Consegnato - Fascicolo Chiuso", false), + RECRN002C(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(CHECK_IF_REQUIRED),"Mancata consegna - Fascicolo Chiuso", false), + RECRN002F(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Irreperibilità Assoluta - Fascicolo Chiuso", false), + RECRN003C(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(),"Consegnato presso Punti di Giacenza - Fascicolo Chiuso", false), + RECRN004C(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(),"Mancata consegna presso Punti di Giacenza - Fascicolo Chiuso", false), + RECRN005C(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(),"Compiuta giacenza - Fascicolo Chiuso", false), + RECRN011(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "In giacenza", false), + RECRN001A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Consegnato - pre-esito", false), + RECRN002A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(M02, M05, M06, M07, M08, M09, M10), "Mancata consegna - pre-esito", false), + RECRN002D(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(M01, M03, M04), "Irreperibilità Assoluta - pre-esito", false), + RECRN003A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Consegnato presso Punti di Giacenza - pre-esito", false), + RECRN004A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - pre-esito", false), + RECRN005A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Compiuta giacenza pre-esito", false), + RECRN001B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Consegnato - In Dematerializzazione", true), + RECRN002B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Mancata consegna - In Dematerializzazione", true), + RECRN002E(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Irreperibilità Assoluta - In Dematerializzazione", true), + RECRN003B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Consegnato presso Punti di Giacenza - In Dematerializzazione", true), + RECRN004B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - In Dematerializzazione", true), + RECRN005B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - In Dematerializzazione", true), + RECRN010(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.AR, EventStatus.PROGRESS, List.of(), "Inesito", false), + PNRN012(EventTypeEnum.FINAL_EVENT, ProductType.AR, EventStatus.OK, List.of(),"Perfezionamento per decorrenza termini", false), + + // RIR + RECRI001(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(), "Avviato all'estero", false), + RECRI002(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(), "Ingresso nel paese estero", false), + RECRI005(EventTypeEnum.RETRYABLE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(F01, F02, F03, F04), "Furto, smarrimento o deterioramento", false), + RECRI003A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(), "Consegnato - pre-esito", false), + RECRI004A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Mancata consegna - pre-esito", false), + RECRI003B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(), "Consegnato - In Dematerializzazione", true), + RECRI004B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIR, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Mancata consegna - In Dematerializzazione", true), + RECRI003C(EventTypeEnum.FINAL_EVENT, ProductType.RIR, EventStatus.OK, List.of(),"Consegnato - Fascicolo Chiuso", false), + RECRI004C(EventTypeEnum.FINAL_EVENT, ProductType.RIR, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Mancata consegna - Fascicolo Chiuso", false), + + // CON + CON998(EventTypeEnum.NOT_RETRYABLE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Scartato NODOC", false), + CON997(EventTypeEnum.NOT_RETRYABLE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Scartato CAP/INTERNAZIONALE", false), + CON996(EventTypeEnum.CON996_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Scartato PDF", false), + CON995(EventTypeEnum.NOT_RETRYABLE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Errore stampa", false), + CON993(EventTypeEnum.NOT_RETRYABLE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Errore Stampa (parziale)", false), + CON080(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Stampato ed Imbustato", false), + CON020(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Affido conservato", false), + CON010(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Distinta Elettronica inviata a Recapitista", false), + CON011(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Distinta Elettronica Sigillata", false), + CON012(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "OK Distinta Elettronica da Recapitista", false), + CON09A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Materialità Pronta", false), + CON09B(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Prenotazione Pickup", false), + CON016(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "PICKUP Sigillata", false), + CON018(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Accettazione Recapitista", false), + + REC016(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Materialità Ritirata", false), + REC018(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Accettazione Recapitista", false), + REC991(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Mancata Accettazione Recapitista", false), + //eventi non gestiti da paper-channel ma previsti dal consolidatore + //CON992(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "KO Distinta Elettronica da Recapitista", false), + //CON991(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Mancata Accetazione Recapitsita ", false); + + P000(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Affidato al consolidatore", false), + P001(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "In progress", false), + P011(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Errore di sintassi", false), + P012(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Errore semantico", false), + P013(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.ALL, EventStatus.PROGRESS, List.of(), "Errore di trasformazione", false), + + // 890 + RECAG001A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato - pre-esito", false), + RECAG002A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato a persona abilitata - pre-esito", false), + RECAG003A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(M02, M05, M06, M07, M08, M09, M10), "Mancata consegna - pre-esito", false), + RECAG003D(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(M01, M03, M04), "Irreperibilità Assoluta - pre-esito", false), + RECAG002B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato a persona abilitata - In Dematerializzazione", true), + RECAG003B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Mancata consegna - In Dematerializzazione", true), + RECAG001B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato - In Dematerializzazione", true), + RECAG003E(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Irreperibilità Assoluta - In Dematerializzazione", true), + RECAG002C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.OK, List.of(), "Consegnato a persona abilitata - Fascicolo Chiuso", false), + RECAG003C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.OK, List.of(CHECK_IF_REQUIRED), "Mancata consegna - Fascicolo Chiuso", false), + RECAG001C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.OK, List.of(), "Consegnato - Fascicolo Chiuso", false), + RECAG003F(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Irreperibilità Assoluta - Fascicolo Chiuso", false), + RECAG010(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Inesito", false), + RECAG010A(EventTypeEnum.SAVE_ONLY_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Invio CAD", false), + RECAG004(EventTypeEnum.RETRYABLE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(F01, F02, F03, F04), "Furto/Smarrimento/deterioramento", false), + RECAG015(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(C01, C02, C03, C04, C05, C06), "Causa Forza Maggiore", false), + RECAG013(EventTypeEnum.RETRYABLE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Non Rendicontabile", false), + RECAG011A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "In giacenza", false), + RECAG011B(EventTypeEnum.STOCK_INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "In giacenza - In Dematerializzazione", true), + RECAG012(EventTypeEnum.RECAG012_EVENT, ProductType._890, EventStatus.OK, List.of(), "Accettazione 23L", false), + RECAG012A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Accettazione 23L - pre-esito", false), + RECAG005A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato presso Punti di Giacenza - pre-esito", false), + RECAG005B(EventTypeEnum.STOCK_INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato presso Punti di Giacenza - In Dematerializzazione", true), + RECAG005C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegnato presso Punti di Giacenza - Fascicolo Chiuso", false), + RECAG006A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegna a persona abilitata presso Punti di Giacenza - pre-esito", false), + RECAG006B(EventTypeEnum.STOCK_INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegna a persona abilitata presso Punti di Giacenza - In Dematerializzazione", true), + RECAG006C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Consegna a persona abilitata presso Punti di Giacenza - Fascicolo Chiuso", false), + RECAG007A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - pre-esito", false), + RECAG007B(EventTypeEnum.STOCK_INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - In Dematerializzazione", true), + RECAG007C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - Fascicolo Chiuso", false), + RECAG008A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - pre-esito", false), + RECAG008B(EventTypeEnum.STOCK_INTERMEDIATE_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - In Dematerializzazione", true), + RECAG008C(EventTypeEnum.FINAL_EVENT, ProductType._890, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - Fascicolo Chiuso", false), + + // RS + RECRS002A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(M02, M05, M06, M07, M08, M09, M10), "Mancata consegna - pre-esito", false), + RECRS002D(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(M01, M03, M04), "Irreperibilità Assoluta - pre-esito", false), + RECRS004A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - pre-esito", false), + RECRS005A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - pre-esito", false), + RECRS015(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(C01, C02, C03, C04, C05, C06), "Causa Forza Maggiore", false), + RECRS010(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Inesito", false), + RECRS002B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Mancata consegna - In Dematerializzazione", true), + RECRS002E(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED),"Irreperibilità Assoluta - In Dematerializzazione",true), + RECRS004B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Mancata consegna presso Punti di Giacenza - In Dematerializzazione", true), + RECRS005B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Compiuta giacenza - In Dematerializzazione", true), + RECRS001C(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.OK, List.of(), "Consegnato - Fascicolo Chiuso", false), + RECRS002C(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Mancata consegna - Fascicolo Chiuso", false), + RECRS003C(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.OK, List.of(), "Consegnato presso Punti di Giacenza - Fascicolo Chiuso", false), + RECRS002F(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Irreperibilità Assoluta - Fascicolo Chiuso", false), + RECRS004C(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.KO, List.of(), "Mancata consegna presso Punti di Giacenza - Fascicolo Chiuso", false), + RECRS005C(EventTypeEnum.FINAL_EVENT, ProductType.RS, EventStatus.KO, List.of(), "Compiuta giacenza - Fascicolo Chiuso", false), + RECRS006(EventTypeEnum.RETRYABLE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(F01, F02, F03, F04), "Furto/Smarrimento/deterioramento", false), + RECRS013(EventTypeEnum.RETRYABLE_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "Non Rendicontabile", false), + RECRS011(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.RS, EventStatus.PROGRESS, List.of(), "In giacenza", false), + + //RIS + RECRSI004A(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIS, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Non Consegnato - pre-esito", false), + RECRSI004B(EventTypeEnum.INTERMEDIATE_EVENT, ProductType.RIS, EventStatus.PROGRESS, List.of(CHECK_IF_REQUIRED), "Non Consegnato - In Dematerializzazione", true), + RECRSI003C(EventTypeEnum.FINAL_EVENT, ProductType.RIS, EventStatus.OK, List.of(), "Consegnato - Fascicolo Chiuso", false), + RECRSI004C(EventTypeEnum.FINAL_EVENT, ProductType.RIS, EventStatus.KO, List.of(CHECK_IF_REQUIRED), "Non Consegnato - fascicolo Chiuso", false), + RECRSI005(EventTypeEnum.RETRYABLE_EVENT, ProductType.RIS, EventStatus.PROGRESS, List.of(F01, F02, F03, F04), "Furto/Smarrimento/deterioramento", false), + RECRSI001(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.RIS, EventStatus.PROGRESS, List.of(), "Avviato all'estero", false), + RECRSI002(EventTypeEnum.SAVE_ONLY_EVENT, ProductType.RIS, EventStatus.PROGRESS, List.of(), "Ingresso nel paese estero", false); + + + private final EventTypeEnum codeType; + private final ProductType productType; + private final EventStatus status; + private final List deliveryFailureCauseList; + private final String statusCodeDescription; + private final boolean isFinalDemat; + + EventStatusCodeEnum(EventTypeEnum codeType, ProductType productType, + EventStatus status, List deliveryFailureCauseList, String statusCodeDescription, boolean isFinalDemat) { + this.codeType = codeType; + this.productType = productType; + this.status = status; + this.statusCodeDescription = statusCodeDescription; + this.deliveryFailureCauseList = deliveryFailureCauseList; + this.isFinalDemat = isFinalDemat; + } + + public static EventStatusCodeEnum fromKey(String key) { + return Stream.of(values()) + .filter(definition -> definition.name().equals(key)) + .findFirst() + .orElse(null); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventTypeEnum.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventTypeEnum.java new file mode 100644 index 000000000..b2b40b9dd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/EventTypeEnum.java @@ -0,0 +1,13 @@ +package it.pagopa.pn.papertracker.model; + +public enum EventTypeEnum { + INTERMEDIATE_EVENT, + RETRYABLE_EVENT, + NOT_RETRYABLE_EVENT, + FINAL_EVENT, + SAVE_ONLY_EVENT, + OCR_RESPONSE_EVENT, + CON996_EVENT, + STOCK_INTERMEDIATE_EVENT, + RECAG012_EVENT +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/FileType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/FileType.java new file mode 100644 index 000000000..4b80fa075 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/FileType.java @@ -0,0 +1,24 @@ +package it.pagopa.pn.papertracker.model; + +import lombok.Getter; + +@Getter +public enum FileType { + PDF("pdf"), + UNKNOWN("UNKNOWN"); + + private final String value; + + FileType(String value) { + this.value = value; + } + + public static FileType fromValue(String fileType) { + for (FileType ft : FileType.values()) { + if (ft.value.equalsIgnoreCase(fileType)) { + return ft; + } + } + return UNKNOWN; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/HandlerContext.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/HandlerContext.java new file mode 100644 index 000000000..43370b8a0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/HandlerContext.java @@ -0,0 +1,30 @@ +package it.pagopa.pn.papertracker.model; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class HandlerContext { + + private PaperProgressStatusEvent paperProgressStatusEvent; + private String trackingId; + private PaperTrackings paperTrackings; + private String anonymizedDiscoveredAddressId; + private List eventsToSend = new ArrayList<>(); + private boolean stopExecution = false; + private String eventId; + private String finalStatusCode; + private boolean dryRunEnabled; + private Long messageReceiveCount; + private boolean needToSendRECAG012A = false; + private String reworkId; + private OcrDataResultPayload ocrDataResultPayload; + private boolean isRedrive; + private String nextRequestIdPcRetry; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OcrStatusEnum.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OcrStatusEnum.java new file mode 100644 index 000000000..c43c3342c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OcrStatusEnum.java @@ -0,0 +1,7 @@ +package it.pagopa.pn.papertracker.model; + +public enum OcrStatusEnum { + DRY, + RUN, + DISABLED +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OriginType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OriginType.java new file mode 100644 index 000000000..ce9656cda --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/OriginType.java @@ -0,0 +1,7 @@ +package it.pagopa.pn.papertracker.model; + +public enum OriginType { + + ORIGINAL, + DUPLICATED +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/PredictedRefinementType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/PredictedRefinementType.java new file mode 100644 index 000000000..8b44de50a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/PredictedRefinementType.java @@ -0,0 +1,6 @@ +package it.pagopa.pn.papertracker.model; + +public enum PredictedRefinementType { + PRE10, + POST10 +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/SourceType.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/SourceType.java new file mode 100644 index 000000000..1152d3081 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/SourceType.java @@ -0,0 +1,7 @@ +package it.pagopa.pn.papertracker.model; + +public enum SourceType { + + SCANNED, + DIGITAL +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/DateValidationGroup.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/DateValidationGroup.java new file mode 100644 index 000000000..69e850c5e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/DateValidationGroup.java @@ -0,0 +1,42 @@ +package it.pagopa.pn.papertracker.model.sequence; + +import lombok.Getter; + +import java.util.Set; + +@Getter +public enum DateValidationGroup { + RECRN005C(Set.of("RECRN005A", "RECRN005B", "RECRN005C"), Set.of()), + RECRN004C(Set.of("RECRN004A", "RECRN004B", "RECRN004C"), Set.of()), + RECRN003C(Set.of("RECRN003A", "RECRN003B", "RECRN003C"), Set.of()), + RECRN002F(Set.of("RECRN002D", "RECRN002E", "RECRN002F"), Set.of()), + RECRN002C(Set.of("RECRN002A", "RECRN002B", "RECRN002C"), Set.of()), + RECRN001C(Set.of("RECRN001A", "RECRN001B", "RECRN001C"), Set.of()), + RECRI003C(Set.of("RECRI003A", "RECRI003B", "RECRI003C"), Set.of()), + RECRI004C(Set.of("RECRI004A", "RECRI004B", "RECRI004C"), Set.of()), + RECAG001C(Set.of("RECAG001A", "RECAG001B", "RECAG001C"), Set.of()), + RECAG002C(Set.of("RECAG002A", "RECAG002B", "RECAG002C"), Set.of()), + RECAG003C(Set.of("RECAG003A", "RECAG003B", "RECAG003C"), Set.of()), + RECAG003F(Set.of("RECAG003D", "RECAG003E", "RECAG003F"), Set.of()), + RECAG005C(Set.of("RECAG005A", "RECAG005B", "RECAG005C"), Set.of("RECAG011A","RECAG011B")), + RECAG006C(Set.of("RECAG006A", "RECAG006B", "RECAG006C"), Set.of("RECAG011A","RECAG011B")), + RECAG007C(Set.of("RECAG007A", "RECAG007B", "RECAG007C"), Set.of("RECAG011A","RECAG011B")), + RECAG008C(Set.of("RECAG008A", "RECAG008B", "RECAG008C"), Set.of("RECAG011A","RECAG011B")), + RECRS001C(Set.of("RECRS001C"), Set.of()), + RECRS002C(Set.of("RECRS002A","RECRS002B","RECRS002C"), Set.of()), + RECRS002F(Set.of("RECRS002D","RECRS002E","RECRS002F"), Set.of()), + RECRS003C(Set.of("RECRS003C"), Set.of()), + RECRS004C(Set.of("RECRS004A","RECRS004B","RECRS004C"), Set.of()), + RECRS005C(Set.of("RECRS005A","RECRS005B","RECRS005C"), Set.of()), + RECRSI003C(Set.of("RECRSI003C"), Set.of()), + RECRSI004C(Set.of("RECRSI004A","RECRSI004B","RECRSI004C"), Set.of()); + + + private final Set finalEventDateValidationGroup; + private final Set stockEventsDateValidationGroup; + + DateValidationGroup(Set finalEventDateValidationGroup, Set stockEventsDateValidationGroup) { + this.finalEventDateValidationGroup = finalEventDateValidationGroup; + this.stockEventsDateValidationGroup = stockEventsDateValidationGroup; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/RequiredSequenceStatusCodes.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/RequiredSequenceStatusCodes.java new file mode 100644 index 000000000..32b892727 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/RequiredSequenceStatusCodes.java @@ -0,0 +1,48 @@ +package it.pagopa.pn.papertracker.model.sequence; + +import lombok.Getter; + +import java.util.Set; +/** + * Enum that defines required sequences of status codes for various processes. + * Each enum constant represents a specific sequence and holds a set of strings, + * where each string specifies a status code in the sequence. + * The "?" prefix indicates that the status code is optional. + */ +@Getter +public enum RequiredSequenceStatusCodes { + + RECRN005C(Set.of("RECRN010","RECRN011","RECRN005A","RECRN005B","RECRN005C")), + RECRN004C(Set.of("RECRN010", "RECRN011", "RECRN004A", "RECRN004B", "RECRN004C")), + RECRN003C(Set.of("RECRN010", "RECRN011", "RECRN003A", "RECRN003B", "RECRN003C")), + RECRN002F(Set.of("RECRN002D", "RECRN002E", "RECRN002F")), + RECRN002C(Set.of("RECRN002A", "RECRN002B", "RECRN002C")), + RECRN001C(Set.of("RECRN001A", "RECRN001B", "RECRN001C")), + RECRI003C(Set.of("RECRI001", "RECRI002", "RECRI003A", "RECRI003B", "RECRI003C")), + RECRI004C(Set.of("RECRI001", "RECRI002", "RECRI004A", "RECRI004B", "RECRI004C")), + RECAG001C(Set.of("RECAG001A", "RECAG001B", "RECAG001C")), + RECAG002C(Set.of("RECAG002A", "RECAG002B", "RECAG002C")), + RECAG003C(Set.of("RECAG003A", "RECAG003B", "RECAG003C")), + RECAG003F(Set.of("RECAG003D", "RECAG003E", "RECAG003F")), + RECAG005C(Set.of("RECAG010", "?RECAG010A", "RECAG011A", "?RECAG011B", "RECAG012", "RECAG005A", "?RECAG005B", "RECAG005C")), + RECAG006C(Set.of("RECAG010", "?RECAG010A", "RECAG011A", "?RECAG011B", "RECAG012", "RECAG006A", "?RECAG006B", "RECAG006C")), + RECAG007C(Set.of("RECAG010", "?RECAG010A", "RECAG011A", "?RECAG011B", "RECAG012", "RECAG007A", "RECAG007B", "RECAG007C")), + RECAG008C(Set.of("RECAG010", "?RECAG010A", "RECAG011A", "RECAG011B", "RECAG012", "RECAG008A", "RECAG008B", "RECAG008C")), + RECRS001C(Set.of("RECRS001C")), + RECRS002C(Set.of("RECRS002A","RECRS002B","RECRS002C")), + RECRS002F(Set.of("RECRS002D","RECRS002E","RECRS002F")), + RECRS003C(Set.of("RECRS003C")), + RECRS004C(Set.of("RECRS010","RECRS011","RECRS004A","RECRS004B","RECRS004C")), + RECRS005C(Set.of("RECRS010","RECRS011","RECRS005A","RECRS005B","RECRS005C")), + RECRSI003C(Set.of("RECRSI001","RECRSI002","RECRSI003C")), + RECRSI004C(Set.of("RECRSI001","RECRSI002","RECRSI004A","RECRSI004B","RECRSI004C")); + + + private final Set statusCodeSequence; + + RequiredSequenceStatusCodes(Set statusCodeSequence) { + this.statusCodeSequence = statusCodeSequence; + } + + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceAttachments.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceAttachments.java new file mode 100644 index 000000000..8b6ef1d2b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceAttachments.java @@ -0,0 +1,52 @@ +package it.pagopa.pn.papertracker.model.sequence; + +import lombok.Getter; + +import java.util.Arrays; +import java.util.Set; + +/** + * Enum that defines required attachments for event statusCode. + * the ? indicates that the attachment is optional. + * + */ +@Getter +public enum SequenceAttachments { + RECRN005B(Set.of("Plico")), + RECRN004B(Set.of("Plico")), + RECRN003B(Set.of("AR")), + RECRN002E(Set.of("Plico","?Indagine")), + RECRN002B(Set.of("Plico")), + RECRN001B(Set.of("AR")), + RECRI003B(Set.of("AR")), + RECRI004B(Set.of("Plico")), + RECAG001B(Set.of("23L")), + RECAG002B(Set.of("23L","?CAN")), + RECAG003B(Set.of("Plico")), + RECAG003E(Set.of("Plico","?Indagine")), + RECAG011B(Set.of("23L","ARCAD","CAD")), + RECAG005B(Set.of("23L","ARCAD","CAD")), + RECAG006B(Set.of("23L","ARCAD","CAD")), + RECAG007B(Set.of("23L","ARCAD","CAD","Plico")), + RECAG008B(Set.of("Plico")), + RECRS002B(Set.of("Plico")), + RECRS002E(Set.of("Plico")), + RECRS004B(Set.of("Plico")), + RECRS005B(Set.of("Plico")), + RECRSI004B(Set.of("Plico")); + + + + private final Set attachments; + + SequenceAttachments(Set attachments) { + this.attachments = attachments; + } + + public static SequenceAttachments getFromKey(String statusCode) { + return Arrays.stream(SequenceAttachments.values()) + .filter(sequenceAttachments -> sequenceAttachments.name().equalsIgnoreCase(statusCode)) + .findFirst() + .orElse(null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfig.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfig.java new file mode 100644 index 000000000..8859c3c7b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfig.java @@ -0,0 +1,13 @@ +package it.pagopa.pn.papertracker.model.sequence; + +import java.util.Map; +import java.util.Set; + +public record SequenceConfig( + Set sequenceStatusCodes, + Set requiredStatusCodes, + Set dateValidationGroupForFinalEvents, + Set dateValidationGroupForStockEvents, + Set requiredAttachments, + Map> validAttachments +) {} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfiguration.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfiguration.java new file mode 100644 index 000000000..d95fdfff6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/model/sequence/SequenceConfiguration.java @@ -0,0 +1,90 @@ +package it.pagopa.pn.papertracker.model.sequence; + +import java.util.*; +import java.util.stream.Collectors; + +public class SequenceConfiguration { + + private static final Map CONFIGS = new HashMap<>(); + + static { + for (RequiredSequenceStatusCodes seq : RequiredSequenceStatusCodes.values()) { + String key = seq.name(); + Set finalEventsDateValidation = getFinalEvents(key); + Set requiredStatusCodes = getRequiredStatusCodes(seq.getStatusCodeSequence()); + Set sequenceStatusCodes = getSequenceStatusCodes(seq.getStatusCodeSequence()); + Set stockEventsDateValidation = getStockEvents(key); + Set requiredAttachments = getRequiredAttachments(sequenceStatusCodes); + Map> validAttachments = getValidAttachments(sequenceStatusCodes); + CONFIGS.put(key, new SequenceConfig(sequenceStatusCodes, + requiredStatusCodes, finalEventsDateValidation, + stockEventsDateValidation, requiredAttachments, validAttachments)); + } + } + + private static Set getSequenceStatusCodes(Set statusCodeSequence) { + return statusCodeSequence.stream() + .map(code -> code.replace("?","")) + .collect(Collectors.toSet()); + } + + private static Set getRequiredStatusCodes(Set statusCodeSequence) { + return statusCodeSequence.stream() + .filter(code -> !code.contains("?")) + .map(code -> code.contains(";") ? code.split(";")[0] : code) + .collect(Collectors.toSet()); + } + + public static Set getRequiredAttachments(Set sequenceStatusCodes) { + return sequenceStatusCodes.stream() + .map(statusCode -> Optional.ofNullable(SequenceAttachments.getFromKey(statusCode)) + .map(SequenceAttachments::getAttachments) + .orElse(Set.of())) + .flatMap(Set::stream) + .collect(Collectors.toSet()) + .stream() + .filter(attachment -> !attachment.contains("?")) + .collect(Collectors.toSet()); + + } + + private static Map> getValidAttachments(Set sequenceStatusCodes) { + Map> map = new HashMap<>(); + sequenceStatusCodes.forEach(statusCode -> Optional.ofNullable(SequenceAttachments.getFromKey(statusCode)) + .map(SequenceAttachments::getAttachments) + .map(SequenceConfiguration::getAllValidAttachments) + .map(attachments -> map.put(statusCode, attachments))); + return map; + } + + private static Set getAllValidAttachments(Set attachments) { + return attachments.stream() + .map(attachment -> attachment.replace("?","")) + .collect(Collectors.toSet()); + } + + public static SequenceConfig getConfig(String key) { + SequenceConfig config = CONFIGS.get(key); + if (config == null) { + throw new IllegalArgumentException("No configuration found for: " + key); + } + return config; + } + + + private static Set getFinalEvents(String key) { + return Arrays.stream(DateValidationGroup.values()) + .filter(e -> e.name().equalsIgnoreCase(key)) + .findFirst() + .map(DateValidationGroup::getFinalEventDateValidationGroup) + .orElse(Set.of()); + } + + private static Set getStockEvents(String key) { + return Arrays.stream(DateValidationGroup.values()) + .filter(e -> e.name().equalsIgnoreCase(key)) + .findFirst() + .map(DateValidationGroup::getStockEventsDateValidationGroup) + .orElse(Set.of()); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/NotificationReworkController.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/NotificationReworkController.java new file mode 100644 index 000000000..1526905f7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/NotificationReworkController.java @@ -0,0 +1,31 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.api.NotificationReworkApi; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceResponse; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +@RestController +@Slf4j +@RequiredArgsConstructor +public class NotificationReworkController implements NotificationReworkApi { + + private final NotificationReworkService notificationReworkService; + + @Override + public Mono> retrieveSequenceAndFinalStatus(String statusCode, String productType, String deliveryFailureCause, final ServerWebExchange exchange) { + return notificationReworkService.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause, productType) + .map(ResponseEntity::ok); + } + + @Override + public Mono> initNotificationRework(String reworkId, String trackingId, final ServerWebExchange exchange) { + return notificationReworkService.updatePaperTrackingsStatusForRework(trackingId, reworkId) + .thenReturn(ResponseEntity.status(HttpStatus.NO_CONTENT).build()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorController.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorController.java new file mode 100644 index 000000000..e2cafdfba --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorController.java @@ -0,0 +1,27 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.api.PaperTrackerErrorApi; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@RestController +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerErrorController implements PaperTrackerErrorApi { + + private final PaperTrackerErrorService paperTrackerErrorService; + + @Override + public Mono> retrieveTrackingErrors(Mono trackingsRequest, final ServerWebExchange exchange) { + return trackingsRequest + .flatMap(paperTrackerErrorService::retrieveTrackingErrors) + .map(ResponseEntity::ok); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputController.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputController.java new file mode 100644 index 000000000..ccc08cb62 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputController.java @@ -0,0 +1,27 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.api.PaperTrackerOutputApi; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.service.PaperTrackerOutputService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@RestController +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerOutputController implements PaperTrackerOutputApi { + + private final PaperTrackerOutputService paperTrackerOutputService; + + @Override + public Mono> retrieveTrackingOutputs(Mono trackingsRequest, final ServerWebExchange exchange) { + return trackingsRequest + .flatMap(paperTrackerOutputService::retrieveTrackingOutputs) + .map(ResponseEntity::ok); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingController.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingController.java new file mode 100644 index 000000000..e166ff1e2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingController.java @@ -0,0 +1,53 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerConflictException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.api.PaperTrackerTrackingApi; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsResponse; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; + +@RestController +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerTrackingController implements PaperTrackerTrackingApi { + + private final PaperTrackerTrackingService paperTrackerEventService; + + /** + * Api chiamata da pn-paper-channel per inizializzare l'oggetto PaperTrackings. + *

+ * Riceve una richiesta con i dati da salvare, la elabora tramite il servizio + * {@code paperTrackerEventService} e restituisce una risposta HTTP 201 (CREATED) se l'operazione ha successo. + * + * @param trackingCreationRequest richiesta con i dati da salvare + * @return status HTTP + */ + @Override + public Mono> initTracking(Mono trackingCreationRequest, String xOriginClientId, final ServerWebExchange exchange) { + return trackingCreationRequest + .flatMap(trackingRequest -> paperTrackerEventService.insertPaperTrackings(trackingRequest, xOriginClientId)) + .thenReturn(ResponseEntity.status(HttpStatus.CREATED).build()) + .onErrorResume(PnPaperTrackerConflictException.class, ex -> + Mono.just(ResponseEntity.status(HttpStatus.NO_CONTENT).build())); + } + + @Override + public Mono> retrieveTrackings(Mono trackingsRequest, ServerWebExchange exchange) { + return trackingsRequest.flatMap(paperTrackerEventService::retrieveTrackings) + .map(ResponseEntity::ok); + } + + @Override + public Mono> retrieveTrackingsByAttemptId(String attemptId, String pcRetry, final ServerWebExchange exchange) { + return paperTrackerEventService.retrieveTrackingsByAttemptId(attemptId, pcRetry) + .map(ResponseEntity::ok); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/NotificationReworkService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/NotificationReworkService.java new file mode 100644 index 000000000..bec37a5ce --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/NotificationReworkService.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.service; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceResponse; +import reactor.core.publisher.Mono; + +public interface NotificationReworkService { + + Mono retrieveSequenceAndEventStatus(String statusCode, String deliveryFailureCause, String productType); + + Mono updatePaperTrackingsStatusForRework(String trackingId, String reworkId); + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerErrorService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerErrorService.java new file mode 100644 index 000000000..4aff1da37 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerErrorService.java @@ -0,0 +1,14 @@ +package it.pagopa.pn.papertracker.service; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import reactor.core.publisher.Mono; + +public interface PaperTrackerErrorService { + + Mono retrieveTrackingErrors(TrackingsRequest trackingsRequest); + + Mono insertPaperTrackingsError(PaperTrackingsErrors paperTrackingsErrors); + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerOutputService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerOutputService.java new file mode 100644 index 000000000..08f7b0b3c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerOutputService.java @@ -0,0 +1,10 @@ +package it.pagopa.pn.papertracker.service; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import reactor.core.publisher.Mono; + +public interface PaperTrackerOutputService { + + Mono retrieveTrackingOutputs(TrackingsRequest trackingsRequest); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerTrackingService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerTrackingService.java new file mode 100644 index 000000000..b753b995d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/PaperTrackerTrackingService.java @@ -0,0 +1,19 @@ +package it.pagopa.pn.papertracker.service; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsResponse; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import reactor.core.publisher.Mono; + +public interface PaperTrackerTrackingService { + + Mono insertPaperTrackings(TrackingCreationRequest trackingCreationRequest, String xOriginClientId); + + Mono retrieveTrackings(TrackingsRequest trackingsRequest); + + Mono updatePaperTrackingsStatus(String trackingId, PaperTrackings paperTrackings); + + Mono retrieveTrackingsByAttemptId(String attemptId, String pcRetry); + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/SourceQueueProxyService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/SourceQueueProxyService.java new file mode 100644 index 000000000..bcd127b37 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/SourceQueueProxyService.java @@ -0,0 +1,13 @@ +package it.pagopa.pn.papertracker.service; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; + +public interface SourceQueueProxyService { + + Mono handleExternalChannelMessage(SingleStatusUpdate message, Map messageAttributes); + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/DematValidatorAr.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/DematValidatorAr.java new file mode 100644 index 000000000..8d6e320bb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/DematValidatorAr.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericDematValidator; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DematValidatorAr extends GenericDematValidator implements HandlerStep { + + public DematValidatorAr(OcrUtility ocrUtility, PaperTrackerErrorService paperTrackerErrorService) { + super(ocrUtility, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderAr.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderAr.java new file mode 100644 index 000000000..9c5feca14 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderAr.java @@ -0,0 +1,260 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.mapper.SendEventMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericFinalEventBuilder; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.time.*; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Map; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; + +@Component +@Slf4j +public class FinalEventBuilderAr extends GenericFinalEventBuilder implements HandlerStep { + + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + private final PaperTrackingsDAO paperTrackingsDAO; + + public FinalEventBuilderAr(PnPaperTrackerConfigs pnPaperTrackerConfigs, DataVaultClient dataVaultClient, PaperTrackingsDAO paperTrackingsDAO) { + super(dataVaultClient, paperTrackingsDAO); + this.pnPaperTrackerConfigs = pnPaperTrackerConfigs; + this.paperTrackingsDAO = paperTrackingsDAO; + } + + /** + * Step che elabora l'evento finale in base alla logica di business definita. + * Se l'evento finale non è uno stato di giacenza, viene semplicemente aggiunto alla lista degli eventi da inviare. + * Se l'evento finale è uno stato di giacenza, viene verificata la differenza tra le date degli eventi RECRN010 e RECRN00XA. + * In base a questa differenza e alla configurazione, viene deciso se aggiungere l'evento finale e un evento PNRN012 alla lista degli eventi da inviare, + * oppure se lanciare un'eccezione in caso di errore di giacenza. + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing FinalEventBuilderAr step for trackingId: {}", context.getTrackingId()); + + return Mono.just(TrackerUtility.extractEventFromContext(context)) + .doOnNext(event -> context.setFinalStatusCode(event.getStatusCode())) + .flatMap(event -> handleFinalEvent(context, event)) + .thenReturn(context) + .map(ctx -> paperTrackingsDAO.updateItem(ctx.getPaperTrackings().getTrackingId(), getPaperTrackingsToUpdate())) + .then(); + } + + private Mono handleFinalEvent(HandlerContext context, Event finalEvent) { + PaperTrackings paperTrackings = context.getPaperTrackings(); + String statusCode = finalEvent.getStatusCode(); + if (!isStockStatus(statusCode)) { + String eventStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECRN002C.name(), statusCode, context.getPaperTrackings()).name(); + return addEventToSend(context, finalEvent, eventStatus); + } + + List validatedEvents = TrackerUtility.validatedEvents( + paperTrackings.getPaperStatus().getValidatedEvents(), + paperTrackings.getEvents() + ); + EventStatusCodeEnum configEnum = getRECRN00XA(statusCode); + Event eventRECRN00XA = getEvent(validatedEvents, configEnum); + Event eventRECRN010 = getEvent(validatedEvents, RECRN010); + + boolean differenceGreater = isDifferenceGreater(statusCode, eventRECRN010, eventRECRN00XA); + return differenceGreater + ? prepareFinalEventAndPNRN012toSend(context, finalEvent, eventRECRN010) + : handleNoDifferenceGreater(context, paperTrackings, statusCode, finalEvent, eventRECRN00XA, eventRECRN010); + } + + private Mono handleNoDifferenceGreater(HandlerContext context, + PaperTrackings paperTrackings, + String statusCode, + Event finalEvent, + Event eventRECRN00XA, + Event eventRECRN010) { + if (RECRN005C.name().equals(statusCode)) { + log.error("The difference between RECRN005A and RECRN010 is greater than the configured duration, throwing exception"); + return Mono.error(new PnPaperTrackerValidationException( + "The difference between RECRN005A and RECRN010 is greater than the configured duration", + PaperTrackingsErrorsMapper.buildPaperTrackingsError(paperTrackings, finalEvent.getStatusCode(), ErrorCategory.RENDICONTAZIONE_SCARTATA, ErrorCause.GIACENZA_DATE_ERROR, + String.format("RECRN005A getStatusTimestamp: %s, RECRN010 getStatusTimestamp: %s", eventRECRN00XA.getStatusTimestamp(), eventRECRN010.getStatusTimestamp()), + Map.of("recrn005aTimestamp", eventRECRN00XA.getStatusTimestamp().toString(), + "recrn010Timestamp", eventRECRN010.getStatusTimestamp().toString() + ), + FlowThrow.FINAL_EVENT_BUILDING, ErrorType.ERROR, finalEvent.getId()))); + } + return addEventToSend(context, finalEvent, EventStatusCodeEnum.fromKey(statusCode).getStatus().name()); + } + + private boolean isStockStatus(String status) { + return RECRN003C.name().equals(status) || + RECRN004C.name().equals(status) || + RECRN005C.name().equals(status); + } + + private boolean isDifferenceGreater(String statusCode, Event eventRECRN010, Event eventRECRN00XA) { + return RECRN005C.name().equals(statusCode) + ? isDifferenceGreaterOrEqualToStockDuration(eventRECRN010.getStatusTimestamp(), eventRECRN00XA.getStatusTimestamp()) + : isDifferenceGreaterRefinementDuration(eventRECRN010.getStatusTimestamp(), eventRECRN00XA.getStatusTimestamp()); + } + + private EventStatusCodeEnum getRECRN00XA(String statusCode) { + final String status = statusCode.substring(0, statusCode.length() - 1).concat("A"); + return EventStatusCodeEnum.fromKey(status); + } + + private Mono prepareFinalEventAndPNRN012toSend(HandlerContext context, Event finalEvent, Event recrn010) { + OffsetDateTime pnrn012Time = addDurationToInstant(recrn010.getStatusTimestamp(), pnPaperTrackerConfigs.getRefinementDuration()).atOffset(ZoneOffset.UTC); + + return SendEventMapper.createSendEventsFromEventEntity(context.getTrackingId(), finalEvent, StatusCodeEnum.OK, PNRN012.name(), pnrn012Time) + .doOnNext(context.getEventsToSend()::add) + .flatMap(se -> buildSendEvent(context, finalEvent, StatusCodeEnum.PROGRESS, finalEvent.getStatusCode(), finalEvent.getStatusTimestamp().atOffset(ZoneOffset.UTC))) + .doOnNext(context.getEventsToSend()::add) + .then(); + } + + private Event getEvent(List events, EventStatusCodeEnum code) { + return events.stream() + .filter(e -> code.name().equals(e.getStatusCode())) + .findFirst() + .orElseThrow(); + } + + /** + * Calculates the temporal distance between two {@link Instant}s according to the + * “truncate‑to‑date” settings. + * + *

Behaviour

+ *
    + *
  • Date‑based mode – If + * {@link it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs#isEnableTruncatedDateForRefinementCheck()} + * returns {@code true}, each instant is first converted to the civil date in the {@code Europe/Rome} + * time‑zone (see {@link #toRomeDate(Instant)}). + * The method then returns a {@link Duration} equal to the number of calendar + * days between those two dates: + * {@code Duration.ofDays(…)}. Sub‑day information and daylight‑saving gaps/overlaps are + * deliberately ignored.
  • + *
  • Time‑based mode – If the flag is {@code false}, the method falls back to + * {@link Duration#between( java.time.temporal.Temporal, java.time.temporal.Temporal)} + * and preserves the full time‑of‑day component (hours, minutes, seconds, nanoseconds).
  • + *
+ * + * @param instant1 the starting instant (inclusive), must not be {@code null} + * @param instant2 the ending instant (exclusive), must not be {@code null} + * @return a {@link Duration} representing either + *
    + *
  • the exact time‑based interval between the two instants, or
  • + *
  • a whole‑days interval measured on the local calendar in Europe/Rome,
  • + *
+ * depending on the configuration flag + * + * @see #toRomeDate(Instant) + * @see Duration#between(java.time.temporal.Temporal, java.time.temporal.Temporal) + * @see it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs#isEnableTruncatedDateForRefinementCheck() + */ + protected Duration getDurationBetweenDates(Instant instant1, Instant instant2) { + LocalDate romeDate1 = toRomeDate(instant1); + LocalDate romeDate2 = toRomeDate(instant2); + Duration result = pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck() + ? Duration.ofDays(ChronoUnit.DAYS.between(romeDate1, romeDate2)) + : Duration.between(instant1, instant2); + log.info("Duration between dates i1={} i2={} result={}",instant1, instant2, result); + return result; + } + + /** + * Adds a {@link Duration} to an {@link Instant}, respecting the + * “truncate‑to‑date” setting. + * + *

+ * If {@link it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs#isEnableTruncatedDateForRefinementCheck()} + * is {@code true}, the instant is first converted to its calendar date in {@code Europe/Rome}; + * only the whole‑days part of the duration ({@link Duration#toDays()}) is applied, + * and the result is returned as the start‑of‑day {@link Instant}. + * Otherwise, the full duration is added in the usual way ({@link Instant#plus(java.time.temporal.TemporalAmount)}). + *

+ * + * @param instant the base moment + * @param duration the amount to add + * @return the adjusted {@link Instant} + */ + protected Instant addDurationToInstant(Instant instant, Duration duration) { + return pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck() + ? romeDateToInstant( + toRomeDate(instant).plusDays(duration.toDays())) + : instant.plus(duration); + } + + /** + * Checks whether the time difference between RECRN010 and RECRN00xA is + * greater than {@link it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs#getRefinementDuration()}. + * + * @param recrn010Timestamp The {@link Instant} of RECRN010. + * @param recrn00xATimestamp The {@link Instant} of RECRN00xA (e.g., RECRN003A). + * @return {@code true} if the difference is > the configured refinement duration; otherwise, {@code false}. + */ + protected boolean isDifferenceGreaterRefinementDuration ( + Instant recrn010Timestamp, + Instant recrn00xATimestamp) { + log.debug("recrn010Timestamp={}, recrn00xATimestamp={}, refinementDuration={}", + recrn010Timestamp, recrn00xATimestamp, pnPaperTrackerConfigs.getRefinementDuration()); + return getDurationBetweenDates(recrn010Timestamp, recrn00xATimestamp) + .compareTo(pnPaperTrackerConfigs.getRefinementDuration()) > 0; + } + + /** + * Checks whether the time difference between RECRN010 and RECRN005A is + * greater than or equal to {@link it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs#getCompiutaGiacenzaArDuration()}. + * + * @param recrn010Timestamp The {@link Instant} of RECRN010. + * @param recrn005ATimestamp The {@link Instant} of RECRN005A. + * @return {@code true} if the difference is ≥ the compiuta giacenza AR duration; otherwise, {@code false}. + */ + protected boolean isDifferenceGreaterOrEqualToStockDuration ( + Instant recrn010Timestamp, + Instant recrn005ATimestamp) { + log.debug("recrn010Timestamp={}, recrn005ATimestamp={}, refinementDuration={}", + recrn010Timestamp, recrn005ATimestamp, pnPaperTrackerConfigs.getCompiutaGiacenzaArDuration()); + return getDurationBetweenDates(recrn010Timestamp, recrn005ATimestamp) + .compareTo(pnPaperTrackerConfigs.getCompiutaGiacenzaArDuration()) >= 0; + } + + /** + * Converts the supplied {@link Instant} to a calendar date in the + * {@code Europe/Rome} time zone. + * + * @param instant the moment in time to convert; must not be {@code null} + * @return the corresponding {@link LocalDate} in Europe/Rome + */ + private LocalDate toRomeDate(Instant instant) { + return instant.atZone(ZoneId.of("Europe/Rome")) + .toLocalDate(); + } + + /** + * Converts the supplied {@link LocalDate} to an {@link Instant} that marks + * the start of that day (00:00) in the {@code Europe/Rome} time zone. + * + * @param date the calendar day to convert; must not be {@code null} + * @return the {@link Instant} at the start of the given day in Europe/Rome + */ + private Instant romeDateToInstant(LocalDate date) { + ZoneId rome = ZoneId.of("Europe/Rome"); + return date.atStartOfDay(rome) + .toInstant(); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryAr.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryAr.java new file mode 100644 index 000000000..f71e2c5c1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryAr.java @@ -0,0 +1,46 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class HandlersFactoryAr extends AbstractHandlersFactory { + + public HandlersFactoryAr(MetadataUpserter metadataUpserter, + CheckTrackingProduct checkTrackingProduct, + OutputTargetSender outputTargetSender, + FinalEventBuilderAr finalEventBuilder, + IntermediateEventsBuilder intermediateEventsBuilder, + DematValidatorAr dematValidator, + SequenceValidatorAr sequenceValidator, + @Qualifier("retrySender") + RetrySender retrySender, + M10RetryTrigger m10RetryTrigger, + NotRetryableErrorInserting notRetryableErrorInserting, + DuplicatedEventFiltering duplicatedEventFiltering, + CheckTrackingState checkTrackingState, + CheckOcrResponse checkOcrResponse, + RetrySenderCON996 retrySenderCON996) { + super(metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996); + } + + @Override + public ProductType getProductType() { return ProductType.AR; } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorAr.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorAr.java new file mode 100644 index 000000000..b19ffdb37 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorAr.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericSequenceValidator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class SequenceValidatorAr extends GenericSequenceValidator implements HandlerStep { + + public SequenceValidatorAr(PaperTrackingsDAO paperTrackingsDAO, PaperTrackerErrorService paperTrackerErrorService) { + super(paperTrackingsDAO, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/Handler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/Handler.java new file mode 100644 index 000000000..279e4d804 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/Handler.java @@ -0,0 +1,8 @@ +package it.pagopa.pn.papertracker.service.handler_step; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import reactor.core.publisher.Mono; + +public interface Handler { + Mono execute(HandlerContext context); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerImpl.java new file mode 100644 index 000000000..2f8887486 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerImpl.java @@ -0,0 +1,35 @@ +package it.pagopa.pn.papertracker.service.handler_step; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import lombok.AllArgsConstructor; +import lombok.CustomLog; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +@CustomLog +@AllArgsConstructor +public class HandlerImpl implements Handler { + + private final List steps; + + /** + * Metodo che data una lista di HandlerStep esegue ogni step, passando il contex per eventuali modifiche ai dati + * + * @param context HandlerContext che contiene i dati per i processi + * @return Mono Void se tutto è andato a buon fine, altrimenti Mono Error + */ + @Override + public Mono execute(HandlerContext context) { + return Flux.fromIterable(steps) + .concatMap(step -> { + if (context.isStopExecution()) { + log.debug("Requested stop execution for trackingId: {} on step: {}", context.getTrackingId(), step.getClass().getSimpleName()); + return Mono.empty(); + } + return step.execute(context); + }) + .then(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerStep.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerStep.java new file mode 100644 index 000000000..16ddc8f34 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlerStep.java @@ -0,0 +1,8 @@ +package it.pagopa.pn.papertracker.service.handler_step; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import reactor.core.publisher.Mono; + +public interface HandlerStep { + Mono execute(HandlerContext context); +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlersFactory.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlersFactory.java new file mode 100644 index 000000000..5adf1f864 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/HandlersFactory.java @@ -0,0 +1,14 @@ +package it.pagopa.pn.papertracker.service.handler_step; + +import it.pagopa.pn.papertracker.model.HandlerContext; + +public interface HandlersFactory { + + Handler buildFinalEventsHandler(HandlerContext context); + Handler buildIntermediateEventsHandler(HandlerContext context); + Handler buildRetryEventHandler(HandlerContext context); + Handler buildNotRetryableEventHandler(HandlerContext context); + Handler buildOcrResponseHandler(HandlerContext context); + Handler buildSaveOnlyEventHandler(HandlerContext context); + Handler buildCon996EventHandler(HandlerContext context); +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/DematValidatorRir.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/DematValidatorRir.java new file mode 100644 index 000000000..1b5a89ebd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/DematValidatorRir.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericDematValidator; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DematValidatorRir extends GenericDematValidator implements HandlerStep { + + public DematValidatorRir(OcrUtility ocrUtility, PaperTrackerErrorService paperTrackerErrorService) { + super(ocrUtility, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java new file mode 100644 index 000000000..cea168698 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRir.java @@ -0,0 +1,61 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericFinalEventBuilder; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRI004C; + + +@Component +@Slf4j +public class FinalEventBuilderRir extends GenericFinalEventBuilder implements HandlerStep { + + /** + * Step che elabora l'evento finale per una raccomandata RIR in base alla logica di business definita. + * Se l'evento che ha innescato il flusso è un evento finale, viene estratto l'evento dal contesto, + * viene valutato lo status code e determinato lo stato dell'evento secondo le regole di business. + * Infine, l'evento viene aggiunto alla lista degli eventi da inviare. + * Viene utilizzato il metodo di utility evaluateStatusCodeAndRetrieveStatus perché tutti i casi non gestiti esplicitamente (M01, M03, M04) + * e il caso della deliveryFailureCause = null ricadono comunque nel ramo di default, che restituisce il valore KO previsto dall’enum. + * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono + */ + + private final PaperTrackingsDAO paperTrackingsDAO; + + public FinalEventBuilderRir(DataVaultClient dataVaultClient, PaperTrackingsDAO paperTrackingsDAO) { + super(dataVaultClient, paperTrackingsDAO); + this.paperTrackingsDAO = paperTrackingsDAO; + } + + @Override + public Mono execute(HandlerContext context) { + log.info("Executing FinalEventBuilderRir for trackingId: {}", context.getTrackingId()); + + return Mono.just(TrackerUtility.extractEventFromContext(context)) + .doOnNext(event -> context.setFinalStatusCode(event.getStatusCode())) + .flatMap(event -> handleFinalEvent(context, event)) + .thenReturn(context) + .map(ctx -> paperTrackingsDAO.updateItem(ctx.getPaperTrackings().getTrackingId(), getPaperTrackingsToUpdate())) + .then(); + } + + private Mono handleFinalEvent(HandlerContext context, Event finalEvent) { + String statusCode = finalEvent.getStatusCode(); + if (RECRI004C.name().equals(statusCode)) { + String eventStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECRI004C.name(), statusCode, context.getPaperTrackings()).name(); + return addEventToSend(context, finalEvent, eventStatus); + } + return addEventToSend(context, finalEvent, EventStatusCodeEnum.fromKey(statusCode).getStatus().name()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRir.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRir.java new file mode 100644 index 000000000..3b29f4cb9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRir.java @@ -0,0 +1,47 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.service.handler_step.generic.NotRetryableErrorInserting; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class HandlersFactoryRir extends AbstractHandlersFactory { + + public HandlersFactoryRir(MetadataUpserter metadataUpserter, + CheckTrackingProduct checkTrackingProduct, + OutputTargetSender outputTargetSender, + FinalEventBuilderRir finalEventBuilder, + IntermediateEventsBuilder intermediateEventsBuilder, + DematValidatorRir dematValidator, + SequenceValidatorRir sequenceValidator, + @Qualifier("retrySender") + RetrySender retrySender, + M10RetryTrigger m10RetryTrigger, + NotRetryableErrorInserting notRetryableErrorInserting, + DuplicatedEventFiltering duplicatedEventFiltering, + CheckTrackingState checkTrackingState, + CheckOcrResponse checkOcrResponse, + RetrySenderCON996 retrySenderCON996) { + super(metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996); + } + + @Override + public ProductType getProductType() { return ProductType.RIR; } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java new file mode 100644 index 000000000..5c29fe0c2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRir.java @@ -0,0 +1,61 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.model.DeliveryFailureCauseEnum; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericSequenceValidator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static it.pagopa.pn.papertracker.utils.TrackerUtility.idRECRI004XEvent; + +@Component +@Slf4j +public class SequenceValidatorRir extends GenericSequenceValidator implements HandlerStep { + + public SequenceValidatorRir(PaperTrackingsDAO paperTrackingsDAO, PaperTrackerErrorService paperTrackerErrorService) { + super(paperTrackingsDAO, paperTrackerErrorService); + } + + @Override + protected Mono> validateDeliveryFailureCause(List events, PaperTrackings paperTrackings, HandlerContext context, Boolean strictFinalEventValidation) { + log.info("Beginning validation for delivery failure cause for events : {}", events); + return Flux.fromIterable(events) + .flatMap(event -> { + EventStatusCodeEnum statusCodeEnum = EventStatusCodeEnum.fromKey(event.getStatusCode()); + List allowedCauses = statusCodeEnum.getDeliveryFailureCauseList(); + if(idRECRI004XEvent(event) && !StringUtils.hasText(event.getDeliveryFailureCause())){ + return Mono.empty(); + }else { + return super.checkPresenceOfCause(event, context, paperTrackings, allowedCauses, strictFinalEventValidation); + } + }) + .flatMap(event -> { + EventStatusCodeEnum statusCodeEnum = EventStatusCodeEnum.fromKey(event.getStatusCode()); + List allowedCauses = statusCodeEnum.getDeliveryFailureCauseList(); + return super.checkIfIsValidCause(context, paperTrackings, strictFinalEventValidation, allowedCauses, event) + .flatMap(unused -> { + if(idRECRI004XEvent(event) && !StringUtils.hasText(event.getDeliveryFailureCause())){ + return Mono.empty(); + } + return super.checkIfStrictValidation(context, paperTrackings, strictFinalEventValidation, allowedCauses, event); + }); + }) + .filter(event -> StringUtils.hasText(event.getDeliveryFailureCause())) + .collectList() + .filter(filteredEvents -> !CollectionUtils.isEmpty(filteredEvents)) + .flatMap(filteredEvents -> super.allDeliveryFailureCauseAreEquals(context, paperTrackings, strictFinalEventValidation, filteredEvents)) + .thenReturn(events); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRis.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRis.java new file mode 100644 index 000000000..882282d50 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRis.java @@ -0,0 +1,31 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericDematValidator; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRSI003C; + +@Component +@Slf4j +public class DematValidatorRis extends GenericDematValidator implements HandlerStep { + public DematValidatorRis(OcrUtility ocrUtility, PaperTrackerErrorService paperTrackerErrorService) { + super(ocrUtility, paperTrackerErrorService); + } + + @Override + public Mono execute(HandlerContext context) { + log.info("Starting DematValidatorRis execution for trackingId={}", context.getTrackingId()); + String statusCode = context.getPaperProgressStatusEvent().getStatusCode(); + if (RECRSI003C.name().equals(statusCode)) { + log.info("StatusCode excluded from validateDemat: {}", statusCode); + return Mono.empty(); + } + return validateDemat(context); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/FinalEventBuilderRis.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/FinalEventBuilderRis.java new file mode 100644 index 000000000..2fcb656ed --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/FinalEventBuilderRis.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericFinalEventBuilder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class FinalEventBuilderRis extends GenericFinalEventBuilder implements HandlerStep { + + public FinalEventBuilderRis(DataVaultClient dataVaultClient, PaperTrackingsDAO paperTrackingsDAO) { + super(dataVaultClient, paperTrackingsDAO); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRis.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRis.java new file mode 100644 index 000000000..28c86b2ac --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRis.java @@ -0,0 +1,44 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +public class HandlersFactoryRis extends AbstractHandlersFactory { + + public HandlersFactoryRis(MetadataUpserter metadataUpserter, + CheckTrackingProduct checkTrackingProduct, + OutputTargetSender outputTargetSender, + FinalEventBuilderRis finalEventBuilder, + IntermediateEventsBuilder intermediateEventsBuilder, + DematValidatorRis dematValidator, + SequenceValidatorRis sequenceValidator, + @Qualifier("retrySender") + RetrySender retrySender, + M10RetryTrigger m10RetryTrigger, + NotRetryableErrorInserting notRetryableErrorInserting, + DuplicatedEventFiltering duplicatedEventFiltering, + CheckTrackingState checkTrackingState, + CheckOcrResponse checkOcrResponse, + RetrySenderCON996 retrySenderCON996) { + super(metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996); + } + + @Override + public ProductType getProductType() { return ProductType.RIS; } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/SequenceValidatorRis.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/SequenceValidatorRis.java new file mode 100644 index 000000000..abda3b318 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RIS/SequenceValidatorRis.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericSequenceValidator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class SequenceValidatorRis extends GenericSequenceValidator implements HandlerStep { + + public SequenceValidatorRis(PaperTrackingsDAO paperTrackingsDAO, PaperTrackerErrorService paperTrackerErrorService) { + super(paperTrackingsDAO, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRs.java new file mode 100644 index 000000000..fdb300a00 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRs.java @@ -0,0 +1,33 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericDematValidator; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRS001C; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRS003C; + +@Component +@Slf4j +public class DematValidatorRs extends GenericDematValidator implements HandlerStep { + + public DematValidatorRs(OcrUtility ocrUtility, PaperTrackerErrorService paperTrackerErrorService) { + super(ocrUtility, paperTrackerErrorService); + } + + @Override + public Mono execute(HandlerContext context) { + log.info("Starting DematValidatorRs execution for trackingId={}", context.getTrackingId()); + String statusCode = context.getPaperProgressStatusEvent().getStatusCode(); + if (RECRS001C.name().equals(statusCode) || RECRS003C.name().equals(statusCode)) { + log.info("StatusCode excluded from validateDemat: {}", statusCode); + return Mono.empty(); + } + return validateDemat(context); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/FinalEventBuilderRs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/FinalEventBuilderRs.java new file mode 100644 index 000000000..fd4c349b3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/FinalEventBuilderRs.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericFinalEventBuilder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class FinalEventBuilderRs extends GenericFinalEventBuilder implements HandlerStep { + + public FinalEventBuilderRs(DataVaultClient dataVaultClient, PaperTrackingsDAO paperTrackingsDAO) { + super(dataVaultClient, paperTrackingsDAO); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRs.java new file mode 100644 index 000000000..bfca1c4c5 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRs.java @@ -0,0 +1,44 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +public class HandlersFactoryRs extends AbstractHandlersFactory { + + public HandlersFactoryRs(MetadataUpserter metadataUpserter, + CheckTrackingProduct checkTrackingProduct, + OutputTargetSender outputTargetSender, + FinalEventBuilderRs finalEventBuilder, + IntermediateEventsBuilder intermediateEventsBuilder, + DematValidatorRs dematValidator, + SequenceValidatorRs sequenceValidator, + @Qualifier("retrySender") + RetrySender retrySender, + M10RetryTrigger m10RetryTrigger, + NotRetryableErrorInserting notRetryableErrorInserting, + DuplicatedEventFiltering duplicatedEventFiltering, + CheckTrackingState checkTrackingState, + CheckOcrResponse checkOcrResponse, + RetrySenderCON996 retrySenderCON996) { + super(metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996); + } + + @Override + public ProductType getProductType() { return ProductType.RS; } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/SequenceValidatorRs.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/SequenceValidatorRs.java new file mode 100644 index 000000000..5e452e666 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/RS/SequenceValidatorRs.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericSequenceValidator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class SequenceValidatorRs extends GenericSequenceValidator implements HandlerStep { + + public SequenceValidatorRs(PaperTrackingsDAO paperTrackingsDAO, PaperTrackerErrorService paperTrackerErrorService) { + super(paperTrackingsDAO, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/DematValidator890.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/DematValidator890.java new file mode 100644 index 000000000..93926c375 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/DematValidator890.java @@ -0,0 +1,17 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericDematValidator; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DematValidator890 extends GenericDematValidator implements HandlerStep { + + public DematValidator890(OcrUtility ocrUtility, PaperTrackerErrorService paperTrackerErrorService) { + super(ocrUtility, paperTrackerErrorService); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890.java new file mode 100644 index 000000000..3142f7ef9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890.java @@ -0,0 +1,52 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericFinalEventBuilder; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG003C; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012; + +@Component +@Slf4j +public class FinalEventBuilder890 extends GenericFinalEventBuilder implements HandlerStep { + + private final PaperTrackingsDAO paperTrackingsDAO; + + public FinalEventBuilder890(DataVaultClient dataVaultClient, PaperTrackingsDAO paperTrackingsDAO) { + super(dataVaultClient, paperTrackingsDAO); + this.paperTrackingsDAO = paperTrackingsDAO; + } + + /** + * Step che elabora l'evento finale (890) in base alla logica di business definita. + * Se l'evento che ha innescato il flusso è il RECAG012, non viene eseguita alcuna azione e si passa allo step successivo. + * Questo scenario può presentarsi solo nell'handler dedicato alle response dell OCR + * Se l'evento che ha innescato il flusso è un evento finale, viene estratto l'evento finale dal contesto, + * viene valutato lo status code e viene determinato lo stato dell'evento. + * Infine, l'evento viene aggiunto alla lista degli eventi da inviare. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("FinalEventBuilder890 execute for trackingId: {}", context.getTrackingId()); + Event finalEvent = TrackerUtility.extractEventFromContext(context); + if(finalEvent.getStatusCode().equalsIgnoreCase(RECAG012.name())){ + return Mono.empty(); + } + context.setFinalStatusCode(finalEvent.getStatusCode()); + String statusCode = finalEvent.getStatusCode(); + String eventStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECAG003C.name(), statusCode, context.getPaperTrackings()).name(); + return addEventToSend(context, finalEvent, eventStatus) + .thenReturn(finalEvent) + .map(sendEvent -> paperTrackingsDAO.updateItem(context.getPaperTrackings().getTrackingId(), getPaperTrackingsToUpdate())) + .then(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890.java new file mode 100644 index 000000000..37338db48 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890.java @@ -0,0 +1,121 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.Handler; +import it.pagopa.pn.papertracker.service.handler_step.HandlerImpl; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.function.Function; + +@Component +@Slf4j +public class HandlersFactory890 extends AbstractHandlersFactory { + + private final RECAG012EventChecker recag012EventChecker; + private final RECAG012EventBuilder recag012EventBuilder; + private final PendingFinalEventTrigger pendingFinalEventTrigger; + + public HandlersFactory890( + MetadataUpserter metadataUpserter, + CheckTrackingProduct checkTrackingProduct, + OutputTargetSender outputTargetSender, + FinalEventBuilder890 finalEventBuilder, + IntermediateEventsBuilder intermediateEventsBuilder, + DematValidator890 dematValidator, + SequenceValidator890 sequenceValidator, + @Qualifier("retrySender") + RetrySender retrySender, + M10RetryTrigger m10RetryTrigger, + NotRetryableErrorInserting notRetryableErrorInserting, + DuplicatedEventFiltering duplicatedEventFiltering, + CheckTrackingState checkTrackingState, + CheckOcrResponse checkOcrResponse, + RetrySenderCON996 retrySenderCON996, + RECAG012EventChecker recag012EventChecker, + RECAG012EventBuilder recag012EventBuilder, + PendingFinalEventTrigger pendingFinalEventTrigger + ) { + super( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996 + ); + this.recag012EventChecker = recag012EventChecker; + this.recag012EventBuilder = recag012EventBuilder; + this.pendingFinalEventTrigger = pendingFinalEventTrigger; + } + + + @Override + public ProductType getProductType() { + return ProductType._890; + } + + @Override + public Function getDispatcher(EventTypeEnum eventType) { + return switch (eventType) { + case STOCK_INTERMEDIATE_EVENT -> this::buildStockIntermediateEventHandler; + case RECAG012_EVENT -> this::buildRecag012EventHandler; + case OCR_RESPONSE_EVENT -> this::buildOcrResponseHandler890; + default -> super.getDispatcher(eventType); + }; + } + + public Handler buildStockIntermediateEventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingState, + duplicatedEventFiltering, + recag012EventChecker, + intermediateEventsBuilder, + recag012EventBuilder, + outputTargetSender + )); + } + + public Handler buildRecag012EventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingState, + duplicatedEventFiltering, + recag012EventChecker, + recag012EventBuilder, + outputTargetSender + )); + } + + public Handler buildOcrResponseHandler890(HandlerContext context) { + return new HandlerImpl( + List.of( + checkOcrResponse, + finalEventBuilder, + m10RetryTrigger, + recag012EventBuilder, + outputTargetSender, + pendingFinalEventTrigger, + sequenceValidator, + dematValidator, + finalEventBuilder, + outputTargetSender + )); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/PendingFinalEventTrigger.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/PendingFinalEventTrigger.java new file mode 100644 index 000000000..a19d88cda --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/PendingFinalEventTrigger.java @@ -0,0 +1,34 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.BusinessState; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012; + +@Component +@RequiredArgsConstructor +@Slf4j +public class PendingFinalEventTrigger implements HandlerStep { + + @Override + public Mono execute(HandlerContext context) { + log.info("PendingFinalEventTrigger executed for trackingId: {}", context.getTrackingId()); + Event event = TrackerUtility.extractEventFromContext(context); + if(RECAG012.name().equalsIgnoreCase(event.getStatusCode()) && context.getPaperTrackings().getBusinessState().equals(BusinessState.AWAITING_REFINEMENT_OCR)) { + context.setEventId(context.getPaperTrackings().getPendingFinalEventId()); + context.setEventsToSend(new ArrayList<>()); + }else{ + context.setStopExecution(true); + } + return Mono.empty(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilder.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilder.java new file mode 100644 index 000000000..6eb5a365a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilder.java @@ -0,0 +1,182 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.mapper.SendEventMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.time.ZoneOffset; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012A; + +/** + * Questo step viene invocato dai seguenti handler: + * - StockIntermediateEventHandler (RECAG011B, RECAG005B, RECAG006B, RECAG007B, RECAG008B) + * - Recag012EventHandler (RECAG012) + * - OcrResponseHandler890 (RECAG012, RECAG001C, RECAG002C, RECAG003C, + * RECAG003F, RECAG005C, RECAG006C, RECAG007C, RECAG008C) + * + * Regole di esclusione: + * Lo step non esegue alcuna azione se: + * - Il tracking è già in stato DONE + * - L’evento corrente è di tipo FINAL_EVENT + * (RECAG001C, RECAG002C, RECAG003C, RECAG003F, + * RECAG005C, RECAG006C, RECAG007C, RECAG008C) + * + * Gestione RECAG012A: + * Il flag needToSendRECAG012A viene valorizzato a monte ed è TRUE se e solo se: + * - Non sono arrivati tutti gli allegati obbligatori al refinement ma è arrivato il RECAG012 + * - L’handler chiamante non è OcrResponseHandler890 + * + * Se il flag è TRUE: + * - Viene inviato RECAG012A (status PROGRESS) solo se l’evento corrente è RECAG012 + * - Negli altri casi il flusso termina + * + * Gestione RECAG012 (flusso principale): + * + * Se needToSendRECAG012A è FALSE si distinguono due macro-scenari: + * + * 1) OCR DISABLED o DRY + * - Se l’evento corrente è RECAG012 viene inviato RECAG012 + * - Se l’evento corrente è diverso viene inviato RECAG012 + * utilizzando l’evento RECAG012 solo se già presente nel tracking + * + * 2) OCR RUN + * - Se l’evento corrente è RECAG012 e tutte le risposte OCR + * relative agli allegati obbligatori sono arrivate, oppure non è previsto nessun allegato obbligatorio, + * viene inviato RECAG012 + * - Se le risposte OCR non sono complete il flusso termina + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RECAG012EventBuilder implements HandlerStep { + + + @Override + public Mono execute(HandlerContext context) { + log.info("Executing RECAG012EventBuilder step for trackingId: {}", context.getTrackingId()); + + PaperTrackings tracking = context.getPaperTrackings(); + // StatusCode dell'evento appena arrivato da pn-ec (RECAG011B o RECA00xB) + // Oppure StatusCode dell'evento inviato all'OCR (RECAG012, RECAG00xC, RECAG00xF) + Event currentEvent = TrackerUtility.getEventFromEventId(tracking, context.getEventId()); + String currentStatusCode = currentEvent.getStatusCode(); + EventStatusCodeEnum eventStatus = EventStatusCodeEnum.fromKey(currentStatusCode); + + // Filtro eventi RECAG001C, RECAG002C, RECAG003C, RECAG003F, RECAG005C, RECAG006C, RECAG007C, RECAG008C + if (tracking.getState() == PaperTrackingsState.DONE || eventStatus.getCodeType() == EventTypeEnum.FINAL_EVENT) { + log.info("Skip RECAG012 build for trackingId={} (state={}, status={})", context.getTrackingId(), tracking.getState(), currentStatusCode); + return Mono.empty(); + } + + boolean isRecag012 = RECAG012.name().equalsIgnoreCase(currentStatusCode); + boolean ocrDisabled = isOcrDisabledOrDry(tracking); + boolean allOcrCompleted = TrackerUtility.isOcrResponseCompleted(context, RECAG012.name()); + + // isNeedToSendRECAG012A true se è arrivato RECAG012 e non ci sono tutti gli allegati + // false se il RECAG012 non è ancora arrivato + // false se il RECAG012 è arrivato e ci sono tutti gli allegati + if (context.isNeedToSendRECAG012A()) { + return isRecag012 ? sendRecag012A(context) : Mono.empty(); + } + + Event recag012Event = findExistingRecag012(context.getPaperTrackings()); + + if(recag012Event == null){ + log.info("Skip RECAG012 build, RECAG012 not found in events"); + return Mono.empty(); + } + + // Da qui in poi è arrivato il RECAG012 e ci sono tutti gli allegati required + + // OCR DISABLED / DRY + if (ocrDisabled) { + return sendRecag012(context, recag012Event); + } + + // OCR RUN + if (allOcrCompleted) { + log.info("Check OCR responses completed: OCR RUN"); + return sendRecag012(context, recag012Event); + } + + log.info("Skip RECAG012 build"); + return Mono.empty(); + } + + private boolean isOcrDisabledOrDry(PaperTrackings tracking) { + OcrStatusEnum status = tracking.getValidationConfig().getOcrEnabled(); + return OcrStatusEnum.DISABLED.equals(status) || OcrStatusEnum.DRY.equals(status); + } + + private Mono sendRecag012(HandlerContext context, Event recag012Event) { + + return SendEventMapper.createSendEventsFromEventEntity( + context.getTrackingId(), + recag012Event, + StatusCodeEnum.OK, + RECAG012.name(), + recag012Event.getStatusTimestamp().atOffset(ZoneOffset.UTC) + ) + .doOnNext(context.getEventsToSend()::add) + .doOnNext(sendEvent -> context.setFinalStatusCode(recag012Event.getStatusCode())) + .collectList() + .filter(sendEvents -> !CollectionUtils.isEmpty(sendEvents)) + .doOnNext(list -> updateContextPaperTrackings(context)) + .then(); + } + + private void updateContextPaperTrackings(HandlerContext context) { + PaperTrackings paperTrackings = context.getPaperTrackings(); + ValidationFlow validationFlow = Optional.ofNullable(paperTrackings.getValidationFlow()) + .orElse(new ValidationFlow()); + validationFlow.setRefinementDematValidationTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + paperTrackings.setState(PaperTrackingsState.DONE); + } + + private Mono sendRecag012A(HandlerContext context) { + return buildReca012aEvent(context) + .doOnNext(context.getEventsToSend()::add) + .then(); + } + + private Flux buildReca012aEvent(HandlerContext context) { + return SendEventMapper.createSendEventsFromPaperProgressStatusEvent(context.getPaperProgressStatusEvent()) + .doOnNext(event -> { + event.setStatusCode(StatusCodeEnum.PROGRESS); + event.setStatusDetail(RECAG012A.name()); + event.setStatusDescription(RECAG012A.name()); + }); + } + + private Event findExistingRecag012(PaperTrackings tracking) { + return Optional.ofNullable(tracking.getEvents()) + .orElse(List.of()) + .stream() + .filter(e -> RECAG012.name().equalsIgnoreCase(e.getStatusCode())) + .findFirst() + .orElse(null); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventChecker.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventChecker.java new file mode 100644 index 000000000..1e86dcf70 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventChecker.java @@ -0,0 +1,117 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Mono; + +import java.util.*; +import java.util.stream.Collectors; + +import static it.pagopa.pn.papertracker.utils.TrackerUtility.*; + +@Component +@RequiredArgsConstructor +@Slf4j +public class RECAG012EventChecker implements HandlerStep { + + private final OcrUtility ocrUtility; + + /** + * Step che effettua i seguenti passaggi:
+ * Verifica se tutti gli allegati richiesti sono presenti tra gli eventi salvati e che l'evento RECAG012 sia presente.
+ * Se entrambe le condizioni sono soddisfatte
+ * - imposta l'attributo refinementCondition a true nel contesto
+ * - verifica se l'OCR è abilitato:
+ * -- se abilitato, invia gli allegati necessari all'OCR e prosegue il flusso
+ * -- se non abilitato, prosegue con i successivi step
+ * Altrimenti, se una delle condizioni non è soddisfatta, il flusso prosegue con i successivi step senza ulteriori azioni.
+ * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Starting RECAG012EventChecker for trackingId {}", context.getTrackingId()); + + Optional recag012Event = findRECAG012Event(context.getPaperTrackings()); + List requiredAttachments = context.getPaperTrackings().getValidationConfig().getRequiredAttachmentsRefinementStock890(); + List ocrAttachments = context.getPaperTrackings().getValidationConfig().getSendOcrAttachmentsRefinementStock890(); + context.setNeedToSendRECAG012A(false); + + if(recag012Event.isEmpty()){ + log.info("RECAG012 event not found for trackingId {}", context.getTrackingId()); + return Mono.empty(); + } + + // Non ha tutti gli allegati richiesti al refinement ma è arrivato il RECAG012 + if (!hasRequiredAttachments(context, requiredAttachments)) { + log.info("Missing required attachments for trackingId {}", context.getTrackingId()); + context.setNeedToSendRECAG012A(true); + return Mono.empty(); + } + + if (isInvalidStateForSendToOCRInRECAG012Checker(context)) { + log.info("Tracking is in invalid state for sending to OCR for trackingId {}", context.getTrackingId()); + return Mono.empty(); + } + + PaperStatus paperStatus = context.getPaperTrackings().getPaperStatus(); + + List events = context.getPaperTrackings().getEvents(); + + List filteredEvent = events.stream() + .filter(event -> !CollectionUtils.isEmpty(event.getAttachments())) + .peek(event -> { + // Popola il registeredLetterCode perchè non presente prima del SequenceValidator890 + if (checkIfIsFinalDemat(event.getStatusCode())) + paperStatus.setRegisteredLetterCode(event.getRegisteredLetterCode()); + }) + .filter(event -> event.getAttachments().stream() + .anyMatch(attachment -> ocrAttachments.contains(attachment.getDocumentType()))) + .sorted(Comparator.comparing(Event::getCreatedAt)) + .toList(); + + Map> attachmentsToSend = getAttachmentsToSend(filteredEvent, ocrAttachments); + + return ocrUtility.checkAndSendToOcr(recag012Event.get(), attachmentsToSend, context).then(); + } + + private static Map> getAttachmentsToSend(List filteredEvent, List ocrAttachments) { + return filteredEvent.stream() + .flatMap(event -> event.getAttachments().stream() + .map(Attachment::getDocumentType) + .filter(ocrAttachments::contains) + .map(documentType -> Map.entry(documentType, event))) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (existing, replacement) -> replacement)) + .entrySet().stream() + .flatMap(entry -> { + String documentType = entry.getKey(); + Event event = entry.getValue(); + return event.getAttachments().stream() + .filter(a -> documentType.equals(a.getDocumentType())) + .map(a -> Map.entry(event.getId(), a)); + }) + .collect(Collectors.groupingBy(Map.Entry::getKey, Collectors.mapping(Map.Entry::getValue, Collectors.toList()))); + } + + private boolean hasRequiredAttachments(HandlerContext context, List requiredAttachments) { + Set documentTypes = context.getPaperTrackings().getEvents().stream() + .map(Event::getAttachments) + .filter(attachments -> !CollectionUtils.isEmpty(attachments)) + .flatMap(attachmentList -> attachmentList.stream().map(Attachment::getDocumentType)) + .collect(Collectors.toSet()); + return TrackerUtility.hasRequiredAttachmentsRefinementStock890(requiredAttachments, documentTypes); + } + + + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890.java new file mode 100644 index 000000000..ba4b0ed99 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890.java @@ -0,0 +1,127 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfig; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.GenericSequenceValidator; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Map; +import java.util.Objects; + +@Component +@Slf4j +public class SequenceValidator890 extends GenericSequenceValidator implements HandlerStep { + + private final PaperTrackingsDAO paperTrackingsDAO; + + public SequenceValidator890(PaperTrackingsDAO paperTrackingsDAO, PaperTrackerErrorService paperTrackerErrorService) { + super(paperTrackingsDAO, paperTrackerErrorService); + this.paperTrackingsDAO = paperTrackingsDAO; + } + + @Override + public Mono execute(HandlerContext context) { + log.info("SequenceValidator890 execute for trackingId: {}", context.getTrackingId()); + SequenceConfig sequenceConfig; + boolean isStock890; + if (Objects.nonNull(context.getPaperProgressStatusEvent())) { + isStock890 = TrackerUtility.isStockStatus890(context.getPaperProgressStatusEvent().getStatusCode()); + sequenceConfig = SequenceConfiguration.getConfig(context.getPaperProgressStatusEvent().getStatusCode()); + } else { + Event event = TrackerUtility.extractEventFromContext(context); + isStock890 = TrackerUtility.isStockStatus890(event.getStatusCode()); + sequenceConfig = SequenceConfiguration.getConfig(event.getStatusCode()); + + } + Boolean strictFinalValidationStock890 = context.getPaperTrackings().getValidationConfig().getStrictFinalValidationStock890(); + + return Mono.just(context.getPaperTrackings()) + .flatMap(paperTrackings -> { + if (!isStock890) { + return Mono.just(paperTrackings); + } + return checkState(context) + .filter(Boolean::booleanValue) + .map(ignored -> paperTrackings); + }) + .flatMap(paperTrackings -> validateSequence(paperTrackings, context, sequenceConfig, isStock890 ? strictFinalValidationStock890 : true)) + .doOnNext(context::setPaperTrackings) + .then(); + } + + private Mono checkState(HandlerContext context) { + PaperTrackingsState state = context.getPaperTrackings().getState(); + log.info("Current state for trackingId {}: {}", context.getTrackingId(), state); + return switch (state) { + case DONE -> Mono.just(true); + case AWAITING_REFINEMENT, AWAITING_REWORK_EVENTS -> Mono.error( new PnPaperTrackerValidationException( + "invalid AWAITING_REFINEMENT state for stock 890", + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + context.getPaperTrackings(), + context.getPaperProgressStatusEvent().getStatusCode(), + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.STOCK_890_REFINEMENT_MISSING, + "invalid AWAITING_REFINEMENT state for stock 890", + Map.of("statusCode", context.getPaperProgressStatusEvent().getStatusCode(), + "statusTimestamp", context.getPaperProgressStatusEvent().getStatusDateTime().toString() + ), + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + context.getEventId() + ) + )); + case AWAITING_OCR -> { + log.info("Awaiting OCR response for refinement, updating business state to AWAITING_REFINEMENT_OCR for trackingId: {}", context.getTrackingId()); + yield paperTrackingsDAO.updateItem(context.getTrackingId(), getPaperTrackingsToUpdate(context.getEventId())) + .doOnNext(paperTrackings -> context.setStopExecution(true)) + .thenReturn(false); + } + case KO -> Mono.error(new PnPaperTrackerValidationException( + "Refinement process reached KO state, cannot proceed with final event validation", + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + context.getPaperTrackings(), + context.getPaperProgressStatusEvent().getStatusCode(), + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.STOCK_890_REFINEMENT_ERROR, + "Refinement process reached KO state, cannot proceed with final event validation", + Map.of("statusCode", context.getPaperProgressStatusEvent().getStatusCode(), + "statusTimestamp", context.getPaperProgressStatusEvent().getStatusDateTime().toString() + ), + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + context.getEventId() + ) + )); + case AWAITING_FINAL_STATUS_CODE -> Mono.error(new PnPaperTrackerValidationException( + "Invalid state for processing stock 890 final event", + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + context.getPaperTrackings(), + context.getPaperProgressStatusEvent().getStatusCode(), + ErrorCategory.INVALID_STATE_FOR_STOCK_890, + ErrorCause.STOCK_890_REFINEMENT_ERROR, + String.format("Invalid state %s for processing stock 890 final event", state), + null, + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + context.getEventId() + ))); + }; + } + + private PaperTrackings getPaperTrackingsToUpdate(String eventId) { + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setBusinessState(BusinessState.AWAITING_REFINEMENT_OCR); + paperTrackings.setPendingFinalEventId(eventId); + return paperTrackings; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/AbstractHandlersFactory.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/AbstractHandlersFactory.java new file mode 100644 index 000000000..31ca8c918 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/AbstractHandlersFactory.java @@ -0,0 +1,224 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.Handler; +import it.pagopa.pn.papertracker.service.handler_step.HandlerImpl; +import it.pagopa.pn.papertracker.service.handler_step.HandlersFactory; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; + +@Slf4j +@RequiredArgsConstructor +public abstract class AbstractHandlersFactory implements HandlersFactory { + protected final MetadataUpserter metadataUpserter; + protected final CheckTrackingProduct checkTrackingProduct; + protected final OutputTargetSender outputTargetSender; + protected final GenericFinalEventBuilder finalEventBuilder; + protected final IntermediateEventsBuilder intermediateEventsBuilder; + protected final GenericDematValidator dematValidator; + protected final GenericSequenceValidator sequenceValidator; + protected final RetrySender retrySender; + protected final M10RetryTrigger m10RetryTrigger; + protected final NotRetryableErrorInserting notRetryableErrorInserting; + protected final DuplicatedEventFiltering duplicatedEventFiltering; + protected final CheckTrackingState checkTrackingState; + protected final CheckOcrResponse checkOcrResponse; + protected final RetrySenderCON996 retrySenderCON996; + + public abstract ProductType getProductType(); + + public Function getDispatcher(EventTypeEnum eventType) { + return switch (eventType) { + case INTERMEDIATE_EVENT -> this::buildIntermediateEventsHandler; + case RETRYABLE_EVENT -> this::buildRetryEventHandler; + case NOT_RETRYABLE_EVENT -> this::buildNotRetryableEventHandler; + case FINAL_EVENT -> this::buildFinalEventsHandler; + case SAVE_ONLY_EVENT -> this::buildSaveOnlyEventHandler; + case OCR_RESPONSE_EVENT -> this::buildOcrResponseHandler; + case CON996_EVENT -> this::buildCon996EventHandler; + default -> throw new IllegalStateException("Unexpected value: " + eventType); + }; + } + + public Handler build(EventTypeEnum eventType, HandlerContext context) { + var handler = getDispatcher(eventType); + if (Objects.isNull(handler)) { + log.error("No handler founded for EventType ={} and productType: [{}] (trackingId={})", eventType, getProductType(), context.getTrackingId()); + throw new PaperTrackerException(String.format("No handler founded for EventType =%s and productType: %s", eventType, getProductType())); + } + return handler.apply(context); + } + + /** + * Metodo che prende in carico gli eventi finali per poi inviare la risposta a delivery-push. + * I step da compiere sono i seguenti: + * - Upsert metadati e demat + * - filtraggio eventi duplicati + * - Validazione triplette + * - Validazione demat tramite invio di un messaggio all'OCR + * - Costruzione evento finale + * - Attivazione retry per causale M10 e riallineamento dello stato evento + * - Invio evento finale a delivery-push + * - aggiornamento stato su PaperTrackings + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildFinalEventsHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct, + checkTrackingState, + sequenceValidator, + dematValidator, + finalEventBuilder, + m10RetryTrigger, + outputTargetSender + )); + } + + /** + * Metodo che costruisce la lista di steps necessari al processamento di un evento intermedio. + * I step da compiere sono i seguenti: + * - Upsert metadati e demat (se presenti) + * - filtraggio eventi duplicati + * - Costruzione eventi intermedi + * - Invio a pn-delivery-push + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildIntermediateEventsHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct, + checkTrackingState, + duplicatedEventFiltering, + intermediateEventsBuilder, + outputTargetSender + )); + } + + /** + * Metodo che costruisce la lista di steps necessari al processamento di un evento di retry. + * I step da compiere sono i seguenti: + * - Upsert metadati e demat (se presenti) + * - filtraggio eventi duplicati + * - chiamata PaperChannel per richiedere il nuovo PCRETRY se esistente, e salva la nuova entità se esiste un nuovo PCRETRY + * altrimenti inserisce un errore nella tabella degli errori con category MAX_RETRY_REACHED_ERROR + * - costruzione dell'evento da inviare a pn-delivery-push + * - invio a pn-delivery-push + * - aggiornamento stato su PaperTrackings + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildRetryEventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct, + checkTrackingState, + retrySender, + intermediateEventsBuilder, + outputTargetSender + )); + } + + /** + * Metodo che costruisce la lista di steps necessari al processamento di un evento notRetryable (CON998, CON997, CON995, CON993). + * I step da compiere sono i seguenti: + * - Upsert metadati + * - filtraggio eventi duplicati + * - inserimento errore nella tabella PaperTrackingsError + * - costruzione dell'evento da inviare a pn-delivery-push + * - invio a pn-delivery-push + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildNotRetryableEventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct, + checkTrackingState, + duplicatedEventFiltering, + notRetryableErrorInserting, + intermediateEventsBuilder, + outputTargetSender + )); + } + + /** + * Metodo che costruisce la lista di steps necessari al processamento di un evento di risposta della validazione ocr. + * I step da compiere sono i seguenti: + * - Upsert metadati e demat (se presenti) + * - Costruzione evento finale + * - Invio a pn-delivery-push + * - aggiornamento stato su PaperTrackings + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildOcrResponseHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + checkOcrResponse, + finalEventBuilder, + m10RetryTrigger, + outputTargetSender + )); + } + + @Override + public Handler buildSaveOnlyEventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct + )); + } + + /** + * Metodo che costruisce la lista di steps necessari al processamento di un evento CON996. + * I step da compiere sono i seguenti: + * - Upsert metadati + * - filtraggio eventi duplicati + * - chiamata PaperChannel per richiedere il nuovo PCRETRY se esistente, e salva la nuova entità se esiste un nuovo PCRETRY + * altrimenti inserisce un errore nella tabella degli errori con category NOT_RETRYABLE_EVENT_ERROR + * - costruzione dell'evento da inviare a pn-delivery-push + * - invio a pn-delivery-push + * - aggiornamento stato su PaperTrackings + * + * @param context contesto in cui sono presenti tutti i dati necessari per il processo + * @return Empty Mono se tutto è andato a buon fine, altrimenti un Mono Error + */ + @Override + public Handler buildCon996EventHandler(HandlerContext context) { + return new HandlerImpl( + List.of( + metadataUpserter, + checkTrackingProduct, + checkTrackingState, + duplicatedEventFiltering, + retrySenderCON996, + intermediateEventsBuilder, + outputTargetSender + )); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponse.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponse.java new file mode 100644 index 000000000..7e7c24e9d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponse.java @@ -0,0 +1,162 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Map; +import java.util.Objects; + +@Component +@RequiredArgsConstructor +@Slf4j +public class CheckOcrResponse implements HandlerStep { + + private final PaperTrackingsDAO paperTrackingsDAO; + private final ObjectMapper objectMapper; + + /** + * Step che effettua un controllo sul messaggio ricevuto dal servizio OCR.
+ * Se lo stato della notifica è AWAITING_OCR, il flusso prosegue, altrimenti, viene + * generato un errore. + * Viene aggiornato il contesto con l'eventId e dryRun recuperati dall'evento finale.
+ * Se lo tato di validazione dell'OCR è
+ * - OK: il flusso prosegue con gli step successivi
+ * - KO: viene generato un errore ed il flusso viene interrotto
+ * - PENDING: il flusso viene interrotto
+ * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing CheckOcrResponse step for trackingId: {}", context.getTrackingId()); + + OcrDataResultPayload ocrResultMessage = context.getOcrDataResultPayload(); + + return Mono.just(context.getPaperTrackings()) + .flatMap(paperTrackings -> { + Event event = TrackerUtility.extractFinalEventFromOcr(ocrResultMessage.getCommandId(), paperTrackings); + if (TrackerUtility.isInInvalidStateForOcr(paperTrackings, event.getStatusCode()) + && OcrStatusEnum.RUN.equals(paperTrackings.getValidationConfig().getOcrEnabled())) { + return handleFinalStateError(event, paperTrackings, ocrResultMessage); + } + updateContext(context, event); + Data.ValidationStatus validationStatus = ocrResultMessage.getData().getValidationStatus(); + return handleValidationStatus(validationStatus, paperTrackings, event, ocrResultMessage, context); + }) + .then(); + } + + private void updateContext(HandlerContext context, Event event) { + context.setEventId(event.getId()); + context.setDryRunEnabled(event.getDryRun()); + } + + private Mono handleFinalStateError(Event event, PaperTrackings paperTrackings, OcrDataResultPayload ocrResultMessage) { + + return Mono.error(new PnPaperTrackerValidationException( + "Error in OCR validation for requestId: " + ocrResultMessage.getCommandId(), + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + paperTrackings, event.getStatusCode(), ErrorCategory.OCR_VALIDATION, + ErrorCause.OCR_DUPLICATED_EVENT, "CommandId: " + ocrResultMessage.getCommandId(), + Map.of("ocrDataResultPayload", transformToMap(ocrResultMessage.getData())), + FlowThrow.DEMAT_VALIDATION, ErrorType.WARNING, event.getId() + ) + )); + } + + private Map transformToMap(Data data) { + return objectMapper.convertValue(data, new TypeReference<>() {}); + } + + + private Mono handleValidationStatus(Data.ValidationStatus status, PaperTrackings paperTrackings, + Event event, OcrDataResultPayload ocrResultMessage, HandlerContext context) { + String[] parsedOcrCommandId = TrackerUtility.getParsedOcrCommandId(ocrResultMessage.getCommandId()); + String docType = parsedOcrCommandId[2]; + String trackingId = parsedOcrCommandId[0]; + + Integer index = TrackerUtility.getOcrRequestIndexByEventIdAndDocType(paperTrackings, context.getEventId(), docType); + + return switch (status) { + case KO -> { + log.info("OCR validation KO for requestId: {}", ocrResultMessage.getCommandId()); + yield paperTrackingsDAO.updateOcrRequests(index, trackingId, Data.ValidationStatus.KO) + .doOnNext(context::setPaperTrackings) + .then(Mono.error(new PnPaperTrackerValidationException( + "Error in OCR validation for requestId: " + ocrResultMessage.getCommandId(), + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + paperTrackings, event.getStatusCode(), ErrorCategory.OCR_VALIDATION, + ErrorCause.OCR_KO, ocrResultMessage.getData().getDescription(), + Map.of("ocrDataResultPayload", transformToMap(ocrResultMessage.getData())), + FlowThrow.DEMAT_VALIDATION, + OcrStatusEnum.RUN.equals(paperTrackings.getValidationConfig().getOcrEnabled())? ErrorType.ERROR : ErrorType.WARNING, event.getId() + ) + ))); + } + + case OK -> { + log.info("OCR validation successful for requestId: {}", ocrResultMessage.getCommandId()); + yield handleOkStatus(paperTrackings, event, ocrResultMessage, context, index); + } + + case PENDING -> { + log.info("OCR validation pending for requestId: {}", ocrResultMessage.getCommandId()); + yield paperTrackingsDAO.updateOcrRequests(index, trackingId, Data.ValidationStatus.PENDING) + .doOnNext(unused -> context.setStopExecution(true)) + .then(); + } + }; + } + + private Mono handleOkStatus(PaperTrackings tracking, Event event, OcrDataResultPayload payload, HandlerContext context, Integer index) { + String trackingId = tracking.getTrackingId(); + return paperTrackingsDAO.updateOcrRequests(index, trackingId, Data.ValidationStatus.OK) + .doOnNext(context::setPaperTrackings) + .flatMap(paperTrackings -> { + if(!OcrStatusEnum.RUN.equals(paperTrackings.getValidationConfig().getOcrEnabled())){ + log.info("OCR validation OK but OCR is not enabled for trackingId: {}, stopping execution", context.getTrackingId()); + context.setStopExecution(true); + return Mono.empty(); + } + log.info("OCR validation OK, checking if all OCR validations are completed for trackingId: {}", context.getTrackingId()); + return Mono.just(TrackerUtility.isOcrResponseCompleted(context, event.getStatusCode())); + }) + .flatMap(ocrResponseCompleted -> { + if (ocrResponseCompleted) { + log.info("All OCR validations completed for trackingId: {}", context.getTrackingId()); + return paperTrackingsDAO.updateItem(trackingId, getPaperTrackingsToUpdate(event.getStatusCode(), payload)) + .doOnNext(context::setPaperTrackings) + .then(); + } + log.info("OCR validation pending for other requests, trackingId: {}", context.getTrackingId()); + context.setStopExecution(true); + return Mono.empty(); + }); + } + + private PaperTrackings getPaperTrackingsToUpdate(String statusCode, OcrDataResultPayload payload) { + PaperTrackings paperTrackings = new PaperTrackings(); + TrackerUtility.setDematValidationTimestamp(paperTrackings, statusCode); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setPredictedRefinementType(Objects.nonNull(payload.getData().getPredictedRefinementType()) ? + payload.getData().getPredictedRefinementType().getValue() : null); + paperTrackings.setPaperStatus(paperStatus); + return paperTrackings; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProduct.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProduct.java new file mode 100644 index 000000000..b11a247f5 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProduct.java @@ -0,0 +1,70 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; + +import static it.pagopa.pn.papertracker.utils.TrackerUtility.createAffectedEventsMap; + + +@Component +@Slf4j +public class CheckTrackingProduct implements HandlerStep { + + /** + * Step che effettua un controllo di coerenza tra il tipo di prodotto associato al tracking e quello atteso per lo statusCode dell'evento ricevuto && + * quello contenuto nel payload. + * Se il tipo di prodotto non corrisponde, viene generato un errore di validazione. + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono + */ + + @Override + public Mono execute(HandlerContext context) { + log.info("Executing CheckTrackingProduct for trackingId: {}", context.getTrackingId()); + + String paperTrackingProduct = context.getPaperTrackings().getProductType(); + String payloadProduct = context.getPaperProgressStatusEvent().getProductType(); + String statusCode = context.getPaperProgressStatusEvent().getStatusCode(); + String productType = EventStatusCodeEnum.fromKey(statusCode).getProductType().getValue(); + + if (productType.equals(ProductType.ALL.getValue())) { + return Mono.empty(); + } + + if (!paperTrackingProduct.equals(payloadProduct) || !paperTrackingProduct.equals(productType)) { + String errorMsg = String.format("Product type mismatch for trackingId %s: expected %s, but got %s", + context.getTrackingId(), paperTrackingProduct, + !paperTrackingProduct.equals(payloadProduct) ? payloadProduct : productType); + + Map additionalDetails = createAffectedEventsMap(false, + List.of(TrackerUtility.extractEventFromContext(context))); + + return Mono.error(new PnPaperTrackerValidationException( + errorMsg, + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + context.getPaperTrackings(), + context.getPaperProgressStatusEvent().getStatusCode(), + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.VALUES_NOT_MATCHING, + errorMsg, + additionalDetails, + FlowThrow.CHECK_TRACKING_PRODUCT, + ErrorType.WARNING, + context.getEventId() + ))); + } + + return Mono.empty(); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingState.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingState.java new file mode 100644 index 000000000..87af90eee --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingState.java @@ -0,0 +1,79 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorCategory; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorCause; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorType; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.FlowThrow; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Map; +import java.util.Objects; + +import static it.pagopa.pn.papertracker.utils.TrackerUtility.checkIfIsFinalDemat; +import static it.pagopa.pn.papertracker.utils.TrackerUtility.isInvalidState; + +@Component +@RequiredArgsConstructor +@Slf4j +public class CheckTrackingState implements HandlerStep { + + /** + * Step che effettua un controllo se lo stato del tracking associato all'evento ricevuto + * è in stato DONE o AWAITING_OCR. + * Vengono esclusi da questo controllo gli eventi con statusCode che iniziano con "CON". + * Se il tracking è in uno di questi stati, viene generato un errore di validazione, + * altrimenti, il flusso prosegue con gli step successivi. + * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + public Mono execute(HandlerContext context) { + log.info("Executing CheckTrackingState step for trackingId: {}", context.getTrackingId()); + + return Mono.just(context) + .flatMap(ctx -> { + String statusCode = TrackerUtility.getStatusCodeFromEventId(ctx.getPaperTrackings(), ctx.getEventId()); + if (statusCode.startsWith("CON") || checkIfIsFinalDemat(statusCode)) { + log.info("StatusCode excluded from CheckTrackingState: {}", statusCode); + return Mono.empty(); + } + return isInvalidState(ctx, statusCode) + ? createValidationError(ctx, statusCode) + : Mono.empty(); + }); + } + + private Mono createValidationError(HandlerContext ctx, String statusCode) { + String state = TrackerUtility.isStockStatus890(statusCode) + ? ctx.getPaperTrackings().getBusinessState().name() + : ctx.getPaperTrackings().getState().name(); + + String errorMsg = String.format("Tracking in state %s, statusCode %s: %s", state, statusCode, ctx.getTrackingId()); + Map additionalDetails = Map.of("statusCode", statusCode, + "statusTimestamp", Objects.toString(ctx.getPaperProgressStatusEvent().getStatusDateTime(), null) + ); + + return Mono.error(new PnPaperTrackerValidationException( + errorMsg, + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + ctx.getPaperTrackings(), + statusCode, + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.VALUE_AFTER_REFINEMENT, + errorMsg, + additionalDetails, + FlowThrow.CHECK_TRACKING_STATE, + ErrorType.WARNING, + ctx.getEventId() + ) + )); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFiltering.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFiltering.java new file mode 100644 index 000000000..57f6333f6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFiltering.java @@ -0,0 +1,167 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.ZoneOffset; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import static java.time.temporal.ChronoUnit.SECONDS; + +@Component +@RequiredArgsConstructor +@Slf4j +public class DuplicatedEventFiltering implements HandlerStep { + + private final DataVaultClient dataVaultClient; + + /** + * Step di validazione per filtrare eventi duplicati. + * Verifica se l'evento in arrivo è già presente nella lista degli eventi. + * Escludo dal controllo duplicati eventi con lo stesso ID (es. ultimo evento ricevuto precedentemente salvato + * e retry dello stesso messaggio). + * In caso di evento duplicato, genera un errore di validazione. Altrimenti, permette il proseguimento del flusso. + * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Starting DuplicatedEventFiltering for trackingId: {}", context.getTrackingId()); + + PaperTrackings paperTrackings = context.getPaperTrackings(); + PaperProgressStatusEvent paperProgressStatusEvent = context.getPaperProgressStatusEvent(); + + if (context.isRedrive()) { + log.info("Skipping DuplicatedEventFiltering isRedrive: true"); + return Mono.empty(); + } + + return Flux.fromIterable(paperTrackings.getEvents()) + .filter(event -> !event.getId().equalsIgnoreCase(context.getEventId())) + .flatMap(event -> isDuplicatedEvent(event, paperProgressStatusEvent, paperTrackings.getNotificationReworkId())) + .any(Boolean::booleanValue) + .flatMap(isDuplicate -> isDuplicate + ? Mono.error(createValidationException(paperTrackings, paperProgressStatusEvent, context)) + : Mono.empty()); + } + + private PnPaperTrackerValidationException createValidationException(PaperTrackings paperTrackings, + PaperProgressStatusEvent event, + HandlerContext context) { + String statusCode = event.getStatusCode(); + Map additionalDetails = Map.of( + "statusCode", statusCode, + "statusTimestamp", Objects.toString(event.getStatusDateTime(), null) + ); + return new PnPaperTrackerValidationException( + "Duplicated event found: " + statusCode, + PaperTrackingsErrorsMapper.buildPaperTrackingsError( + paperTrackings, + statusCode, + ErrorCategory.DUPLICATED_EVENT, + null, + "Duplicated event found for statusCode: " + statusCode, + additionalDetails, + FlowThrow.DUPLICATED_EVENT_VALIDATION, + ErrorType.WARNING, + context.getEventId() + ) + ); + } + + public Mono isDuplicatedEvent(Event event, PaperProgressStatusEvent paperProgressStatusEvent, String reworkId) { + boolean fieldsMatch = Objects.equals(paperProgressStatusEvent.getRegisteredLetterCode(),event.getRegisteredLetterCode()) + && Objects.equals(paperProgressStatusEvent.getProductType(), event.getProductType()) + && Objects.equals(paperProgressStatusEvent.getIun(), event.getIun()) + && Objects.equals(paperProgressStatusEvent.getStatusCode(), event.getStatusCode()) + && Objects.equals(paperProgressStatusEvent.getStatusDescription(), event.getStatusDescription()) + && paperProgressStatusEvent.getStatusDateTime().truncatedTo(SECONDS).isEqual(event.getStatusTimestamp().truncatedTo(SECONDS).atOffset(ZoneOffset.UTC)) + && Objects.equals(paperProgressStatusEvent.getDeliveryFailureCause(), event.getDeliveryFailureCause()) + && Objects.equals(reworkId, event.getNotificationReworkId()) + && isSameAttachments(paperProgressStatusEvent.getAttachments(), event.getAttachments()); + + if(fieldsMatch){ + return deanonymizeAddressAndCheckIt(event.getAnonymizedDiscoveredAddressId(), paperProgressStatusEvent); + }else { + return Mono.just(false); + } + + } + + private Mono deanonymizeAddressAndCheckIt(String anonymizedDiscoveredAddressId, PaperProgressStatusEvent paperProgressStatusEvent) { + if (StringUtils.hasText(anonymizedDiscoveredAddressId) && Objects.nonNull(paperProgressStatusEvent.getDiscoveredAddress())) + return dataVaultClient.deAnonymizeDiscoveredAddress(paperProgressStatusEvent.getRequestId(), anonymizedDiscoveredAddressId) + .map(paperAddress -> isSameAddress(paperAddress, paperProgressStatusEvent.getDiscoveredAddress())); + return Mono.just(!StringUtils.hasText(anonymizedDiscoveredAddressId) && Objects.isNull(paperProgressStatusEvent.getDiscoveredAddress())); + } + + private static boolean isSameAttachments(List attachmentsDetails, List attachments) { + + if(attachments == null) { + attachments = List.of(); + } + + if(attachmentsDetails == null) { + attachmentsDetails = List.of(); + } + + if(attachmentsDetails.isEmpty() && attachments.isEmpty()) { + return true; + } + + if (attachments.isEmpty() || attachmentsDetails.isEmpty()) { + return false; + } + + if (attachments.size() != attachmentsDetails.size()){ + return false; + } else { + + for (int i = 0; i execute(HandlerContext context) { + return validateDemat(context) + .then(); + } + + public Mono validateDemat(HandlerContext context) { + PaperTrackings paperTrackings = context.getPaperTrackings(); + String trackingId = paperTrackings.getTrackingId(); + log.info("Starting demat validation for trackingId={}", trackingId); + + Event currentEvent = TrackerUtility.extractEventFromContext(context); + List requiredAttachments = getRequiredAttachments(currentEvent, paperTrackings); + List validatedEvent = TrackerUtility.validatedEvents(paperTrackings.getPaperStatus().getValidatedEvents(), paperTrackings.getEvents()); + Map> attachmentList = retrieveFinalDemat(validatedEvent, requiredAttachments); + return checkSourceTypeFileTypeCoherent(paperTrackings, validatedEvent) + .then(Mono.defer(() -> ocrUtility.checkAndSendToOcr(currentEvent, attachmentList, context) + .onErrorResume(e -> Mono.error(new PaperTrackerException("Error during Demat Validation", e))) + .filter(isSentToOcr -> Boolean.TRUE.equals(isSentToOcr)) + // Ferma l'esecuzione degli step se è stato inviato all'OCR + .doOnNext(unused -> context.setStopExecution(true)) + .then())); + } + + private Map> retrieveFinalDemat(List validatedEvents, List requiredAttachments) { + return validatedEvents.stream() + .filter(event -> !CollectionUtils.isEmpty(event.getAttachments())) + .map(event -> Map.entry( + event.getId(), + event.getAttachments().stream() + .filter(att -> requiredAttachments.contains(att.getDocumentType())) + .toList() + )) + .filter(entry -> !CollectionUtils.isEmpty(entry.getValue())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + } + + private List getRequiredAttachments(Event event, PaperTrackings paperTrackings) { + if (TrackerUtility.isStockStatus890(event.getStatusCode())) + return paperTrackings.getValidationConfig().getSendOcrAttachmentsFinalValidationStock890(); + + return paperTrackings.getValidationConfig().getSendOcrAttachmentsFinalValidation(); + } + + private Mono checkSourceTypeFileTypeCoherent(PaperTrackings paperTracking, List validatedEvent) { + return Flux.fromIterable(validatedEvent) + .filter(event -> !CollectionUtils.isEmpty(event.getAttachments())) + .flatMap(event -> Flux.fromIterable(event.getAttachments()) + .flatMap(attachment -> { + String fileType = retrieveFileType(attachment.getUri()); + return isSourceTypeFileTypeCoherent(attachment.getSourceType(), fileType) + ? Mono.empty() + : insertSourceTypeFileTypeWarning(paperTracking, event, attachment, fileType); + })) + .then(); + } + + private boolean isSourceTypeFileTypeCoherent(String sourceType, String fileType) { + if (StringUtils.isBlank(sourceType) || StringUtils.isBlank(fileType)) { + return true; + } + + if (!SourceType.SCANNED.name().equalsIgnoreCase(sourceType)) { + return true; + } + + return FileType.PDF.getValue().equalsIgnoreCase(fileType); + + } + + private Mono insertSourceTypeFileTypeWarning(PaperTrackings paperTracking, + Event event, + Attachment attachment, + String fileType) { + String sourceType = attachment.getSourceType(); + String message = String.format( + "SourceType/fileType incoherent for OCR: sourceType=%s, fileType=%s, uri=%s", + sourceType, fileType, attachment.getUri() + ); + + PaperTrackingsErrors warning = PaperTrackingsErrorsMapper.buildPaperTrackingsError( + paperTracking, + event.getStatusCode(), + ErrorCategory.ATTACHMENTS_ERROR, + ErrorCause.SOURCETYPE_FILETYPE_INCOHERENT, + message, + Map.of( + "sourceType", sourceType, + "fileType", fileType, + "uri", attachment.getUri() + ), + FlowThrow.DEMAT_VALIDATION, + ErrorType.WARNING, + event.getId() + ); + + return paperTrackerErrorService.insertPaperTrackingsError(warning) + .doOnError(ex -> log.warn("Unable to persist warning for trackingId={}, eventId={}", + paperTracking.getTrackingId(), event.getId(), ex)) + .onErrorResume(ex -> Mono.empty()) + .then(); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilder.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilder.java new file mode 100644 index 000000000..d1c67ace7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilder.java @@ -0,0 +1,89 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.mapper.SendEventMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ValidationFlow; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +@Slf4j +@RequiredArgsConstructor +public abstract class GenericFinalEventBuilder implements HandlerStep { + + private final DataVaultClient dataVaultClient; + private final PaperTrackingsDAO paperTrackingsDAO; + + /** + * Step che elabora l'evento finale in base alla logica di business definita. + * Viene semplicemente aggiunto alla lista degli eventi da inviare. + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing GenericFinalEventBuilder step for trackingId: {}", context.getTrackingId()); + + Event finalEvent = TrackerUtility.extractEventFromContext(context); + return addEventToSend(context, finalEvent, EventStatusCodeEnum.fromKey(finalEvent.getStatusCode()).getStatus().name()) + .thenReturn(finalEvent) + .doOnNext(event -> context.setFinalStatusCode(finalEvent.getStatusCode())) + .map(sendEvent -> paperTrackingsDAO.updateItem(context.getPaperTrackings().getTrackingId(), getPaperTrackingsToUpdate())) + .then(); + } + + protected Mono addEventToSend(HandlerContext ctx, Event finalEvent, String status) { + return buildSendEvent(ctx, finalEvent, StatusCodeEnum.valueOf(status), finalEvent.getStatusCode(), finalEvent.getStatusTimestamp().atOffset(ZoneOffset.UTC)) + .doOnNext(event -> ctx.getEventsToSend().add(event)) + .then(); + } + + protected PaperTrackings getPaperTrackingsToUpdate() { + PaperTrackings paperTrackings = new PaperTrackings(); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setFinalEventBuilderTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + return paperTrackings; + } + + protected Flux buildSendEvent(HandlerContext context, + Event source, + StatusCodeEnum status, + String logicalStatus, + OffsetDateTime ts) { + return SendEventMapper.createSendEventsFromEventEntity(context.getTrackingId(), source, status, logicalStatus, ts) + .flatMap(sendEvent -> enrichWithDeliveryFailureCauseAndDiscoveredAddress(context, sendEvent)); + } + + private Mono enrichWithDeliveryFailureCauseAndDiscoveredAddress(HandlerContext context, SendEvent sendEvent) { + sendEvent.setDeliveryFailureCause(context.getPaperTrackings().getPaperStatus().getDeliveryFailureCause()); + return enrichWithDiscoveredAddress(context, sendEvent); + } + + protected Mono enrichWithDiscoveredAddress(HandlerContext context, SendEvent sendEvent) { + if (StringUtils.isBlank(context.getPaperTrackings().getPaperStatus().getAnonymizedDiscoveredAddress())) { + return Mono.just(sendEvent); + } + context.setAnonymizedDiscoveredAddressId(context.getPaperTrackings().getPaperStatus().getAnonymizedDiscoveredAddress()); + return dataVaultClient.deAnonymizeDiscoveredAddress(context.getPaperTrackings().getTrackingId(), context.getPaperTrackings().getPaperStatus().getAnonymizedDiscoveredAddress()) + .map(SendEventMapper::toAnalogAddress) + .doOnNext(sendEvent::setDiscoveredAddress) + .thenReturn(sendEvent); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidator.java new file mode 100644 index 000000000..9d80ca4f1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidator.java @@ -0,0 +1,556 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.DeliveryFailureCauseEnum; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfig; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.*; +import java.util.stream.Collectors; + +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorCause.INVALID_VALUES; +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorCause.VALUES_NOT_MATCHING; +import static it.pagopa.pn.papertracker.model.DocumentTypeEnum.ARCAD; +import static it.pagopa.pn.papertracker.model.DocumentTypeEnum.CAD; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012; +import static it.pagopa.pn.papertracker.model.PredictedRefinementType.PRE10; +import static it.pagopa.pn.papertracker.utils.TrackerUtility.createAffectedEventsMap; + +@RequiredArgsConstructor +@Slf4j +public abstract class GenericSequenceValidator implements HandlerStep { + + private final PaperTrackingsDAO paperTrackingsDAO; + private final PaperTrackerErrorService paperTrackerErrorService; + + /** + * Step di validazione della sequenza degli eventi di una raccomandata. + * La validazione include controlli sulla presenza di eventi necessari, coerenza dei timestamp + * di business, validità dei documenti allegati, coerenza dei codici di lettera raccomandata e + * correttezza della causa di mancata consegna. + * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + SequenceConfig sequenceConfig = SequenceConfiguration.getConfig(context.getPaperProgressStatusEvent().getStatusCode()); + + log.debug("Executing GenericSequenceValidator with sequence config: {}", sequenceConfig); + return Mono.just(context.getPaperTrackings()) + .flatMap(paperTrackings -> validateSequence(paperTrackings, context, sequenceConfig, true)) + .doOnNext(TrackerUtility::checkValidationConfig)//aggiunto per retrocompatibilità + .doOnNext(context::setPaperTrackings) + .then(); + } + + /** + * Valida la sequenza degli eventi di una raccomandata, applicando una serie di controlli di business. + * + * @param paperTrackings oggetto contenente gli eventi da validare + * @return Mono che completa se la validazione ha successo, altrimenti emette un Mono.error + */ + public Mono validateSequence(PaperTrackings paperTrackings, HandlerContext context, SequenceConfig sequenceConfig, Boolean strictFinalEventValidation) { + PaperTrackings paperTrackingsToUpdate = new PaperTrackings(); + paperTrackingsToUpdate.setPaperStatus(new PaperStatus()); + log.info("Starting validation for sequence for paper tracking : {}", paperTrackings); + return extractSequenceFromEvents(paperTrackings.getEvents(), sequenceConfig.sequenceStatusCodes(), context.getReworkId()) + .filter(events -> !CollectionUtils.isEmpty(events)) + .switchIfEmpty(Mono.defer(() -> getErrorOrSaveWarning("Invalid lastEvent for sequence validation", context, paperTrackings, ErrorCategory.LAST_EVENT_EXTRACTION_ERROR,null,null, strictFinalEventValidation, Collections.emptyList()))) + .flatMap(this::getOnlyLatestEvents) + .flatMap(events -> validatePresenceOfStatusCodes(events, paperTrackings, context, sequenceConfig.requiredStatusCodes(),strictFinalEventValidation)) + .flatMap(events -> validateBusinessTimestamps(events, paperTrackings, context, sequenceConfig,strictFinalEventValidation, paperTrackingsToUpdate)) + .flatMap(events -> validateAttachments(events, paperTrackings, context, sequenceConfig.validAttachments(), sequenceConfig.requiredAttachments(),strictFinalEventValidation)) + .flatMap(events -> validateRegisteredLetterCode(events, paperTrackings, paperTrackingsToUpdate, context,strictFinalEventValidation)) + .flatMap(events -> validateDeliveryFailureCause(events, paperTrackings, context,strictFinalEventValidation)) + .flatMap(events -> enrichPaperTrackingToUpdateWithAddressAndFailureCause(events, paperTrackingsToUpdate, TrackerUtility.extractEventFromContext(context).getStatusCode())) + .flatMap(events -> paperTrackingsDAO.updateItem(paperTrackings.getTrackingId(), enrichWithSequenceValidationTimestamp(events, paperTrackingsToUpdate))); + } + + private Mono> enrichPaperTrackingToUpdateWithAddressAndFailureCause(List events, PaperTrackings paperTrackingsToUpdate, String statusCode) { + return Mono.justOrEmpty(events.stream() + .filter(e -> e.getStatusCode().equalsIgnoreCase(preCloseMetaStatusCode(statusCode))) + .findFirst()) + .doOnNext(preCloseEvent -> { + if (StringUtils.hasText(preCloseEvent.getAnonymizedDiscoveredAddressId())) { + paperTrackingsToUpdate.getPaperStatus().setAnonymizedDiscoveredAddress(preCloseEvent.getAnonymizedDiscoveredAddressId()); + } + if (StringUtils.hasText(preCloseEvent.getDeliveryFailureCause())) { + paperTrackingsToUpdate.getPaperStatus().setDeliveryFailureCause(preCloseEvent.getDeliveryFailureCause()); + } + }) + .thenReturn(events); + } + + private String preCloseMetaStatusCode(String finalStatusCode) { + String lastLetter = finalStatusCode.substring(finalStatusCode.length() - 1); + if (lastLetter.equals("C")) { + return finalStatusCode.substring(0, finalStatusCode.length() - 1) + "A"; + } else if (lastLetter.equals("F")) { + return finalStatusCode.substring(0, finalStatusCode.length() - 1) + "D"; + } + return finalStatusCode; + } + + /** + * Valida la presenza dei documenti necessari presenti nella lista di eventi in input. La lista dei documenti necessari + * viene ottenuta dalle configurazione e nel caso in cui si abbiano documenti in più non richiesti non mandiamo in errore + * ma continuiamo il flusso. + *

+ * Esempio lista OK: + * RECRN002D + * RECRN002E[AR, INDAGINE] + * RECRN002E[AR] + * RECRN002F + * Esempio lista KO: + * RECRN002D + * RECRN002E[PLICO] + * RECRN002E[INDAGINE] + * RECRN002F + * + * @param events lista di eventi da cui estrarre la sequenza + * @param paperTrackings entità di paper tracking + * @return Mono contenente la lista di eventi dati in input, altrimenti se la validazione non è andata a buona fine Mono.error() + */ + private Mono> validateAttachments(List events, PaperTrackings paperTrackings, HandlerContext context, + Map> validAttachments, Set requiredAttachments, Boolean strictFinalEventValidation) { + log.info("Beginning attachment validation for events: {}", events); + + var eventsWithAttachments = events.stream() + .filter(event -> !CollectionUtils.isEmpty(event.getAttachments())) + .toList(); + + var allDocs = eventsWithAttachments.stream() + .flatMap(event -> event.getAttachments().stream().map(Attachment::getDocumentType)) + .collect(Collectors.toSet()); + + return verifyRequiredAttachments(events, paperTrackings, context, requiredAttachments, allDocs, strictFinalEventValidation) + .flatMap(unused -> verifyValidAttachments(events, paperTrackings, context, validAttachments, eventsWithAttachments, strictFinalEventValidation)) + .doOnNext(unused -> log.info("Attachments validation completed successfully")); + } + + private Mono> verifyRequiredAttachments(List events, PaperTrackings paperTrackings, HandlerContext context, Set requiredAttachments, Set allDocs, Boolean strictFinalEventValidation) { + var missingDocs = new HashSet<>(requiredAttachments); + missingDocs.removeAll(allDocs); + + if (allDocs.contains(CAD.getValue()) || allDocs.contains(ARCAD.getValue())) { + missingDocs.remove(CAD.getValue()); + missingDocs.remove(ARCAD.getValue()); + } + + if (missingDocs.isEmpty()) { + return Mono.just(events); + } + Map additionalDetails = Map.of("missingAttachments", missingDocs.stream().toList()); + return getErrorOrSaveWarning + ("Missed required attachments for the sequence validation: " + missingDocs, context, paperTrackings, ErrorCategory.ATTACHMENTS_ERROR, VALUES_NOT_MATCHING, additionalDetails, strictFinalEventValidation, events); } + + private Mono> verifyValidAttachments(List events, PaperTrackings paperTrackings, HandlerContext context, Map> validAttachments, List eventsWithAttachments, Boolean strictFinalEventValidation) { + for (Event e : eventsWithAttachments) { + var allowedDocs = validAttachments.get(e.getStatusCode()); + + var eventDocs = e.getAttachments().stream() + .map(Attachment::getDocumentType) + .collect(Collectors.toSet()); + + // Se l'evento contiene documenti non ammessi + var invalidDocs = eventDocs.stream() + .filter(doc -> CollectionUtils.isEmpty(allowedDocs) || !allowedDocs.contains(doc)) + .collect(Collectors.toSet()); + + if (!CollectionUtils.isEmpty(invalidDocs)) { + Map additionalDetails = Map.of("invalidAttachments", invalidDocs.stream().toList()); + + return getErrorOrSaveWarning("Event " + e.getStatusCode() + " contains invalid attachments: " + invalidDocs, context, paperTrackings, ErrorCategory.ATTACHMENTS_ERROR, INVALID_VALUES, additionalDetails, strictFinalEventValidation, events); + } + } + return Mono.just(events); + } + + /** + * Filtra la lista di eventi per ottenere solo gli ultimi eventi rilevanti. + * Nel caso di eventi contententi documenti, il codice prenderà gli eventi che hanno un documento non presente nella + * mappa dei documenti già presi + *

+ * Ad esempio per la seguente lista prenderemo i seguenti eventi + * -> RECRN002D + * RECRN002E[INDAGINE] + * -> RECRN002E[PLICO] + * -> RECRN002E[INDAGINE] + * RECRN002E[AR] + * -> RECRN002E[AR] + * -> RECRN002F + *

+ * similmente nel caso di evento con più documenti, prende l'evento se uno tra i documenti dell'evento + * non è nella mappa ad esempio: + * -> RECRN002D + * RECRN002E[INDAGINE] + * -> RECRN002E[PLICO] + * RECRN002E[INDAGINE] + * -> RECRN002E[AR, INDAGINE] + * -> RECRN002E[AR] + * -> RECRN002F + * + * @param events lista di eventi da filtrare + * @return Mono di eventi contenenti gli elementi filtrati dal metodo + */ + public Mono> getOnlyLatestEvents(List events) { + log.info("Beginning extraction of latest events from : {}", events); + HashMap> uniqueCodes = new HashMap<>(); + List mutableEvents = new ArrayList<>(events); + + //Ordino la lista in base al timestamp e poi la inverto per avere al primo posto l'evento con requestTimestamp più recente + mutableEvents.sort(Comparator.comparing(Event::getRequestTimestamp).reversed()); + + return Mono.just(mutableEvents.stream().filter( + event -> { + Set documents = uniqueCodes.get(event.getStatusCode()); + boolean allDocumentsInEventAreAlreadyPresentInMap = + documents != null && + Optional.ofNullable(event.getAttachments()).orElse(new ArrayList<>()) + .stream() + .allMatch(document -> documents.contains(document.getDocumentType())); + if (allDocumentsInEventAreAlreadyPresentInMap) { + return false; + } else { + if (documents == null) { + uniqueCodes.put(event.getStatusCode(), new HashSet<>()); + } + if (!CollectionUtils.isEmpty(event.getAttachments())) { + List documentsToAdd = event.getAttachments().stream() + .filter(document -> !uniqueCodes.get(event.getStatusCode()) + .contains(document.getDocumentType())) + .toList(); + if (!CollectionUtils.isEmpty(documentsToAdd)) { + Set eventDocuments = uniqueCodes.get(event.getStatusCode()); + eventDocuments.addAll(documentsToAdd.stream().map(Attachment::getDocumentType).toList()); + uniqueCodes.put(event.getStatusCode(), eventDocuments); + } + } + return true; + } + } + ).toList()); + } + + /** + * Valida la presenza e la correttezza della deliveryFailureCause negli eventi.
+ * Il controllo viene effettuato sulla base di quanto censito nell'enum {@link it.pagopa.pn.papertracker.model.EventStatusCodeEnum}:
+ * - Se per lo status code dell'evento, come deliveryFailureCauseList, risulta censita CHECK_IF_REQUIRED, + * allora la validazione viene saltata
+ * - Se per lo status code dell'evento, come deliveryFailureCauseList, risulta censita una lista vuota o una lista con valori specifici, + * allora viene controllato che la deliveryFailureCause dell'evento sia assente (nel primo caso) o presente e valida (nel secondo caso)
+ * + * @param events lista di eventi da validare + * @param paperTrackings oggetto principale della richiesta + * @return Mono contenente la lista di eventi dati in input, altrimenti se la validazione non è andata a buona fine Mono.error() + */ + protected Mono> validateDeliveryFailureCause(List events, PaperTrackings paperTrackings, HandlerContext context, Boolean strictFinalEventValidation) { + log.info("Beginning validation for delivery failure cause for events : {}", events); + return Flux.fromIterable(events) + .flatMap(event -> { + EventStatusCodeEnum statusCodeEnum = EventStatusCodeEnum.fromKey(event.getStatusCode()); + List allowedCauses = statusCodeEnum.getDeliveryFailureCauseList(); + return checkPresenceOfCause(event, context, paperTrackings, allowedCauses, strictFinalEventValidation); + }) + .flatMap(event -> { + EventStatusCodeEnum statusCodeEnum = EventStatusCodeEnum.fromKey(event.getStatusCode()); + List allowedCauses = statusCodeEnum.getDeliveryFailureCauseList(); + return checkIfIsValidCause(context, paperTrackings, strictFinalEventValidation, allowedCauses, event) + .flatMap(unused -> checkIfStrictValidation(context, paperTrackings, strictFinalEventValidation, allowedCauses, event)); + }) + .filter(event -> StringUtils.hasText(event.getDeliveryFailureCause())) + .collectList() + .filter(filteredEvents -> !CollectionUtils.isEmpty(filteredEvents)) + .flatMap(filteredEvents -> allDeliveryFailureCauseAreEquals(context, paperTrackings, strictFinalEventValidation, filteredEvents)) + .thenReturn(events); + } + + protected Mono checkIfIsValidCause(HandlerContext context, PaperTrackings paperTrackings, boolean strictFinalEventValidation, List allowedCauses, Event event) { + String deliveryFailureCause = event.getDeliveryFailureCause(); + if (allowedCauses.contains(DeliveryFailureCauseEnum.CHECK_IF_REQUIRED) || !StringUtils.hasText(deliveryFailureCause)) { + return Mono.just(event); + } + + DeliveryFailureCauseEnum causeEnum = DeliveryFailureCauseEnum.fromValue(deliveryFailureCause); + boolean isValidCause = allowedCauses.contains(causeEnum); + if (!isValidCause) { + Map additionalDetails = createAffectedEventsMap(true, List.of(event)); + return getErrorOrSaveWarning( + "Invalid deliveryFailureCause: " + deliveryFailureCause, + context, + paperTrackings, + ErrorCategory.DELIVERY_FAILURE_CAUSE_ERROR, + VALUES_NOT_MATCHING, + additionalDetails, + strictFinalEventValidation, + event + ).then(Mono.empty()); + } + + return Mono.just(event); + } + + protected Mono checkPresenceOfCause(Event event, HandlerContext context, PaperTrackings paperTrackings, List allowedCauses, boolean strictFinalEventValidation) { + String cause = event.getDeliveryFailureCause(); + boolean hasCause = StringUtils.hasText(cause); + boolean hasAllowed = !CollectionUtils.isEmpty(allowedCauses); + Map additionalDetails = createAffectedEventsMap(true, List.of(event)); + if (!hasAllowed && hasCause) { + return getErrorOrSaveWarning( + "Invalid deliveryFailureCause: " + cause, + context, + paperTrackings, + ErrorCategory.DELIVERY_FAILURE_CAUSE_ERROR, + VALUES_NOT_MATCHING, + additionalDetails, + strictFinalEventValidation, + event + ).then(Mono.empty()); + } + + if (hasAllowed && !hasCause && !allowedCauses.contains(DeliveryFailureCauseEnum.CHECK_IF_REQUIRED)) { + return getErrorOrSaveWarning( + "Missing deliveryFailureCause", + context, + paperTrackings, + ErrorCategory.DELIVERY_FAILURE_CAUSE_ERROR, + INVALID_VALUES, + additionalDetails, + strictFinalEventValidation, + event + ).then(Mono.empty()); + } + return Mono.just(event); + } + + protected Mono checkIfStrictValidation(HandlerContext context, PaperTrackings paperTrackings, boolean strictFinalEventValidation, List allowedCauses, Event event) { + boolean isStrictValidation = Boolean.TRUE.equals(paperTrackings.getValidationConfig().getStrictDeliveryFailureCause()); + if (isStrictValidation && allowedCauses.contains(DeliveryFailureCauseEnum.CHECK_IF_REQUIRED) && !StringUtils.hasText(event.getDeliveryFailureCause())) { + Map additionalDetails = createAffectedEventsMap(true, List.of(event)); + return getErrorOrSaveWarning( + "Missing deliveryFailureCause", + context, + paperTrackings, + ErrorCategory.DELIVERY_FAILURE_CAUSE_ERROR, + INVALID_VALUES, + additionalDetails, + strictFinalEventValidation, + event + ).then(Mono.empty()); + } + return Mono.just(event); + } + + protected Mono> allDeliveryFailureCauseAreEquals(HandlerContext context, PaperTrackings paperTrackings, boolean strictFinalEventValidation, List events) { + List deliveryFailureCauses = events.stream() + .map(Event::getDeliveryFailureCause) + .map(String::toUpperCase) + .toList(); + + boolean areEquals = deliveryFailureCauses.stream() + .map(DeliveryFailureCauseEnum::fromValue) + .distinct() + .count() <= 1; + + if (!areEquals) { + Map additionalDetails = createAffectedEventsMap(true, events); + return getErrorOrSaveWarning( + "Invalid deliveryFailureCause on events: " + deliveryFailureCauses, + context, + paperTrackings, + ErrorCategory.DELIVERY_FAILURE_CAUSE_ERROR, + VALUES_NOT_MATCHING, + additionalDetails, + strictFinalEventValidation, + events + ); + } + paperTrackings.getPaperStatus().setDeliveryFailureCause(deliveryFailureCauses.getFirst()); + return Mono.just(events); + } + + /** + * Verifica che tutti i registered letter code degli eventi siano uguali. + * + * @param paperTrackings oggetto principale della richiesta + * @param events lista di eventi da validare + * @return Mono contenente la lista di eventi dati in input, altrimenti se la validazione non è andata a buona fine Mono.error() + */ + private Mono> validateRegisteredLetterCode(List events, PaperTrackings paperTrackings, PaperTrackings paperTrackingsToUpdate, HandlerContext context, Boolean strictFinalEventValidation) { + log.info("Beginning validation for registered letter codes for events : {}", events); + + // escludo RECAG012 dalla validazione in quanto potrebbe avere registeredLetterCode diverso + List filteredEvents = events.stream().filter(event -> !RECAG012.name().equalsIgnoreCase(event.getStatusCode())).toList(); + + String firstRegisteredLetterCode = filteredEvents.getFirst().getRegisteredLetterCode(); + + if (filteredEvents.stream().anyMatch(event -> !StringUtils.hasText(event.getRegisteredLetterCode()))) { + Map additionalDetails = createAffectedEventsMap(false, events.stream().filter(event -> !StringUtils.hasText(event.getRegisteredLetterCode())).toList()); + return getErrorOrSaveWarning("Registered letter code is null or empty in one or more events", + context, paperTrackings, ErrorCategory.REGISTERED_LETTER_CODE_ERROR, INVALID_VALUES, additionalDetails, strictFinalEventValidation, events); + } + + if (filteredEvents.stream().anyMatch(event -> !event.getRegisteredLetterCode().equals(firstRegisteredLetterCode))) { + Map additionalDetails = createAffectedEventsMap(false, events); + return getErrorOrSaveWarning("Registered letter codes do not match in sequence: " + + filteredEvents.stream().map(Event::getRegisteredLetterCode).toList(), + context, paperTrackings, ErrorCategory.REGISTERED_LETTER_CODE_ERROR, VALUES_NOT_MATCHING, additionalDetails, strictFinalEventValidation, events); + } + + paperTrackingsToUpdate.getPaperStatus().setRegisteredLetterCode(firstRegisteredLetterCode); + return Mono.just(events); + } + + /** + * Estrae la sequenza di eventi rilevanti (tripletta ABC/ DEF) dalla lista fornita. + * + * @param events lista di eventi da cui estrarre la sequenza + * @return Mono contenente la lista filtrata di eventi + */ + private Mono> extractSequenceFromEvents(List events, Set requiredStatusCodes, String notificationReworkId) { + log.info("Beginning extraction of relevant events from : {}", events); + return Mono.just(events.stream() + .filter(event -> !StringUtils.hasText(notificationReworkId) || notificationReworkId.equalsIgnoreCase(event.getNotificationReworkId())) + .filter(e -> requiredStatusCodes.contains(e.getStatusCode())) + .toList()); + } + + /** + * Valida la presenza di tutti gli eventi necessari per la sequenza data dall'evento finale. + * + * @param events lista di eventi da validare + * @param paperTrackings entità di paper tracking + * @return Mono contenente la lista di eventi dati in input, altrimenti se la validazione non è andata a buona fine Mono.error() + */ + private Mono> validatePresenceOfStatusCodes(List events, PaperTrackings paperTrackings, HandlerContext context, Set requiredStatusCodes, Boolean strictFinalEventValidation) { + log.info("Beginning validation for required status codes for events : {}", events); + + Set eventStatusCodes = events.stream().map(Event::getStatusCode).collect(Collectors.toSet()); + Set missingStatusCodes = new HashSet<>(requiredStatusCodes); + missingStatusCodes.removeAll(eventStatusCodes); + if (!missingStatusCodes.isEmpty()) { + + Map additionalDetails = Map.of( + "missingStatusCodes", String.join(",",missingStatusCodes) + ); + return getErrorOrSaveWarning( + "Necessary status code not found in events: " + missingStatusCodes, + context, + paperTrackings, + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.VALUES_NOT_FOUND, + additionalDetails, + strictFinalEventValidation, + events + ); + } + return Mono.just(events); + } + + /** + * Verifica che i timestamp di business degli eventi siano coerenti tra loro. Questa validazione raggruppa gli eventi + * in base ad un groupId specificato nella configurazione della sequence. Eventi con groupId uguali verranno comparati + * tra di loro, eventi con groupId null non verranno validati. + * + * @param events lista di eventi da validare + * @param paperTrackings entità di tracking + * @return Mono contenente la lista di eventi dati in input, altrimenti se la validazione non è andata a buona fine Mono.error() + */ + private Mono> validateBusinessTimestamps(List events, PaperTrackings paperTrackings, HandlerContext context, SequenceConfig sequenceConfig, Boolean strictFinalEventValidation, PaperTrackings paperTrackingsToUpdate) { + log.info("Beginning validation for business timestamps for events : {}", events); + Set finalGroup = sequenceConfig.dateValidationGroupForFinalEvents(); + Set stockGroup = sequenceConfig.dateValidationGroupForStockEvents(); + + if(events.stream().anyMatch(event -> Objects.isNull(event.getStatusTimestamp()))){ + Map additionalDetails = createAffectedEventsMap(false, events.stream() + .filter(event -> Objects.isNull(event.getStatusTimestamp())) + .toList()); + return getErrorOrSaveWarning("Invalid business timestamps", context, paperTrackings, ErrorCategory.DATE_ERROR, INVALID_VALUES, additionalDetails, strictFinalEventValidation, events); + } + + Instant validFinal = allStatusTimestampAreEquals(events, finalGroup); + boolean validStock = allStockStatusTimestampAreEquals(events, stockGroup); + + if (Objects.nonNull(validFinal) && validStock && checkPredictedRefinementTypeIfStock890(paperTrackings, validFinal)) { + paperTrackingsToUpdate.getPaperStatus().setValidatedSequenceTimestamp(validFinal); + return Mono.just(events); + } + + Map additionalDetails = createAffectedEventsMap(false, events.stream().filter(event -> finalGroup.contains(event.getStatusCode()) + || stockGroup.contains(event.getStatusCode())).toList()); + return getErrorOrSaveWarning("Invalid business timestamps", context, paperTrackings, ErrorCategory.DATE_ERROR, VALUES_NOT_MATCHING, additionalDetails, strictFinalEventValidation, events); + } + + private boolean checkPredictedRefinementTypeIfStock890(PaperTrackings paperTrackings, Instant validFinal) { + if (Objects.nonNull(paperTrackings.getPaperStatus()) && StringUtils.hasText(paperTrackings.getPaperStatus().getPredictedRefinementType()) + && paperTrackings.getPaperStatus().getPredictedRefinementType().equalsIgnoreCase(PRE10.name())) { + Optional RECAG012Event = TrackerUtility.findRECAG012Event(paperTrackings); + return RECAG012Event.map(event -> event.getStatusTimestamp().equals(validFinal)).orElse(true); + } + return true; + } + + private Instant allStatusTimestampAreEquals(List events, Set group) { + List timestamps = events.stream() + .filter(e -> group.contains(e.getStatusCode())) + .map(Event::getStatusTimestamp) + .toList(); + if (timestamps.size() <= 1 || timestamps.stream().allMatch(t -> t.equals(timestamps.getFirst()))) { + return timestamps.getFirst(); + } + return null; + } + + private boolean allStockStatusTimestampAreEquals(List events, Set group) { + List timestamps = events.stream() + .filter(e -> group.contains(e.getStatusCode())) + .map(Event::getStatusTimestamp) + .toList(); + return timestamps.size() <= 1 || timestamps.stream().allMatch(t -> t.equals(timestamps.getFirst())); + } + + protected Mono getErrorOrSaveWarning(String message, HandlerContext context, PaperTrackings paperTrackings, ErrorCategory errorCategory, ErrorCause errorCause, Map additionalDetails, Boolean strictFinalEventValidation, T returnValue) { + log.info("getErrorOrSaveWarning for trackingId {}: {} | strictFinalEventValidation: {}", context.getTrackingId(), message, strictFinalEventValidation); + + var error = PaperTrackingsErrorsMapper.buildPaperTrackingsError( + paperTrackings, + TrackerUtility.getStatusCodeFromEventId(paperTrackings, context.getEventId()), + errorCategory, + errorCause, + message, + additionalDetails, + FlowThrow.SEQUENCE_VALIDATION, + strictFinalEventValidation ? ErrorType.ERROR : ErrorType.WARNING, + context.getEventId() + ); + + return strictFinalEventValidation + ? Mono.error(new PnPaperTrackerValidationException(message, error)) + : paperTrackerErrorService.insertPaperTrackingsError(error).thenReturn(returnValue); + } + + private PaperTrackings enrichWithSequenceValidationTimestamp(List events, PaperTrackings paperTrackingsToUpdate) { + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + paperTrackingsToUpdate.setValidationFlow(validationFlow); + paperTrackingsToUpdate.getPaperStatus().setValidatedEvents(events.stream().map(Event::getId).toList()); + return paperTrackingsToUpdate; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/HandlersRegistry.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/HandlersRegistry.java new file mode 100644 index 000000000..96af97d03 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/HandlersRegistry.java @@ -0,0 +1,27 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.*; + +@Component +public class HandlersRegistry { + private final Map registry = new EnumMap<>(ProductType.class); + private final UnrecognizedEventHandler unrecognizedHandler; + + public HandlersRegistry(List factories, UnrecognizedEventHandler unrecognizedHandler) { + factories.forEach(factory -> registry.put(factory.getProductType(), factory)); + this.unrecognizedHandler = unrecognizedHandler; + } + + public Mono handleEvent(ProductType productType, EventTypeEnum eventType, HandlerContext ctx) { + return Optional.ofNullable(registry.get(productType)) + .map(abstractHandlersFactory -> abstractHandlersFactory.build(eventType, ctx)) + .map(handler -> handler.execute(ctx)) + .orElseGet(() -> unrecognizedHandler.handle(ctx)); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilder.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilder.java new file mode 100644 index 000000000..1006d469f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilder.java @@ -0,0 +1,30 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.mapper.SendEventMapper; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +@Component +@RequiredArgsConstructor +@Slf4j +public class IntermediateEventsBuilder implements HandlerStep { + + /** + * Step che gestisce la logica di creazione degli eventi intermedi in base agli eventi validati presenti nel tracciamento. + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing IntermediateEventsBuilder step for trackingId: {}", context.getTrackingId()); + + return SendEventMapper.createSendEventsFromPaperProgressStatusEvent(context.getPaperProgressStatusEvent()) + .doOnNext(sendEvent -> context.getEventsToSend().add(sendEvent)) + .then(); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTrigger.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTrigger.java new file mode 100644 index 000000000..056b14320 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTrigger.java @@ -0,0 +1,79 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.DeliveryFailureCauseEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Objects; +import java.util.Optional; +import java.util.Set; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; + +/** + * Attiva il retry verso pn-paper-channel solo quando il tracking presenta la + * delivery failure cause {@code M10}. + */ +@Component +@Slf4j +public class M10RetryTrigger extends RetrySender { + + private static final Set M10_RETRY_STATUS_CODES = Set.of( + RECRS002C.name(), + RECRN002C.name(), + RECAG003C.name(), + RECRI004C.name(), + RECRSI004C.name() + ); + + public M10RetryTrigger(PaperChannelClient paperChannelClient, PcRetryService pcRetryService) { + super(paperChannelClient, pcRetryService); + } + + /** + * Verifica la causale di mancata consegna del tracking e, se corrisponde a + * {@code M10} e lo status finale è supportato, riallinea gli eventi finali + * verso uno stato di PROGRESS ed esegue il retry ereditato da {@link RetrySender}. + * + * @param context contesto contenente il tracking da verificare + * @return mono vuoto se la causale non è {@code M10} o lo status finale non è supportato, + * altrimenti il mono del retry + */ + @Override + public Mono execute(HandlerContext context) { + boolean hasM10FailureCause = DeliveryFailureCauseEnum.M10.equals( + Optional.ofNullable(context.getPaperTrackings()) + .map(PaperTrackings::getPaperStatus) + .map(PaperStatus::getDeliveryFailureCause) + .map(DeliveryFailureCauseEnum::fromValue) + .orElse(DeliveryFailureCauseEnum.UNKNOWN) + ); + + if (!hasM10FailureCause || !M10_RETRY_STATUS_CODES.contains(context.getFinalStatusCode())) { + log.info("M10 retry skipped for trackingId: {} because hasM10FailureCause: {} and finalStatusCode: {}", + context.getTrackingId(), hasM10FailureCause, context.getFinalStatusCode()); + return Mono.empty(); + } + + context.getEventsToSend().stream() + .filter(sendEvent -> M10_RETRY_STATUS_CODES.contains(sendEvent.getStatusDetail())) + .filter(sendEvent -> isFeedbackEvent(context, sendEvent)) + .forEach(sendEvent -> sendEvent.setStatusCode(StatusCodeEnum.PROGRESS)); + + log.info("DeliveryFailureCause M10 found for trackingId: {}, executing PcRetryService", context.getTrackingId()); + return super.execute(context); + } + + private boolean isFeedbackEvent(HandlerContext context, SendEvent sendEvent) { + return Objects.equals(context.getFinalStatusCode(), sendEvent.getStatusDetail()) + && (sendEvent.getStatusCode() == StatusCodeEnum.OK + || sendEvent.getStatusCode() == StatusCodeEnum.KO); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserter.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserter.java new file mode 100644 index 000000000..f39d88c1f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserter.java @@ -0,0 +1,78 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.mapper.PaperProgressStatusEventMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +import java.util.Objects; + +@Component +@RequiredArgsConstructor +@Slf4j +public class MetadataUpserter implements HandlerStep { + + private final PaperTrackingsDAO paperTrackingsDAO; + private final DataVaultClient dataVaultClient; + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + + /** + * Step utilizzato per l'upsert dei metadati relativi all'evento di avanzamento. Inoltre se è presente l'indirizzo scoperto, si occupa di anonimizzarlo. + * Alla fine del processo l'entità aggiornata viene settata nel context insieme al trackingId. + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing MetadataUpserter step for trackingId: {}", context.getTrackingId()); + + return Mono.just(context) + .flatMap(this::discoveredAddressAnonimization) + .map(handlerContext -> PaperProgressStatusEventMapper.toPaperTrackings( + context.getReworkId(), + context.getPaperProgressStatusEvent(), + context.getAnonymizedDiscoveredAddressId(), + context.getEventId(), + context.isDryRunEnabled(), + TrackerUtility.checkIfIsFinalDemat(context.getPaperProgressStatusEvent().getStatusCode()), + TrackerUtility.checkIfIsP000event(context.getPaperProgressStatusEvent().getStatusCode()), + TrackerUtility.checkIfIsInternalEvent(pnPaperTrackerConfigs.getInternalEvents(), context.getPaperProgressStatusEvent().getStatusCode()), + TrackerUtility.checkIfIsRecag012event(context.getPaperProgressStatusEvent().getStatusCode()) + )) + .flatMap(paperTrackings -> paperTrackingsDAO.updateItem( + context.getPaperProgressStatusEvent().getRequestId(), + paperTrackings + )) + .doOnNext(TrackerUtility::checkValidationConfig)//aggiunto per retrocompatibilità + .doOnNext(paperTrackings -> updateContextWithTrackingInfo(context, paperTrackings)) + .then(); + } + + private void updateContextWithTrackingInfo(HandlerContext context, PaperTrackings paperTrackings) { + Long eventReceiveCount = paperTrackings.getEvents().stream() + .filter(event -> event.getId().equalsIgnoreCase(context.getEventId())) + .count(); + context.setPaperTrackings(paperTrackings); + context.setTrackingId(paperTrackings.getTrackingId()); + context.setMessageReceiveCount(eventReceiveCount); + } + + private Mono discoveredAddressAnonimization(HandlerContext handlerContext) { + DiscoveredAddress discoveredAddress = handlerContext.getPaperProgressStatusEvent().getDiscoveredAddress(); + if (Objects.nonNull(discoveredAddress)) { + return dataVaultClient.anonymizeDiscoveredAddress(handlerContext.getPaperProgressStatusEvent().getRequestId(), discoveredAddress) + .doOnNext(handlerContext::setAnonymizedDiscoveredAddressId) + .thenReturn(handlerContext); + } + return Mono.just(handlerContext); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/NotRetryableErrorInserting.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/NotRetryableErrorInserting.java new file mode 100644 index 000000000..bf97a1b44 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/NotRetryableErrorInserting.java @@ -0,0 +1,46 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +@Component +@RequiredArgsConstructor +@Slf4j +public class NotRetryableErrorInserting implements HandlerStep { + + private final PaperTrackerExceptionHandler paperTrackerExceptionHandler; + + /** + * Step che costruisce un oggetto `PaperTrackingsErrors`, relativamente ad un evento notRetryable, + * utilizzando i dati forniti nel contesto + * e delega la gestione dell'errore al rispettivo handler. + * + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return {@link Mono} + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing NotRetryableErrorInserting step for trackingId: {}", context.getTrackingId()); + + String statusCode = context.getPaperProgressStatusEvent().getStatusCode(); + PaperTrackingsErrors paperTrackingsErrors = PaperTrackingsErrorsMapper.buildPaperTrackingsError(context.getPaperTrackings(), + statusCode, + ErrorCategory.NOT_RETRYABLE_EVENT_ERROR, + null, + EventStatusCodeEnum.fromKey(statusCode).getStatusCodeDescription(), + null, + FlowThrow.NOT_RETRYABLE_EVENT_HANDLER, + ErrorType.WARNING, + context.getEventId() + ); + return paperTrackerExceptionHandler.handleRetryError(paperTrackingsErrors); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSender.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSender.java new file mode 100644 index 000000000..ddbb22fce --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSender.java @@ -0,0 +1,113 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.mapper.PaperTrackerDryRunOutputsMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.BusinessState; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import it.pagopa.pn.papertracker.middleware.eventBridge.EventBridgePublisher; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.utils.LogUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; + +import static it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent.JSON_PROPERTY_DISCOVERED_ADDRESS; +import static it.pagopa.pn.papertracker.utils.TrackerUtility.setNewStatus; + +@Slf4j +@RequiredArgsConstructor +@Component +public class OutputTargetSender implements HandlerStep { + + private final String CLIENT_ID = "pn-delivery-push"; + private final PnPaperTrackerConfigs configs; + private final PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + private final PaperTrackingsDAO paperTrackingsDAO; + private final EventBridgePublisher eventBridgePublisher; + private final LogUtility logUtility; + + /** + * Step che esegue l'invio degli eventi al target di output configurato, coda verso delivery-push oppure tabella di dry-run + * @param context Contesto contenente le informazioni necessarie per l'elaborazione dell'evento. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing OutputTargetSender step for trackingId: {}", context.getTrackingId()); + + List filteredEvent = context.getEventsToSend().stream() + .filter(sendEvent -> !configs.getSaveAndNotSendToDeliveryPush().contains(sendEvent.getStatusDetail())) + .toList(); + + if (CollectionUtils.isEmpty(filteredEvent)) { + log.info("No events to send for trackingId: {}. Skipping OutputTargetSender step.", context.getTrackingId()); + return Mono.empty(); + } + + return Flux.fromIterable(filteredEvent) + .concatMap(sendEvent -> sendToOutputTarget(sendEvent, context)) + .collectList() + .filter(sendEvent -> StringUtils.hasText(context.getFinalStatusCode()) || StringUtils.hasText(context.getNextRequestIdPcRetry())) + .map(sendEvent -> getPaperTrackingsDone(context.getNextRequestIdPcRetry(), context.getFinalStatusCode())) + .flatMap(paperTrackings -> paperTrackingsDAO.updateItem(context.getTrackingId(), paperTrackings)) + .doOnNext(context::setPaperTrackings) + .then(); + } + + /** + * Invia i dati specificati al target di output configurato. + *

+ * I target possono essere o la coda pn-external_channel_outputs o la tabella PnPaperTrackerDryRunOutputs + * Per configurare il target di output si utilizza un flag sendToDeliveryPushFlag + * + * @param event evento da salvare nel target di output + */ + public Mono sendToOutputTarget(SendEvent event, HandlerContext context) { + return Mono.just(event) + .flatMap(sendEvent -> { + String anonymizedEvent = logUtility.maskSensitiveData(sendEvent, JSON_PROPERTY_DISCOVERED_ADDRESS); + log.info("Sending to output target for event: {}", anonymizedEvent); + if (context.isDryRunEnabled()) { + log.info("Sending event to PnPaperTrackerDryRunOutputs"); + return paperTrackerDryRunOutputsDAO.insertOutputEvent(PaperTrackerDryRunOutputsMapper.dtoToEntity(sendEvent, context.getAnonymizedDiscoveredAddressId())); + } else { + log.info("Sending event to pn-external_channel_outputs"); + sendEvent.setRequestId(context.getPaperTrackings().getAttemptId()); + PaperChannelUpdate paperChannelUpdate = new PaperChannelUpdate(); + paperChannelUpdate.setSendEvent(sendEvent); + paperChannelUpdate.setClientId(StringUtils.hasText(context.getPaperTrackings().getAnalogRequestClientId()) ? + context.getPaperTrackings().getAnalogRequestClientId() : CLIENT_ID); + return eventBridgePublisher.publish(paperChannelUpdate); + } + }) + .thenReturn(event); + } + + private PaperTrackings getPaperTrackingsDone(String nextRequestIdPcRetry, String finalStatusCode) { + PaperTrackings paperTrackings = new PaperTrackings(); + setNewStatus(paperTrackings, finalStatusCode, BusinessState.DONE, PaperTrackingsState.DONE); + if(StringUtils.hasText(nextRequestIdPcRetry)){ + paperTrackings.setNextRequestIdPcretry(nextRequestIdPcRetry); + } + if(StringUtils.hasText(finalStatusCode)){ + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setFinalStatusCode(finalStatusCode); + paperTrackings.setPaperStatus(paperStatus); + } + return paperTrackings; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryService.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryService.java new file mode 100644 index 000000000..157eb9c0e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryService.java @@ -0,0 +1,64 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +@Component +@RequiredArgsConstructor +@Slf4j +public class PcRetryService { + + private final PaperTrackerExceptionHandler paperTrackerExceptionHandler; + /** + * Gestione della risposta del Paper Channel alla richiesta di retry. + * Se il retry è stato trovato, viene creata la nuova entità di tracking con il nuovo pcRetry e + * aggiornato lo stato dell'entità relativa al pcRetry precedente con lo stato DONE e il nextRequestIdPcretry. + * Se il retry non è stato trovato, viene gestito l'errore in base al tipo di evento (CON996 o generico). + * @param pcRetryResponse risposta del Paper Channel alla richiesta di retry + * @param isCON996 booleano che indica se l'evento è un CON996 + * @param context contesto dell'handler + * @return Mono(Void) + */ + public Mono handlePcRetryResponse(PcRetryResponse pcRetryResponse, Boolean isCON996, HandlerContext context) { + if (Boolean.TRUE.equals(pcRetryResponse.getRetryFound())) { + context.setNextRequestIdPcRetry(pcRetryResponse.getRequestId()); + return Mono.empty(); + } else { + PaperTrackingsErrors paperTrackingsErrors = Boolean.TRUE.equals(isCON996) ? buildErrorForCON996(context) : buildErrorForGeneric(context); + return paperTrackerExceptionHandler.handleRetryError(paperTrackingsErrors); + } + } + + private PaperTrackingsErrors buildErrorForGeneric(HandlerContext context) { + return PaperTrackingsErrorsMapper.buildPaperTrackingsError(context.getPaperTrackings(), + context.getPaperProgressStatusEvent().getStatusCode(), + ErrorCategory.MAX_RETRY_REACHED_ERROR, + null, + "Retry not found for trackingId: " + context.getPaperTrackings().getTrackingId(), + null, + FlowThrow.RETRY_PHASE, + ErrorType.ERROR, + context.getEventId()); + } + + private PaperTrackingsErrors buildErrorForCON996(HandlerContext context) { + String statusCode = context.getPaperProgressStatusEvent().getStatusCode(); + return PaperTrackingsErrorsMapper.buildPaperTrackingsError(context.getPaperTrackings(), + statusCode, + ErrorCategory.NOT_RETRYABLE_EVENT_ERROR, + null, + EventStatusCodeEnum.fromKey(statusCode).getStatusCodeDescription(), + null, + FlowThrow.NOT_RETRYABLE_EVENT_HANDLER, + ErrorType.WARNING, + context.getEventId()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySender.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySender.java new file mode 100644 index 000000000..7b23c0da2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySender.java @@ -0,0 +1,40 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +/** + * Gestisce l'invio delle richieste di retry a pn-paper-channel e la successiva + * elaborazione della risposta ricevuta. + */ +@Component +@RequiredArgsConstructor +@Slf4j +public class RetrySender implements HandlerStep { + + private final PaperChannelClient paperChannelClient; + private final PcRetryService pcRetryService; + + /** + * Invia al Paper Channel la richiesta di retry associata al contesto e delega + * l'elaborazione della risposta a {@link PcRetryService} (per tutti gli eventi di retry escluso il CON996). + * + * @param context contesto contenente i dati del tracking per cui effettuare il retry + * @return mono che completa al termine dell'elaborazione della risposta + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing RetrySender step for trackingId: {}", context.getTrackingId()); + + return paperChannelClient.getPcRetry(context, Boolean.FALSE) + .doOnError(throwable -> log.error("Error retrieving retry on {} for trackingId: {}", + context.getPaperProgressStatusEvent().getStatusCode(), + context.getPaperTrackings().getTrackingId(), throwable)) + .flatMap(pcRetryResponse -> pcRetryService.handlePcRetryResponse(pcRetryResponse, Boolean.FALSE, context)); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCON996.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCON996.java new file mode 100644 index 000000000..685ebc572 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCON996.java @@ -0,0 +1,31 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +@Component +@RequiredArgsConstructor +@Slf4j +public class RetrySenderCON996 implements HandlerStep { + + private final PaperChannelClient paperChannelClient; + private final PcRetryService pcRetryService; + + /** + * Step di invio della richiesta di retry al Paper Channel per tutti gli eventi CON996. + * @return Mono(Void) + */ + @Override + public Mono execute(HandlerContext context) { + log.info("Executing RetrySenderCON996 step for trackingId: {}", context.getTrackingId()); + + return paperChannelClient.getPcRetry(context, Boolean.TRUE) + .doOnError(throwable -> log.error("Error retrieving retry on CON996 for trackingId: {}", context.getPaperTrackings().getTrackingId(), throwable)) + .flatMap(pcRetryResponse -> pcRetryService.handlePcRetryResponse(pcRetryResponse, Boolean.TRUE, context)); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/UnrecognizedEventHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/UnrecognizedEventHandler.java new file mode 100644 index 000000000..bb2b67df7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/handler_step/generic/UnrecognizedEventHandler.java @@ -0,0 +1,23 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.model.HandlerContext; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Mono; + +@Component +@Slf4j +@RequiredArgsConstructor +public class UnrecognizedEventHandler{ + + private final MetadataUpserter metadataUpserter; + + public Mono handle(HandlerContext ctx) { + log.info("UnrecognizedEventHandler called. No action performed just saving for trackingId {}", ctx.getTrackingId()); + return Mono.just(metadataUpserter) + .flatMap(s -> s.execute(ctx)) + .then(); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImpl.java new file mode 100644 index 000000000..86e5d9b75 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImpl.java @@ -0,0 +1,92 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerBadRequestException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceItem; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceResponse; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.BusinessState; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import it.pagopa.pn.papertracker.model.EventStatus; +import it.pagopa.pn.papertracker.model.EventStatusCodeEnum; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfig; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.util.List; +import java.util.Optional; +import java.util.Set; + + +@Service +@Slf4j +@RequiredArgsConstructor +public class NotificationReworkServiceImpl implements NotificationReworkService { + + private final PaperTrackingsDAO paperTrackingsDAO; + + private static final String ERROR_CODE_INVALID_STATUS_CODE = "PN_PAPER_TRACKER_INVALID_STATUS_CODE"; + private static final String ERROR_CODE_INVALID_DELIVERY_FAILURE_CAUSE = "PN_PAPER_TRACKER_INVALID_STATUS_CODE"; + + + @Override + public Mono retrieveSequenceAndEventStatus(String statusCode, String deliveryFailureCause, String productType) { + SequenceResponse sequenceResponse = new SequenceResponse(); + + return Mono.justOrEmpty(TrackerUtility.evaluateStatusCodeAndRetrieveStatus(statusCode, deliveryFailureCause, productType)) + .switchIfEmpty(Mono.error(new PnPaperTrackerBadRequestException(ERROR_CODE_INVALID_STATUS_CODE, String.format("statusCode %s is invalid", statusCode)))) + .filter(eventStatus -> !EventStatus.PROGRESS.equals(eventStatus)) + .switchIfEmpty(Mono.error(new PnPaperTrackerBadRequestException(ERROR_CODE_INVALID_STATUS_CODE, String.format("statusCode %s is PROGRESS", statusCode)))) + .doOnNext(eventStatus -> sequenceResponse.setFinalStatusCode(SequenceResponse.FinalStatusCodeEnum.fromValue(eventStatus.name()))) + .flatMap(eventStatus -> Mono.justOrEmpty(retrieveSequence(statusCode, deliveryFailureCause))) + .switchIfEmpty(Mono.error(new PnPaperTrackerBadRequestException(ERROR_CODE_INVALID_DELIVERY_FAILURE_CAUSE, String.format("deliveryFailureCause %s is invalid", deliveryFailureCause)))) + .map(sequenceList -> { + sequenceResponse.setSequence(sequenceList); + log.info("Successfully retrieved sequence for statusCode {} with {} elements", statusCode, sequenceList.size()); + return sequenceResponse; + }) + .doOnError(throwable -> log.error("Error retrieving sequence for statusCode {}: {}", statusCode, throwable.getMessage())); + } + + @Override + public Mono updatePaperTrackingsStatusForRework(String trackingId, String reworkId) { + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setState(PaperTrackingsState.AWAITING_REWORK_EVENTS); + paperTrackings.setBusinessState(BusinessState.AWAITING_REWORK_EVENTS); + paperTrackings.setNotificationReworkRequestTimestamp(Instant.now()); + paperTrackings.setNotificationReworkId(reworkId); + return paperTrackingsDAO.updateItemForRework(trackingId, paperTrackings).then(); + } + + private List retrieveSequence(String statusCode, String deliveryFailureCause) { + SequenceConfig sequenceConfig = SequenceConfiguration.getConfig(statusCode); + List deliveryFailureCauses = sequenceConfig.sequenceStatusCodes().stream() + .map(EventStatusCodeEnum::fromKey) + .flatMap(eventStatusCodeEnum -> eventStatusCodeEnum.getDeliveryFailureCauseList().stream().map(Enum::name)) + .toList(); + + boolean hasFailureCause = StringUtils.isNotBlank(deliveryFailureCause); + + if (CollectionUtils.isEmpty(deliveryFailureCauses) ? hasFailureCause : !deliveryFailureCauses.contains(deliveryFailureCause)) { + return null; + } + return sequenceConfig.sequenceStatusCodes().stream() + .map(code -> { + SequenceItem item = new SequenceItem(); + item.setStatusCode(code); + item.setAttachments(Optional.ofNullable(sequenceConfig.validAttachments().get(code)).orElse(Set.of()).stream().toList()); + return item; + }).toList(); + } +} + + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImpl.java new file mode 100644 index 000000000..e66463387 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImpl.java @@ -0,0 +1,56 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponseResultsInner; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorDetails; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.Optional; + +@Service +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerErrorServiceImpl implements PaperTrackerErrorService { + + private final PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + private final PaperTrackerMapStructMapper mapper; + + @Override + public Mono retrieveTrackingErrors(TrackingsRequest trackingsRequest) { + TrackingErrorsResponse trackingErrorsResponse = new TrackingErrorsResponse(); + return Flux.fromIterable(trackingsRequest.getTrackingIds()) + .flatMap(trackingId -> paperTrackingsErrorsDAO.retrieveErrors(trackingId) + .map(mapper::toTrackingError) + .collectList() + .map(trackingErrors -> { + TrackingErrorsResponseResultsInner trackingErrorsResponseResultsInner = new TrackingErrorsResponseResultsInner(); + trackingErrorsResponseResultsInner.setTrackingId(trackingId); + trackingErrorsResponseResultsInner.setErrors(trackingErrors); + return trackingErrorsResponseResultsInner; + } + )) + .collectList() + .doOnNext(trackingErrorsResponse::setResults) + .map(trackingErrorsResponseResultsInners -> trackingErrorsResponse); + } + @Override + public Mono insertPaperTrackingsError(PaperTrackingsErrors paperTrackingsError) { + log.info("Inserting paper trackings error: trackingId={}, category={}, cause={} type={}", + paperTrackingsError.getTrackingId(), + paperTrackingsError.getErrorCategory(), + Optional.ofNullable(paperTrackingsError.getDetails()).map(ErrorDetails::getCause).orElse(null), + paperTrackingsError.getType()); + // TODO: inoltrare gli errori al consolidatore quando il contratto sara definito. + return paperTrackingsErrorsDAO.insertError(paperTrackingsError) + .thenReturn(paperTrackingsError); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImpl.java new file mode 100644 index 000000000..f4b4492ce --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImpl.java @@ -0,0 +1,40 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponseResultsInner; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerOutputService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +@Service +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerOutputServiceImpl implements PaperTrackerOutputService { + + private final PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + private final PaperTrackerMapStructMapper mapper; + + @Override + public Mono retrieveTrackingOutputs(TrackingsRequest trackingsRequest) { + PaperTrackerOutputsResponse paperTrackerOutputsResponse = new PaperTrackerOutputsResponse(); + return Flux.fromIterable(trackingsRequest.getTrackingIds()) + .flatMap(trackingId -> paperTrackerDryRunOutputsDAO.retrieveOutputEvents(trackingId) + .map(mapper::toDtoPaperTrackerOutput) + .collectList() + .map(paperTrackerDryRunOutputs -> { + PaperTrackerOutputsResponseResultsInner paperTrackerOutputsResponseResultInner = new PaperTrackerOutputsResponseResultsInner(); + paperTrackerOutputsResponseResultInner.setTrackingId(trackingId); + paperTrackerOutputsResponseResultInner.setOutputs(paperTrackerDryRunOutputs); + return paperTrackerOutputsResponseResultInner; + })) + .collectList() + .doOnNext(paperTrackerOutputsResponse::setResults) + .map(paperTrackerOutputsResponseResultInners -> paperTrackerOutputsResponse); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImpl.java new file mode 100644 index 000000000..0f87d5745 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImpl.java @@ -0,0 +1,71 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.config.TrackerConfigUtils; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsResponse; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; + +import java.time.Instant; + +import static it.pagopa.pn.papertracker.mapper.PaperTrackingsMapper.toPaperTrackings; + +@Service +@Slf4j +@RequiredArgsConstructor +public class PaperTrackerTrackingServiceImpl implements PaperTrackerTrackingService { + + private final PaperTrackingsDAO paperTrackingsDAO; + private final TrackerConfigUtils trackerConfigUtils; + private final PnPaperTrackerConfigs pnPaperTrackerConfigs; + private final PaperTrackerMapStructMapper mapper; + + @Override + public Mono insertPaperTrackings(TrackingCreationRequest trackingCreationRequest, String xOriginClientId) { + log.info("Init tracking for request: {}", trackingCreationRequest); + + return paperTrackingsDAO.putIfAbsent(toPaperTrackings(trackingCreationRequest, trackerConfigUtils, pnPaperTrackerConfigs, Instant.now(), xOriginClientId)).then(); + } + + @Override + public Mono retrieveTrackings(TrackingsRequest trackingsRequest) { + log.info("Retrieving trackings for request: {}", trackingsRequest); + + TrackingsResponse response = new TrackingsResponse(); + return paperTrackingsDAO.retrieveAllByTrackingIds(trackingsRequest.getTrackingIds()) + .map(mapper::toTracking) + .collectList() + .doOnNext(trackings -> log.info("Retrieved {} trackings for request {}", trackings.size(), trackingsRequest)) + .doOnNext(response::setTrackings) + .thenReturn(response); + } + + @Override + public Mono updatePaperTrackingsStatus(String trackingId, PaperTrackings paperTrackings) { + log.info("Updating tracking status for trackingId: {}", trackingId); + + return paperTrackingsDAO.updateItem(trackingId, paperTrackings) + .then(); + } + + @Override + public Mono retrieveTrackingsByAttemptId(String attemptId, String pcRetry) { + log.info("Retrieving trackings for attemptId: {} with pcRetry: {}", attemptId, pcRetry); + + TrackingsResponse response = new TrackingsResponse(); + return paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, pcRetry) + .map(mapper::toTracking) + .collectList() + .doOnNext(response::setTrackings) + .thenReturn(response); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImpl.java new file mode 100644 index 000000000..e9195f5fb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImpl.java @@ -0,0 +1,201 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.queue.model.CustomEventHeader; +import it.pagopa.pn.papertracker.middleware.queue.model.ExternalChannelEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperChannelDryRunMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperTrackerMomProducer; +import it.pagopa.pn.papertracker.service.SourceQueueProxyService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.utils.QueueConst.*; + +/** + * Service che gestisce il routing degli eventi provenienti da pn-ec in base alla modalità operativa. + *

+ * Implementa la logica di proxy tra pn-ec e i componenti paper-tracker e paper-channel, + * determinando il flusso di elaborazione in base alle all'attributo processingMode presente nella tabella pn-PaperTrackings. + *

+ */ +@Service +@Slf4j +@RequiredArgsConstructor +public class SourceQueueProxyServiceImpl implements SourceQueueProxyService { + private static final String DRY_RUN_KEY = "dryRun"; + + private final ExternalChannelToPaperTrackerMomProducer paperTrackerProducer; + private final ExternalChannelToPaperChannelDryRunMomProducer paperChannelDryRunProducer; + private final PaperTrackingsDAO paperTrackingsDAO; + + /** + * Gestisce un messaggio proveniente da pn-ec applicando le regole di routing in base al processingMode. + *

+ * Le regole applicate sono: + *

    + *
  • Spedizione NON presente su pn-PaperTrackings -> evento inoltrato solo a pn-paper-channel (se non duplicato)
  • + *
  • Spedizione presente e modalità DRY -> evento inoltrato a pn-paper-channel (se non duplicato) e pn-paper-tracker
  • + *
  • Spedizione presente e modalità RUN -> evento inoltrato solo a pn-paper-tracker
  • + *
  • Spedizione presente e processingMode null -> evento inoltrato a pn-paper-channel (se non duplicato) e pn-paper-tracker
  • + *
+ *

+ * + * @param message il messaggio da pn-ec + * @param messageAttributes attributi del messaggio + * @return Mono + */ + public Mono handleExternalChannelMessage( + SingleStatusUpdate message, + Map messageAttributes + ) { + String requestId; + try { + requestId = message.getAnalogMail().getRequestId(); + } catch (NullPointerException e) { + return Mono.error(new PaperTrackerException("Malformed event from external-channel", e)); + } + + log.info("Routing message - requestId: {}, statusCode: {}, isDuplicate: {}, clientRequestTimeStamp: {}", + requestId, + message.getAnalogMail().getStatusCode(), + message.getAnalogMail().getIsDuplicate(), + message.getAnalogMail().getClientRequestTimeStamp()); + + return paperTrackingsDAO.retrieveEntityByTrackingId(requestId) + // caso: tracking NON trovato + .switchIfEmpty(handlePaperChannelEvent(message, messageAttributes).then(Mono.empty())) + // caso: tracking trovato + .flatMap(tracking -> handleByProcessingMode(tracking, message, messageAttributes)) + .then(); + } + + /** + * Gestisce un evento quando il tracking non è presente su pn-PaperTrackings. + * L'evento viene inoltrato a pn-paper-channel in modalità dry-run solo se non è un duplicato + * (isDuplicate == false o isDuplicate == null). + * + * @param event l'evento da inoltrare + * @return Mono + */ + private Mono handlePaperChannelEvent(SingleStatusUpdate event, + Map messageAttributes) { + return Mono.fromRunnable(() -> { + if (shouldForwardToPaperChannel(event)) { + paperChannelDryRunProducer.push(buildOutputMessage(event, messageAttributes, true)); + } + }); + } + + /** + * Gestisce l'evento in base alla modalità operativa (DRY o RUN) recuperata dal tracking. + *

+ * Modalità DRY: l'evento viene inoltrato a pn-paper-tracker e a pn-paper-channel solo se non duplicato. + * Modalità RUN: l'evento viene inviato solo a pn-paper-tracker. + * Null: spedizioni inizializzate prima della GA26Q1.A, stesse regole di DRY per l'inoltro a pn-paper-channel. + *

+ * + * @param tracking oggetto della spedizione + * @param event l'evento da processare + * @param messageAttributes attributi del messaggio + * @return Mono + */ + private Mono handleByProcessingMode( + PaperTrackings tracking, + SingleStatusUpdate event, + Map messageAttributes + ) { + return switch (tracking.getProcessingMode()) { + case DRY -> Mono.fromRunnable(() -> forwardInDryRun(tracking, event, messageAttributes)); + case RUN -> Mono.fromRunnable(() -> + paperTrackerProducer.push(buildOutputMessage(event, messageAttributes, false)) + ); + case null -> Mono.fromRunnable(() -> { + log.info("Tracking entity created without processignMode, createdAt: {}", tracking.getCreatedAt()); + forwardInDryRun(tracking, event, messageAttributes); + }); + }; + } + + /** + * Inoltra l'evento in modalità dry-run a pn-paper-tracker e, solo se non è un duplicato + * (isDuplicate == false o isDuplicate == null), anche a pn-paper-channel. + * + * @param tracking oggetto della spedizione + * @param event l'evento da inoltrare + * @param messageAttributes attributi del messaggio + */ + private void forwardInDryRun( + PaperTrackings tracking, + SingleStatusUpdate event, + Map messageAttributes + ) { + var enrichedMessage = buildOutputMessage(event, messageAttributes, true); + if (shouldForwardToPaperChannel(event)) { + paperChannelDryRunProducer.push(enrichedMessage); + } else { + log.info("Event is duplicate, not forwarding to paper-channel, requestId: {}, statusCode: {}, clientRequestTimeStamp: {}", + tracking.getTrackingId(), + event.getAnalogMail().getStatusCode(), + event.getAnalogMail().getClientRequestTimeStamp()); + } + paperTrackerProducer.push(enrichedMessage); + } + + /** + * Determina se l'evento deve essere inoltrato a pn-paper-channel. + * L'evento viene inoltrato solo se non è un duplicato (isDuplicate == false o isDuplicate == null). + * + * @param event l'evento da verificare + * @return true se l'evento deve essere inoltrato a pn-paper-channel + */ + private boolean shouldForwardToPaperChannel(SingleStatusUpdate event) { + Boolean isDuplicate = event.getAnalogMail() != null + ? event.getAnalogMail().getIsDuplicate() + : null; + return !Boolean.TRUE.equals(isDuplicate); + } + + /** + * Costruisce il messaggio di output da inoltrare ai consumer, arricchendolo con header e flag dry-run. + * + * @param event il messaggio originale da pn-ec + * @param messageAttributes attributi del messaggio + * @param isDryRun header dryRun + * @return evento arricchito pronto per essere inoltrato + */ + private ExternalChannelEvent buildOutputMessage( + SingleStatusUpdate event, + Map messageAttributes, + boolean isDryRun) { + + Map attributes = + new HashMap<>(messageAttributes != null ? messageAttributes : Map.of()); + + attributes.put(DRY_RUN_KEY, MessageAttributeValue.builder() + .dataType("String") + .stringValue(String.valueOf(isDryRun)) + .build()); + + return ExternalChannelEvent.builder() + .header(CustomEventHeader.builder() + .publisher(PUBLISHER) + .eventId(UUID.randomUUID().toString()) + .createdAt(Instant.now()) + .eventType(TRACKER_QUEUE_PROXY_EVENT_TYPE) + .messageAttributes(attributes) + .build()) + .payload(event) + .build(); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/AttachmentsConfigUtils.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/AttachmentsConfigUtils.java new file mode 100644 index 000000000..95e3f65e0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/AttachmentsConfigUtils.java @@ -0,0 +1,39 @@ +package it.pagopa.pn.papertracker.utils; + +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class AttachmentsConfigUtils { + + static String SAFESTORAGE_PREFIX = "safestorage://"; + + public static String cleanFileKey(String fileKey) { + return cleanFileKey(fileKey, true); + } + + public static String cleanFileKey(String fileKey, boolean cleanSafestoragePrefix) { + if (fileKey == null) { + return null; + } + + StringBuilder fileKeyNew = new StringBuilder(); + + if (cleanSafestoragePrefix && fileKey.contains(SAFESTORAGE_PREFIX)){ + //clean safestorage:// + fileKeyNew.append(fileKey.replace(SAFESTORAGE_PREFIX, "")); + } + else { + fileKeyNew.append(fileKey); + } + + var queryParamStartIndex = fileKeyNew.indexOf("?"); + if(queryParamStartIndex != -1) { + //clean all query params + fileKeyNew.delete(queryParamStartIndex, fileKeyNew.length()); + } + + return fileKeyNew.toString(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/LogUtility.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/LogUtility.java new file mode 100644 index 000000000..a76126298 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/LogUtility.java @@ -0,0 +1,139 @@ +package it.pagopa.pn.papertracker.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import io.awspring.cloud.sqs.listener.SqsHeaders; +import lombok.RequiredArgsConstructor; +import org.springframework.messaging.Message; +import org.springframework.stereotype.Component; + +import java.util.*; + + +@Component +@RequiredArgsConstructor +public class LogUtility { + + private static final String MASK = "***"; + + private final ObjectMapper objectMapper; + + + /** + * Maschera i campi sensibili di un oggetto Java. + * + * @param obj oggetto da loggare; se {@code null} viene restituita la stringa {@code "null"} + * @param fieldNames nomi dei campi da mascherare (case-sensitive) + * @return rappresentazione JSON con i campi sensibili mascherati + */ + public String maskSensitiveData(Object obj, String... fieldNames) { + if (obj == null) { + return "null"; + } + + try { + JsonNode rootNode = objectMapper.valueToTree(obj); + maskSensitiveData(rootNode, fieldNames); + return objectMapper.writeValueAsString(rootNode); + } catch (Exception e) { + return obj.toString(); + } + } + + /** + * Maschera i campi sensibili di una stringa JSON. + * + * @param json stringa JSON da loggare; se {@code null} viene restituita la stringa {@code "null"} + * @param fieldNames nomi dei campi da mascherare (case-sensitive) + * @return stringa JSON con i campi sensibili mascherati + */ + public String maskSensitiveDataFromJson(String json, String... fieldNames) { + if (json == null) { + return "null"; + } + + try { + JsonNode rootNode = objectMapper.readTree(json); + maskSensitiveData(rootNode, fieldNames); + return objectMapper.writeValueAsString(rootNode); + } catch (Exception e) { + return json; + } + } + + /** + * Maschera i campi sensibili direttamente su un {@link JsonNode}. + *

+ * Nessuna serializzazione o deserializzazione viene eseguita. + *

+ * + * @param rootNode nodo JSON da mascherare + * @param fieldNames nomi dei campi da mascherare (case-sensitive) + * @return lo stesso {@link JsonNode} modificato + */ + public JsonNode maskSensitiveData(JsonNode rootNode, String... fieldNames) { + if (rootNode == null) { + return null; + } + + Set fieldsToMask = new HashSet<>(Arrays.asList(fieldNames)); + maskRecursively(rootNode, fieldsToMask); + return rootNode; + } + + + /** + * Visita ricorsivamente un {@link JsonNode} e maschera i campi + * il cui nome è presente nell'insieme {@code fieldsToMask}. + * + * @param node nodo corrente dell'albero JSON + * @param fieldsToMask insieme dei nomi dei campi da mascherare + */ + private void maskRecursively(JsonNode node, Set fieldsToMask) { + + if (node.isObject()) { + ObjectNode objectNode = (ObjectNode) node; + + objectNode.fieldNames().forEachRemaining(fieldName -> { + JsonNode child = objectNode.get(fieldName); + + if (fieldsToMask.contains(fieldName)) { + objectNode.set(fieldName, objectMapper.getNodeFactory().textNode(MASK)); + } else { + maskRecursively(child, fieldsToMask); + } + }); + + } else if (node.isArray()) { + for (JsonNode element : node) { + maskRecursively(element, fieldsToMask); + } + } + } + + /** + * Converte un {@link Message} in una stringa pronta per il logging, anonimizzando + * i campi sensibili del payload e rimuovendo l'header "Body". + * + * @param tipo del payload del messaggio + * @param message messaggio da convertire in stringa; non deve essere {@code null} + * @param fieldsToMask insieme dei nomi dei campi del payload da mascherare; se vuoto o {@code null}, il payload non viene modificato + * @return rappresentazione in stringa del messaggio con payload mascherato e headers senza "Body" + */ + public String messageToString(Message message, Set fieldsToMask) { + T payload = message.getPayload(); + // Maschera il payload reale + String maskedPayload = maskSensitiveData(payload, fieldsToMask.toArray(new String[0])); + + // Toglie Body da headers + Map headersMap = new LinkedHashMap<>(); + message.getHeaders().forEach((k, v) -> { + if (!SqsHeaders.SQS_SOURCE_DATA_HEADER.equalsIgnoreCase(k)) { + headersMap.put(k, v); + } + }); + + return "Message [payload=" + maskedPayload + ", headers=" + headersMap + "]"; + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/MetricUtils.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/MetricUtils.java new file mode 100644 index 000000000..38893e7e9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/MetricUtils.java @@ -0,0 +1,55 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.commons.log.dto.metrics.Dimension; +import it.pagopa.pn.commons.log.dto.metrics.GeneralMetric; +import it.pagopa.pn.commons.log.dto.metrics.Metric; +import lombok.Getter; + +import java.time.Instant; +import java.util.List; + +public class MetricUtils { + private static final String METRIC_NAMESPACE = "paper-tracker-errors"; + + private MetricUtils() {} + + public static Dimension generateDimension(DimensionName name, String value) { + return new Dimension(name.getValue(), value); + } + + public static GeneralMetric generateGeneralMetric(MetricName metricName, int metricValue, List dimensions) { + return generateGeneralMetric(metricName, metricValue, dimensions, null); + } + + public static GeneralMetric generateGeneralMetric(MetricName metricName, int metricValue, List dimensions, MetricUnit unit) { + GeneralMetric generalMetric = new GeneralMetric(); + generalMetric.setNamespace(METRIC_NAMESPACE); + generalMetric.setMetrics(List.of(new Metric(metricName.getValue(), metricValue))); + generalMetric.setDimensions(dimensions); + generalMetric.setTimestamp(Instant.now().toEpochMilli()); + if (unit != null) generalMetric.setUnit(unit.getValue()); + return generalMetric; + } + + @Getter + public enum MetricName { + ERROR_COUNT("ERROR_COUNT"); + private final String value; + MetricName(String value) { this.value = value; } + } + + @Getter + public enum MetricUnit { + COUNT("Count"); + private final String value; + MetricUnit(String value) { this.value = value; } + } + + @Getter + public enum DimensionName { + ERROR_CATEGORY("errorCategory"), + PRODUCT_TYPE("productType"); + private final String value; + DimensionName(String value) { this.value = value; } + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/OcrUtility.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/OcrUtility.java new file mode 100644 index 000000000..c438473ca --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/OcrUtility.java @@ -0,0 +1,254 @@ +package it.pagopa.pn.papertracker.utils; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.DataDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.DetailsDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.api.dto.events.GenericEventHeader; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.*; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.*; +import java.util.stream.Collectors; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG010A; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRN010; +import static it.pagopa.pn.papertracker.utils.QueueConst.OCR_REQUEST_EVENT_TYPE; +import static it.pagopa.pn.papertracker.utils.QueueConst.PUBLISHER; + +@Component +@RequiredArgsConstructor +@Slf4j +public class OcrUtility { + + private final OcrMomProducer ocrMomProducer; + private final SafeStorageClient safeStorageClient; + private final PnPaperTrackerConfigs cfg; + private final PaperTrackingsDAO paperTrackingsDAO; + + public Mono checkAndSendToOcr(Event event, Map> attachmentList, HandlerContext context) { + PaperTrackings paperTracking = context.getPaperTrackings(); + OcrStatusEnum ocrStatusEnum = context.getPaperTrackings().getValidationConfig().getOcrEnabled(); + + if (Objects.nonNull(ocrStatusEnum) && !ocrStatusEnum.equals(OcrStatusEnum.DISABLED)) { + log.info("OCR validation enabled for trackingId={}", paperTracking.getTrackingId()); + return sendMessageToOcr(event, attachmentList, paperTracking, ocrStatusEnum) + .flatMap(sentToOcr -> OcrStatusEnum.DRY.equals(ocrStatusEnum) ? Mono.just(false) : Mono.just(sentToOcr)); + } else { + log.info("OCR validation disabled for trackingId={}", paperTracking.getTrackingId()); + return paperTrackingsDAO.updateItem(paperTracking.getTrackingId(), getPaperTrackingsToUpdate(OcrStatusEnum.DISABLED, false, event, null)) + .doOnNext(v -> log.debug("Updated PaperTrackings entity with OCR flag disabled for trackingId={}", paperTracking.getTrackingId())) + .thenReturn(false); + } + } + + /** + * Invia i documenti validi al servizio OCR per la validazione allegati. + *

+ * Il metodo filtra preliminarmente gli allegati verificando che il loro + * tipo sia tra quelli abilitati alla validazione OCR da configurazione. + * + * @param event evento corrente del flusso + * @param attachmentList mappa degli allegati associati all'evento + * @param paperTracking entità di tracking della spedizione + * @param ocrStatusEnum stato OCR da impostare sul tracking + * @return {@link Mono} che emette: + *

    + *
  • {@code true} se la richiesta OCR è stata effettivamente inviata
  • + *
  • {@code false} se non sono presenti allegati validi e l'OCR è stato saltato
  • + *
+ */ + private Mono sendMessageToOcr(Event event, + Map> attachmentList, + PaperTrackings paperTracking, + OcrStatusEnum ocrStatusEnum) { + Instant now = Instant.now(); + List ocrFileTypes = paperTracking.getValidationConfig().getOcrFileTypes(); + Map> validAttachmentList = attachmentList.entrySet().stream() + .map(entry -> Map.entry( + entry.getKey(), + entry.getValue().stream() + .filter(attachment -> + ocrFileTypes.contains(retrieveFileType(attachment.getUri())) + && getSourceType(attachment).equals(SourceType.SCANNED.name()) && getOriginType(attachment).equals(OriginType.ORIGINAL.name())) + .toList())) + .filter(entry -> !entry.getValue().isEmpty()) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + + // Nessun allegato valido -> OCR non invocato + if (validAttachmentList.isEmpty()) { + log.info("No attachment type supported found for OCR, skipping OCR request for trackingId={}", paperTracking.getTrackingId()); + return paperTrackingsDAO.updateItem(paperTracking.getTrackingId(), getPaperTrackingsToUpdate(ocrStatusEnum,false, event, null)) + .thenReturn(false); + } + + // OCR invocato + List ocrRequests = new ArrayList<>(); + return Flux.fromIterable(validAttachmentList.entrySet()) + .flatMap(attachmentEntry -> processAttachments(attachmentEntry, paperTracking, event, ocrRequests, now)) + .collectList() + .flatMap(unused -> paperTrackingsDAO.updateItem(paperTracking.getTrackingId(), + getPaperTrackingsToUpdate(ocrStatusEnum, true, event, ocrRequests))) + .doOnNext(unused -> log.info("OCR validation completed for trackingId={}", paperTracking.getTrackingId())) + .thenReturn(true); + } + + private boolean isSourceTypeAndOriginTypeNotNull(Attachment attachment) { + return StringUtils.isNotBlank(attachment.getSourceType()) && StringUtils.isNotBlank(attachment.getOriginType()); + } + + private String getSourceType(Attachment attachment) { + if (isSourceTypeAndOriginTypeNotNull(attachment)) { + return attachment.getSourceType(); + } + return FileType.PDF.getValue().equalsIgnoreCase(retrieveFileType(attachment.getUri())) ? SourceType.SCANNED.name() : SourceType.DIGITAL.name(); + } + + private String getOriginType(Attachment attachment) { + return isSourceTypeAndOriginTypeNotNull(attachment) ? attachment.getOriginType() : OriginType.ORIGINAL.name(); + } + + private Flux processAttachments(Map.Entry> attachmentEntry, + PaperTrackings paperTracking, + Event event, + List ocrRequests, + Instant now) { + return Flux.fromIterable(attachmentEntry.getValue()) + .flatMap(attachment -> processAttachmentForOcr(paperTracking, attachment, attachmentEntry.getKey(), event, ocrRequests, now)); + } + + private Mono processAttachmentForOcr(PaperTrackings paperTracking, + Attachment attachment, + String attachmentEventId, + Event event, + List ocrRequests, + Instant now) { + String documentType = attachment.getDocumentType(); + String ocrRequestId = TrackerUtility.buildOcrRequestId(paperTracking.getTrackingId(), event.getId(), documentType); + ocrRequests.add(getOcrRequest(documentType, event.getId(), attachmentEventId, attachment.getUri(), now)); + + return safeStorageClient.getSafeStoragePresignedUrl(attachment.getUri()) + .doOnNext(presignedUrl -> { + OcrEvent ocrEvent = buildOcrEvent(paperTracking, ocrRequestId, presignedUrl, DocumentTypeEnum.fromValue(documentType), event); + ocrMomProducer.push(ocrEvent); + }); + } + + private OcrRequest getOcrRequest(String documentType, String finalEventId, String attachmentEventId, String uri, Instant now) { + OcrRequest ocrRequest = new OcrRequest(); + ocrRequest.setDocumentType(documentType); + ocrRequest.setFinalEventId(finalEventId); + ocrRequest.setAttachmentEventId(attachmentEventId); + ocrRequest.setRequestTimestamp(now); + ocrRequest.setUri(uri); + return ocrRequest; + } + + static public String retrieveFileType(String uri) { + return FilenameUtils.getExtension(uri).toLowerCase(Locale.ROOT); + } + + private PaperTrackings getPaperTrackingsToUpdate(OcrStatusEnum ocrStatusEnum, + boolean isSentToOcr, + Event event, + List ocrRequests) { + PaperTrackings paperTracking = new PaperTrackings(); + paperTracking.setValidationConfig(new ValidationConfig()); + paperTracking.setValidationFlow(new ValidationFlow()); + paperTracking.getValidationConfig().setOcrEnabled(ocrStatusEnum); + paperTracking.getValidationFlow().setOcrRequests(ocrRequests != null ? ocrRequests : List.of()); + + if(isSentToOcr && ocrStatusEnum.equals(OcrStatusEnum.RUN)) { + TrackerUtility.setNewStatus(paperTracking, event.getStatusCode(), BusinessState.AWAITING_OCR, PaperTrackingsState.AWAITING_OCR); + } else { + TrackerUtility.setDematValidationTimestamp(paperTracking, event.getStatusCode()); + } + + return paperTracking; + } + + private OcrEvent buildOcrEvent(PaperTrackings paperTracking, String ocrRequestId, String presignedUrl, DocumentTypeEnum documentType, Event event) { + + GenericEventHeader ocrHeader = GenericEventHeader.builder() + .publisher(PUBLISHER) + .eventId(UUID.randomUUID().toString()) + .createdAt(Instant.now()) + .eventType(OCR_REQUEST_EVENT_TYPE) + .build(); + + DetailsDTO.DeliveryFailureCause deliveryFailureCause = StringUtils.isNotBlank(paperTracking.getPaperStatus().getDeliveryFailureCause()) ? + DetailsDTO.DeliveryFailureCause.valueOf(paperTracking.getPaperStatus().getDeliveryFailureCause()) : null; + + DataDTO.UnifiedDeliveryDriver unifiedDeliveryDriver = StringUtils.isNotBlank(paperTracking.getUnifiedDeliveryDriver()) ? + DataDTO.UnifiedDeliveryDriver.valueOf(paperTracking.getUnifiedDeliveryDriver().toUpperCase()) : null; + + LocalDateTime deliveryAttemptDate = Optional.ofNullable(getDeliveryAttemptDate(paperTracking)) + .map(instant -> LocalDateTime.ofInstant(instant, ZoneOffset.UTC)) + .orElse(null); + + OcrDataPayloadDTO ocrDataPayload = OcrDataPayloadDTO.builder() + .version("v1") + .commandType(OcrDataPayloadDTO.CommandType.POSTAL) + .commandId(ocrRequestId) + .data(DataDTO.builder() + .documentType(DataDTO.DocumentType.valueOf(documentType.name())) + .productType(getProductType(paperTracking)) + .unifiedDeliveryDriver(unifiedDeliveryDriver) + .details( + DetailsDTO.builder() + .attachment(presignedUrl) + .registeredLetterCode(paperTracking.getPaperStatus().getRegisteredLetterCode()) + .notificationDate(LocalDateTime.ofInstant(event.getStatusTimestamp(), ZoneOffset.UTC)) + .deliveryFailureCause(deliveryFailureCause) + .deliveryDetailCode(event.getStatusCode()) + .deliveryAttemptDate(deliveryAttemptDate) + .build() + ) + .build()) + .build(); + + return new OcrEvent(ocrHeader, ocrDataPayload); + } + + private DataDTO.ProductType getProductType(PaperTrackings paperTracking) { + return Arrays.stream(DataDTO.ProductType.values()).filter(ocrProductType -> ocrProductType.getValue().equals(paperTracking.getProductType())) + .findFirst() + .orElseThrow(() -> { + log.error("invalid ProductType for trackingId={}: {}", paperTracking.getTrackingId(), paperTracking.getProductType()); + return new IllegalArgumentException("Invalid product type: " + paperTracking.getProductType()); + }); + } + + /** + * Per il prodotto AR, recupera lo statusTimestamp dell'evento RECRN010 se presente, altrimenti ritorna null. + * Per il prodotto 890, recupera lo statusTimestamp dell'evento RECAG010A se presente, altrimenti ritorna null. + * + * @param paperTrackings L'oggetto `PaperTrackings` contenente gli eventi associati al tracking. + * @return Lo statusTimestamp del primo evento trovato, oppure null. + */ + private Instant getDeliveryAttemptDate(PaperTrackings paperTrackings) { + return paperTrackings.getEvents().stream() + .filter(event -> RECRN010.name().equals(event.getStatusCode()) + || RECAG010A.name().equals(event.getStatusCode())) + .sorted(Comparator.comparing(Event::getRequestTimestamp).reversed()) + .map(Event::getStatusTimestamp) + .findFirst() + .orElse(null); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMock.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMock.java new file mode 100644 index 000000000..35a27eda0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMock.java @@ -0,0 +1,60 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import reactor.core.publisher.Mono; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.CON996; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class PcRetryUtilsMock { + + public static final String RETRY = ".PCRETRY_"; + public static final String PCRETRY = "PCRETRY_"; + + + static public Mono getPcRetryPaperMock(PaperTrackings paperTrackings, int maxRetry, String statusCode) { + PcRetryResponse pcRetryResponse = new PcRetryResponse(); + pcRetryResponse.setParentRequestId(paperTrackings.getTrackingId()); + pcRetryResponse.setDeliveryDriverId(paperTrackings.getUnifiedDeliveryDriver()); + + if (hasOtherAttempt(paperTrackings.getTrackingId(), statusCode.equalsIgnoreCase(CON996.name()) ? 0 : maxRetry)) { + pcRetryResponse.setRetryFound(true); + String newRequestId = setRetryRequestId(paperTrackings.getTrackingId()); + setRetryRequestIdAndPcRetry(pcRetryResponse, newRequestId); + return Mono.just(pcRetryResponse); + } + + pcRetryResponse.setRetryFound(false); + return Mono.just(pcRetryResponse); + } + + static public boolean hasOtherAttempt(String requestId, int maxRetry) { + return maxRetry == -1 || maxRetry >= getRetryAttempt(requestId); + } + + static public int getRetryAttempt(String requestId) { + int retry = 0; + if (requestId.contains(RETRY)) { + retry = Integer.parseInt(requestId.substring(requestId.lastIndexOf("_")+1)); + } + return retry; + } + + static public String setRetryRequestId(String requestId) { + if (requestId.contains(RETRY)) { + String prefix = requestId.substring(0, requestId.indexOf(RETRY)); + String attempt = String.valueOf(getRetryAttempt(requestId) + 1); + requestId = prefix.concat(RETRY).concat(attempt); + } + return requestId; + } + + static public void setRetryRequestIdAndPcRetry(PcRetryResponse pcRetryResponse, String newRequestId) { + String suffix = newRequestId.substring(newRequestId.indexOf(PCRETRY), newRequestId.length()); + pcRetryResponse.setPcRetry(suffix); + pcRetryResponse.setRequestId(newRequestId); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/QueueConst.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/QueueConst.java new file mode 100644 index 000000000..19a51d4d0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/QueueConst.java @@ -0,0 +1,12 @@ +package it.pagopa.pn.papertracker.utils; + +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class QueueConst { + public static final String PUBLISHER = "pn-paper-tracker"; + public static final String OCR_REQUEST_EVENT_TYPE = "OCR_REQUEST"; + public static final String DELIVERY_PUSH_EVENT_TYPE = "SEND_ANALOG_RESPONSE"; + public static final String TRACKER_QUEUE_PROXY_EVENT_TYPE = "QUEUE_PROXY"; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/TrackerUtility.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/TrackerUtility.java new file mode 100644 index 000000000..6f60c21d1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/java/it/pagopa/pn/papertracker/utils/TrackerUtility.java @@ -0,0 +1,378 @@ +package it.pagopa.pn.papertracker.utils; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.*; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfig; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; + +import java.time.Instant; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; + +@RequiredArgsConstructor(access = AccessLevel.NONE) +public class TrackerUtility { + + public static boolean checkIfIsFinalDemat(String eventStatusCode) { + var parsedStatusCode = EventStatusCodeEnum.fromKey(eventStatusCode); + return parsedStatusCode != null && parsedStatusCode.isFinalDemat(); + } + + public static boolean checkIfIsP000event(String eventStatusCode) { + return P000.name().equalsIgnoreCase(eventStatusCode); + } + + public static boolean checkIfIsInternalEvent(List internalEvents, String eventStatusCode) { + return internalEvents.contains(eventStatusCode); + } + + public static boolean checkIfIsRecag012event(String statusCode) { + return RECAG012.name().equalsIgnoreCase(statusCode); + } + + public static String buildOcrRequestId(String trackingId, String eventId, String documentType) { + return String.join("#", trackingId, eventId, documentType); + } + + public static String[] getParsedOcrCommandId(String ocrCommandId) { + return ocrCommandId.split("#"); + } + + public static List validatedEvents(List eventsIds, List events) { + return events.stream() + .filter(event -> eventsIds.contains(event.getId())) + .collect(Collectors.toMap( + Event::getId, + Function.identity(), + (existing, replacement) -> + existing.getCreatedAt().isAfter(replacement.getCreatedAt()) + ? existing + : replacement + )) + .values() + .stream() + .toList(); + } + + public static boolean isStockStatus890(String status) { + return RECAG005C.name().equalsIgnoreCase(status) || + RECAG006C.name().equalsIgnoreCase(status) || + RECAG007C.name().equalsIgnoreCase(status) || + RECAG008C.name().equalsIgnoreCase(status); + } + + public static void setNewStatus(PaperTrackings paperTrackingsToUpdate, String statusCode, BusinessState businessState, PaperTrackingsState state) { + if (RECAG012.name().equalsIgnoreCase(statusCode)) { + paperTrackingsToUpdate.setState(state); + } else if (TrackerUtility.isStockStatus890(statusCode)) { + paperTrackingsToUpdate.setBusinessState(businessState); + } else { + paperTrackingsToUpdate.setState(state); + paperTrackingsToUpdate.setBusinessState(businessState); + } + } + + public static void checkValidationConfig(PaperTrackings paperTrackings) { + //CONFIGURAZIONE DI DEFAULT PER TUTTE LE SPEDIZIONI INIZIALIZZATE PRIMA DEL RILASCIO DELL 890 (PN-17784) + if(Objects.isNull(paperTrackings.getValidationConfig())){ + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of(DocumentTypeEnum.PLICO.getValue(), DocumentTypeEnum.AR.getValue())); + paperTrackings.setValidationConfig(validationConfig); + } + // Conf di default per le spedizioni antecedenti a PN-18630 + if(Objects.isNull(paperTrackings.getValidationConfig().getOcrFileTypes())){ + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + } + } + + + public static void setDematValidationTimestamp(PaperTrackings paperTrackingsToUpdate, String statusCode) { + ValidationFlow validationFlow = paperTrackingsToUpdate.getValidationFlow(); + if(Objects.isNull(validationFlow)){ + validationFlow = new ValidationFlow(); + } + if (RECAG012.name().equalsIgnoreCase(statusCode)) { + validationFlow.setRefinementDematValidationTimestamp(Instant.now()); + } else if (TrackerUtility.isStockStatus890(statusCode)) { + validationFlow.setFinalEventDematValidationTimestamp(Instant.now()); + } else { + validationFlow.setRefinementDematValidationTimestamp(Instant.now()); + validationFlow.setFinalEventDematValidationTimestamp(Instant.now()); + } + paperTrackingsToUpdate.setValidationFlow(validationFlow); + } + + public static boolean isInvalidState(HandlerContext ctx, String statusCode) { + if (RECAG012.name().equalsIgnoreCase(statusCode) || !isStock890SequenceStatusCodes(statusCode)) { + PaperTrackingsState state = ctx.getPaperTrackings().getState(); + return state == PaperTrackingsState.DONE || state == PaperTrackingsState.AWAITING_OCR; + } else { + BusinessState businessState = ctx.getPaperTrackings().getBusinessState(); + return businessState == BusinessState.DONE || businessState == BusinessState.AWAITING_OCR; + } + } + + public static boolean isInvalidStateForSendToOCRInRECAG012Checker(HandlerContext ctx) { + PaperTrackingsState state = ctx.getPaperTrackings().getState(); + return state == PaperTrackingsState.DONE || state == PaperTrackingsState.AWAITING_OCR; + } + + private static boolean isStock890SequenceStatusCodes(String statusCode) { + SequenceConfig config005 = SequenceConfiguration.getConfig(RECAG005C.name()); + SequenceConfig config006 = SequenceConfiguration.getConfig(RECAG006C.name()); + SequenceConfig config007 = SequenceConfiguration.getConfig(RECAG007C.name()); + SequenceConfig config008 = SequenceConfiguration.getConfig(RECAG008C.name()); + return config005.sequenceStatusCodes().contains(statusCode) || + config006.sequenceStatusCodes().contains(statusCode) || + config007.sequenceStatusCodes().contains(statusCode) || + config008.sequenceStatusCodes().contains(statusCode); + } + + public static boolean idRECRI004XEvent(Event event) { + return RECRI004C.name().equals(event.getStatusCode()) + || RECRI004A.name().equals(event.getStatusCode()) + || RECRI004B.name().equals(event.getStatusCode()); + } + + public static boolean isInInvalidStateForOcr(PaperTrackings paperTrackings, String statusCode) { + if (TrackerUtility.isStockStatus890(statusCode)) { + BusinessState businessState = paperTrackings.getBusinessState(); + return businessState != BusinessState.AWAITING_OCR; + } else{ + PaperTrackingsState state = paperTrackings.getState(); + return state != PaperTrackingsState.AWAITING_OCR; + } + } + + public static Map createAffectedEventsMap(boolean addDeliveryFailureCause, List events) { + List list; + if(addDeliveryFailureCause){ + list = events.stream() + .map(event -> Map.of("statusCode", event.getStatusCode(), + "statusTimestamp", Optional.ofNullable(event.getStatusTimestamp()).map(Instant::toString).orElse(""), + "deliveryFailureCause", Optional.ofNullable(event.getDeliveryFailureCause()).orElse(""))) + .toList(); + } else { + list = events.stream() + .map(event -> Map.of("statusCode", event.getStatusCode(), + "statusTimestamp", Optional.ofNullable(event.getStatusTimestamp()).map(Instant::toString).orElse(""))) + .toList(); + } + return Map.of("affectedEvents", list); + } + + + public static boolean isOcrResponseCompleted(HandlerContext context, String statusCode) { + ValidationConfig validationConfig = context.getPaperTrackings().getValidationConfig(); + ValidationFlow validationFlow = context.getPaperTrackings().getValidationFlow(); + List requiredDocs; + List ocrFileTypes = validationConfig.getOcrFileTypes(); + if(RECAG012.name().equalsIgnoreCase(statusCode)){ + requiredDocs = Optional.ofNullable(validationConfig.getSendOcrAttachmentsRefinementStock890()).orElse(List.of()); + return checkAllOcrResponseRecag012(context, requiredDocs, ocrFileTypes); + }else if(TrackerUtility.isStockStatus890(statusCode)){ + requiredDocs = validationConfig.getSendOcrAttachmentsFinalValidationStock890(); + } else { + requiredDocs = validationConfig.getSendOcrAttachmentsFinalValidation(); + } + + return validationFlow.getOcrRequests().stream() + .filter(ocrRequest -> !Data.ValidationStatus.KO.getValue().equalsIgnoreCase(ocrRequest.getResponseStatus())) + .filter(ocrRequest -> requiredDocs.contains(ocrRequest.getDocumentType())) + .allMatch(ocrRequest -> Data.ValidationStatus.OK.getValue().equalsIgnoreCase(ocrRequest.getResponseStatus())); + } + + + private static boolean checkAllOcrResponseRecag012(HandlerContext context, + List requiredDocs, + List ocrFileTypes) { + if (requiredDocs.isEmpty()) {return true;} + + PaperTrackings tracking = context.getPaperTrackings(); + ValidationFlow flow = tracking.getValidationFlow(); + + Set eventsDocumentTypesNotSent = context.getPaperTrackings().getEvents().stream() + .map(Event::getAttachments) + .filter(attachments -> !CollectionUtils.isEmpty(attachments)) + .flatMap(List::stream) + .filter(attachment -> + !ocrFileTypes.contains( + OcrUtility.retrieveFileType(attachment.getUri()) + ) + ) + .map(Attachment::getDocumentType) + .collect(Collectors.toSet()); + + Set completedDocuments = flow.getOcrRequests().stream() + .filter(req -> requiredDocs.contains(req.getDocumentType())) + .filter(ocrRequest -> Data.ValidationStatus.OK.getValue().equals(ocrRequest.getResponseStatus())) + .map(OcrRequest::getDocumentType) + .collect(Collectors.toSet()); + + completedDocuments.addAll(eventsDocumentTypesNotSent); + + return TrackerUtility.hasRequiredAttachmentsRefinementStock890(requiredDocs, completedDocuments); + } + + public static Event extractEventFromContext(HandlerContext context) { + return context.getPaperTrackings().getEvents().stream() + .filter(event -> context.getEventId().equalsIgnoreCase(event.getId())) + .findFirst() + .orElseThrow(() -> new RuntimeException("The event with id " + context.getEventId() + " does not exist in the paperTrackings events list.")); + } + + public static String getStatusCodeFromEventId(PaperTrackings paperTrackings, String eventId) { + Event event = getEventFromEventId(paperTrackings, eventId); + return event != null ? event.getStatusCode() : null; + } + + public static Event getEventFromEventId(PaperTrackings paperTrackings, String eventId) { + if(!CollectionUtils.isEmpty(paperTrackings.getEvents())) { + return paperTrackings.getEvents().stream() + .filter(event -> event.getId().equalsIgnoreCase(eventId)) + .findFirst() + .orElse(null); + } + return null; + } + + public static Event extractFinalEventFromOcr(String commandId, PaperTrackings paperTrackings) { + String eventId = TrackerUtility.getParsedOcrCommandId(commandId)[1]; + return paperTrackings.getEvents().stream() + .filter(event -> eventId.equalsIgnoreCase(event.getId())) + .findFirst() + .orElseThrow(() -> new PaperTrackerException("Invalid eventId in ocrCommandId: " + eventId + + ". The event with id " + eventId + " does not exist in the paperTrackings events list.")); + } + + public static Integer getOcrRequestIndexByEventIdAndDocType(PaperTrackings tracking, String eventId, String docType) { + List ocrRequests = tracking.getValidationFlow().getOcrRequests(); + if(CollectionUtils.isEmpty(ocrRequests)){ + return null; + } + return IntStream.iterate(ocrRequests.size() - 1, i -> i >= 0, i -> i - 1) + .filter(i -> ocrRequests.get(i).getFinalEventId().equalsIgnoreCase(eventId) && ocrRequests.get(i).getDocumentType().equalsIgnoreCase(docType)) + .findFirst() + .orElse(-1); + } + + public static Attachment getAttachmentFromEventIdAndDocType(PaperTrackings tracking, String eventId, String docType) { + List ocrRequests = tracking.getValidationFlow().getOcrRequests(); + if(CollectionUtils.isEmpty(ocrRequests)){ + return null; + } + return tracking.getValidationFlow().getOcrRequests().stream() + .filter(req -> req.getFinalEventId().equalsIgnoreCase(eventId) && req.getDocumentType().equalsIgnoreCase(docType)) + .findFirst() + .map(ocrRequest -> { + Attachment attachment = new Attachment(); + attachment.setDocumentType(docType); + attachment.setUri(ocrRequest.getUri()); + return attachment; + }) + .orElse(null); + } + + public static Optional findRECAG012Event(PaperTrackings paperTrackings) { + return paperTrackings.getEvents().stream() + .filter(event -> RECAG012.name().equalsIgnoreCase(event.getStatusCode())) + .findFirst(); + } + public static EventStatus evaluateStatusCodeAndRetrieveStatus(String statusCodeToEvaluate, String statusCode, PaperTrackings paperTrackings) { + String deliveryFailureCause = paperTrackings.getPaperStatus().getDeliveryFailureCause(); + if (statusCodeToEvaluate.equalsIgnoreCase(statusCode)) { + if (StringUtils.equals("M02", deliveryFailureCause) || StringUtils.equals("M05", deliveryFailureCause)) { + return EventStatus.OK; + } + if (StringUtils.equals("M06", deliveryFailureCause) || StringUtils.equals("M07", deliveryFailureCause) || + StringUtils.equals("M08", deliveryFailureCause) || StringUtils.equals("M09", deliveryFailureCause)) { + return EventStatus.KO; + } + } + return EventStatusCodeEnum.fromKey(statusCode).getStatus(); + } + + + public static EventStatus evaluateStatusCodeAndRetrieveStatus(String statusCodeToEvaluate, String deliveryFailureCause, String productType) { + + EventStatusCodeEnum statusCodeEnum = EventStatusCodeEnum.fromKey(statusCodeToEvaluate); + if (Objects.isNull(statusCodeEnum)) { + return null; + } + + if (!statusCodeEnum.getProductType().getValue().equalsIgnoreCase(productType) && statusCodeEnum.getProductType() != ProductType.RIR) { + return null; + } + + if (StringUtils.isNotBlank(deliveryFailureCause) && (statusCodeEnum.equals(EventStatusCodeEnum.RECAG003C) || statusCodeEnum.equals(EventStatusCodeEnum.RECRN002C))) { + return switch (deliveryFailureCause) { + case "M02", "M05" -> EventStatus.OK; + case "M06", "M07", "M08", "M09" -> EventStatus.KO; + default -> statusCodeEnum.getStatus(); + }; + } + + if(isStockStatus890(statusCodeToEvaluate)){ + return EventStatus.OK; + } + + return statusCodeEnum.getStatus(); + } + + /** + * Verifica se i tipi di documento forniti contengono tutti gli allegati richiesti + * nel caso del perfezionamento della giacenza 890". + * Se nella lista degli allegati obbligatori sono presenti sia "ARCAD" che "CAD", + * verifica se almeno uno tra ARCAD e CAD è presente nei tipi di documento forniti + * + * @param requiredAttachments Una lista di stringhe che rappresentano gli allegati obbligatori richiesti. + * @param documentTypes Un insieme di stringhe che rappresentano i tipi di documento disponibili. + * @return {@code true} se i tipi di documento forniti soddisfano i requisiti degli allegati richiesti, + * {@code false} altrimenti. + */ + public static boolean hasRequiredAttachmentsRefinementStock890( + List requiredAttachments, + Set documentTypes) { + + String arcad = DocumentTypeEnum.ARCAD.getValue(); + String cad = DocumentTypeEnum.CAD.getValue(); + + boolean hasArcad = requiredAttachments.contains(arcad); + boolean hasCad = requiredAttachments.contains(cad); + + // Caso ARCAD o CAD + if (hasArcad && hasCad) { + + // Rimuove ARCAD e CAD dalla lista degli allegati obbligatori + List remaining = requiredAttachments.stream() + .filter(r -> !r.equals(arcad) && !r.equals(cad)) + .toList(); + + boolean hasRemaining = documentTypes.containsAll(remaining); + boolean hasAtLeastOne = documentTypes.contains(arcad) || documentTypes.contains(cad); + + return hasRemaining && hasAtLeastOne; + } + + // Caso standard + return documentTypes.containsAll(requiredAttachments); + } + + public static boolean checkIfIsRedrive(String senderId, List redriveEnabledDomains) { + if(StringUtils.isBlank(senderId) || CollectionUtils.isEmpty(redriveEnabledDomains)) { + return false; + } + return redriveEnabledDomains.stream().anyMatch(senderId::endsWith); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/resources/application.properties b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/resources/application.properties new file mode 100644 index 000000000..323722c4e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/main/resources/application.properties @@ -0,0 +1,8 @@ +logging.config=classpath:logback-base.xml + +pn.env.runtime=PROD +spring.application.name=PN-PAPER-TRACKER +spring.cloud.aws.sqs.observation-enabled=true + +pn.paper-tracker.eventbus.detailType = PaperChannelOutcomeEvent +pn.paper-tracker.eventbus.source = pn-paper-tracker \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/.gitkeep b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/BaseTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/BaseTest.java new file mode 100644 index 000000000..7f3d06776 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/BaseTest.java @@ -0,0 +1,26 @@ +package it.pagopa.pn.papertracker; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.ActiveProfiles; + + +@Slf4j +@SpringBootTest +@ActiveProfiles("test") +@AutoConfigureMockMvc +public abstract class BaseTest { + + + @Slf4j + @SpringBootTest + @ActiveProfiles("test") + @Import(LocalStackTestConfig.class) + public static class WithLocalStack { + + } + + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/LocalStackTestConfig.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/LocalStackTestConfig.java new file mode 100644 index 000000000..7cc140557 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/LocalStackTestConfig.java @@ -0,0 +1,61 @@ +package it.pagopa.pn.papertracker; + +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.core.io.ClassPathResource; +import org.testcontainers.containers.BindMode; +import org.testcontainers.containers.Network; +import org.testcontainers.containers.localstack.LocalStackContainer; +import org.testcontainers.containers.wait.strategy.Wait; +import org.testcontainers.utility.DockerImageName; + +import java.io.IOException; +import java.time.Duration; +import java.util.List; + +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.DYNAMODB; +import static org.testcontainers.containers.localstack.LocalStackContainer.Service.SQS; + +/** + * Classe che permette di creare un container Docker di LocalStack. + * Il container (e quindi la classe) può essere condivisa tra più classi di test. + * Per utilizzare questa classe, le classi di test dovranno essere annotate con + * + * @Import(LocalStackTestConfig.class) + */ +@TestConfiguration +public class LocalStackTestConfig { + + public static LocalStackContainer localStack = + new LocalStackContainer(DockerImageName.parse("localstack/localstack:1.0.4")) + .withServices(DYNAMODB, SQS) // ← AGGIUNTO SQS! + .withClasspathResourceMapping("testcontainers/init.sh", + "/docker-entrypoint-initaws.d/make-storages.sh", BindMode.READ_ONLY) + .withClasspathResourceMapping("testcontainers/credentials", + "/root/.aws/credentials", BindMode.READ_ONLY) + .withNetworkAliases("localstack") + .withNetwork(Network.builder().build()) + .waitingFor(Wait.forLogMessage(".*Initialization terminated.*", 1) + .withStartupTimeout(Duration.ofSeconds(180))); + + static { + localStack.start(); + System.setProperty("aws.endpoint-url", localStack.getEndpointOverride(DYNAMODB).toString()); + System.setProperty("aws.endpoint", localStack.getEndpointOverride(DYNAMODB).toString()); + System.setProperty("aws.region", localStack.getRegion()); + System.setProperty("aws.accessKey", localStack.getAccessKey()); + System.setProperty("aws.secretKey", localStack.getSecretKey()); + System.setProperty("spring.cloud.aws.sqs.endpoint", localStack.getEndpointOverride(SQS).toString()); + System.setProperty("spring.cloud.aws.region.static", localStack.getRegion()); + System.setProperty("spring.cloud.aws.credentials.access-key", localStack.getAccessKey()); + System.setProperty("spring.cloud.aws.credentials.secret-key", localStack.getSecretKey()); + System.setProperty("pn.paper-tracker.saveAndNotSendToDeliveryPush", "CON018"); + + try { + System.setProperty("aws.sharedCredentialsFile", new ClassPathResource("testcontainers/credentials").getFile().getAbsolutePath()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/TrackerConfigUtilsTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/TrackerConfigUtilsTest.java new file mode 100644 index 000000000..13d7fbfcf --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/TrackerConfigUtilsTest.java @@ -0,0 +1,406 @@ +package it.pagopa.pn.papertracker; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.config.TrackerConfigUtils; +import it.pagopa.pn.papertracker.exception.ConfigNotFound; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProcessingMode; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import java.time.Instant; +import java.time.LocalDate; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +@ExtendWith(SpringExtension.class) +public class TrackerConfigUtilsTest { + + private final LocalDate startDate = LocalDate.of(2025, 3, 2); + + @Test + void returnsRequiredAttachmentsRefinementStock890Empty() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setRequiredAttachmentsRefinementStock890(List.of("2023-01-01", "2026-01-01;DOC1;DOC2", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualRequiredAttachmentsRefinementStock890(startDate); + + assertTrue(result.isEmpty()); + } + + @Test + void returnsRequiredAttachmentsRefinementStock890OneItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setRequiredAttachmentsRefinementStock890(List.of("2023-01-01", "2024-01-01;DOC1", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualRequiredAttachmentsRefinementStock890(startDate); + + assertEquals(1, result.size()); + } + + @Test + void returnsRequiredAttachmentsRefinementStock890MoreItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setRequiredAttachmentsRefinementStock890(List.of("2023-01-01", "2024-01-01;DOC1", "2025-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualRequiredAttachmentsRefinementStock890(startDate); + + assertEquals(2, result.size()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationEmpty() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidation(List.of("2023-01-01", "2026-01-01;DOC1;DOC2", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidation(startDate); + + assertTrue(result.isEmpty()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationOneItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidation(List.of("2023-01-01", "2024-01-01;DOC1", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidation(startDate); + + assertEquals(1, result.size()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationMoreItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidation(List.of("2023-01-01", "2024-01-01;DOC1", "2025-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidation(startDate); + + assertEquals(2, result.size()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationStock890Empty() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidationStock890(List.of("2023-01-01", "2026-01-01;DOC1;DOC2", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidationStock890(startDate); + + assertTrue(result.isEmpty()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationStock890OneItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidationStock890(List.of("2023-01-01", "2024-01-01;DOC1", "2027-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidationStock890(startDate); + + assertEquals(1, result.size()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationStock890MoreItems() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidationStock890(List.of("2023-01-01", "2024-01-01;DOC1", "2025-01-01;DOC3;DOC4")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidationStock890(startDate); + + assertEquals(2, result.size()); + } + + @Test + void returnsSendOcrAttachmentsFinalValidationStock890OnlyStartDate() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + List result = utils.getActualSendOcrAttachmentsFinalValidationStock890(startDate); + + assertTrue(result.isEmpty()); + } + + @Test + void returnsStrictFinalValidationStock890Default() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setStrictFinalValidationStock890(List.of("2023-01-01", "2026-01-01;true", "2027-01-01;false")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Boolean result = utils.getActualStrictFinalValidationStock890(startDate); + + assertFalse(result); + } + + @Test + void returnsStrictFinalValidationStock890true() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setStrictFinalValidationStock890(List.of("2023-01-01", "2024-01-01;true", "2027-01-01;false")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Boolean result = utils.getActualStrictFinalValidationStock890(startDate); + + assertTrue(result); + } + + @Test + void returnsStrictFinalValidationStock890false() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setStrictFinalValidationStock890(List.of("2023-01-01", "2024-01-01;true", "2025-01-01;false")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Boolean result = utils.getActualStrictFinalValidationStock890(startDate); + + assertFalse(result); + } + + @Test + void returnsProductsProcessingModes() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RIR:RUN", "2026-02-02;AR:RUN;RIR:RUN;890:DRY")); + Map resultExpected = Map.of( + ProductType.AR, ProcessingMode.RUN, + ProductType.RIR, ProcessingMode.RUN + ); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Map result = utils.getActualProductsProcessingModes(startDate); + + assertEquals(resultExpected, result); + } + + @Test + void returnsProductsProcessingModesStartDateAfterTwo() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setProductsProcessingModes(List.of("2024-04-12;890:RUN", "2025-03-01;AR:RUN;RIR:RUN;890:DRY")); + Map resultExpected = Map.of( + ProductType.AR, ProcessingMode.RUN, + ProductType.RIR, ProcessingMode.RUN, + ProductType._890, ProcessingMode.DRY + ); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Map result = utils.getActualProductsProcessingModes(startDate); + + assertEquals(resultExpected, result); + } + + @Test + void returnsProductsProcessingModesStartDateEqualToConfigDate() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setProductsProcessingModes(List.of("2026-08-19;AR:RUN", "2025-03-02;AR:DRY;RIR:RUN;890:RUN")); + Map resultExpected = Map.of( + ProductType.AR, ProcessingMode.DRY, + ProductType.RIR, ProcessingMode.RUN, + ProductType._890, ProcessingMode.RUN + ); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Map result = utils.getActualProductsProcessingModes(startDate); + + assertEquals(resultExpected, result); + } + + @Test + void returnsProductsProcessingModesEmpty() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setProductsProcessingModes(List.of()); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + assertThrows( + ConfigNotFound.class, + () -> utils.getActualProductsProcessingModes(startDate) + ); + } + + @Test + void returnsProductsProcessingModesNotFound() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setProductsProcessingModes(List.of("2026-02-02;AR:RUN;RIR:RUN;890:DRY")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + assertThrows( + ConfigNotFound.class, + () -> utils.getActualProductsProcessingModes(startDate) + ); + } + + @Test + void returnsOcrFilterTemporalActiveInactive() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterTemporal("* * 09-11,16-18 * * WED"); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean resultActive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T17:45:00Z")); + boolean resultActive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T17:59:59Z")); + boolean resultActive3 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T15:00:00Z")); + boolean resultActive4 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T15:00:01Z")); + boolean resultActive5 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T08:00:00Z")); + boolean resultActive6 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T10:59:59Z")); + boolean resultInactive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T19:45:00Z")); + boolean resultInactive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T14:59:59Z")); + boolean resultInactive3 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T07:59:59Z")); + boolean resultInactive4 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T11:00:00Z")); + boolean resultInactive5 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T14:59:59Z")); + boolean resultInactive6 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-25T18:00:00Z")); + boolean resultDisabled = utils.isOcrFilterTemporalDisabled(); + + assertTrue(resultActive1); + assertTrue(resultActive2); + assertTrue(resultActive3); + assertTrue(resultActive4); + assertTrue(resultActive5); + assertTrue(resultActive6); + assertFalse(resultInactive1); + assertFalse(resultInactive2); + assertFalse(resultInactive3); + assertFalse(resultInactive4); + assertFalse(resultInactive5); + assertFalse(resultInactive6); + assertFalse(resultDisabled); + } + + @Test + void returnsOcrFilterTemporalActiveInactiveAllDay(){ + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterTemporal("* * * * * MON"); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean resultInactive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T22:59:59Z")); + boolean resultInactive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-23T23:00:00Z")); + boolean resultActive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:00Z")); + boolean resultActive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:01Z")); + boolean resultActive3 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-23T22:59:59Z")); + boolean resultDisabled = utils.isOcrFilterTemporalDisabled(); + + assertFalse(resultInactive1); + assertFalse(resultInactive2); + assertTrue(resultActive1); + assertTrue(resultActive2); + assertTrue(resultActive3); + assertFalse(resultDisabled); + } + + @Test + void returnsOcrFilterTemporalActiveInactiveAllDay2(){ + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterTemporal("* * * * * MON"); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean resultInactive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T22:59:59Z")); + boolean resultInactive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T22:59:59.333Z")); + boolean resultActive1 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:00.333Z")); + boolean resultActive2 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:01Z")); + boolean resultActive3 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:01.333Z")); + boolean resultActive4 = utils.isOcrFilterTemporalActive(Instant.parse("2026-02-22T23:00:02.333Z")); + + assertFalse(resultInactive1); + assertFalse(resultInactive2); + assertTrue(resultActive1); + assertTrue(resultActive2); + assertTrue(resultActive3); + assertTrue(resultActive4); + } + + @Test + void returnsOcrFilterTemporalActiveInactiveAllDay3(){ + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterTemporal("* * * * * *"); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean resultActive1 = utils.isOcrFilterTemporalActive(Instant.now()); + + assertTrue(resultActive1); + + } + + @Test + void returnsOcrFilterTemporalDisabled() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterTemporal("DISABLED"); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean result = utils.isOcrFilterTemporalDisabled(); + + assertTrue(result); + } + + @Test + void returnsOcrFilterDriverActiveInactive() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterUnifiedDeliveryDriver(List.of("DRIVER1", "DRIVER2")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean resultActive = utils.isOcrFilterDriverActive("DRIVER1"); + boolean resultInactive = utils.isOcrFilterDriverActive("DRIVER3"); + boolean resultDisabled = utils.isOcrFilterDriverDisabled(); + + assertTrue(resultActive); + assertFalse(resultInactive); + assertFalse(resultDisabled); + } + + @Test + void returnsOcrFilterDriverDisabled() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setOcrFilterUnifiedDeliveryDriver(List.of("DISABLED")); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + boolean result = utils.isOcrFilterDriverDisabled(); + + assertTrue(result); + } + + @Test + void returnsEnableOcrValidationFor() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN", "2026-02-02;AR:RUN;RIR:RUN;890:DRY")); + Map resultExpected = Map.of( + ProductType.AR, OcrStatusEnum.RUN, + ProductType.RIR, OcrStatusEnum.RUN + ); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Map result = utils.getActualEnableOcrValidationFor(startDate); + + assertEquals(resultExpected, result); + } + + @Test + void returnsEnableOcrValidationForStartDateEqualToConfigDate() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setEnableOcrValidationFor(List.of("2026-08-19;AR:RUN", "2025-03-02;AR:DRY;RIR:RUN;890:RUN")); + Map resultExpected = Map.of( + ProductType.AR, OcrStatusEnum.DRY, + ProductType.RIR, OcrStatusEnum.RUN, + ProductType._890, OcrStatusEnum.RUN + ); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + + Map result = utils.getActualEnableOcrValidationFor(startDate); + + assertEquals(resultExpected, result); + } + + @Test + void returnsEnableOcrValidationForEmpty() { + PnPaperTrackerConfigs cfg = new PnPaperTrackerConfigs(); + cfg.setEnableOcrValidationFor(List.of()); + TrackerConfigUtils utils = new TrackerConfigUtils(cfg); + assertThrows( + ConfigNotFound.class, + () -> utils.getActualEnableOcrValidationFor(startDate) + ); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigsTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigsTest.java new file mode 100644 index 000000000..5e2951357 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/config/PnPaperTrackerConfigsTest.java @@ -0,0 +1,57 @@ +package it.pagopa.pn.papertracker.config; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class PnPaperTrackerConfigsTest { + + private PnPaperTrackerConfigs configs; + + @BeforeEach + void setup() { + configs = new PnPaperTrackerConfigs(); + } + + @Test + void validateSendOcrAttachmentsFinalValidationStock890_withCorrectValue_doesNotThrow() { + // Arrange + configs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;")); + + // Act & Assert: chiamo il metodo e non mi aspetto eccezioni + configs.validateSendOcrAttachmentsFinalValidationStock890(); + } + + @Test + void validateSendOcrAttachmentsFinalValidationStock890_withWrongValue_throwsException() { + // Arrange + configs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + + // Act & Assert + assertThatThrownBy(() -> configs.validateSendOcrAttachmentsFinalValidationStock890()) + .isInstanceOf(IllegalStateException.class); + } + + @Test + void validateSendOcrAttachmentsFinalValidationStock890_withEmptyList_throwsException() { + // Arrange + configs.setSendOcrAttachmentsFinalValidationStock890(List.of()); + + // Act & Assert + assertThatThrownBy(() -> configs.validateSendOcrAttachmentsFinalValidationStock890()) + .isInstanceOf(IllegalStateException.class); + } + + @Test + void validateSendOcrAttachmentsFinalValidationStock890_withPartialMatch_throwsException() { + // Arrange + configs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01")); // senza il ';' + + // Act & Assert + assertThatThrownBy(() -> configs.validateSendOcrAttachmentsFinalValidationStock890()) + .isInstanceOf(IllegalStateException.class); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandlerTest.java new file mode 100644 index 000000000..2ca32b28f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/exception/PaperTrackerExceptionHandlerTest.java @@ -0,0 +1,121 @@ +package it.pagopa.pn.papertracker.exception; + +import it.pagopa.pn.papertracker.mapper.PaperTrackingsErrorsMapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerExceptionHandlerTest { + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + @Mock + private PaperTrackerTrackingService paperTrackerEventService; + + private PaperTrackerExceptionHandler exceptionHandler; + + @BeforeEach + void setUp() { + exceptionHandler = new PaperTrackerExceptionHandler(paperTrackerErrorService, paperTrackerEventService); + } + + @Test + void handleInternalExceptionSuccessfully() { + // ARRANGE + PnPaperTrackerValidationException exception = new PnPaperTrackerValidationException("Validation error", new PaperTrackingsErrors()); + when(paperTrackerErrorService.insertPaperTrackingsError(exception.getError())).thenReturn(Mono.empty()); + + // ACT + Mono response = exceptionHandler.handleInternalException(exception, 1L); + + // ASSERT + StepVerifier.create(response) + .verifyComplete(); + verify(paperTrackerErrorService, times(1)).insertPaperTrackingsError(exception.getError()); + } + + @Test + void handleStatusCodeErrorFirstREtry(){ + //Arrange + PnPaperTrackerValidationException exception = new PnPaperTrackerValidationException("Validation error", PaperTrackingsErrorsMapper.buildPaperTrackingsError( + new PaperTrackings(), + "RECRN001C", + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.VALUES_NOT_FOUND, + "message", + null, + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + "eventId")); + + // ACT + Mono response = exceptionHandler.handleInternalException(exception, 1L); + // ASSERT + StepVerifier.create(response) + .verifyError(PnPaperTrackerValidationException.class); + verify(paperTrackerErrorService, times(0)).insertPaperTrackingsError(exception.getError()); + + } + + + @Test + void handleStatusCodeErrorSixthRetry(){ + //Arrange + PnPaperTrackerValidationException exception = new PnPaperTrackerValidationException("Validation error", PaperTrackingsErrorsMapper.buildPaperTrackingsError( + new PaperTrackings(), + "RECRN001C", + ErrorCategory.INCONSISTENT_STATE, + ErrorCause.VALUES_NOT_FOUND, + "message", + null, + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + "eventId")); + + when(paperTrackerErrorService.insertPaperTrackingsError(exception.getError())).thenReturn(Mono.empty()); + + // ACT + Mono response = exceptionHandler.handleInternalException(exception, 5L); + // ASSERT + StepVerifier.create(response) + .verifyComplete(); + verify(paperTrackerErrorService, times(1)).insertPaperTrackingsError(exception.getError()); + } + + @Test + void handleOtherError(){ + //Arrange + PnPaperTrackerValidationException exception = new PnPaperTrackerValidationException("Validation error", PaperTrackingsErrorsMapper.buildPaperTrackingsError( + new PaperTrackings(), + "RECRN001C", + ErrorCategory.ATTACHMENTS_ERROR, + null, + "message", + null, + FlowThrow.SEQUENCE_VALIDATION, + ErrorType.ERROR, + "eventId")); + + when(paperTrackerErrorService.insertPaperTrackingsError(exception.getError())).thenReturn(Mono.empty()); + + // ACT + Mono response = exceptionHandler.handleInternalException(exception, 1L); + // ASSERT + StepVerifier.create(response) + .verifyComplete(); + verify(paperTrackerErrorService, times(1)).insertPaperTrackingsError(exception.getError()); + } + + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/AbstractARTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/AbstractARTestIT.java new file mode 100644 index 000000000..1b6f851b6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/AbstractARTestIT.java @@ -0,0 +1,157 @@ +package it.pagopa.pn.papertracker.it.AR; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.DataDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.provider.Arguments; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.springframework.core.io.ClassPathResource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public abstract class AbstractARTestIT extends BaseTest.WithLocalStack { + + private static final Set SINGLE_PC_RETRY_SCENARIOS = Set.of( + "OK_RETRY_AR", + "OK_RETRY_AR_2", + "OK_RETRY_M10_AR", + "OK_CAUSA_FORZA_MAGGIORE_AR", + "OK_NON_RENDICONTABILE_AR" + ); + + private static final Set DOUBLE_PC_RETRY_SCENARIOS = Set.of( + "FAIL_CON996_PC_RETRY_FURTO_AR" + ); + + @MockitoBean + protected PaperChannelClient paperChannelClient; + + @MockitoBean + protected SafeStorageClient safeStorageClient; + + @MockitoBean + protected OcrMomProducer ocrMomProducer; + + @MockitoBean + protected DataVaultClient dataVaultClient; + + protected void mockData(ProductTestCase productTestCase, OcrStatusEnum ocrStatusEnum){ + mockPcRetry(productTestCase); + mockDataVault(productTestCase); + if(!ocrStatusEnum.equals(OcrStatusEnum.DISABLED)) { + mockSendToOcr(productTestCase); + } + } + + protected void mockDataVault(ProductTestCase scenario) { + if (scenario.getEvents().stream().anyMatch(testEvent -> Objects.nonNull(testEvent.getAnalogMail()) && Objects.nonNull(testEvent.getAnalogMail().getDiscoveredAddress()))) { + Mockito.when(dataVaultClient.anonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just("anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9")); + PaperAddress paperAddress = PaperAddress.builder() + .name("test") + .address("via Roma 10") + .cap("00100") + .pr("RM") + .city("Roma") + .build(); + Mockito.when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just(paperAddress)); + } + } + + protected void mockPcRetry(ProductTestCase scenario) { + + getPcRetryResponse(scenario); + String scenarioName = scenario.getName().toUpperCase(); + + if (SINGLE_PC_RETRY_SCENARIOS.contains(scenarioName)) { + Mockito.when(paperChannelClient.getPcRetry(any(), any())) + .thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + } + + if (DOUBLE_PC_RETRY_SCENARIOS.contains(scenarioName)) { + Mockito.when(paperChannelClient.getPcRetry(any(), any())) + .thenReturn(Mono.just(scenario.getFirstPcRetryResponse())) + .thenReturn(Mono.just(scenario.getSecondPcRetryResponse())); + } + } + + protected void mockSendToOcr(ProductTestCase scenario) { + if (Objects.nonNull(scenario.getExpected().getOcrDataPayload())) { + Mockito.when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("Uri")); + Mockito.doNothing().when(ocrMomProducer).push(any(OcrEvent.class)); + } + } + + + protected void verifySentToOcr(ProductTestCase scenario, ArgumentCaptor ocrEventCaptor){ + Mockito.verify(ocrMomProducer, times(scenario.getExpected().getSentToOcr())).push(ocrEventCaptor.capture()); + List ocrEvents = ocrEventCaptor.getAllValues().stream().map(OcrEvent::getPayload).toList(); + List expected = scenario.getExpected().getOcrDataPayload(); + if(Objects.nonNull(expected)) { + Assertions.assertEquals(expected.size(), ocrEvents.size()); + for (int i = 0; i < expected.size(); i++) { + OcrDataPayloadDTO exp = expected.get(i); + OcrDataPayloadDTO act = ocrEvents.get(i); + Assertions.assertEquals(exp.getCommandId(), act.getCommandId()); + Assertions.assertEquals(exp.getCommandType(), act.getCommandType()); + Assertions.assertNotNull(act.getData()); + DataDTO expData = exp.getData(); + DataDTO actData = act.getData(); + Assertions.assertEquals(expData.getDocumentType(), actData.getDocumentType()); + Assertions.assertEquals(expData.getProductType(), actData.getProductType()); + Assertions.assertEquals(expData.getUnifiedDeliveryDriver(), actData.getUnifiedDeliveryDriver()); + Assertions.assertNotNull(actData.getDetails()); + Assertions.assertEquals(expData.getDetails().getDeliveryDetailCode(), actData.getDetails().getDeliveryDetailCode()); + Assertions.assertEquals(expData.getDetails().getRegisteredLetterCode(), actData.getDetails().getRegisteredLetterCode()); + Assertions.assertEquals(expData.getDetails().getAttachment(), actData.getDetails().getAttachment()); + Assertions.assertEquals(expData.getDetails().getNotificationDate(), actData.getDetails().getNotificationDate()); + Assertions.assertEquals(expData.getDetails().getDeliveryFailureCause(), actData.getDetails().getDeliveryFailureCause()); + Assertions.assertEquals(expData.getDetails().getDeliveryAttemptDate(), actData.getDetails().getDeliveryAttemptDate()); + } + } + } + + + protected Stream loadTestCases(String folder, String exclude, boolean ocrDisable) throws Exception { + ClassPathResource classPathResource = new ClassPathResource("testcase/" + folder); + URI excludeURI = null; + if (StringUtils.hasText(exclude)) { + ClassPathResource classPathResourceExclude = new ClassPathResource("testcase/" + folder + exclude); + excludeURI = classPathResourceExclude.getURI(); + } + + Stream scenarios = SequenceLoader.loadScenarios(classPathResource.getURI(), excludeURI); + + if(ocrDisable) { + ClassPathResource extraResource = new ClassPathResource("testcase/rework/ok_ar_rework.json"); + Stream extraScenarios = SequenceLoader.loadScenarios(extraResource.getURI(), null); + return Stream.concat(scenarios, extraScenarios); + } + + return scenarios; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDisableTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDisableTestIT.java new file mode 100644 index 000000000..03b658349 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDisableTestIT.java @@ -0,0 +1,51 @@ +package it.pagopa.pn.papertracker.it.AR; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DISABLED; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;" + } +) +public class DryAROcrDisableTestIT extends AbstractARTestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockData(scenario, DISABLED); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, false); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRN001B]")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("AR", "/multiple_ocr_request/run", true); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDryTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDryTestIT.java new file mode 100644 index 000000000..3c7dfbe3c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrDryTestIT.java @@ -0,0 +1,55 @@ +package it.pagopa.pn.papertracker.it.AR; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DISABLED; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DRY; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:DRY;890:DRY" + } +) +public class DryAROcrDryTestIT extends AbstractARTestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, DRY); + scenarioRunner.run(scenario, DRY,false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRN001B]")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("AR", "/multiple_ocr_request/run", false); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrRunTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrRunTestIT.java new file mode 100644 index 000000000..5b9e611b9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/DryAROcrRunTestIT.java @@ -0,0 +1,55 @@ +package it.pagopa.pn.papertracker.it.AR; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:RUN;890:RUN" + } +) +public class DryAROcrRunTestIT extends AbstractARTestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, OcrStatusEnum.RUN, false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRN001B]")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("AR", "/multiple_ocr_request/disable", false); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/TestCaseHandlerAR.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/TestCaseHandlerAR.java new file mode 100644 index 000000000..27c470b26 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/AR/TestCaseHandlerAR.java @@ -0,0 +1,26 @@ +package it.pagopa.pn.papertracker.it.AR; + +import it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import it.pagopa.pn.papertracker.service.impl.NotificationReworkServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +@Component +public class TestCaseHandlerAR extends GenericTestCaseHandlerImpl { + + public TestCaseHandlerAR(ExternalChannelHandler externalChannelHandler, PaperTrackingsErrorsDAO paperTrackingsErrorsDAO, PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao, PaperTrackingsDAO paperTrackingsDAO, OcrEventHandler ocrEventHandler, NotificationReworkService notificationReworkService) { + super(externalChannelHandler, paperTrackingsErrorsDAO, paperTrackerDryRunOutputsDao, paperTrackingsDAO, ocrEventHandler, notificationReworkService); + } + + @Override + public String getProductType() { + return ProductType.AR.getValue(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandler.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandler.java new file mode 100644 index 000000000..6b0c588c4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandler.java @@ -0,0 +1,19 @@ +package it.pagopa.pn.papertracker.it; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; + +public interface GenericTestCaseHandler { + + String getProductType(); + + void beforeInit(ProductTestCase scenario, boolean strictFinalValidation, OcrStatusEnum ocrStatusEnum); + + void afterInit(ProductTestCase scenario, TrackingCreationRequest request); + + void sendEventsAndOcrResponse(ProductTestCase scenario, OcrStatusEnum ocrStatusEnum); + + void afterSendEvents(ProductTestCase scenario, OcrStatusEnum ocrStatusEnum, boolean strictValidation); + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandlerImpl.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandlerImpl.java new file mode 100644 index 000000000..88f904138 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/GenericTestCaseHandlerImpl.java @@ -0,0 +1,322 @@ +package it.pagopa.pn.papertracker.it; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.it.model.TestEvent; +import it.pagopa.pn.papertracker.it.validator.ErrorValidator; +import it.pagopa.pn.papertracker.it.validator.OutputValidator; +import it.pagopa.pn.papertracker.it.validator.TrackingValidator; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorCategory.OCR_VALIDATION; +import static java.util.stream.Collectors.groupingBy; + + +@Component +@RequiredArgsConstructor +public class GenericTestCaseHandlerImpl implements GenericTestCaseHandler { + + private final ExternalChannelHandler externalChannelHandler; + private final PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + private final PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao; + private final PaperTrackingsDAO paperTrackingsDAO; + private final OcrEventHandler ocrEventHandler; + private final NotificationReworkService notificationReworkService; + + @Override + public String getProductType() { + return ProductType.UNKNOWN.getValue(); + } + + @Override + public void beforeInit(ProductTestCase scenario, boolean strictFinalValidation, OcrStatusEnum ocrStatusEnum) { + String randomIun = UUID.randomUUID().toString(); + + replaceIun(scenario, randomIun); + + List expErrors = scenario.getExpected().getErrors(); + + if(scenario.getName().equalsIgnoreCase("OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_890") + && OcrStatusEnum.DISABLED.equals(ocrStatusEnum)){ + scenario.getExpected().setErrors(expErrors.stream() + .filter(paperTrackingsErrors -> !paperTrackingsErrors.getErrorCategory().equals(OCR_VALIDATION)) + .toList()); + } + + //se è attiva a la strict validation per lo stock890, + // in caso di errori di sequence validation vengono convertiti in errori bloccanti e vengono rimossi tutti gli eventi di output con status detail + // che termina con C (l'evento finale non sale in timeline come progress) + //poichè la validazione non è andata a buon fine deve essere aggiornato il paperStatus rimuovendo i valdiatedEvent, il registeredLetterCode e + //la deliveryFailureCause e impostando come finalStatusCode il "RECAG012" + if (strictFinalValidation) { + List expTrackings = scenario.getExpected().getTrackings(); + List expOutputs = scenario.getExpected().getOutputs(); + + if (expErrors.stream().anyMatch(paperTrackingsErrors -> + paperTrackingsErrors.getFlowThrow().equals(FlowThrow.SEQUENCE_VALIDATION)) && !scenario.getName().equalsIgnoreCase("OK_TIMESTAMPERROR_890")) { + + replaceOutputsFields(scenario, expOutputs); + replaceTrackingsFields(scenario, expTrackings); + } + + replaceErrorsFields(scenario, expErrors); + } + + } + + private static void replaceErrorsFields(ProductTestCase scenario, List expErrors) { + scenario.getExpected().getErrors().stream() + .filter(paperTrackingsErrors -> paperTrackingsErrors.getFlowThrow().equals(FlowThrow.SEQUENCE_VALIDATION)) + .forEach(paperTrackingsErrors -> paperTrackingsErrors.setType(ErrorType.ERROR)); + + if (scenario.getName().equalsIgnoreCase("OK_GIACENZA_MORE_ERROR_890")) { + scenario.getExpected().setErrors(expErrors.stream() + .filter(paperTrackingsErrors -> paperTrackingsErrors.getErrorCategory().equals(ErrorCategory.DATE_ERROR)) + .toList()); + } + if (scenario.getName().contains("INVALID_ATTACHMENT")) { + scenario.getExpected().setErrors(expErrors.stream() + .filter(paperTrackingsErrors -> paperTrackingsErrors.getDetails().getMessage().startsWith("Missed required attachments")) + .toList()); + } + } + + private static void replaceOutputsFields(ProductTestCase scenario, List expOutputs) { + scenario.getExpected().setOutputs(expOutputs.stream() + .filter(paperTrackerDryRunOutputs -> !paperTrackerDryRunOutputs.getStatusDetail().endsWith("C")).toList()); + } + + private static void replaceTrackingsFields(ProductTestCase scenario, List expTrackings) { + expTrackings.forEach(paperTrackings -> { + paperTrackings.setBusinessState(BusinessState.KO); + paperTrackings.getPaperStatus().setValidatedEvents(new ArrayList<>()); + paperTrackings.getPaperStatus().setRegisteredLetterCode(null); + paperTrackings.getPaperStatus().setDeliveryFailureCause(null); + }); + + if (scenario.getExpected().getTrackings().stream().anyMatch(paperTrackings -> Objects.nonNull(paperTrackings.getPaperStatus().getFinalStatusCode()))) { + scenario.getExpected().getTrackings().forEach(paperTrackings -> paperTrackings.getPaperStatus().setFinalStatusCode("RECAG012")); + } + } + + private static void replaceIun(ProductTestCase scenario, String randomIun) { + scenario.getInitialTracking().setAttemptId( + scenario.getInitialTracking().getAttemptId() + .replace("{{RANDOM_IUN}}", randomIun) + ); + + scenario.getEvents() + .stream().filter(testEvent -> Objects.nonNull(testEvent.getAnalogMail())) + .forEach(testEvent -> testEvent.getAnalogMail().setRequestId( + testEvent.getAnalogMail().getRequestId().replace("{{RANDOM_IUN}}", randomIun))); + + scenario.getExpected().getTrackings().forEach(out -> { + out.setTrackingId(out.getTrackingId().replace("{{RANDOM_IUN}}", randomIun)); + out.setAttemptId(out.getAttemptId().replace("{{RANDOM_IUN}}", randomIun)); + }); + } + + @Override + public void afterInit(ProductTestCase scenario, TrackingCreationRequest request) { + + String requestId = String.join(".", request.getAttemptId(), request.getPcRetry()); + String retryRequestId = requestId.replace("PCRETRY_0", "PCRETRY_1"); + String secondRetryRequestId = requestId.replace("PCRETRY_0", "PCRETRY_2"); + + if (!CollectionUtils.isEmpty(scenario.getEvents())) { + scenario.getEvents() + .stream().filter(testEvent -> Objects.nonNull(testEvent.getAnalogMail())) + .forEach(event -> { + String original = event.getAnalogMail().getRequestId(); + if (original.contains("{{REQUEST_ID_RETRY}}")) { + event.getAnalogMail().setRequestId(retryRequestId); + } else if (original.contains("{{REQUEST_ID_RETRY_2}}")) { + event.getAnalogMail().setRequestId(secondRetryRequestId); + } else { + event.getAnalogMail().setRequestId(requestId); + } + }); + } + if (Objects.nonNull(scenario.getExpected())) { + scenario.getExpected().getOutputs().forEach(event -> { + if (event.getTrackingId().contains("{{REQUEST_ID_RETRY}}")) { + event.setTrackingId(retryRequestId); + } else if (event.getTrackingId().contains("{{REQUEST_ID_RETRY_2}}")) { + event.setTrackingId(secondRetryRequestId); + } else { + event.setTrackingId(requestId); + } + }); + scenario.getExpected().getErrors().forEach(event -> { + if (event.getTrackingId().contains("{{REQUEST_ID_RETRY}}")) { + event.setTrackingId(retryRequestId); + } else if (event.getTrackingId().contains("{{REQUEST_ID_RETRY_2}}")) { + event.setTrackingId(secondRetryRequestId); + } else { + event.setTrackingId(requestId); + } + }); + scenario.getExpected().getTrackings().forEach(paperTrackings -> { + if (paperTrackings.getTrackingId().contains("{{REQUEST_ID_RETRY}}")) { + paperTrackings.setTrackingId(retryRequestId); + if (Objects.nonNull(paperTrackings.getNextRequestIdPcretry())) { + paperTrackings.setNextRequestIdPcretry(secondRetryRequestId); + } + } else if (paperTrackings.getTrackingId().contains("{{REQUEST_ID_RETRY_2}}")) { + paperTrackings.setTrackingId(secondRetryRequestId); + } else { + paperTrackings.setTrackingId(requestId); + if (Objects.nonNull(paperTrackings.getNextRequestIdPcretry())) { + paperTrackings.setNextRequestIdPcretry(retryRequestId); + } + } + }); + if (Objects.nonNull(scenario.getExpected().getOcrResultPayload())) { + scenario.getExpected().getOcrResultPayload().forEach(ocrDataResultPayload -> + ocrDataResultPayload.setCommandId(ocrDataResultPayload.getCommandId().replace("{{REQUEST_ID_RETRY}}", retryRequestId) + .replace("{{REQUEST_ID_RETRY_2}}", secondRetryRequestId) + .replace("{{REQUEST_ID}}", requestId))); + scenario.getExpected().getOcrDataPayload().forEach(ocrDataResultPayload -> ocrDataResultPayload.setCommandId(ocrDataResultPayload.getCommandId().replace("{{REQUEST_ID_RETRY}}", retryRequestId) + .replace("{{REQUEST_ID_RETRY_2}}", secondRetryRequestId) + .replace("{{REQUEST_ID}}", requestId))); + } + } + + resolvePcRetryResponse(scenario); + } + + private static void resolvePcRetryResponse(ProductTestCase scenario) { + if (!CollectionUtils.isEmpty(scenario.getEvents())) { + scenario.getEvents().stream() + .map(TestEvent::getAnalogMail) + .filter(Objects::nonNull) + .filter(item -> item.getRequestId().endsWith("PCRETRY_1")) + .findFirst() + .ifPresent(item -> scenario.getFirstPcRetryResponse().setRequestId(item.getRequestId())); + + scenario.getEvents().stream() + .map(TestEvent::getAnalogMail) + .filter(Objects::nonNull) + .filter(item -> item.getRequestId().endsWith("PCRETRY_2")) + .findFirst() + .ifPresent(item -> scenario.getSecondPcRetryResponse().setRequestId(item.getRequestId())); + } + } + + @Override + public void sendEventsAndOcrResponse(ProductTestCase scenario, OcrStatusEnum ocrStatusEnum) { + + List events = scenario.getEvents(); + boolean ocrEnabled = !OcrStatusEnum.DISABLED.equals(ocrStatusEnum); + boolean hasEvents = !CollectionUtils.isEmpty(events); + + if (hasEvents) { + for (TestEvent event : events) { + boolean isOcrMessage = "SEND_OCR_RESPONSE".equalsIgnoreCase(event.getMessageId()); + boolean runRework = "RUN_REWORK".equalsIgnoreCase(event.getMessageId()); + if (runRework) { + notificationReworkService.updatePaperTrackingsStatusForRework(event.getAnalogMail().getRequestId(), "REWORK_0").block(); + } else if (!isOcrMessage) { + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(event.getAnalogMail()); + externalChannelHandler.handleExternalChannelMessage( + singleStatusUpdate, + true, + null, + event.getMessageId(), + null + ); + } else if (ocrEnabled) { + ocrEventHandler.handleOcrMessage( + scenario.getExpected() + .getOcrResultPayload() + .get(event.getOcrResponseIdx() - 1) + ); + } + } + } + + boolean noOcrEventInScenario = hasEvents && events.stream().noneMatch(e -> "SEND_OCR_RESPONSE".equalsIgnoreCase(e.getMessageId())); + boolean hasOcrPayload = Objects.nonNull(scenario.getExpected().getOcrResultPayload()); + if (noOcrEventInScenario && hasOcrPayload && ocrEnabled) { + var firstPayload = scenario.getExpected().getOcrResultPayload().getFirst(); + ocrEventHandler.handleOcrMessage(firstPayload); + boolean isDuplicateScenario = scenario.getName().equalsIgnoreCase("OK_DUPLICATE_OCR_RESPONSE_AR") || + scenario.getName().equalsIgnoreCase("OK_DUPLICATE_OCR_RESPONSE_890"); + + if (isDuplicateScenario) { + ocrEventHandler.handleOcrMessage(firstPayload); + } + } + } + + @Override + public void afterSendEvents(ProductTestCase scenario, OcrStatusEnum ocrStatusEnum, boolean strictValidation) { + if (!CollectionUtils.isEmpty(scenario.getEvents())) { + Set requestIds = scenario.getEvents().stream() + .filter(testEvent -> Objects.nonNull(testEvent.getAnalogMail())) + .collect(groupingBy(event -> event.getAnalogMail().getRequestId())) + .keySet(); + + List errors = new ArrayList<>(); + List outputs = new ArrayList<>(); + List trackings = paperTrackingsDAO.retrieveAllByTrackingIds(requestIds.stream().toList()).collectList().block(); + + requestIds.forEach(requestId -> errors.addAll(Objects.requireNonNull(paperTrackingsErrorsDAO.retrieveErrors(requestId).collectList().block()))); + ErrorValidator.verifyErrors(scenario, errors); + + requestIds.forEach(requestId -> outputs.addAll(Objects.requireNonNull(paperTrackerDryRunOutputsDao.retrieveOutputEvents(requestId).collectList().block()))); + OutputValidator.verifyOutputs(scenario, ocrStatusEnum, outputs); + + TrackingValidator.verifyTrackingEntities(scenario, trackings, ocrStatusEnum, strictValidation); + } + } + + public static void getPcRetryResponse(ProductTestCase scenario) { + PcRetryResponse response = new PcRetryResponse(); + response.setRetryFound(true); + response.setPcRetry("PCRETRY_1"); + + PcRetryResponse response2 = new PcRetryResponse(); + response2.setRetryFound(true); + response2.setPcRetry("PCRETRY_2"); + + if (!CollectionUtils.isEmpty(scenario.getEvents())) { + + scenario.getEvents().stream() + .map(TestEvent::getAnalogMail) + .filter(Objects::nonNull) + .filter(item -> item.getRequestId().endsWith("PCRETRY_1")) + .findFirst() + .ifPresent(item -> { + response.setRequestId(item.getRequestId()); + }); + + scenario.getEvents().stream() + .map(TestEvent::getAnalogMail) + .filter(Objects::nonNull) + .filter(item -> item.getRequestId().endsWith("PCRETRY_2")) + .findFirst() + .ifPresent(item -> { + response2.setRequestId(item.getRequestId()); + }); + } + + scenario.setFirstPcRetryResponse(response); + scenario.setSecondPcRetryResponse(response2); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/DryRIROcrDisableTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/DryRIROcrDisableTestIT.java new file mode 100644 index 000000000..6dd039aad --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/DryRIROcrDisableTestIT.java @@ -0,0 +1,77 @@ +package it.pagopa.pn.papertracker.it.RIR; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;" + } +) +public class DryRIROcrDisableTestIT extends BaseTest.WithLocalStack { + + @Autowired + private SequenceRunner scenarioRunner; + + @MockitoBean + private PaperChannelClient paperChannelClient; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockPcRetry(scenario); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, false); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRI003B]")){ + throw e; + } + } + } + + private void mockPcRetry(ProductTestCase scenario) { + getPcRetryResponse(scenario); + switch (scenario.getName().toUpperCase()) { + case "OK_RETRY_RIR", "OK_RETRY_M10_RIR", "OK_PCRETRY_CON996_RIR" -> Mockito.when(paperChannelClient.getPcRetry(any(), any())).thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + case "FAIL_CON996_PC_RETRY_FURTO_RIR" -> Mockito.when(paperChannelClient.getPcRetry(any(), any())) + .thenReturn(Mono.just(scenario.getFirstPcRetryResponse())) + .thenReturn(Mono.just(scenario.getSecondPcRetryResponse())); + } + } + + Stream loadTestCases() throws Exception { + URI uri = Objects.requireNonNull(Thread.currentThread() + .getContextClassLoader() + .getResource("testcase/RIR")).toURI(); + + return SequenceLoader.loadScenarios(uri, null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/TestCaseHandlerRIR.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/TestCaseHandlerRIR.java new file mode 100644 index 000000000..ed2425e6a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIR/TestCaseHandlerRIR.java @@ -0,0 +1,25 @@ +package it.pagopa.pn.papertracker.it.RIR; + +import it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.service.impl.NotificationReworkServiceImpl; +import org.springframework.stereotype.Component; + +@Component +public class TestCaseHandlerRIR extends GenericTestCaseHandlerImpl { + + public TestCaseHandlerRIR(ExternalChannelHandler externalChannelHandler, PaperTrackingsErrorsDAO paperTrackingsErrorsDAO, PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao, PaperTrackingsDAO paperTrackingsDAO, OcrEventHandler ocrEventHandler, NotificationReworkServiceImpl notificationReworkService) { + super(externalChannelHandler, paperTrackingsErrorsDAO, paperTrackerDryRunOutputsDao, paperTrackingsDAO, ocrEventHandler, notificationReworkService); + } + + @Override + public String getProductType() { + return ProductType.RIR.getValue(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/DryRISOcrDisableTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/DryRISOcrDisableTestIT.java new file mode 100644 index 000000000..ef2ad93cb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/DryRISOcrDisableTestIT.java @@ -0,0 +1,75 @@ +package it.pagopa.pn.papertracker.it.RIS; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;" + } +) +public class DryRISOcrDisableTestIT extends BaseTest.WithLocalStack { + + @Autowired + private SequenceRunner scenarioRunner; + + @MockitoBean + private PaperChannelClient paperChannelClient; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockPcRetry(scenario); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, false); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRSI004B]")){ + throw e; + } + } + } + + private void mockPcRetry(ProductTestCase scenario) { + getPcRetryResponse(scenario); + if (scenario.getName().equalsIgnoreCase("OK_RETRY_RIS") + || scenario.getName().equalsIgnoreCase("OK_RETRY_M10_RIS")) { + Mockito.when(paperChannelClient.getPcRetry(any(), any())).thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + } + } + + Stream loadTestCases() throws Exception { + URI uri = Objects.requireNonNull(Thread.currentThread() + .getContextClassLoader() + .getResource("testcase/RIS")).toURI(); + + return SequenceLoader.loadScenarios(uri, null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/TestCaseHandlerRIS.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/TestCaseHandlerRIS.java new file mode 100644 index 000000000..cb8dee431 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RIS/TestCaseHandlerRIS.java @@ -0,0 +1,26 @@ +package it.pagopa.pn.papertracker.it.RIS; + +import it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import it.pagopa.pn.papertracker.service.impl.NotificationReworkServiceImpl; +import org.springframework.stereotype.Component; + +@Component +public class TestCaseHandlerRIS extends GenericTestCaseHandlerImpl { + + public TestCaseHandlerRIS(ExternalChannelHandler externalChannelHandler, PaperTrackingsErrorsDAO paperTrackingsErrorsDAO, PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao, PaperTrackingsDAO paperTrackingsDAO, OcrEventHandler ocrEventHandler, NotificationReworkService notificationReworkService) { + super(externalChannelHandler, paperTrackingsErrorsDAO, paperTrackerDryRunOutputsDao, paperTrackingsDAO, ocrEventHandler, notificationReworkService); + } + + @Override + public String getProductType() { + return ProductType.RIS.getValue(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/AbstractRSTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/AbstractRSTestIT.java new file mode 100644 index 000000000..a6b925141 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/AbstractRSTestIT.java @@ -0,0 +1,129 @@ +package it.pagopa.pn.papertracker.it.RS; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.DataDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.provider.Arguments; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.springframework.core.io.ClassPathResource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public class AbstractRSTestIT extends BaseTest.WithLocalStack { + + + @MockitoBean + protected PaperChannelClient paperChannelClient; + + @MockitoBean + protected SafeStorageClient safeStorageClient; + + @MockitoBean + protected OcrMomProducer ocrMomProducer; + + @MockitoBean + protected DataVaultClient dataVaultClient; + + protected void mockData(ProductTestCase productTestCase, OcrStatusEnum ocrStatusEnum){ + mockPcRetry(productTestCase); + mockDataVault(productTestCase); + if(!ocrStatusEnum.equals(OcrStatusEnum.DISABLED)) { + mockSendToOcr(productTestCase); + } + } + + protected void mockDataVault(ProductTestCase scenario) { + if (scenario.getEvents().stream().anyMatch(testEvent -> Objects.nonNull(testEvent.getAnalogMail()) && Objects.nonNull(testEvent.getAnalogMail().getDiscoveredAddress()))) { + Mockito.when(dataVaultClient.anonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just("anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9")); + PaperAddress paperAddress = PaperAddress.builder() + .name("test") + .address("via Roma 10") + .cap("00100") + .pr("RM") + .city("Roma") + .build(); + Mockito.when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just(paperAddress)); + } + } + + private void mockPcRetry(ProductTestCase scenario) { + getPcRetryResponse(scenario); + if (scenario.getName().equalsIgnoreCase("OK_RETRY_RS") + || scenario.getName().equalsIgnoreCase("OK_RETRY_M10_RS") + || scenario.getName().equalsIgnoreCase("OK_NON_RENDICONTABILE_RS")) { + Mockito.when(paperChannelClient.getPcRetry(any(), any())).thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + } + } + + protected void mockSendToOcr(ProductTestCase scenario) { + if (Objects.nonNull(scenario.getExpected().getOcrDataPayload())) { + Mockito.when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("uri.pdf")); + Mockito.doNothing().when(ocrMomProducer).push(any(OcrEvent.class)); + } + } + + + protected void verifySentToOcr(ProductTestCase scenario, ArgumentCaptor ocrEventCaptor){ + Mockito.verify(ocrMomProducer, times(scenario.getExpected().getSentToOcr())).push(ocrEventCaptor.capture()); + List ocrEvents = ocrEventCaptor.getAllValues().stream().map(OcrEvent::getPayload).toList(); + List expected = scenario.getExpected().getOcrDataPayload(); + if(Objects.nonNull(expected)) { + Assertions.assertEquals(expected.size(), ocrEvents.size()); + for (int i = 0; i < expected.size(); i++) { + OcrDataPayloadDTO exp = expected.get(i); + OcrDataPayloadDTO act = ocrEvents.get(i); + Assertions.assertEquals(exp.getCommandId(), act.getCommandId()); + Assertions.assertEquals(exp.getCommandType(), act.getCommandType()); + Assertions.assertNotNull(act.getData()); + DataDTO expData = exp.getData(); + DataDTO actData = act.getData(); + Assertions.assertEquals(expData.getDocumentType(), actData.getDocumentType()); + Assertions.assertEquals(expData.getProductType(), actData.getProductType()); + Assertions.assertEquals(expData.getUnifiedDeliveryDriver(), actData.getUnifiedDeliveryDriver()); + Assertions.assertNotNull(actData.getDetails()); + Assertions.assertEquals(expData.getDetails().getDeliveryDetailCode(), actData.getDetails().getDeliveryDetailCode()); + Assertions.assertEquals(expData.getDetails().getRegisteredLetterCode(), actData.getDetails().getRegisteredLetterCode()); + Assertions.assertEquals(expData.getDetails().getAttachment(), actData.getDetails().getAttachment()); + Assertions.assertEquals(expData.getDetails().getNotificationDate(), actData.getDetails().getNotificationDate()); + Assertions.assertEquals(expData.getDetails().getDeliveryFailureCause(), actData.getDetails().getDeliveryFailureCause()); + Assertions.assertEquals(expData.getDetails().getDeliveryAttemptDate(), actData.getDetails().getDeliveryAttemptDate()); + } + } + } + + + protected Stream loadTestCases(String folder, String exclude) throws Exception { + ClassPathResource classPathResource = new ClassPathResource("testcase/" + folder); + URI excludeURI = null; + if(StringUtils.hasText(exclude)) { + ClassPathResource classPathResourceExclude = new ClassPathResource("testcase/" + folder + exclude); + excludeURI = classPathResourceExclude.getURI(); + } + return SequenceLoader.loadScenarios(classPathResource.getURI(),excludeURI); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDisableTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDisableTestIT.java new file mode 100644 index 000000000..071f6dea7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDisableTestIT.java @@ -0,0 +1,76 @@ +package it.pagopa.pn.papertracker.it.RS; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;" + } +) +public class DryRSOcrDisableTestIT extends BaseTest.WithLocalStack { + + @Autowired + private SequenceRunner scenarioRunner; + + @MockitoBean + private PaperChannelClient paperChannelClient; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockPcRetry(scenario); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, false); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRS004B]")){ + throw e; + } + } + } + + private void mockPcRetry(ProductTestCase scenario) { + getPcRetryResponse(scenario); + if (scenario.getName().equalsIgnoreCase("OK_RETRY_RS") + || scenario.getName().equalsIgnoreCase("OK_RETRY_M10_RS") + || scenario.getName().equalsIgnoreCase("OK_NON_RENDICONTABILE_RS")) { + Mockito.when(paperChannelClient.getPcRetry(any(), any())).thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + } + } + + Stream loadTestCases() throws Exception { + URI uri = Objects.requireNonNull(Thread.currentThread() + .getContextClassLoader() + .getResource("testcase/RS")).toURI(); + + return SequenceLoader.loadScenarios(uri, null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDryTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDryTestIT.java new file mode 100644 index 000000000..da0c6e049 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrDryTestIT.java @@ -0,0 +1,69 @@ +package it.pagopa.pn.papertracker.it.RS; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DRY; +import static org.mockito.ArgumentMatchers.any; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:DRY;890:DRY;RS:DRY" + } +) +public class DryRSOcrDryTestIT extends AbstractRSTestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, DRY); + scenarioRunner.run(scenario, DRY,false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRS004B]")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + URI uri = Objects.requireNonNull(Thread.currentThread() + .getContextClassLoader() + .getResource("testcase/RS")).toURI(); + + return SequenceLoader.loadScenarios(uri, null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrRunTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrRunTestIT.java new file mode 100644 index 000000000..e2a571e1e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/DryRSOcrRunTestIT.java @@ -0,0 +1,68 @@ +package it.pagopa.pn.papertracker.it.RS; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; +import static org.mockito.ArgumentMatchers.any; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:RUN;890:RUN;RS:RUN" + } +) +public class DryRSOcrRunTestIT extends AbstractRSTestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, OcrStatusEnum.RUN, false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().equalsIgnoreCase("Necessary status code not found in events: [RECRS004B]")){ + throw e; + } + } + } + Stream loadTestCases() throws Exception { + URI uri = Objects.requireNonNull(Thread.currentThread() + .getContextClassLoader() + .getResource("testcase/RS")).toURI(); + + return SequenceLoader.loadScenarios(uri, null); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/TestCaseHandlerRS.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/TestCaseHandlerRS.java new file mode 100644 index 000000000..9155c15f9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/RS/TestCaseHandlerRS.java @@ -0,0 +1,26 @@ +package it.pagopa.pn.papertracker.it.RS; + +import it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import it.pagopa.pn.papertracker.service.impl.NotificationReworkServiceImpl; +import org.springframework.stereotype.Component; + +@Component +public class TestCaseHandlerRS extends GenericTestCaseHandlerImpl { + + public TestCaseHandlerRS(ExternalChannelHandler externalChannelHandler, PaperTrackingsErrorsDAO paperTrackingsErrorsDAO, PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao, PaperTrackingsDAO paperTrackingsDAO, OcrEventHandler ocrEventHandler, NotificationReworkService notificationReworkService) { + super(externalChannelHandler, paperTrackingsErrorsDAO, paperTrackerDryRunOutputsDao, paperTrackingsDAO, ocrEventHandler, notificationReworkService); + } + + @Override + public String getProductType() { + return ProductType.RS.getValue(); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceLoader.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceLoader.java new file mode 100644 index 000000000..015a391a0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceLoader.java @@ -0,0 +1,46 @@ +package it.pagopa.pn.papertracker.it; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import org.junit.jupiter.params.provider.Arguments; + +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; + +public class SequenceLoader { + + public static Stream loadScenarios(URI uri, URI exclude) throws Exception { + + ObjectMapper mapper = new ObjectMapper().findAndRegisterModules(); + + List result = new ArrayList<>(); + + Path dir = Path.of(uri); + Path excludedPath = exclude != null ? Path.of(exclude) : null; + + try (Stream paths = Files.walk(dir)) { + List jsonFiles = paths + .filter(Files::isRegularFile) + .filter(p -> Objects.isNull(excludedPath) || !p.startsWith(excludedPath)) + .filter(p -> p.toString().endsWith(".json")) + .sorted() + .toList(); + for (Path path : jsonFiles) { + String raw = Files.readString(path); + ProductTestCase scenario = mapper.readValue(raw, ProductTestCase.class); + result.add(Arguments.of(path.toAbsolutePath().toString(), scenario)); + } + } + + if (result.isEmpty()) { + throw new IllegalStateException("No scenarios found!"); + } + + return result.stream(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceRunner.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceRunner.java new file mode 100644 index 000000000..549047812 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/SequenceRunner.java @@ -0,0 +1,67 @@ +package it.pagopa.pn.papertracker.it; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.List; +import java.util.Objects; + +@Component +@RequiredArgsConstructor +public class SequenceRunner { + + private final List handlers; + private final PaperTrackerTrackingService paperTrackerTrackingService; + + public void run(ProductTestCase scenario, OcrStatusEnum ocrStatusEnum, boolean strictFinalValidation) throws InterruptedException { + GenericTestCaseHandler handler = handlers.stream() + .filter(h -> h.getProductType() + .equalsIgnoreCase(scenario.getProductType())) + .findFirst() + .orElseThrow(() -> + new IllegalStateException( + "No handler for product " + scenario.getProductType()) + ); + + handler.beforeInit(scenario, strictFinalValidation, ocrStatusEnum); + initPaperTrackings(scenario); + handler.afterInit(scenario, scenario.getInitialTracking()); + handler.sendEventsAndOcrResponse(scenario, ocrStatusEnum); + handler.afterSendEvents(scenario, ocrStatusEnum, strictFinalValidation); + } + + private void initPaperTrackings(ProductTestCase scenario) { + String xOriginClientId = "clientId"; + paperTrackerTrackingService.insertPaperTrackings(scenario.getInitialTracking(), xOriginClientId).block(); + if(!CollectionUtils.isEmpty(scenario.getEvents())) { + + if (scenario.getEvents().stream() + .filter(testEvent -> Objects.nonNull(testEvent.getAnalogMail())) + .anyMatch(singleStatusUpdate -> singleStatusUpdate.getAnalogMail() + .getRequestId().equalsIgnoreCase("{{REQUEST_ID_RETRY}}"))) { + paperTrackerTrackingService.insertPaperTrackings(getTrackingCreationRequest(scenario, "PCRETRY_1"), xOriginClientId).block(); + } + + if (scenario.getEvents().stream() + .filter(testEvent -> Objects.nonNull(testEvent.getAnalogMail())) + .anyMatch(singleStatusUpdate -> singleStatusUpdate.getAnalogMail() + .getRequestId().equalsIgnoreCase("{{REQUEST_ID_RETRY_2}}"))) { + paperTrackerTrackingService.insertPaperTrackings(getTrackingCreationRequest(scenario, "PCRETRY_2"), xOriginClientId).block(); + } + } + } + + private static TrackingCreationRequest getTrackingCreationRequest(ProductTestCase scenario, String pcRetry) { + TrackingCreationRequest retryTrackingCreationRequest = new TrackingCreationRequest(); + retryTrackingCreationRequest.setAttemptId(scenario.getInitialTracking().getAttemptId()); + retryTrackingCreationRequest.setProductType(scenario.getInitialTracking().getProductType()); + retryTrackingCreationRequest.setUnifiedDeliveryDriver(scenario.getInitialTracking().getUnifiedDeliveryDriver()); + retryTrackingCreationRequest.setPcRetry(pcRetry); + return retryTrackingCreationRequest; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Abstract890TestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Abstract890TestIT.java new file mode 100644 index 000000000..a84f72096 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Abstract890TestIT.java @@ -0,0 +1,124 @@ +package it.pagopa.pn.papertracker.it._890; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.DataDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.it.SequenceLoader; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.provider.Arguments; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.springframework.core.io.ClassPathResource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; + +import java.net.URI; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl.getPcRetryResponse; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +public abstract class Abstract890TestIT extends BaseTest.WithLocalStack { + + @MockitoBean + protected PaperChannelClient paperChannelClient; + + @MockitoBean + protected DataVaultClient dataVaultClient; + + @MockitoBean + protected SafeStorageClient safeStorageClient; + + @MockitoBean + protected OcrMomProducer ocrMomProducer; + + protected void mockData(ProductTestCase productTestCase, OcrStatusEnum ocrStatusEnum){ + mockPcRetry(productTestCase); + mockDataVault(productTestCase); + if(!ocrStatusEnum.equals(OcrStatusEnum.DISABLED)) { + mockSendToOcr(productTestCase); + } + } + + protected void mockPcRetry(ProductTestCase scenario) { + getPcRetryResponse(scenario); + switch (scenario.getName().toUpperCase()) { + case "OK_RETRY_890", "OK_RETRY_M10_890", "OK_NON_RENDICONTABILE_890" -> + Mockito.when(paperChannelClient.getPcRetry(any(), any())) + .thenReturn(Mono.just(scenario.getFirstPcRetryResponse())); + } + } + + protected void mockDataVault(ProductTestCase scenario) { + if (scenario.getEvents().stream().anyMatch(testEvent -> Objects.nonNull(testEvent.getAnalogMail()) && Objects.nonNull(testEvent.getAnalogMail().getDiscoveredAddress()))) { + Mockito.when(dataVaultClient.anonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just("anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9")); + PaperAddress paperAddress = PaperAddress.builder() + .name("test") + .address("via Roma 10") + .cap("00100") + .pr("RM") + .city("Roma") + .build(); + Mockito.when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just(paperAddress)); + } + } + + protected void mockSendToOcr(ProductTestCase scenario) { + if (Objects.nonNull(scenario.getExpected().getOcrDataPayload())) { + Mockito.when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("Uri")); + Mockito.doNothing().when(ocrMomProducer).push(any(OcrEvent.class)); + } + } + + protected void verifySentToOcr(ProductTestCase scenario, ArgumentCaptor ocrEventCaptor){ + Mockito.verify(ocrMomProducer, times(scenario.getExpected().getSentToOcr())).push(ocrEventCaptor.capture()); + List ocrEvents = ocrEventCaptor.getAllValues().stream().map(OcrEvent::getPayload).toList(); + List expected = scenario.getExpected().getOcrDataPayload(); + if(Objects.nonNull(expected)) { + Assertions.assertEquals(expected.size(), ocrEvents.size()); + for (int i = 0; i < expected.size(); i++) { + OcrDataPayloadDTO exp = expected.get(i); + OcrDataPayloadDTO act = ocrEvents.get(i); + Assertions.assertEquals(exp.getCommandId(), act.getCommandId()); + Assertions.assertEquals(exp.getCommandType(), act.getCommandType()); + Assertions.assertNotNull(act.getData()); + DataDTO expData = exp.getData(); + DataDTO actData = act.getData(); + Assertions.assertEquals(expData.getDocumentType(), actData.getDocumentType()); + Assertions.assertEquals(expData.getProductType(), actData.getProductType()); + Assertions.assertEquals(expData.getUnifiedDeliveryDriver(), actData.getUnifiedDeliveryDriver()); + Assertions.assertNotNull(actData.getDetails()); + Assertions.assertEquals(expData.getDetails().getDeliveryDetailCode(), actData.getDetails().getDeliveryDetailCode()); + Assertions.assertEquals(expData.getDetails().getRegisteredLetterCode(), actData.getDetails().getRegisteredLetterCode()); + Assertions.assertEquals(expData.getDetails().getAttachment(), actData.getDetails().getAttachment()); + Assertions.assertEquals(expData.getDetails().getNotificationDate(), actData.getDetails().getNotificationDate()); + Assertions.assertEquals(expData.getDetails().getDeliveryFailureCause(), actData.getDetails().getDeliveryFailureCause()); + Assertions.assertEquals(expData.getDetails().getDeliveryAttemptDate(), actData.getDetails().getDeliveryAttemptDate()); + } + } + } + + protected Stream loadTestCases(String folder, String exclude) throws Exception { + ClassPathResource classPathResource = new ClassPathResource("testcase/" + folder); + URI excludeURI = null; + if(StringUtils.hasText(exclude)) { + ClassPathResource classPathResourceExclude = new ClassPathResource("testcase/" + folder + exclude); + excludeURI = classPathResourceExclude.getURI(); + } + return SequenceLoader.loadScenarios(classPathResource.getURI(),excludeURI); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableStrictTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableStrictTestIT.java new file mode 100644 index 000000000..8dfa26141 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableStrictTestIT.java @@ -0,0 +1,53 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DISABLED; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;", + "pn.paper-tracker.strict-final-validation-stock890=1970-01-01;true" + } +) +public class Dry890OcrDisableStrictTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockData(scenario, DISABLED); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, true); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/run"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableTestIT.java new file mode 100644 index 000000000..1623b9941 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDisableTestIT.java @@ -0,0 +1,54 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DISABLED; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;" + } +) +public class Dry890OcrDisableTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + mockData(scenario, DISABLED); + scenarioRunner.run(scenario, OcrStatusEnum.DISABLED, false); + + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/run"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryStrictTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryStrictTestIT.java new file mode 100644 index 000000000..01a5588f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryStrictTestIT.java @@ -0,0 +1,57 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DRY; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:DRY;890:DRY", + "pn.paper-tracker.strict-final-validation-stock890=1970-01-01;true" + } +) +public class Dry890OcrDryStrictTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, DRY,true); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/run"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryTestIT.java new file mode 100644 index 000000000..64cb8e287 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrDryTestIT.java @@ -0,0 +1,56 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.DRY; +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:DRY;890:DRY" + } +) +public class Dry890OcrDryTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, DRY,false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/run"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunStrictTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunStrictTestIT.java new file mode 100644 index 000000000..01900d06e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunStrictTestIT.java @@ -0,0 +1,56 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:RUN;890:RUN", + "pn.paper-tracker.strict-final-validation-stock890=1970-01-01;true" + } +) +public class Dry890OcrRunStrictTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, RUN,true); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/disable"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunTestIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunTestIT.java new file mode 100644 index 000000000..c0e794f88 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/Dry890OcrRunTestIT.java @@ -0,0 +1,55 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.it.SequenceRunner; +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestPropertySource; + +import java.util.stream.Stream; + +import static it.pagopa.pn.papertracker.model.OcrStatusEnum.RUN; + +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@SpringBootTest +@TestPropertySource( + locations = "classpath:application.test-IT.properties", + properties = { + "pn.paper-tracker.enable-ocr-validation-for=1970-01-01;AR:RUN;890:RUN" + } +) +public class Dry890OcrRunTestIT extends Abstract890TestIT { + + @Autowired + private SequenceRunner scenarioRunner; + + @ParameterizedTest(name = "{0}") + @MethodSource("loadTestCases") + void runScenario(String fileName, ProductTestCase scenario) throws InterruptedException { + try { + ArgumentCaptor ocrEventCaptor = ArgumentCaptor.forClass(OcrEvent.class); + mockData(scenario, RUN); + scenarioRunner.run(scenario, RUN,false); + verifySentToOcr(scenario, ocrEventCaptor); + }catch (PnPaperTrackerValidationException e){ + //se all'arrivo dell'evento C non sono presenti tutti gli statusCode necessari viene fatta salire l'eccezione + //per consentire il riaccodamento del messaggio e il successivo reprocess degli eventi, + // in questo modo si simula il comportamento del sistema in caso di eventi arrivati in ordine non corretto + if(!e.getError().getDetails().getMessage().startsWith("Necessary status code not found in events:")){ + throw e; + } + } + } + + Stream loadTestCases() throws Exception { + return super.loadTestCases("_890", "/giacenza/multiple_ocr_request/disable"); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/TestCaseHandler890.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/TestCaseHandler890.java new file mode 100644 index 000000000..63fd180c7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/_890/TestCaseHandler890.java @@ -0,0 +1,24 @@ +package it.pagopa.pn.papertracker.it._890; + +import it.pagopa.pn.papertracker.it.GenericTestCaseHandlerImpl; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.service.impl.NotificationReworkServiceImpl; +import org.springframework.stereotype.Component; + +@Component +public class TestCaseHandler890 extends GenericTestCaseHandlerImpl { + + public TestCaseHandler890(ExternalChannelHandler externalChannelHandler, PaperTrackingsErrorsDAO paperTrackingsErrorsDAO, PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDao, PaperTrackingsDAO paperTrackingsDAO, OcrEventHandler ocrEventHandler, NotificationReworkServiceImpl notificationReworkService) { + super(externalChannelHandler, paperTrackingsErrorsDAO, paperTrackerDryRunOutputsDao, paperTrackingsDAO, ocrEventHandler, notificationReworkService); + } + + @Override + public String getProductType() { + return ProductType._890.getValue(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/Expected.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/Expected.java new file mode 100644 index 000000000..56fddc791 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/Expected.java @@ -0,0 +1,22 @@ +package it.pagopa.pn.papertracker.it.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import lombok.Data; + +import java.util.List; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class Expected { + private List errors; + private List outputs; + private List trackings; + private Integer sentToOcr; + private List ocrResultPayload; + private List ocrDataPayload; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/ProductTestCase.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/ProductTestCase.java new file mode 100644 index 000000000..72c1547bc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/ProductTestCase.java @@ -0,0 +1,22 @@ +package it.pagopa.pn.papertracker.it.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import lombok.Data; + +import java.util.List; + +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class ProductTestCase { + private String name; + private String productType; + private TrackingCreationRequest initialTracking; + private List events; + private boolean createAttempt1; + private Expected expected; + private PcRetryResponse firstPcRetryResponse; + private PcRetryResponse secondPcRetryResponse; + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/TestEvent.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/TestEvent.java new file mode 100644 index 000000000..c82b20f4b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/model/TestEvent.java @@ -0,0 +1,11 @@ +package it.pagopa.pn.papertracker.it.model; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import lombok.Data; + +@Data +public class TestEvent { + private String messageId; + private Integer ocrResponseIdx; + private PaperProgressStatusEvent analogMail; +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/ErrorValidator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/ErrorValidator.java new file mode 100644 index 000000000..9282bfea4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/ErrorValidator.java @@ -0,0 +1,73 @@ +package it.pagopa.pn.papertracker.it.validator; + +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; + +import java.util.List; +import java.util.Objects; + +import static org.junit.jupiter.api.Assertions.*; + +public class ErrorValidator { + + public static void verifyErrors(ProductTestCase scenario, + List actualErrors) { + + List expected = scenario.getExpected().getErrors(); + if (expected == null) return; + + assertEquals(expected.size(), actualErrors.size(), "Mismatch error count"); + + for (PaperTrackingsErrors exp : expected) { + + PaperTrackingsErrors match = actualErrors.stream() + .filter(act -> sameErrorIdentity(exp, act)) + .findFirst() + .orElseThrow(() -> new AssertionError( + "Expected error not found: " + exp)); + + verifyErrorFields(exp, match); + + assertNotNull(match.getCreated()); + } + } + + private static void verifyErrorFields(PaperTrackingsErrors exp, + PaperTrackingsErrors act) { + + assertAll("Error fields", + () -> assertEquals(exp.getTrackingId(), act.getTrackingId()), + () -> assertEquals(exp.getErrorCategory(), act.getErrorCategory()), + () -> assertEquals(exp.getFlowThrow(), act.getFlowThrow()), + () -> assertEquals(exp.getType(), act.getType()), + () -> assertEquals(exp.getProductType(), act.getProductType()), + () -> assertEquals(exp.getEventThrow(), act.getEventThrow()), + () -> assertEquals(exp.getEventIdThrow(), act.getEventIdThrow()) + ); + } + + private static boolean sameErrorIdentity(PaperTrackingsErrors exp, + PaperTrackingsErrors act) { + + return Objects.equals(exp.getTrackingId(), act.getTrackingId()) + && exp.getErrorCategory() == act.getErrorCategory() + && exp.getFlowThrow() == act.getFlowThrow() + && exp.getType() == act.getType() + && Objects.equals(exp.getProductType(), act.getProductType()) + && Objects.equals(exp.getEventThrow(), act.getEventThrow()) + && Objects.equals(exp.getEventIdThrow(), act.getEventIdThrow()) + && act.getDetails().getMessage().contains(exp.getDetails().getMessage()) + && (Objects.isNull(act.getDetails().getCause()) || Objects.equals(exp.getDetails().getCause(), act.getDetails().getCause())) + && checkAdditionalDetails(act, exp); + } + + private static boolean checkAdditionalDetails(PaperTrackingsErrors act, PaperTrackingsErrors exp) { + if( Objects.isNull(act.getDetails().getAdditionalDetails()) ){ + return true; + } + if(act.getDetails().getAdditionalDetails().containsKey("affectedEvents")){ + return Objects.equals(exp.getDetails().getAdditionalDetails().get("affectedEvents"), act.getDetails().getAdditionalDetails().get("affectedEvents")); + } + return Objects.equals(exp.getDetails().getAdditionalDetails(), act.getDetails().getAdditionalDetails()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/OutputValidator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/OutputValidator.java new file mode 100644 index 000000000..a04ebaa9e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/OutputValidator.java @@ -0,0 +1,182 @@ +package it.pagopa.pn.papertracker.it.validator; + +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.time.OffsetDateTime; +import java.util.*; + +import static org.junit.jupiter.api.Assertions.*; + +@Component +public class OutputValidator { + + private static final Map> swapRules = new HashMap<>(); + private static final Map reorderRules = new HashMap<>(); + + public OutputValidator() { + + // -------- SWAP RULES -------- + swapRules.put("OK_GIACENZA_GT10_890", List.of(new SwapRule("RECAG005A", "RECAG012"))); + swapRules.put("OK_GIACENZA_DELEGATO_GT10_890", List.of(new SwapRule("RECAG006A", "RECAG012"))); + swapRules.put("OK_COMPIUTA_GIACENZA_890", List.of(new SwapRule("RECAG008A", "RECAG012"), new SwapRule("RECAG008A", "RECAG008B"))); + swapRules.put("OK_COMPIUTA_GIACENZA_890_RECAG010A", List.of(new SwapRule("RECAG008A", "RECAG012"), new SwapRule("RECAG008A", "RECAG008B"))); + swapRules.put("OK_COMPIUTA_GIACENZA_INVALID_ATTACHMENT_890", List.of(new SwapRule("RECAG008A", "RECAG012"), new SwapRule("RECAG008A", "RECAG008B"))); + swapRules.put("OK_COMPIUTA_GIACENZA_NO_ATTACHMENT_890", List.of(new SwapRule("RECAG008A", "RECAG012"))); + swapRules.put("FAIL_GIACENZA_NO_ATTACHMENT_890", List.of(new SwapRule("RECAG007A", "RECAG012"))); + swapRules.put("FAIL_GIACENZA_INVALID_ATTACHMENT_890", List.of(new SwapRule("RECAG007A", "RECAG012"), new SwapRule("RECAG007A", "RECAG007B"))); + swapRules.put("FAIL_GIACENZA_GT10_890", List.of(new SwapRule("RECAG007A", "RECAG012"), new SwapRule("RECAG007B", "RECAG007A"))); + swapRules.put("OK_GIACENZA_DELEGATO_NO_ATTACHMENT_890", List.of(new SwapRule("RECAG005A", "RECAG012"), new SwapRule("RECAG005A", "RECAG005B"))); + + // -------- REORDER RULE (scenario con 2 eventi B) -------- + //FIX + reorderRules.put("FAIL_GIACENZA_LTE10_890", new ReorderRule("RECAG012", 5)); + } + + + public static void verifyOutputs(ProductTestCase scenario, + OcrStatusEnum ocrStatusEnum, + List actualOutputs) { + + List expected = scenario.getExpected().getOutputs(); + if (expected == null) return; + + assertEquals(expected.size(), actualOutputs.size(), "Mismatch output count"); + + List sortedActual = + sortIfNeeded(scenario, ocrStatusEnum, actualOutputs); + + for (int i = 0; i < expected.size(); i++) { + + PaperTrackerDryRunOutputs exp = expected.get(i); + PaperTrackerDryRunOutputs act = sortedActual.get(i); + + assertAll("Output at position " + i, + () -> assertNotNull(act.getCreated()), + () -> assertEquals(exp.getTrackingId(), act.getTrackingId()), + () -> assertEquals(exp.getRegisteredLetterCode(), act.getRegisteredLetterCode()), + () -> assertEquals(exp.getStatusCode(), act.getStatusCode()), + () -> assertEquals(exp.getStatusDetail(), act.getStatusDetail()), + () -> assertEquals(exp.getStatusDescription(), act.getStatusDescription()), + () -> assertEquals( + OffsetDateTime.parse(exp.getStatusDateTime()), + OffsetDateTime.parse(act.getStatusDateTime()) + ), + () -> assertEquals(exp.getDeliveryFailureCause(), act.getDeliveryFailureCause()), + () -> assertEquals(exp.getAnonymizedDiscoveredAddressId(), + act.getAnonymizedDiscoveredAddressId()), + () -> assertEquals( + OffsetDateTime.parse(exp.getClientRequestTimestamp()), + OffsetDateTime.parse(act.getClientRequestTimestamp()) + ) + ); + + verifyOutputAttachments(exp.getAttachments(), act.getAttachments(), i); + } + } + + private static List sortIfNeeded( + ProductTestCase scenario, + OcrStatusEnum ocrStatusEnum, + List actualOutputs) { + + // 1️⃣ sempre ordinamento per retry + List sortedByRetry = actualOutputs.stream() + .sorted(Comparator.comparingInt(o -> extractPcRetry(o.getTrackingId()))) + .toList(); + + if (ocrStatusEnum != OcrStatusEnum.RUN) { + return sortedByRetry; + } + + // 2️⃣ in RUN ordino per created + List sorted = sortedByRetry.stream() + .sorted(Comparator.comparing(PaperTrackerDryRunOutputs::getCreated)) + .toList(); + + // 3️⃣ PRIORITY REORDER (gestisce duplicati in modo stabile) + var reorder = reorderRules.get(scenario.getName()); + if (reorder != null) { + + var result = new ArrayList<>(sorted); + int index = findIndexByStatus(result, reorder.statusCode); + + if (index != -1 && result.size() >= 2) { + PaperTrackerDryRunOutputs element = result.remove(index); + result.add(reorder.position, element); + } + + return result; + } + + // 4️⃣ SWAP RULES (logica legacy) + var rules = swapRules.get(scenario.getName()); + if (rules == null) { + return sorted; + } + + var result = new ArrayList<>(sorted); + rules.forEach(rule -> swapIfPresent(result, rule)); + return result; + } + + private static int extractPcRetry(String requestId) { + int index = requestId.lastIndexOf("PCRETRY_"); + if (index == -1) { + return Integer.MAX_VALUE; + } + return Integer.parseInt(requestId.substring(index + 8)); + } + + private static void swapIfPresent(List list, SwapRule rule) { + + int index1 = findIndexByStatus(list, rule.first()); + int index2 = findIndexByStatus(list, rule.second()); + + if (index1 != -1 && index2 != -1) { + Collections.swap(list, index1, index2); + } + } + + private static int findIndexByStatus(List list, + String status) { + + for (int i = 0; i < list.size(); i++) { + if (status.equals(list.get(i).getStatusDetail())) { + return i; + } + } + return -1; + } + + + private static void verifyOutputAttachments(List expected, + List actual, + int parentIndex) { + + if (CollectionUtils.isEmpty(expected)) { + assertTrue(actual == null || actual.isEmpty(), + "Attachments should be empty at output index " + parentIndex); + return; + } + assertNotNull(actual); + assertEquals(expected.size(), actual.size(), "Mismatch attachments count at output index " + parentIndex); + for (int i = 0; i < expected.size(); i++) { + Attachment expAtt = expected.get(i); + Attachment actAtt = actual.get(i); + assertAll("Attachment at output " + parentIndex + ", position " + i, + () -> assertEquals(expAtt.getId(), actAtt.getId()), + () -> assertEquals(expAtt.getDocumentType(), actAtt.getDocumentType()), + () -> assertEquals(expAtt.getUri(), actAtt.getUri()), + () -> assertEquals(expAtt.getDate(), actAtt.getDate()) + ); + } + } + + private record SwapRule(String first, String second) {} + private record ReorderRule(String statusCode, Integer position) {} +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/TrackingValidator.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/TrackingValidator.java new file mode 100644 index 000000000..a7e30b0e1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/it/validator/TrackingValidator.java @@ -0,0 +1,315 @@ +package it.pagopa.pn.papertracker.it.validator; + +import it.pagopa.pn.papertracker.it.model.ProductTestCase; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.apache.commons.lang3.StringUtils; +import org.junit.jupiter.api.Assertions; +import org.springframework.util.CollectionUtils; + +import java.util.*; + +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState.DONE; +import static org.junit.jupiter.api.Assertions.*; + +public class TrackingValidator { + + public static void verifyTrackingEntities(ProductTestCase scenario, List actualTrackings, OcrStatusEnum ocrStatusEnum, boolean strictFinalValidationStock890) { + List expectedTrackings = scenario.getExpected().getTrackings(); + if (expectedTrackings == null) return; + assertEquals(expectedTrackings.size(), actualTrackings.size(), "Mismatch Trackings count"); + expectedTrackings.forEach(expected -> + verifySingleTracking(scenario, expected, actualTrackings, ocrStatusEnum, strictFinalValidationStock890) + ); + } + + private static void verifySingleTracking(ProductTestCase scenario, PaperTrackings expected, List actualTrackings, OcrStatusEnum ocrStatusEnum, boolean strictFinalValidationStock890) { + + PaperTrackings actual = actualTrackings.stream() + .filter(t -> t.getTrackingId().equalsIgnoreCase(expected.getTrackingId())) + .findFirst() + .orElseThrow(() -> new AssertionError("Tracking not found: " + expected.getTrackingId())); + + verifyTrackingFields(expected, actual); + verifyEvents(expected.getEvents(), actual.getEvents()); + verifyValidationConfig(expected.getValidationConfig(), actual.getValidationConfig(), + ocrStatusEnum, strictFinalValidationStock890); + verifyValidationFlow(scenario, expected, actual, ocrStatusEnum); + if (StringUtils.isBlank(expected.getNextRequestIdPcretry()) && !scenario.getName().equalsIgnoreCase("NOT_RETRYABLE_EVENT_AR") + && !scenario.getName().equalsIgnoreCase("NOT_RETRYABLE_EVENT_890")) { + verifyPaperStatus(scenario.getName(), expected.getPaperStatus(), actual.getPaperStatus(), expected.getEvents(), expected, scenario.getExpected().getErrors()); + } + + assertNotNull(actual.getCreatedAt()); + assertNotNull(actual.getUpdatedAt()); + } + + private static void verifyTrackingFields(PaperTrackings exp, PaperTrackings act) { + assertAll("Tracking fields", + () -> assertEquals(exp.getBusinessState(), act.getBusinessState()), + () -> assertEquals(exp.getAttemptId(), act.getAttemptId()), + () -> assertEquals(exp.getProductType(), act.getProductType()), + () -> assertEquals(exp.getState(), act.getState()), + () -> assertEquals(exp.getProcessingMode(), act.getProcessingMode()), + () -> assertEquals(exp.getUnifiedDeliveryDriver(), act.getUnifiedDeliveryDriver()), + () -> assertEquals(exp.getNextRequestIdPcretry(), act.getNextRequestIdPcretry()), + () -> assertEquals(exp.getPcRetry(), act.getPcRetry()) + ); + } + + private static void verifyEvents(List expected, List actual) { + + assertNotNull(actual); + assertEquals(expected.size(), actual.size(), "Mismatch events count"); + + // Ordiniamo gli eventi reali per createdAt (ordine di inserimento) + List sortedActual = actual.stream() + .sorted(Comparator.comparing(Event::getCreatedAt)) + .toList(); + + for (int i = 0; i < expected.size(); i++) { + + Event expEvent = expected.get(i); + Event actEvent = sortedActual.get(i); + + int finalI = i; + assertAll("Event at position " + i, + () -> assertNotNull(actEvent.getId()), + () -> assertEquals(expEvent.getId(), actEvent.getId()), + + () -> assertEquals(expEvent.getRequestTimestamp(), actEvent.getRequestTimestamp(), + "Mismatch requestTimestamp at index " + finalI), + + () -> assertEquals(expEvent.getStatusCode(), actEvent.getStatusCode()), + () -> assertEquals(expEvent.getStatusTimestamp(), actEvent.getStatusTimestamp()), + () -> assertEquals(expEvent.getStatusDescription(), actEvent.getStatusDescription()), + () -> assertEquals(expEvent.getProductType(), actEvent.getProductType()), + () -> assertEquals(expEvent.getDeliveryFailureCause(), actEvent.getDeliveryFailureCause()), + () -> assertEquals(expEvent.getRegisteredLetterCode(), actEvent.getRegisteredLetterCode()), + () -> assertEquals(expEvent.getNotificationReworkId(), actEvent.getNotificationReworkId()), + () -> assertEquals(expEvent.getAnonymizedDiscoveredAddressId(), actEvent.getAnonymizedDiscoveredAddressId()), + () -> assertNotNull(actEvent.getCreatedAt()) + ); + + verifyAttachments(expEvent.getAttachments(), actEvent.getAttachments()); + } + } + + private static void verifyAttachments(List expected, List actual) { + assertEquals(expected.size(), actual.size(), "Mismatch attachments count"); + + expected.forEach(expAtt -> { + + Attachment actAtt = actual.stream() + .filter(a -> a.getDocumentType().equalsIgnoreCase(expAtt.getDocumentType()) + && a.getId().equalsIgnoreCase(expAtt.getId())) + .findFirst() + .orElseThrow(() -> new AssertionError("Attachment not found: " + expAtt)); + + assertAll("Attachment fields", + () -> assertNotNull(actAtt.getId()), + () -> assertEquals(expAtt.getDocumentType(), actAtt.getDocumentType()) + ); + }); + } + + private static void verifyValidationConfig(ValidationConfig expected, ValidationConfig actual, OcrStatusEnum ocrStatusEnum, boolean strictFinalValidationStock890) { + + assertNotNull(actual); + + assertAll("ValidationConfig", + () -> assertEquals(ocrStatusEnum, actual.getOcrEnabled()), + () -> assertEquals(expected.getRequiredAttachmentsRefinementStock890(), actual.getRequiredAttachmentsRefinementStock890()), + () -> assertEquals(expected.getSendOcrAttachmentsFinalValidation(), actual.getSendOcrAttachmentsFinalValidation()), + () -> assertEquals(expected.getSendOcrAttachmentsFinalValidationStock890(), actual.getSendOcrAttachmentsFinalValidationStock890()), + () -> assertEquals(expected.getSendOcrAttachmentsRefinementStock890(), actual.getSendOcrAttachmentsRefinementStock890()), + () -> assertEquals(strictFinalValidationStock890, actual.getStrictFinalValidationStock890()) + ); + } + + private static void verifyValidationFlow(ProductTestCase scenario, PaperTrackings expected, PaperTrackings actual, OcrStatusEnum ocrStatusEnum) { + + ValidationFlow flow = actual.getValidationFlow(); + ValidationFlow expectedFlow = expected.getValidationFlow(); + String scenarioName = scenario.getName(); + + boolean isOkRs = scenarioName.equalsIgnoreCase("OK_RS"); + boolean isOkRis = scenarioName.equalsIgnoreCase("OK_RIS"); + boolean isOkRetryRs = scenarioName.equalsIgnoreCase("OK_RETRY_RS") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_RS"); + boolean isCausaForzaMaggioreRS = scenarioName.equalsIgnoreCase("CAUSA_FORZA_MAGGIORE_RS"); + boolean isOkNonRendicontabileRs = scenarioName.equalsIgnoreCase("OK_NON_RENDICONTABILE_RS"); + boolean isOkRetryRis = scenarioName.equalsIgnoreCase("OK_RETRY_RIS") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_RIS"); + boolean isM10Retry = scenarioName.equalsIgnoreCase("OK_RETRY_M10_AR") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_RS") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_RIR") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_RIS") + || scenarioName.equalsIgnoreCase("OK_RETRY_M10_890"); + boolean isFailCompiuta = scenarioName.equalsIgnoreCase("FAIL_COMPIUTA_GIACENZA_AR") || scenarioName.equalsIgnoreCase("FAIL_COMPIUTA_GIACENZA_AR_2"); + boolean isOcrPending = scenarioName.equalsIgnoreCase("OK_AR_OCR_PENDING") || scenarioName.equalsIgnoreCase("OK_890_OCR_PENDING"); + boolean isGiacenza890 = scenarioName.equalsIgnoreCase("OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_KO_890"); + boolean noRetry = StringUtils.isBlank(expected.getNextRequestIdPcretry()); + boolean hasRetry = !noRetry; + boolean businessDoneNoRetry = expected.getBusinessState() == BusinessState.DONE && noRetry; + boolean stateDoneNoRetry = expected.getState() == DONE && noRetry; + boolean isOkRsRis = isCausaForzaMaggioreRS || isOkRs || isOkRis || ((isOkRetryRs || isOkRetryRis || isOkNonRendicontabileRs) && noRetry); + + if (isM10Retry && hasRetry) { + assertNotNull(flow.getFinalEventBuilderTimestamp()); + assertNotNull(flow.getFinalEventDematValidationTimestamp()); + assertNotNull(flow.getSequencesValidationTimestamp()); + } else if (isOkRsRis) { + assertNotNull(flow.getFinalEventBuilderTimestamp()); + assertNull(flow.getFinalEventDematValidationTimestamp()); + assertNotNull(flow.getSequencesValidationTimestamp()); + } else if (businessDoneNoRetry) { + assertNotNull(flow.getFinalEventBuilderTimestamp()); + assertNotNull(flow.getFinalEventDematValidationTimestamp()); + assertNotNull(flow.getSequencesValidationTimestamp()); + } else if (isFailCompiuta) { + assertNull(flow.getFinalEventBuilderTimestamp()); + assertNotNull(flow.getFinalEventDematValidationTimestamp()); + assertNotNull(flow.getSequencesValidationTimestamp()); + } else if (isOcrPending) { + assertNull(flow.getFinalEventBuilderTimestamp()); + assertNull(flow.getFinalEventDematValidationTimestamp()); + assertNotNull(flow.getSequencesValidationTimestamp()); + } else { + assertNull(flow.getFinalEventBuilderTimestamp()); + assertNull(flow.getFinalEventDematValidationTimestamp()); + assertNull(flow.getSequencesValidationTimestamp()); + } + + + boolean hasRecag012 = scenario.getEvents().stream().anyMatch(e -> Objects.nonNull(e.getAnalogMail()) + && "RECAG012".equalsIgnoreCase(e.getAnalogMail().getStatusCode())); + + if (hasRecag012) { + assertNotNull(flow.getRecag012StatusTimestamp()); + } else { + assertNull(flow.getRecag012StatusTimestamp()); + } + + if (isOkRsRis) { + assertNull(flow.getRefinementDematValidationTimestamp()); + + } else if ((isM10Retry && hasRetry) || stateDoneNoRetry || isFailCompiuta || isGiacenza890) { + assertNotNull(flow.getRefinementDematValidationTimestamp()); + + } else { + assertNull(flow.getRefinementDematValidationTimestamp()); + } + + verifyOcrRequests(expectedFlow, flow, ocrStatusEnum, hasRetry, + expected.getState() == DONE || expected.getBusinessState() == BusinessState.DONE, scenarioName, scenario.getExpected().getSentToOcr()); + } + + private static void verifyOcrRequests(ValidationFlow expected, ValidationFlow actual, OcrStatusEnum ocrStatusEnum, boolean hasNextRequestIdPcretry, boolean isDone, String testCase, Integer sentToOcr) { + boolean isFailCompiutaGiacenzaAr = testCase.equalsIgnoreCase("FAIL_COMPIUTA_GIACENZA_AR") || testCase.equalsIgnoreCase("FAIL_COMPIUTA_GIACENZA_AR_2"); + boolean isOkGiacenzaEmptyRegisteredLetterCode890 = testCase.equalsIgnoreCase("OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_KO_890"); + boolean isOcrPending = testCase.equalsIgnoreCase("OK_AR_OCR_PENDING") || testCase.equalsIgnoreCase("OK_890_OCR_PENDING"); + + if (ocrStatusEnum == OcrStatusEnum.DISABLED || sentToOcr == 0) { + assertTrue(actual.getOcrRequests().isEmpty()); + return; + } + + if (expected != null && CollectionUtils.isEmpty(expected.getOcrRequests())) { + assertTrue(actual.getOcrRequests().isEmpty()); + return; + } + + boolean isM10RetryInitialTracking = testCase.startsWith("OK_RETRY_M10_") && hasNextRequestIdPcretry; + if ((!isM10RetryInitialTracking && hasNextRequestIdPcretry) || (!isDone && !isFailCompiutaGiacenzaAr && !isOkGiacenzaEmptyRegisteredLetterCode890 && !isOcrPending)) { + assertTrue(actual.getOcrRequests().isEmpty()); + return; + } + + if (testCase.contains("ZIP")) { + assertTrue(actual.getOcrRequests().isEmpty()); + return; + } + assertFalse(actual.getOcrRequests().isEmpty()); + assertEquals(expected.getOcrRequests().size(), actual.getOcrRequests().size()); + + expected.getOcrRequests().forEach(exp -> { + OcrRequest act = actual.getOcrRequests().stream() + .filter(o -> o.getFinalEventId().equalsIgnoreCase(exp.getFinalEventId()) + && o.getDocumentType().equalsIgnoreCase(exp.getDocumentType()) + && o.getAttachmentEventId().equalsIgnoreCase(exp.getAttachmentEventId())) + .findFirst() + .orElseThrow(); + + assertNotNull(act.getRequestTimestamp()); + assertNotNull(act.getResponseTimestamp()); + assertNotNull(act.getResponseStatus()); + Assertions.assertEquals(exp.getResponseStatus(), act.getResponseStatus()); + }); + } + + private static void verifyPaperStatus(String testCase, PaperStatus exp, PaperStatus act, List events, PaperTrackings expectedTracking, List expectedErrors) { + + boolean isDone = BusinessState.DONE.equals(expectedTracking.getBusinessState()); + boolean isFailCompiutaGiacenzaAr = "FAIL_COMPIUTA_GIACENZA_AR".equalsIgnoreCase(testCase) || "FAIL_COMPIUTA_GIACENZA_AR_2".equalsIgnoreCase(testCase); + boolean isOkTimestampError890 = "OK_TIMESTAMPERROR_890".equalsIgnoreCase(testCase); + boolean isOcrPending = "OK_AR_OCR_PENDING".equalsIgnoreCase(testCase) || "OK_890_OCR_PENDING".equalsIgnoreCase(testCase); + + boolean isProduct890 = "890".equalsIgnoreCase(expectedTracking.getProductType()); + boolean isStrictFinalValidation890False = + Objects.nonNull(expectedTracking.getValidationConfig().getStrictFinalValidationStock890()) && + !expectedTracking.getValidationConfig().getStrictFinalValidationStock890(); + + boolean hasDateError = + !CollectionUtils.isEmpty(expectedErrors) && + expectedErrors.stream() + .anyMatch(error -> ErrorCategory.DATE_ERROR.equals(error.getErrorCategory())); + + boolean hasP000Event = + events.stream() + .anyMatch(e -> "P000".equalsIgnoreCase(e.getStatusCode())); + + assertAll("PaperStatus", + () -> assertEquals(exp.getRegisteredLetterCode(), act.getRegisteredLetterCode()), + () -> assertEquals(exp.getDeliveryFailureCause(), act.getDeliveryFailureCause()), + () -> assertEquals(exp.getAnonymizedDiscoveredAddress(), act.getAnonymizedDiscoveredAddress()), + () -> assertEquals(exp.getFinalStatusCode(), act.getFinalStatusCode()), + () -> assertEquals(exp.getFinalDematFound(), act.getFinalDematFound()), + () -> assertEquals(exp.getPredictedRefinementType(), act.getPredictedRefinementType()), + + // validatedSequenceTimestamp + () -> { + if (!isDone && !isFailCompiutaGiacenzaAr && !isOcrPending) { + assertNull(act.getValidatedSequenceTimestamp()); + } else if (isOkTimestampError890) { + assertNotNull(act.getValidatedSequenceTimestamp()); + } else if (isProduct890 + && isStrictFinalValidation890False + && hasDateError) { + assertNull(act.getValidatedSequenceTimestamp()); + } else { + assertNotNull(act.getValidatedSequenceTimestamp()); + } + }, + + // paperDeliveryTimestamp + () -> { + if (hasP000Event) { + assertNotNull(act.getPaperDeliveryTimestamp()); + } else { + assertNull(act.getPaperDeliveryTimestamp()); + } + }, + + // validatedEvents + () -> assertEquals( + Optional.ofNullable(exp.getValidatedEvents()) + .map(HashSet::new) + .orElseGet(HashSet::new), + Optional.ofNullable(act.getValidatedEvents()) + .map(HashSet::new) + .orElseGet(HashSet::new) + ) + ); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapperTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapperTest.java new file mode 100644 index 000000000..71e872506 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackerDryRunOutputsMapperTest.java @@ -0,0 +1,59 @@ +package it.pagopa.pn.papertracker.mapper; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutput; +import org.mapstruct.factory.Mappers; +import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.time.Instant; +import java.util.List; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerDryRunOutputsMapperTest { + + @Spy + private PaperTrackerMapStructMapper mapper = Mappers.getMapper(PaperTrackerMapStructMapper.class); + + @Test + void shouldSetAndGetAllFieldsCorrectly() { + PaperTrackerDryRunOutputs entity = new PaperTrackerDryRunOutputs(); + entity.setCreated(Instant.now()); + entity.setRegisteredLetterCode("RL123"); + entity.setStatusCode("RECRN001A"); + entity.setStatusDetail("Detail"); + entity.setStatusDescription("Description"); + entity.setStatusDateTime("2024-06-01T12:00:00Z"); + entity.setDeliveryFailureCause("M01"); + Attachment attachment = new Attachment(); + attachment.setId("A1"); + attachment.setDocumentType("Plico"); + attachment.setDate(Instant.now()); + attachment.setUri("url"); + attachment.setSha256("sha256"); + entity.setAttachments(List.of(attachment)); + entity.setAnonymizedDiscoveredAddressId("ADDR1"); + entity.setClientRequestTimestamp("2024-06-01T12:01:00Z"); + PaperTrackerOutput output = mapper.toDtoPaperTrackerOutput(entity); + + Assertions.assertEquals("RL123", output.getRegisteredLetterCode()); + Assertions.assertNotNull(output.getCreated()); + Assertions.assertEquals("RECRN001A", output.getStatusCode()); + Assertions.assertEquals("Detail", output.getStatusDetail()); + Assertions.assertEquals("Description", output.getStatusDescription()); + Assertions.assertEquals("2024-06-01T12:00:00Z", output.getStatusDateTime()); + Assertions.assertEquals("M01", output.getDeliveryFailureCause()); + Assertions.assertNotNull(output.getAttachments()); + Assertions.assertEquals(1, output.getAttachments().size()); + Assertions.assertEquals("A1", output.getAttachments().getFirst().getId()); + Assertions.assertEquals("Plico", output.getAttachments().getFirst().getDocumentType()); + Assertions.assertEquals("url", output.getAttachments().getFirst().getUri()); + Assertions.assertNotNull(output.getAttachments().getFirst().getDate()); + Assertions.assertEquals("ADDR1", output.getAnonymizedDiscoveredAddressId()); + Assertions.assertNotNull(output.getClientRequestTimestamp()); + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapperTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapperTest.java new file mode 100644 index 000000000..4944ee0d8 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/PaperTrackingsMapperTest.java @@ -0,0 +1,547 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.config.TrackerConfigUtils; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.Tracking; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mapstruct.factory.Mappers; +import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.time.Instant; +import java.util.List; +import java.util.Objects; + +import static org.junit.jupiter.api.Assertions.assertThrows; + +@ExtendWith(MockitoExtension.class) +public class PaperTrackingsMapperTest { + + private final String xOriginClientId = "clientId"; + + @Spy + private PaperTrackerMapStructMapper mapper = Mappers.getMapper(PaperTrackerMapStructMapper.class); + + @Test + void toPaperTrackingsValidRequest() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("driver456"); + request.setProductType("RS"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request,trackerConfigUtils, pnPaperTrackerConfigs, Instant.now(), xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("driver456", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.RS.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.DRY, paperTrackings.getProcessingMode()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsInvalidProductType() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("driver456"); + request.setProductType("INVALID_TYPE"); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(new PnPaperTrackerConfigs()); + + //ACT & ASSERT + assertThrows(IllegalArgumentException.class, () -> PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, new PnPaperTrackerConfigs(), Instant.now(), xOriginClientId)); + } + + @Test + void toPaperTrackingsOCRfiltersBothDisabled() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setOcrFilterTemporal("DISABLED"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("disabled")); //controllo sul minuscolo + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, Instant.now(), xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.RUN, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledAndActive() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 14,16-18 * * MON,FRI"); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T15:00:00.333Z"); //venerdì 27 febbraio 2026 alle 16:00 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.RUN, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledTemporalActive() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 14,16-18 * * MON,FRI"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("Sailpost")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T15:00:00.333Z"); //venerdì 27 febbraio 2026 alle 16:00 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.DRY, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledDriverActive() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 14,16-18 * * MON,TUE"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T15:00:00.333Z"); //venerdì 27 febbraio 2026 alle 16:00 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.DRY, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledTemporalDisabledDriverActive() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("DISABLED"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, Instant.now(), xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.RUN, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledDriverDisabledTemporalActive() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:RUN;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 16-20 * * FRI"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("DISABLED")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T19:15:08.333Z"); //venerdì 27 febbraio 2026 alle 20:15 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.RUN, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledDRYmode() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;AR:DRY;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 16-20 * * FRI"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T19:15:08.333Z"); //venerdì 27 febbraio 2026 alle 20:15 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.DRY, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void toPaperTrackingsOCRfiltersBothEnabledDisabledMode() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("POSTE"); + request.setProductType("AR"); + + PnPaperTrackerConfigs pnPaperTrackerConfigs = new PnPaperTrackerConfigs(); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidationStock890(List.of("1970-01-01;ARCAD")); + pnPaperTrackerConfigs.setRequiredAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsRefinementStock890(List.of("1970-01-01;23L")); + pnPaperTrackerConfigs.setSendOcrAttachmentsFinalValidation(List.of("1970-01-01;Plico;AR;23L")); + pnPaperTrackerConfigs.setStrictFinalValidationStock890(List.of("1970-01-01;true")); + pnPaperTrackerConfigs.setStrictDeliveryFailureCause(List.of("1970-01-01;false")); + pnPaperTrackerConfigs.setEnableOcrValidationFor(List.of("1970-01-01;RIR:RUN;890:RUN")); + pnPaperTrackerConfigs.setProductsProcessingModes(List.of("1970-01-01;AR:RUN;RS:DRY")); + pnPaperTrackerConfigs.setOcrFilterTemporal("* * 16-20 * * FRI"); + pnPaperTrackerConfigs.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + Instant dateTime = Instant.parse("2026-02-27T19:15:08.333Z"); //venerdì 27 febbraio 2026 alle 20:15 ora italiana (UTC+1) + + //ACT + PaperTrackings paperTrackings = PaperTrackingsMapper.toPaperTrackings(request, trackerConfigUtils, pnPaperTrackerConfigs, dateTime, xOriginClientId); + + //ASSERT + Assertions.assertEquals("request123.PCRETRY_0", paperTrackings.getTrackingId()); + Assertions.assertEquals("request123", paperTrackings.getAttemptId()); + Assertions.assertEquals("PCRETRY_0", paperTrackings.getPcRetry()); + Assertions.assertEquals("POSTE", paperTrackings.getUnifiedDeliveryDriver()); + Assertions.assertEquals(ProductType.AR.getValue(), paperTrackings.getProductType()); + Assertions.assertEquals(ProcessingMode.RUN, paperTrackings.getProcessingMode()); + Assertions.assertEquals(OcrStatusEnum.DISABLED, paperTrackings.getValidationConfig().getOcrEnabled()); + Assertions.assertEquals(xOriginClientId, paperTrackings.getAnalogRequestClientId()); + } + + @Test + void entityToOutputTest(){ + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("tracking123"); + paperTrackings.setAttemptId("attempt123"); + paperTrackings.setPcRetry("PCRETRY_1"); + paperTrackings.setProductType(ProductType._890.getValue()); + paperTrackings.setUnifiedDeliveryDriver("driver789"); + paperTrackings.setProcessingMode(ProcessingMode.DRY); + + Attachment attachment = new Attachment(); + attachment.setUri("uri"); + attachment.setId("id"); + attachment.setSha256("sha256"); + attachment.setDate(Instant.now()); + attachment.setDocumentType("ARCAD"); + attachment.setSourceType("SCANNED"); + attachment.setOriginType("ORIGINAL"); + + Event event = new Event(); + event.setId("id"); + event.setIun("iun"); + event.setRequestTimestamp(Instant.now()); + event.setStatusCode("RECAG001A"); + event.setStatusDescription("description"); + event.setStatusTimestamp(Instant.now()); + event.setProductType(ProductType._890.getValue()); + event.setDeliveryFailureCause("M06"); + event.setAnonymizedDiscoveredAddressId("ADDR"); + event.setAttachments(List.of(attachment)); + event.setRegisteredLetterCode("regLetterCode123"); + event.setDryRun(true); + event.setCreatedAt(Instant.now()); + + paperTrackings.setEvents(List.of(event)); + + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setRegisteredLetterCode("regLetterCode123"); + paperStatus.setDeliveryFailureCause("M01"); + paperStatus.setAnonymizedDiscoveredAddress("ADDR"); + paperStatus.setFinalStatusCode("RECAG003C"); + paperStatus.setValidatedSequenceTimestamp(Instant.now()); + paperStatus.setPaperDeliveryTimestamp(Instant.now()); + + paperStatus.setValidatedEvents(List.of("event1","event2")); + paperStatus.setFinalDematFound(true); + paperTrackings.setPaperStatus(paperStatus); + + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + validationFlow.setFinalEventDematValidationTimestamp(Instant.now()); + validationFlow.setRefinementDematValidationTimestamp(Instant.now()); + validationFlow.setFinalEventBuilderTimestamp(Instant.now()); + validationFlow.setRecag012StatusTimestamp(Instant.now()); + OcrRequest ocrRequest = new OcrRequest(); + ocrRequest.setRequestTimestamp(Instant.now()); + ocrRequest.setResponseTimestamp(Instant.now()); + ocrRequest.setDocumentType("23L"); + ocrRequest.setFinalEventId("eventId"); + ocrRequest.setAttachmentEventId("attachmentEventId"); + ocrRequest.setResponseStatus("OK"); + ocrRequest.setUri("uri"); + validationFlow.setOcrRequests(List.of(ocrRequest)); + paperTrackings.setValidationFlow(validationFlow); + + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(List.of("ARCAD")); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of("23L","ARCAD")); + validationConfig.setStrictFinalValidationStock890(true); + validationConfig.setStrictDeliveryFailureCause(true); + validationConfig.setSendOcrAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setOcrFilterTemporal("* * 9-18 * * MON"); + validationConfig.setOcrFilterUnifiedDeliveryDriver(List.of("POSTE")); + paperTrackings.setValidationConfig(validationConfig); + + paperTrackings.setNextRequestIdPcretry("nextRequestId123"); + paperTrackings.setState(PaperTrackingsState.DONE); + paperTrackings.setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + paperTrackings.setCreatedAt(Instant.now()); + paperTrackings.setUpdatedAt(Instant.now()); + + Tracking tracking = mapper.toTracking(paperTrackings); + + Assertions.assertEquals(paperTrackings.getTrackingId(), tracking.getTrackingId()); + Assertions.assertEquals(paperTrackings.getAttemptId(), tracking.getAttemptId()); + Assertions.assertEquals(paperTrackings.getPcRetry(), tracking.getPcRetry()); + Assertions.assertEquals(paperTrackings.getProductType(), tracking.getProductType()); + Assertions.assertEquals(paperTrackings.getUnifiedDeliveryDriver(), tracking.getUnifiedDeliveryDriver()); + Assertions.assertEquals(paperTrackings.getEvents().size(), tracking.getEvents().size()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getId(), tracking.getEvents().getFirst().getId()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getStatusCode(), tracking.getEvents().getFirst().getStatusCode()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getStatusTimestamp(), tracking.getEvents().getFirst().getStatusTimestamp()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getStatusDescription(), tracking.getEvents().getFirst().getStatusDescription()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getIun(), tracking.getEvents().getFirst().getIun()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getRegisteredLetterCode(), tracking.getEvents().getFirst().getRegisteredLetterCode()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getRequestTimestamp(), tracking.getEvents().getFirst().getRequestTimestamp()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getProductType(), Objects.requireNonNull(tracking.getEvents().getFirst().getProductType())); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getDeliveryFailureCause(), tracking.getEvents().getFirst().getDeliveryFailureCause()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getAnonymizedDiscoveredAddressId(), tracking.getEvents().getFirst().getAnonymizedDiscoveredAddressId()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getDryRun(), tracking.getEvents().getFirst().getDryRun()); + Assertions.assertNotNull(tracking.getEvents().getFirst().getCreatedAt()); + Assertions.assertEquals(paperTrackings.getEvents().getFirst().getAttachments().size(), Objects.requireNonNull(tracking.getEvents().getFirst().getAttachments()).size()); + it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.Attachment trackingAttachment = tracking.getEvents().getFirst().getAttachments().getFirst(); + Attachment entityAttachment = paperTrackings.getEvents().getFirst().getAttachments().getFirst(); + Assertions.assertEquals(entityAttachment.getId(), trackingAttachment.getId()); + Assertions.assertEquals(entityAttachment.getUri(), trackingAttachment.getUri()); + Assertions.assertEquals(entityAttachment.getSha256(), trackingAttachment.getSha256()); + Assertions.assertEquals(entityAttachment.getDate(), trackingAttachment.getDate()); + Assertions.assertEquals(entityAttachment.getDocumentType(), trackingAttachment.getDocumentType()); + Assertions.assertEquals(entityAttachment.getSourceType(), trackingAttachment.getSourceType()); + Assertions.assertEquals(entityAttachment.getOriginType(), trackingAttachment.getOriginType()); + + + Assertions.assertNotNull(tracking.getPaperStatus()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getRegisteredLetterCode(), tracking.getPaperStatus().getRegisteredLetterCode()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getDeliveryFailureCause(), tracking.getPaperStatus().getDeliveryFailureCause()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getAnonymizedDiscoveredAddress(), tracking.getPaperStatus().getAnonymizedDiscoveredAddress()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getFinalStatusCode(), tracking.getPaperStatus().getFinalStatusCode()); + Assertions.assertNotNull(tracking.getPaperStatus().getValidatedSequenceTimestamp()); + Assertions.assertNotNull(tracking.getPaperStatus().getPaperDeliveryTimestamp()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getRegisteredLetterCode(), tracking.getPaperStatus().getRegisteredLetterCode()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getRegisteredLetterCode(), tracking.getPaperStatus().getRegisteredLetterCode()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getRegisteredLetterCode(), tracking.getPaperStatus().getRegisteredLetterCode()); + Assertions.assertNotNull(tracking.getPaperStatus().getValidatedEvents()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getValidatedEvents().size(), tracking.getPaperStatus().getValidatedEvents().size()); + Assertions.assertEquals(paperTrackings.getPaperStatus().getFinalDematFound(), tracking.getPaperStatus().getFinalDematFound()); + + + Assertions.assertNotNull(tracking.getValidationFlow()); + Assertions.assertNotNull(tracking.getValidationFlow().getSequencesValidationTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getFinalEventDematValidationTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getRefinementDematValidationTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getFinalEventBuilderTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getRecag012StatusTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getOcrRequests()); + Assertions.assertEquals(paperTrackings.getValidationFlow().getOcrRequests().getFirst().getDocumentType(), tracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + Assertions.assertEquals(paperTrackings.getValidationFlow().getOcrRequests().getFirst().getFinalEventId(), tracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + Assertions.assertEquals(paperTrackings.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId(), tracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + Assertions.assertEquals(paperTrackings.getValidationFlow().getOcrRequests().getFirst().getResponseStatus(), tracking.getValidationFlow().getOcrRequests().getFirst().getResponseStatus()); + Assertions.assertEquals(paperTrackings.getValidationFlow().getOcrRequests().getFirst().getUri(), tracking.getValidationFlow().getOcrRequests().getFirst().getUri()); + Assertions.assertNotNull(tracking.getValidationFlow().getOcrRequests().getFirst().getResponseTimestamp()); + Assertions.assertNotNull(tracking.getValidationFlow().getOcrRequests().getFirst().getRequestTimestamp()); + + Assertions.assertNotNull(tracking.getValidationConfig()); + Assertions.assertEquals(paperTrackings.getValidationConfig().getOcrEnabled().name(), tracking.getValidationConfig().getOcrEnabled().name()); + Assertions.assertEquals(validationConfig.getSendOcrAttachmentsFinalValidation(), tracking.getValidationConfig().getSendOcrAttachmentsFinalValidation()); + Assertions.assertEquals(validationConfig.getRequiredAttachmentsRefinementStock890(), tracking.getValidationConfig().getRequiredAttachmentsRefinementStock890()); + Assertions.assertEquals(validationConfig.getSendOcrAttachmentsFinalValidationStock890(), tracking.getValidationConfig().getSendOcrAttachmentsFinalValidationStock890()); + Assertions.assertEquals(validationConfig.getStrictFinalValidationStock890(), tracking.getValidationConfig().getStrictFinalValidationStock890()); + Assertions.assertEquals(validationConfig.getStrictDeliveryFailureCause(), tracking.getValidationConfig().getStrictDeliveryFailureCause()); + Assertions.assertEquals(validationConfig.getSendOcrAttachmentsRefinementStock890(), tracking.getValidationConfig().getSendOcrAttachmentsRefinementStock890()); + Assertions.assertEquals(validationConfig.getOcrFilterTemporal(), tracking.getValidationConfig().getOcrFilterTemporal()); + Assertions.assertEquals(validationConfig.getOcrFilterUnifiedDeliveryDriver(), tracking.getValidationConfig().getOcrFilterUnifiedDeliveryDriver()); + + Assertions.assertEquals(paperTrackings.getNextRequestIdPcretry(), tracking.getNextRequestIdPcretry()); + Assertions.assertEquals(paperTrackings.getState().name(), tracking.getState().name()); + Assertions.assertEquals(paperTrackings.getBusinessState().name(), tracking.getBusinessState().name()); + Assertions.assertEquals(paperTrackings.getProcessingMode() != null ? paperTrackings.getProcessingMode().name() : null, + tracking.getProcessingMode() != null ? tracking.getProcessingMode().name() : null); + Assertions.assertNotNull(tracking.getCreatedAt()); + Assertions.assertNotNull(tracking.getUpdatedAt()); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/SendEventMapperTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/SendEventMapperTest.java new file mode 100644 index 000000000..a8b17c460 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/mapper/SendEventMapperTest.java @@ -0,0 +1,71 @@ +package it.pagopa.pn.papertracker.mapper; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.test.StepVerifier; + +import java.time.OffsetDateTime; +import java.util.List; + +@ExtendWith(MockitoExtension.class) +class SendEventMapperTest { + + @Test + void createSendEventsFromPaperProgressStatusEvent_WithAttachments_ReturnsSendEvent() { + // Arrange + AttachmentDetails attachment = new AttachmentDetails(); + attachment.setId("attch_001"); + attachment.setDocumentType("23L"); + attachment.setDate(OffsetDateTime.now()); + attachment.setUri("http://example.com/document.pdf"); + PaperProgressStatusEvent event = getPaperProgressStatusEvent("RECRN002F", List.of(attachment)); + + // Act & Assert + StepVerifier.create(SendEventMapper.createSendEventsFromPaperProgressStatusEvent(event)) + .assertNext(sendEvent -> { + Assertions.assertEquals("RECRN002F", sendEvent.getStatusDetail()); + Assertions.assertEquals(1, sendEvent.getAttachments().size()); + Assertions.assertEquals("attch_001", sendEvent.getAttachments().getFirst().getId()); + Assertions.assertEquals("23L", sendEvent.getAttachments().getFirst().getDocumentType()); + }) + .verifyComplete(); + } + + @Test + void createSendEventsFromPaperProgressStatusEvent_NoAttachmentsAndNotFinalDemat_ReturnsSendEvent() { + // Arrange + PaperProgressStatusEvent event = getPaperProgressStatusEvent("RECRN001C", null); + + // Act & Assert + StepVerifier.create(SendEventMapper.createSendEventsFromPaperProgressStatusEvent(event)) + .assertNext(sendEvent -> { + Assertions.assertEquals("RECRN001C", sendEvent.getStatusDetail()); + Assertions.assertNull(sendEvent.getAttachments()); + }) + .verifyComplete(); + } + + @Test + void createSendEventsFromPaperProgressStatusEvent_NoAttachmentsAndIsFinalDemat_ReturnsEmpty() { + // Arrange + PaperProgressStatusEvent event = getPaperProgressStatusEvent("RECRN001B", null); + + // Act & Assert + StepVerifier.create(SendEventMapper.createSendEventsFromPaperProgressStatusEvent(event)) + .expectNextCount(0) + .verifyComplete(); + } + + private PaperProgressStatusEvent getPaperProgressStatusEvent(String statusCode, List attachments) { + PaperProgressStatusEvent event = new PaperProgressStatusEvent(); + event.setRequestId("req_123"); + event.setStatusCode(statusCode); + event.setAttachments(attachments); + return event; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDaoIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDaoIT.java new file mode 100644 index 000000000..6f4f7b78f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackerDryRunOutputsDaoIT.java @@ -0,0 +1,109 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.stream.IntStream; + +public class PaperTrackerDryRunOutputsDaoIT extends BaseTest.WithLocalStack { + + @Autowired + PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + + @Test + void insertAndRetrieveError() { + //Arrange + IntStream.range(0, 3).forEach(i -> { + PaperTrackerDryRunOutputs output = new PaperTrackerDryRunOutputs(); + output.setTrackingId("requestId1"); + output.setCreated(Instant.now().minus(i, ChronoUnit.MINUTES)); + output.setClientRequestTimestamp(Instant.now().toString()); + output.setRegisteredLetterCode("registeredLetterCode"); + output.setDeliveryFailureCause("deliveryFailureCause"); + output.setAnonymizedDiscoveredAddressId("discoveredAddress"); + output.setStatusCode("RECRN001C"); + output.setStatusDetail("statusDetail"); + output.setStatusDescription("statusDescription"); + output.setStatusDateTime(Instant.now().toString()); + Attachment attachment = new Attachment(); + attachment.setId("id"); + attachment.setDocumentType("DOC"); + attachment.setDate(Instant.now()); + attachment.setUri("attachmentUrl"); + output.setAttachments(List.of(attachment)); + + paperTrackerDryRunOutputsDAO.insertOutputEvent(output).block(); + }); + + PaperTrackerDryRunOutputs output = new PaperTrackerDryRunOutputs(); + output.setTrackingId("requestId2"); + output.setCreated(Instant.now()); + output.setClientRequestTimestamp(Instant.now().toString()); + output.setRegisteredLetterCode("registeredLetterCode"); + output.setDeliveryFailureCause("deliveryFailureCause"); + output.setAnonymizedDiscoveredAddressId("discoveredAddress"); + output.setStatusCode("RECRN001C"); + output.setStatusDetail("statusDetail"); + output.setStatusDescription("statusDescription"); + output.setStatusDateTime(Instant.now().toString()); + Attachment attachment = new Attachment(); + attachment.setId("id"); + attachment.setDocumentType("DOC"); + attachment.setDate(Instant.now()); + attachment.setUri("attachmentUrl"); + output.setAttachments(List.of(attachment)); + + paperTrackerDryRunOutputsDAO.insertOutputEvent(output).block(); + + List outputs = paperTrackerDryRunOutputsDAO.retrieveOutputEvents("requestId1").collectList().block(); + + //Assert + Assertions.assertNotNull(outputs); + Assertions.assertEquals(3, outputs.size()); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getTrackingId().equals("requestId1"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getStatusCode().equals("RECRN001C"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getStatusDetail().equals("statusDetail"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getStatusDescription().equals("statusDescription"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getDeliveryFailureCause().equals("deliveryFailureCause"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAnonymizedDiscoveredAddressId().equals("discoveredAddress"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getRegisteredLetterCode().equals("registeredLetterCode"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getCreated() != null)); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getClientRequestTimestamp() != null)); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getStatusDateTime() != null)); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAttachments() != null && !e.getAttachments().isEmpty())); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAttachments().getFirst().getId().equals("id"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAttachments().getFirst().getDocumentType().equals("DOC"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAttachments().getFirst().getUri().equals("attachmentUrl"))); + Assertions.assertTrue(outputs.stream().allMatch(e -> e.getAttachments().getFirst().getDate() != null)); + + List outputs2 = paperTrackerDryRunOutputsDAO.retrieveOutputEvents("requestId2").collectList().block(); + Assertions.assertNotNull(outputs2); + Assertions.assertEquals(1, outputs2.size()); + Assertions.assertEquals("requestId2", outputs2.getFirst().getTrackingId()); + Assertions.assertNotNull(outputs2.getFirst().getCreated()); + Assertions.assertNotNull(outputs2.getFirst().getClientRequestTimestamp()); + Assertions.assertEquals("registeredLetterCode", outputs2.getFirst().getRegisteredLetterCode()); + Assertions.assertEquals("deliveryFailureCause", outputs2.getFirst().getDeliveryFailureCause()); + Assertions.assertEquals("discoveredAddress", outputs2.getFirst().getAnonymizedDiscoveredAddressId()); + Assertions.assertEquals("RECRN001C", outputs2.getFirst().getStatusCode()); + Assertions.assertEquals("statusDetail", outputs2.getFirst().getStatusDetail()); + Assertions.assertEquals("statusDescription", outputs2.getFirst().getStatusDescription()); + Assertions.assertNotNull(outputs2.getFirst().getStatusDateTime()); + Assertions.assertNotNull(outputs2.getFirst().getAttachments()); + Assertions.assertEquals(1, outputs2.getFirst().getAttachments().size()); + Assertions.assertEquals("id", outputs2.getFirst().getAttachments().getFirst().getId()); + Assertions.assertEquals("DOC", outputs2.getFirst().getAttachments().getFirst().getDocumentType()); + Assertions.assertEquals("attachmentUrl", outputs2.getFirst().getAttachments().getFirst().getUri()); + Assertions.assertNotNull(outputs2.getFirst().getAttachments().getFirst().getDate()); + + + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDaoIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDaoIT.java new file mode 100644 index 000000000..08f3dc259 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsDaoIT.java @@ -0,0 +1,242 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerConflictException; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.List; + +public class PaperTrackingsDaoIT extends BaseTest.WithLocalStack { + + @Autowired + PaperTrackingsDAO paperTrackingsDAO; + + @Test + void putIfAbsentAndRetrieveByRequestId() { + //Arrange + String requestId = "test-request-id-1"; + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(requestId); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + + paperTrackingsDAO.putIfAbsent(paperTrackings).block(); + + //Assert + paperTrackingsDAO.retrieveEntityByTrackingId(requestId) + .doOnNext(retrieved -> { + assert retrieved != null; + assert retrieved.getTrackingId().equals(requestId); + assert retrieved.getProductType().equalsIgnoreCase(ProductType.AR.getValue()); + assert "POSTE".equalsIgnoreCase(retrieved.getUnifiedDeliveryDriver()); + assert retrieved.getEvents() == null; + assert retrieved.getValidationFlow() == null; + assert retrieved.getNextRequestIdPcretry() == null; + assert retrieved.getState() == PaperTrackingsState.AWAITING_REFINEMENT; + }) + .block(); + + StepVerifier.create(paperTrackingsDAO.putIfAbsent(paperTrackings)) + .expectError(PnPaperTrackerConflictException.class) + .verify(); + } + + @Test + void retrieveByAttemptId() { + //Arrange + String attemptId = "attemptId"; + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(attemptId + ".PCRETRY_1"); + paperTrackings.setAttemptId(attemptId); + paperTrackings.setPcRetry("PCRETRY_1"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setState(PaperTrackingsState.KO); + + paperTrackingsDAO.putIfAbsent(paperTrackings).block(); + + PaperTrackings paperTrackings2 = new PaperTrackings(); + paperTrackings2.setTrackingId(attemptId + ".PCRETRY_0"); + paperTrackings2.setAttemptId(attemptId); + paperTrackings2.setPcRetry("PCRETRY_0"); + paperTrackings2.setProductType(ProductType.AR.getValue()); + paperTrackings2.setUnifiedDeliveryDriver("POSTE"); + paperTrackings2.setState(PaperTrackingsState.AWAITING_REFINEMENT); + + paperTrackingsDAO.putIfAbsent(paperTrackings2).block(); + + PaperTrackings paperTrackings3 = new PaperTrackings(); + paperTrackings3.setTrackingId(attemptId + ".PCRETRY_2"); + paperTrackings3.setAttemptId(attemptId); + paperTrackings3.setPcRetry("PCRETRY_2"); + paperTrackings3.setProductType(ProductType.AR.getValue()); + paperTrackings3.setUnifiedDeliveryDriver("POSTE"); + paperTrackings3.setState(PaperTrackingsState.DONE); + + paperTrackingsDAO.putIfAbsent(paperTrackings3).block(); + + List response = paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, null) + .collectList() + .block(); + + // Assert + Assertions.assertNotNull(response); + Assertions.assertEquals(3, response.size()); + Assertions.assertTrue(response.stream().allMatch(track -> track.getAttemptId().equalsIgnoreCase(attemptId) + && track.getProductType().equals(ProductType.AR.getValue()) && track.getUnifiedDeliveryDriver().equalsIgnoreCase("POSTE"))); + + Assertions.assertEquals("PCRETRY_0", response.getFirst().getPcRetry()); + Assertions.assertEquals("PCRETRY_1", response.get(1).getPcRetry()); + Assertions.assertEquals("PCRETRY_2", response.getLast().getPcRetry()); + Assertions.assertEquals(attemptId + ".PCRETRY_0", response.getFirst().getTrackingId()); + Assertions.assertEquals(attemptId + ".PCRETRY_1", response.get(1).getTrackingId()); + Assertions.assertEquals(attemptId + ".PCRETRY_2", response.getLast().getTrackingId()); + Assertions.assertEquals(PaperTrackingsState.AWAITING_REFINEMENT, response.getFirst().getState()); + Assertions.assertEquals(PaperTrackingsState.KO, response.get(1).getState()); + Assertions.assertEquals(PaperTrackingsState.DONE, response.getLast().getState()); + } + + @Test + void updateItemRequestIdNotExists() { + //Arrange + String requestId = "test-request-id"; + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(requestId); + + paperTrackingsDAO.putIfAbsent(paperTrackings).block(); + + PaperTrackings paperTrackingsToUpdate = new PaperTrackings(); + + //Assert + StepVerifier.create(paperTrackingsDAO.updateItem("non-existing-request-id", paperTrackingsToUpdate)) + .expectError(PnPaperTrackerNotFoundException.class) + .verify(); + } + + @Test + void addEvents() { + //Arrange + String requestId = "test-request-id-3"; + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(requestId); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setNotificationReworkId("reworkId"); + + paperTrackingsDAO.putIfAbsent(paperTrackings).block(); + + PaperTrackings paperTrackingsToUpdate = new PaperTrackings(); + Event event = new Event(); + event.setId("id1"); + event.setRequestTimestamp(Instant.now()); + event.setStatusCode("IN_PROGRESS"); + event.setStatusTimestamp(Instant.now()); + event.setProductType(ProductType.AR.getValue()); + event.setDryRun(true); + event.setNotificationReworkId("reworkId"); + + Attachment attachment = new Attachment(); + attachment.setId("attachment-id-1"); + attachment.setDocumentType("DOCUMENT_TYPE"); + attachment.setUri("http://example.com/document.pdf"); + attachment.setDate(Instant.now()); + + Attachment attachment2 = new Attachment(); + attachment2.setId("attachment-id-1"); + attachment2.setDocumentType("DOCUMENT_TYPE"); + attachment2.setUri("http://example.com/document.pdf"); + + event.setAttachments(List.of(attachment, attachment2)); + paperTrackingsToUpdate.setEvents(List.of(event)); + + paperTrackingsDAO.updateItem(requestId, paperTrackingsToUpdate).block(); + + //Assert + PaperTrackings fisrtResponse = paperTrackingsDAO.retrieveEntityByTrackingId(requestId).block(); + Assertions.assertNotNull(fisrtResponse); + Assertions.assertNotNull(fisrtResponse.getEvents()); + Assertions.assertNotNull(fisrtResponse.getUpdatedAt()); + Assertions.assertFalse(fisrtResponse.getEvents().isEmpty()); + Assertions.assertEquals(1, fisrtResponse.getEvents().size()); + Assertions.assertEquals(2, fisrtResponse.getEvents().getFirst().getAttachments().size()); + Assertions.assertEquals("reworkId", fisrtResponse.getEvents().getFirst().getNotificationReworkId()); + Assertions.assertNull(fisrtResponse.getEvents().getFirst().getDeliveryFailureCause()); + + PaperTrackings paperTrackingsToUpdate1 = new PaperTrackings(); + Event event2 = new Event(); + event2.setRequestTimestamp(Instant.now()); + event2.setStatusCode("IN_PROGRESS"); + event2.setStatusTimestamp(Instant.now()); + event2.setDryRun(false); + + Attachment attachment3 = new Attachment(); + attachment.setId("attachment-id-1"); + attachment.setDocumentType("DOCUMENT_TYPE"); + attachment.setUri("http://example.com/document.pdf"); + attachment.setDate(Instant.now()); + + event2.setAttachments(List.of(attachment3)); + paperTrackingsToUpdate1.setEvents(List.of(event2)); + + paperTrackingsDAO.updateItem(requestId, paperTrackingsToUpdate1).block(); + + PaperTrackings secondeResponse = paperTrackingsDAO.retrieveEntityByTrackingId(requestId).block(); + Assertions.assertNotNull(secondeResponse); + Assertions.assertNotNull(secondeResponse.getEvents()); + Assertions.assertNotNull(secondeResponse.getUpdatedAt()); + Assertions.assertNotEquals(fisrtResponse.getUpdatedAt(), secondeResponse.getUpdatedAt()); + Assertions.assertFalse(secondeResponse.getEvents().isEmpty()); + Assertions.assertEquals(2, secondeResponse.getEvents().size()); + Assertions.assertEquals(2, secondeResponse.getEvents().getFirst().getAttachments().size()); + Assertions.assertEquals(1, secondeResponse.getEvents().getLast().getAttachments().size()); + } + + @Test + void addOcrRequests() { + //Arrange + String requestId = "test-request-id-4"; + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId(requestId); + paperTrackings.setProductType(ProductType.AR.getValue()); + ValidationFlow validationFlow = new ValidationFlow(); + OcrRequest req1 = new OcrRequest(); + req1.setDocumentType("Plico"); + req1.setFinalEventId("eventId1"); + req1.setRequestTimestamp(Instant.now()); + OcrRequest req2 = new OcrRequest(); + req2.setDocumentType("AR"); + req2.setFinalEventId("eventId2"); + req2.setRequestTimestamp(Instant.now()); + validationFlow.setOcrRequests(List.of(req1, req2)); + paperTrackings.setValidationFlow(validationFlow); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + + paperTrackingsDAO.putIfAbsent(paperTrackings).block(); + + paperTrackingsDAO.updateOcrRequests(0, requestId, Data.ValidationStatus.OK).block(); + + //Assert + PaperTrackings fisrtResponse = paperTrackingsDAO.retrieveEntityByTrackingId(requestId).block(); + Assertions.assertNotNull(fisrtResponse); + Assertions.assertNotNull(fisrtResponse.getUpdatedAt()); + Assertions.assertNotNull(fisrtResponse.getValidationFlow().getOcrRequests().getFirst().getResponseTimestamp()); + + paperTrackingsDAO.updateOcrRequests(1, requestId, Data.ValidationStatus.OK).block(); + + PaperTrackings secondeResponse = paperTrackingsDAO.retrieveEntityByTrackingId(requestId).block(); + Assertions.assertNotNull(secondeResponse); + Assertions.assertNotNull(secondeResponse.getUpdatedAt()); + Assertions.assertNotEquals(fisrtResponse.getUpdatedAt(), secondeResponse.getUpdatedAt()); + Assertions.assertNotNull(secondeResponse.getValidationFlow().getOcrRequests().getLast().getResponseTimestamp()); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDaoIT.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDaoIT.java new file mode 100644 index 000000000..dfc71e33f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/dao/dynamo/PaperTrackingsErrorsDaoIT.java @@ -0,0 +1,83 @@ +package it.pagopa.pn.papertracker.middleware.dao.dynamo; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Objects; +import java.util.stream.IntStream; + +public class PaperTrackingsErrorsDaoIT extends BaseTest.WithLocalStack { + + @Autowired + PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + + @Test + void insertAndRetrieveError() { + //Arrange + IntStream.range(0, 3).forEach(i -> { + PaperTrackingsErrors error = new PaperTrackingsErrors(); + error.setTrackingId("requestId1"); + error.setCreated(Instant.now().minus(i, ChronoUnit.MINUTES)); + error.setErrorCategory(ErrorCategory.OCR_VALIDATION); + error.setFlowThrow(FlowThrow.DEMAT_VALIDATION); + error.setProductType(ProductType.AR.getValue()); + error.setType(ErrorType.WARNING); + ErrorDetails errorDetails = new ErrorDetails(); + errorDetails.setCause(ErrorCause.OCR_KO); + errorDetails.setMessage("error"); + error.setDetails(errorDetails); + error.setEventThrow("RECRN001C"); + + paperTrackingsErrorsDAO.insertError(error).block(); + }); + + PaperTrackingsErrors error = new PaperTrackingsErrors(); + error.setTrackingId("requestId2"); + error.setCreated(Instant.now()); + error.setErrorCategory(ErrorCategory.OCR_VALIDATION); + error.setFlowThrow(FlowThrow.DEMAT_VALIDATION); + error.setProductType(ProductType.AR.getValue()); + error.setType(ErrorType.ERROR); + ErrorDetails errorDetails = new ErrorDetails(); + errorDetails.setCause(ErrorCause.GIACENZA_DATE_ERROR); + errorDetails.setMessage("error"); + error.setDetails(errorDetails); + error.setEventThrow("RECRN001C"); + + paperTrackingsErrorsDAO.insertError(error).block(); + + List errors = paperTrackingsErrorsDAO.retrieveErrors("requestId1").collectList().block(); + + //Assert + Assertions.assertNotNull(errors); + Assertions.assertEquals(3, errors.size()); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getTrackingId().equals("requestId1"))); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getErrorCategory() == ErrorCategory.OCR_VALIDATION)); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getFlowThrow() == FlowThrow.DEMAT_VALIDATION)); + Assertions.assertTrue(errors.stream().allMatch(e -> Objects.equals(e.getProductType(), ProductType.AR.getValue()))); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getDetails().getCause() == ErrorCause.OCR_KO)); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getDetails().getMessage().equals("error"))); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getEventThrow().equals("RECRN001C"))); + Assertions.assertTrue(errors.stream().allMatch(e -> e.getType() == ErrorType.WARNING)); + + List errors2 = paperTrackingsErrorsDAO.retrieveErrors("requestId2").collectList().block(); + Assertions.assertNotNull(errors2); + Assertions.assertEquals(1, errors2.size()); + Assertions.assertEquals("requestId2", errors2.getFirst().getTrackingId()); + Assertions.assertSame(ErrorCategory.OCR_VALIDATION, errors2.getFirst().getErrorCategory()); + Assertions.assertSame(FlowThrow.DEMAT_VALIDATION, errors2.getFirst().getFlowThrow()); + Assertions.assertEquals(ProductType.AR.getValue(), errors2.getFirst().getProductType()); + Assertions.assertEquals(ErrorCause.GIACENZA_DATE_ERROR, errors2.getFirst().getDetails().getCause()); + Assertions.assertEquals("error", errors2.getFirst().getDetails().getMessage()); + Assertions.assertEquals("RECRN001C", errors2.getFirst().getEventThrow()); + Assertions.assertSame(ErrorType.ERROR, errors2.getFirst().getType()); + + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisherTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisherTest.java new file mode 100644 index 000000000..babc25cce --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/eventBridge/EventBridgePublisherTest.java @@ -0,0 +1,84 @@ +package it.pagopa.pn.papertracker.middleware.eventBridge; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.test.StepVerifier; +import software.amazon.awssdk.services.eventbridge.EventBridgeAsyncClient; +import software.amazon.awssdk.services.eventbridge.model.PutEventsRequest; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +import java.util.concurrent.CompletableFuture; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class EventBridgePublisherTest { + + @Mock + private EventBridgeAsyncClient client; + + @Mock + private ObjectMapper objectMapper; + + @Mock + private PnPaperTrackerConfigs configs; + + @InjectMocks + private EventBridgePublisher publisher; + + @Test + void publishSuccessfully() throws JsonProcessingException { + Object event = new Object(); + String eventDetail = "{\"key\":\"value\"}"; + PutEventsResponse response = PutEventsResponse.builder().build(); + + when(configs.getEventBus()).thenReturn(new PnPaperTrackerConfigs.EventBus()); + when(objectMapper.writeValueAsString(event)).thenReturn(eventDetail); + when(client.putEvents(any(PutEventsRequest.class))) + .thenReturn(CompletableFuture.completedFuture(response)); + + StepVerifier.create(publisher.publish(event)) + .expectNext(response) + .verifyComplete(); + + verify(client, times(1)).putEvents(any(PutEventsRequest.class)); + } + + @Test + void publishWithSerializationError() throws JsonProcessingException { + Object event = new Object(); + + when(objectMapper.writeValueAsString(event)).thenThrow(new JsonProcessingException("Serialization error") { + }); + + StepVerifier.create(publisher.publish(event)) + .expectError(JsonProcessingException.class) + .verify(); + + verify(client, never()).putEvents(any(PutEventsRequest.class)); + } + + @Test + void publishWithClientError() throws JsonProcessingException { + Object event = new Object(); + String eventDetail = "{\"key\":\"value\"}"; + + when(configs.getEventBus()).thenReturn(new PnPaperTrackerConfigs.EventBus()); + when(objectMapper.writeValueAsString(event)).thenReturn(eventDetail); + when(client.putEvents(any(PutEventsRequest.class))) + .thenReturn(CompletableFuture.failedFuture(new RuntimeException("Client error"))); + + StepVerifier.create(publisher.publish(event)) + .expectError(RuntimeException.class) + .verify(); + + verify(client, times(1)).putEvents(any(PutEventsRequest.class)); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundServiceTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundServiceTest.java new file mode 100644 index 000000000..94c8abc2c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/PnEventInboundServiceTest.java @@ -0,0 +1,93 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelSourceEventsHandler; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.OcrEventHandler; +import it.pagopa.pn.papertracker.utils.LogUtility; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.HashMap; +import java.util.Map; + +import static org.mockito.Mockito.verify; + +@ExtendWith(MockitoExtension.class) +class PnEventInboundServiceTest { + + @Mock + private ExternalChannelSourceEventsHandler externalChannelSourceEventsHandler; + + @Mock + private ExternalChannelHandler externalChannelHandler; + + @Mock + private OcrEventHandler ocrEventHandler; + + @Mock + private LogUtility logUtility; + + private PnEventInboundService service; + + @BeforeEach + void setUp() { + service = new PnEventInboundService( + externalChannelSourceEventsHandler, + externalChannelHandler, + ocrEventHandler, + logUtility + ); + } + + @Test + void externalChannelSourceConsumerProcessesMessage() { + var payload = new SingleStatusUpdate(); + Message message = MessageBuilder.withPayload(payload).build(); + Map headers = new HashMap<>(); + Map attributes = new HashMap<>(); + software.amazon.awssdk.services.sqs.model.Message sqsMessage = software.amazon.awssdk.services.sqs.model.Message.builder() + .messageId("msg-123") + .body("payload-ignored-in-test") + .messageAttributes(attributes) + .build(); + + service.externalChannelSourceConsumer(message, headers, sqsMessage); + + verify(externalChannelSourceEventsHandler).handleExternalChannelMessage(payload, attributes); + } + + @Test + void externalChannelConsumerProcessesMessageWithAllHeaders() { + Message message = MessageBuilder.withPayload(new SingleStatusUpdate()).build(); + Map headers = Map.of( + "dryRun", true, + "reworkId", "rework123", + "id", "message123", + "SenderId", "sender123" + ); + + service.externalChannelConsumer(message, true, "rework123", "message123", "sender123", headers); + + verify(externalChannelHandler).handleExternalChannelMessage( + message.getPayload(), true, "rework123", "message123", "sender123" + ); + } + + @Test + void ocrOutputsConsumerProcessesMessage() { + Message message = MessageBuilder.withPayload(new OcrDataResultPayload.OcrDataResultPayloadBuilder().build()).build(); + Map headers = new HashMap<>(); + + service.ocrOutputsConsumer(message, headers); + + verify(ocrEventHandler).handleOcrMessage(message.getPayload()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandlerTest.java new file mode 100644 index 000000000..2b652a75c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelHandlerTest.java @@ -0,0 +1,159 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.HandlersRegistry; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.List; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class ExternalChannelHandlerTest { + + @Mock + private HandlersRegistry handleRegistry; + + @Mock + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + + @Mock + private PnPaperTrackerConfigs pnPaperTrackerConfigs; + + private ExternalChannelHandler externalChannelHandler; + + private String eventId; + + @BeforeEach + void setUp() { + externalChannelHandler = new ExternalChannelHandler( + paperTrackerExceptionHandler, + handleRegistry, + pnPaperTrackerConfigs); + eventId = "eventId"; + } + + @Test + void handleExternalChannelMessage_callsAREventHandler_PROGRESS() { + //Arrange + SingleStatusUpdate payload = getSingleStatusUpdate(RECRN002A.name()); + when(handleRegistry.handleEvent(eq(ProductType.AR),eq(EventTypeEnum.INTERMEDIATE_EVENT), any())).thenReturn(Mono.empty()); + when(pnPaperTrackerConfigs.getRedriveEnabledDomains()).thenReturn(List.of("@pagopa.it", "@external.pagopa.it")); + + //Act + externalChannelHandler.handleExternalChannelMessage(payload, getDryRunFlag(),null, eventId, "ABCDEF:nome.cognome@pagopa.it"); + + //Assert + ArgumentCaptor contextCaptor = ArgumentCaptor.forClass(HandlerContext.class); + verify(handleRegistry, times(1)).handleEvent(eq(ProductType.AR), eq(EventTypeEnum.INTERMEDIATE_EVENT), contextCaptor.capture()); + HandlerContext capturedContext = contextCaptor.getValue(); + assertTrue(capturedContext.isRedrive()); + } + + @Test + void handleExternalChannelMessage_callsAREventHandler_KO() { + //Arrange + SingleStatusUpdate payload = getSingleStatusUpdate(RECRN006.name()); + when(handleRegistry.handleEvent(eq(ProductType.AR),eq(EventTypeEnum.RETRYABLE_EVENT), any())).thenReturn(Mono.empty()); + when(pnPaperTrackerConfigs.getRedriveEnabledDomains()).thenReturn(List.of("@pagopa.it", "@external.pagopa.it")); + + //Act + externalChannelHandler.handleExternalChannelMessage(payload, getDryRunFlag(),null, eventId, "ABCDEF:nome.cognome@domain.it"); + + //Assert + ArgumentCaptor contextCaptor = ArgumentCaptor.forClass(HandlerContext.class); + verify(handleRegistry, times(1)).handleEvent(eq(ProductType.AR), eq(EventTypeEnum.RETRYABLE_EVENT), contextCaptor.capture()); + HandlerContext capturedContext = contextCaptor.getValue(); + assertFalse(capturedContext.isRedrive()); + } + + @Test + void handleExternalChannelMessage_callsAREventHandler_OK() { + //Arrange + SingleStatusUpdate payload = getSingleStatusUpdate(RECRN004C.name()); + when(handleRegistry.handleEvent(eq(ProductType.AR),eq(EventTypeEnum.FINAL_EVENT), any())).thenReturn(Mono.empty()); + + //Act + externalChannelHandler.handleExternalChannelMessage(payload, getDryRunFlag(),null, eventId, null); + + //Assert + ArgumentCaptor contextCaptor = ArgumentCaptor.forClass(HandlerContext.class); + verify(handleRegistry, times(1)).handleEvent(eq(ProductType.AR), eq(EventTypeEnum.FINAL_EVENT), contextCaptor.capture()); + HandlerContext capturedContext = contextCaptor.getValue(); + assertFalse(capturedContext.isRedrive()); + } + + @Test + void handleExternalChannelMessage_callsAREventHandler_UNRECOGNIZED() { + //Arrange + SingleStatusUpdate payload = getSingleStatusUpdate("UNRECOGNIZED_STATUS"); + when(handleRegistry.handleEvent(eq(ProductType.UNKNOWN),eq(null), any())).thenReturn(Mono.empty()); + + //Act + externalChannelHandler.handleExternalChannelMessage(payload, getDryRunFlag(),null, eventId, null); + + //Assert + verify(handleRegistry, times(1)).handleEvent(eq(ProductType.UNKNOWN),eq(null), any()); + } + + @Test + void handleExternalChannelMessage_whenNotFoundException() { + // Arrange + SingleStatusUpdate payload = getSingleStatusUpdate(RECRN001C.name()); + when(handleRegistry.handleEvent(any(), any(), any())) + .thenReturn(Mono.error(new PnPaperTrackerNotFoundException("ERROR", "Tracking not found"))); + + // Act & Assert + assertThrows(PnPaperTrackerNotFoundException.class, () -> + externalChannelHandler.handleExternalChannelMessage(payload, true, null, eventId, null) + ); + } + + @Test + void handleExternalChannelMessage_whenSuccessfulProcessingWithDryRun() { + // Arrange + SingleStatusUpdate payload = getSingleStatusUpdate(RECRN004C.name()); + when(handleRegistry.handleEvent(eq(ProductType.AR), eq(EventTypeEnum.FINAL_EVENT), any())) + .thenReturn(Mono.empty()); + + // Act + externalChannelHandler.handleExternalChannelMessage(payload, true, "reworkId", eventId, null); + + // Assert + verify(handleRegistry, times(1)) + .handleEvent(eq(ProductType.AR), eq(EventTypeEnum.FINAL_EVENT), any()); + } + + private SingleStatusUpdate getSingleStatusUpdate(String statusCode) { + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + PaperProgressStatusEvent analogMail = new PaperProgressStatusEvent(); + analogMail.setRequestId("test-request-id"); + analogMail.setStatusCode(statusCode); + singleStatusUpdate.setAnalogMail(analogMail); + return singleStatusUpdate; + } + + private boolean getDryRunFlag() { + HashMap headers = new HashMap<>(); + headers.put("dryRun", true); + return (boolean) headers.getOrDefault("dryRun", false); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandlerTest.java new file mode 100644 index 000000000..2268363bf --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/ExternalChannelSourceEventsHandlerTest.java @@ -0,0 +1,111 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.service.SourceQueueProxyService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.messaging.Message; +import org.springframework.messaging.support.MessageBuilder; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class ExternalChannelSourceEventsHandlerTest { + + @Mock + private SourceQueueProxyService sourceQueueProxyService; + + private ExternalChannelSourceEventsHandler handler; + + @BeforeEach + void setUp() { + handler = new ExternalChannelSourceEventsHandler(sourceQueueProxyService); + } + + @Test + void handleExternalChannelMessage_ok() { + // Arrange + SingleStatusUpdate message = getSingleStatusUpdate("REQ-TEST"); + Map attributes = new HashMap<>(); + + when(sourceQueueProxyService.handleExternalChannelMessage(message, attributes)) + .thenReturn(Mono.empty()); + + // Act + assertDoesNotThrow(() -> handler.handleExternalChannelMessage(message, attributes)); + + // Assert + verify(sourceQueueProxyService, times(1)) + .handleExternalChannelMessage(message, attributes); + } + + @Test + void handleExternalChannelMessage_nullMessage_throwsException() { + // Arrange + Map attributes = new HashMap<>(); + + // Act Assert + assertThrows( + IllegalArgumentException.class, + () -> handler.handleExternalChannelMessage(null, attributes) + ); + + verifyNoInteractions(sourceQueueProxyService); + } + + @Test + void handleExternalChannelMessage_nullAnalogMail_throwsException() { + // Arrange + SingleStatusUpdate message = new SingleStatusUpdate(); + message.setAnalogMail(null); + Map attributes = new HashMap<>(); + + // Act Assert + IllegalArgumentException ex = assertThrows( + IllegalArgumentException.class, + () -> handler.handleExternalChannelMessage(message, attributes) + ); + + assertEquals("Payload or analogMail cannot be null", ex.getMessage()); + verifyNoInteractions(sourceQueueProxyService); + } + + @Test + void handleExternalChannelMessage_serviceReturnsError_propagatesException() { + // Arrange + SingleStatusUpdate message = getSingleStatusUpdate("REQ-ERR"); + Map attributes = new HashMap<>(); + + RuntimeException serviceException = new RuntimeException("Boom"); + + when(sourceQueueProxyService.handleExternalChannelMessage(message, attributes)) + .thenReturn(Mono.error(serviceException)); + + // Act / Assert + RuntimeException ex = assertThrows( + RuntimeException.class, + () -> handler.handleExternalChannelMessage(message, attributes) + ); + + assertEquals("Boom", ex.getMessage()); + verify(sourceQueueProxyService).handleExternalChannelMessage(message, attributes); + } + + private SingleStatusUpdate getSingleStatusUpdate(String requestId) { + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + PaperProgressStatusEvent analogMail = new PaperProgressStatusEvent(); + analogMail.setRequestId(requestId); + singleStatusUpdate.setAnalogMail(analogMail); + return singleStatusUpdate; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandlerTest.java new file mode 100644 index 000000000..c35f5499d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/middleware/queue/consumer/internal/OcrEventHandlerTest.java @@ -0,0 +1,78 @@ +package it.pagopa.pn.papertracker.middleware.queue.consumer.internal; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.HandlersRegistry; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class OcrEventHandlerTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + + @Mock + private HandlersRegistry handlersRegistry; + + @InjectMocks + private OcrEventHandler ocrEventHandler; + + @Test + void handleOcrMessageThrowsExceptionWhenPayloadIsNull() { + assertThrows(IllegalArgumentException.class, () -> ocrEventHandler.handleOcrMessage(null)); + } + + @Test + void handleOcrMessageThrowsExceptionWhenCommandIdIsNull() { + OcrDataResultPayload payload = mock(OcrDataResultPayload.class); + when(payload.getCommandId()).thenReturn(null); + + assertThrows(IllegalArgumentException.class, () -> ocrEventHandler.handleOcrMessage(payload)); + } + + @Test + void handleOcrMessageProcessesValidPayloadSuccessfully() { + OcrDataResultPayload payload = mock(OcrDataResultPayload.class); + PaperTrackings paperTrackings = mock(PaperTrackings.class); + when(payload.getCommandId()).thenReturn("validCommandId"); + when(paperTrackings.getProductType()).thenReturn(ProductType.AR.getValue()); + when(paperTrackingsDAO.retrieveEntityByTrackingId(any())).thenReturn(Mono.just(paperTrackings)); + when(handlersRegistry.handleEvent(any(), any(), any())).thenReturn(Mono.empty()); + + ocrEventHandler.handleOcrMessage(payload); + + verify(paperTrackingsDAO).retrieveEntityByTrackingId(any()); + verify(handlersRegistry).handleEvent(any(ProductType.class), eq(EventTypeEnum.OCR_RESPONSE_EVENT), any(HandlerContext.class)); + } + + @Test + void handleOcrMessageHandlesValidationExceptionGracefully() { + OcrDataResultPayload payload = mock(OcrDataResultPayload.class); + when(payload.getCommandId()).thenReturn("validCommandId"); + when(paperTrackingsDAO.retrieveEntityByTrackingId(any())).thenReturn(Mono.error(new PnPaperTrackerValidationException("Validation error", new PaperTrackingsErrors()))); + when(paperTrackerExceptionHandler.handleInternalException(any(), any())).thenReturn(Mono.empty()); + + ocrEventHandler.handleOcrMessage(payload); + + verify(paperTrackerExceptionHandler).handleInternalException(any(PnPaperTrackerValidationException.class), any()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/NotificationReworkControllerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/NotificationReworkControllerTest.java new file mode 100644 index 000000000..1c796d207 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/NotificationReworkControllerTest.java @@ -0,0 +1,100 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerBadRequestException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceResponse; +import it.pagopa.pn.papertracker.service.NotificationReworkService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.List; + +import static org.mockito.Mockito.*; + +class NotificationReworkControllerTest { + + private static final String ERROR_CODE_PAPER_TRACKER_BAD_REQUEST = "PN_PAPER_TRACKER_BAD_REQUEST"; + private NotificationReworkService notificationReworkService; + private NotificationReworkController controller; + private ServerWebExchange exchange; + + @BeforeEach + void setUp() { + notificationReworkService = mock(NotificationReworkService.class); + controller = new NotificationReworkController(notificationReworkService); + exchange = mock(ServerWebExchange.class); + } + + @Test + void notificationRework_shouldReturnOkResponse() { + String statusCode = "RECRN005C"; + String deliveryFailureCause = "M02"; + SequenceResponse response = new SequenceResponse(); + response.setFinalStatusCode(SequenceResponse.FinalStatusCodeEnum.OK); + response.setSequence(List.of()); + when(notificationReworkService.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause, "AR")) + .thenReturn(Mono.just(response)); + + Mono> result = controller.retrieveSequenceAndFinalStatus(statusCode, "AR", deliveryFailureCause, exchange); + + StepVerifier.create(result) + .expectNextMatches(entity -> entity.getStatusCode().is2xxSuccessful() + && entity.getBody().getSequence().equals(List.of()) + && entity.getBody().getFinalStatusCode() == SequenceResponse.FinalStatusCodeEnum.OK) + .verifyComplete(); + + verify(notificationReworkService, times(1)).retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause, "AR"); + } + + @Test + void notificationRework_shouldPropagateError() { + String statusCode = "INVALID"; + String deliveryFailureCause = "M02"; + when(notificationReworkService.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause, "AR")) + .thenReturn(Mono.error(new PnPaperTrackerBadRequestException(ERROR_CODE_PAPER_TRACKER_BAD_REQUEST, String.format("statusCode %s is invalid", statusCode)))); + + Mono> result = controller.retrieveSequenceAndFinalStatus(statusCode, "AR", deliveryFailureCause, exchange); + + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerBadRequestException ) + .verify(); + + verify(notificationReworkService, times(1)).retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR"); + } + + @Test + void initReworkReturnsNoContentResponse() { + String reworkId = "rework123"; + String trackingId = "tracking123"; + + when(notificationReworkService.updatePaperTrackingsStatusForRework(trackingId, reworkId)).thenReturn(Mono.empty()); + + Mono> response = controller.initNotificationRework(reworkId, trackingId, null); + + StepVerifier.create(response) + .expectNext(ResponseEntity.status(HttpStatus.NO_CONTENT).build()) + .verifyComplete(); + verify(notificationReworkService, times(1)).updatePaperTrackingsStatusForRework(trackingId, reworkId); + } + + @Test + void initReworkHandlesError() { + String reworkId = "rework123"; + String trackingId = "tracking123"; + + when(notificationReworkService.updatePaperTrackingsStatusForRework(trackingId, reworkId)) + .thenReturn(Mono.error(new RuntimeException("Service error"))); + + Mono> response = controller.initNotificationRework(reworkId, trackingId, null); + + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Service error".equals(throwable.getMessage())) + .verify(); + verify(notificationReworkService, times(1)).updatePaperTrackingsStatusForRework(trackingId, reworkId); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorControllerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorControllerTest.java new file mode 100644 index 000000000..8f8f149d3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerErrorControllerTest.java @@ -0,0 +1,68 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.http.ResponseEntity; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerErrorControllerTest { + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + private PaperTrackerErrorController paperTrackerErrorController; + + @BeforeEach + void setUp() { + paperTrackerErrorController = new PaperTrackerErrorController(paperTrackerErrorService); + } + + @Test + void retrieveTrackingErrorsReturnsOkResponse() { + //Arrange + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + TrackingErrorsResponse responseMock = new TrackingErrorsResponse(); + + when(paperTrackerErrorService.retrieveTrackingErrors(request)).thenReturn(Mono.just(responseMock)); + + //Act + Mono> response = paperTrackerErrorController.retrieveTrackingErrors(requestMono, null); + + //Assert + StepVerifier.create(response) + .expectNext(ResponseEntity.ok(responseMock)) + .verifyComplete(); + verify(paperTrackerErrorService, times(1)).retrieveTrackingErrors(request); + } + + @Test + void retrieveTrackingErrorsHandlesError() { + //Arrange + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + + when(paperTrackerErrorService.retrieveTrackingErrors(request)).thenReturn(Mono.error(new RuntimeException("Service error"))); + + //Act + Mono> response = paperTrackerErrorController.retrieveTrackingErrors(requestMono, null); + + //Assert + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Service error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerErrorService, times(1)).retrieveTrackingErrors(request); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputControllerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputControllerTest.java new file mode 100644 index 000000000..8c197ef4c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerOutputControllerTest.java @@ -0,0 +1,67 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.service.PaperTrackerOutputService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.http.ResponseEntity; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class PaperTrackerOutputControllerTest { + + @Mock + private PaperTrackerOutputService paperTrackerOutputService; + + private PaperTrackerOutputController controller; + + @BeforeEach + void setUp() { + controller = new PaperTrackerOutputController(paperTrackerOutputService); + } + + @Test + void retrieveTrackingOutputsReturnsOkResponse() { + //Arrange + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + PaperTrackerOutputsResponse responseMock = new PaperTrackerOutputsResponse(); + + when(paperTrackerOutputService.retrieveTrackingOutputs(request)).thenReturn(Mono.just(responseMock)); + + //Act + Mono> response = controller.retrieveTrackingOutputs(requestMono, null); + + //Assert + StepVerifier.create(response) + .expectNext(ResponseEntity.ok(responseMock)) + .verifyComplete(); + verify(paperTrackerOutputService, times(1)).retrieveTrackingOutputs(request); + } + + @Test + void retrieveTrackingOutputsHandlesError() { + //Arrange + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + + when(paperTrackerOutputService.retrieveTrackingOutputs(request)).thenReturn(Mono.error(new RuntimeException("Service error"))); + + //Act + Mono> response = controller.retrieveTrackingOutputs(requestMono, null); + + //Assert + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Service error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerOutputService, times(1)).retrieveTrackingOutputs(request); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingControllerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingControllerTest.java new file mode 100644 index 000000000..66ce00f66 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/rest/PaperTrackerTrackingControllerTest.java @@ -0,0 +1,168 @@ +package it.pagopa.pn.papertracker.rest; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerConflictException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsResponse; +import it.pagopa.pn.papertracker.service.PaperTrackerTrackingService; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerTrackingControllerTest { + + private PaperTrackerTrackingController controller; + + @Mock + private PaperTrackerTrackingService paperTrackerEventService; + + @BeforeEach + void setUp() { + controller = new PaperTrackerTrackingController(paperTrackerEventService); + } + + @Test + void initTrackingReturnsOkResponse() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("test-driver-id"); + request.setProductType("test-product-type"); + Mono requestMono = Mono.just(request); + String xOriginClientId = "clientId"; + + when(paperTrackerEventService.insertPaperTrackings(request, "clientId")).thenReturn(Mono.empty()); + + //ACT + Mono> response = controller.initTracking(requestMono, xOriginClientId, null); + + //ASSERT + StepVerifier.create(response) + .expectNext(ResponseEntity.status(HttpStatus.CREATED).build()) + .verifyComplete(); + verify(paperTrackerEventService, times(1)).insertPaperTrackings(request, xOriginClientId); + } + + @Test + void initTrackingReturnsConflict() { + //ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + Mono requestMono = Mono.just(request); + String xOriginClientId = "clientId"; + + when(paperTrackerEventService.insertPaperTrackings(request, "clientId")).thenReturn(Mono.error(new PnPaperTrackerConflictException("Duplicated item", "Conflict"))); + + //ACT + Mono> response = controller.initTracking(requestMono, xOriginClientId, null); + + //ASSERT + StepVerifier.create(response) + .expectNext(ResponseEntity.noContent().build()) + .verifyComplete(); + verify(paperTrackerEventService, times(1)).insertPaperTrackings(request, xOriginClientId); + } + + @Test + void initTrackingThrowsRuntimeException() { + // ARRANGE + TrackingCreationRequest request = new TrackingCreationRequest(); + Mono requestMono = Mono.just(request); + String xOriginClientId = "clientId"; + + when(paperTrackerEventService.insertPaperTrackings(request, xOriginClientId)) + .thenReturn(Mono.error(new RuntimeException("Unexpected error"))); + + // ACT + Mono> response = controller.initTracking(requestMono, xOriginClientId, null); + + // ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Unexpected error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerEventService, times(1)).insertPaperTrackings(request, xOriginClientId); + } + + @Test + void retrieveTrackingsReturnsOkResponse() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + TrackingsResponse responseMock = new TrackingsResponse(); + + when(paperTrackerEventService.retrieveTrackings(request)).thenReturn(Mono.just(responseMock)); + + //ACT + Mono> response = controller.retrieveTrackings(requestMono, null); + + //ASSERT + StepVerifier.create(response) + .expectNext(ResponseEntity.ok(responseMock)) + .verifyComplete(); + verify(paperTrackerEventService, times(1)).retrieveTrackings(request); + } + + @Test + void retrieveTrackingsHandlesError() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + Mono requestMono = Mono.just(request); + + when(paperTrackerEventService.retrieveTrackings(request)).thenReturn(Mono.error(new RuntimeException("Service error"))); + + //ACT + Mono> response = controller.retrieveTrackings(requestMono, null); + + //ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Service error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerEventService, times(1)).retrieveTrackings(request); + } + + @Test + void retrieveTrackingsByAttemptIdReturnsOkResponse() { + //ARRANGE + TrackingsResponse responseMock = new TrackingsResponse(); + + when(paperTrackerEventService.retrieveTrackingsByAttemptId("attemptId", "pcRetry")).thenReturn(Mono.just(responseMock)); + + //ACT + Mono> response = controller.retrieveTrackingsByAttemptId("attemptId", "pcRetry", null); + + //ASSERT + StepVerifier.create(response) + .expectNext(ResponseEntity.ok(responseMock)) + .verifyComplete(); + verify(paperTrackerEventService, times(1)).retrieveTrackingsByAttemptId("attemptId", "pcRetry"); + } + + @Test + void retrieveTrackingsByAttemptIdHandlesError() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + + when(paperTrackerEventService.retrieveTrackingsByAttemptId("attemptId", "pcRetry")).thenReturn(Mono.error(new RuntimeException("Service error"))); + + //ACT + Mono> response = controller.retrieveTrackingsByAttemptId("attemptId", "pcRetry", null); + + //ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "Service error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerEventService, times(1)).retrieveTrackingsByAttemptId("attemptId", "pcRetry"); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderArTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderArTest.java new file mode 100644 index 000000000..2ccd99526 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/FinalEventBuilderArTest.java @@ -0,0 +1,258 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class FinalEventBuilderArTest { + + @Mock + PnPaperTrackerConfigs cfg; + + @Mock + DataVaultClient dataVaultClient; + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + + FinalEventBuilderAr finalEventBuilder; + + HandlerContext handlerContext; + + PaperTrackings paperTrackings; + + private static final String EVENT_ID = UUID.randomUUID().toString(); + + @BeforeEach + void setUp() { + Instant now = Instant.now(); + handlerContext = new HandlerContext(); + handlerContext.setTrackingId("req-123"); + finalEventBuilder = new FinalEventBuilderAr(cfg, dataVaultClient, paperTrackingsDAO); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.getPaperStatus().setRegisteredLetterCode("RL123"); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M02"); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + Event event = new Event(); + event.setRequestTimestamp(now); + event.setStatusTimestamp(Instant.now()); + event.setId(EVENT_ID + "1"); + + Event event1 = new Event(); + event1.setStatusCode("RECRN005B"); + event1.setStatusTimestamp(now); + event1.setRequestTimestamp(now); + event1.setId(EVENT_ID + "2"); + + Event event2 = new Event(); + event2.setStatusCode("RECRN005C"); + event2.setStatusTimestamp(now); + event2.setRequestTimestamp(now); + event2.setId(EVENT_ID); + + Event event3 = new Event(); + event3.setStatusCode("RECRN004C"); + event3.setStatusTimestamp(now); + event3.setRequestTimestamp(now); + event3.setId(EVENT_ID + "5"); + + Event event4 = new Event(); + event4.setStatusCode("RECRN003C"); + event4.setStatusTimestamp(now); + event4.setRequestTimestamp(now); + event4.setId(EVENT_ID + "6"); + + Event event5 = new Event(); + event5.setStatusCode("RECRN002D"); + event5.setStatusTimestamp(Instant.now()); + event5.setDeliveryFailureCause("M02"); + event5.setRequestTimestamp(Instant.now()); + event5.setId(EVENT_ID + "7"); + + Event event6 = new Event(); + event6.setStatusCode("RECRN002F"); + event6.setStatusTimestamp(Instant.now()); + event6.setRequestTimestamp(Instant.now()); + event6.setId(EVENT_ID + "4"); + + Event event7 = new Event(); + event7.setStatusCode("RECRN010"); + event7.setRequestTimestamp(Instant.now()); + event7.setId(EVENT_ID + "3"); + + paperTrackings.setEvents(List.of(event, event1, event2, event3, event4, event5, event6, event7)); + handlerContext.setPaperTrackings(paperTrackings); + } + + @Test + void buildFinalEvent_stockStatus_differenceGreater_RECRN005C() { + // Arrange + handlerContext.getPaperTrackings().getEvents().getFirst().setStatusCode(RECRN005A.name()); + handlerContext.getPaperTrackings().getEvents().getLast().setStatusTimestamp(Instant.now().minus(40, ChronoUnit.DAYS)); + setValidatedEvents(EVENT_ID + "1"); + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRN005C.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID); + when(cfg.getCompiutaGiacenzaArDuration()).thenReturn(Duration.ofDays(30)); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(2, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(PNRN012.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertNull(handlerContext.getEventsToSend().getFirst().getDeliveryFailureCause()); + Assertions.assertEquals(RECRN005C.name(), handlerContext.getEventsToSend().getLast().getStatusDetail()); + Assertions.assertEquals(StatusCodeEnum.PROGRESS, handlerContext.getEventsToSend().getLast().getStatusCode()); + } + + @Test + void buildFinalEvent_stockStatus_differenceMinor_RECRN005C() { + // Arrange + handlerContext.getPaperTrackings().getEvents().getFirst().setStatusCode(RECRN005A.name()); + handlerContext.getPaperTrackings().getEvents().getLast().setStatusTimestamp(Instant.now().minus(25, ChronoUnit.DAYS)); + setValidatedEvents(EVENT_ID + "1"); + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRN005C.name()); + handlerContext.setEventId(EVENT_ID); + handlerContext.setPaperProgressStatusEvent(finalEvent); + + when(cfg.getCompiutaGiacenzaArDuration()).thenReturn(Duration.ofDays(30)); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .expectErrorSatisfies(throwable -> { + Assertions.assertInstanceOf(PnPaperTrackerValidationException.class, throwable); + PnPaperTrackerValidationException ex = (PnPaperTrackerValidationException) throwable; + Assertions.assertNotNull(ex.getError()); + Assertions.assertEquals(paperTrackings.getTrackingId(), ex.getError().getTrackingId()); + Assertions.assertEquals(finalEvent.getStatusCode(), ex.getError().getEventThrow()); + Assertions.assertEquals(finalEvent.getProductType(), ex.getError().getProductType()); + Assertions.assertEquals(ErrorCause.GIACENZA_DATE_ERROR, ex.getError().getDetails().getCause()); + }) + .verify(); + + // Assert + Assertions.assertTrue(handlerContext.getEventsToSend().isEmpty()); + } + + @Test + void buildFinalEvent_stockStatus_differenceMinor_RECRN003C() { + // Arrange + handlerContext.getPaperTrackings().getEvents().getFirst().setStatusCode(RECRN003A.name()); + handlerContext.getPaperTrackings().getEvents().getLast().setStatusTimestamp(Instant.now().minus(5, ChronoUnit.DAYS)); + setValidatedEvents(EVENT_ID + "1"); + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRN003C.name()); + handlerContext.setEventId(EVENT_ID + "6"); + handlerContext.setPaperProgressStatusEvent(finalEvent); + when(cfg.getRefinementDuration()).thenReturn(Duration.ofDays(10)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(RECRN003C.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertEquals(StatusCodeEnum.valueOf(RECRN003C.getStatus().name()), handlerContext.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void buildFinalEvent_stockStatus_differenceGreater_enableTruncatedDate_RECRN004C() { + // Arrange + handlerContext.getPaperTrackings().getEvents().getFirst().setStatusCode(RECRN004A.name()); + handlerContext.getPaperTrackings().getEvents().getLast().setStatusTimestamp(Instant.now().minus(13, ChronoUnit.DAYS)); + setValidatedEvents(EVENT_ID + "1"); + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRN004C.name()); + handlerContext.setEventId(EVENT_ID + "5"); + handlerContext.setPaperProgressStatusEvent(finalEvent); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + when(cfg.getRefinementDuration()).thenReturn(Duration.ofDays(10)); + when(cfg.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(2, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(PNRN012.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertNotNull(handlerContext.getEventsToSend().getFirst().getStatusDateTime()); + Assertions.assertEquals(RECRN004C.name(), handlerContext.getEventsToSend().getLast().getStatusDetail()); + Assertions.assertEquals(StatusCodeEnum.PROGRESS, handlerContext.getEventsToSend().getLast().getStatusCode()); + } + + @Test + void buildFinalEvent_stockStatusFalse() { + // Arrange + handlerContext.getPaperTrackings().getEvents().getFirst().setStatusCode(RECRN002D.name()); + handlerContext.getPaperTrackings().getEvents().getLast().setStatusTimestamp(Instant.now()); + setValidatedEvents(EVENT_ID + "1"); + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRN002F.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID + "4"); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(RECRN002F.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertEquals("M02", handlerContext.getEventsToSend().getFirst().getDeliveryFailureCause()); + } + + private void setValidatedEvents(String eventId) { + paperTrackings.getPaperStatus().setValidatedEvents(List.of(eventId, EVENT_ID + 3)); + } + + private PaperProgressStatusEvent getFinalEvent(String statusCode) { + PaperProgressStatusEvent finalEvent = new PaperProgressStatusEvent(); + finalEvent.setStatusCode(statusCode); + finalEvent.setRequestId("req-123"); + finalEvent.setClientRequestTimeStamp(OffsetDateTime.now()); + finalEvent.setRegisteredLetterCode("RL123"); + finalEvent.setDeliveryFailureCause("M02"); + finalEvent.setAttachments(new ArrayList<>()); + finalEvent.setStatusDateTime(OffsetDateTime.now()); + finalEvent.setProductType("AR"); + return finalEvent; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryArTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryArTest.java new file mode 100644 index 000000000..8756e07d8 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/HandlersFactoryArTest.java @@ -0,0 +1,322 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.Handler; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Arrays; +import java.util.List; + +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + + +@ExtendWith(MockitoExtension.class) +class HandlersFactoryArTest { + + @Mock + private MetadataUpserter metadataUpserter; + + @Mock + private CheckTrackingProduct checkTrackingProduct; + + @Mock + private SequenceValidatorAr sequenceValidatorAr; + + @Mock + private DematValidatorAr dematValidator; + + @Mock + private FinalEventBuilderAr finalEventBuilder; + + @Mock + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private RetrySender retrySender; + + @Mock + private M10RetryTrigger m10RetryTrigger; + + @Mock + private OutputTargetSender outputTargetSender; + + @Mock + private IntermediateEventsBuilder intermediateEventsBuilder; + + @Mock + private HandlerStep mockHandlerStep1; + + @Mock + private HandlerStep mockHandlerStep2; + + @Mock + private NotRetryableErrorInserting notRetryableErrorInserting; + + @Mock + private CheckTrackingState checkTrackingState; + + @Mock + private CheckOcrResponse checkOcrResponse; + + @Mock + private RetrySenderCON996 retrySenderCON996; + + private HandlersFactoryAr handlersFactoryAr; + + private HandlerContext handlerContext; + + @BeforeEach + void setUp() { + handlerContext = new HandlerContext(); + handlersFactoryAr = new HandlersFactoryAr( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidatorAr, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996 + ); + } + + @Test + void buildEventsHandler_WithValidSteps_ExecutesAllStepsInOrder() { + // Arrange + List steps = Arrays.asList(mockHandlerStep1, mockHandlerStep2); + + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + + + // Act & Assert + StepVerifier.create(handlersFactoryAr.build(EventTypeEnum.INTERMEDIATE_EVENT, handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Verify execution order + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState,duplicatedEventFiltering, outputTargetSender, intermediateEventsBuilder); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(duplicatedEventFiltering).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildEventsHandler_WhenSecondStepFails_FirstStepStillExecuted() { + // Arrange + List steps = Arrays.asList(mockHandlerStep1, mockHandlerStep2); + RuntimeException testException = new RuntimeException("Second step failed"); + + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.error(testException)); + + // Act & Assert + StepVerifier.create(handlersFactoryAr.build(EventTypeEnum.INTERMEDIATE_EVENT, handlerContext).execute(handlerContext)) + .expectError(RuntimeException.class) + .verify(); + + // Verify both steps were attempted in order + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + } + + @Test + void buildFinalEventsHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(sequenceValidatorAr.execute(handlerContext)).thenReturn(Mono.empty()); + when(dematValidator.execute(handlerContext)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryAr.buildFinalEventsHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, sequenceValidatorAr, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(sequenceValidatorAr).execute(handlerContext); + inOrder.verify(dematValidator).execute(handlerContext); + inOrder.verify(finalEventBuilder).execute(handlerContext); + inOrder.verify(m10RetryTrigger).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildIntermediateEventsHandler_ExecutesMetadataUpserterAndDeliveryPushSender() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act & Assert + Handler handler = handlersFactoryAr.buildIntermediateEventsHandler(handlerContext); + StepVerifier.create(handler.execute(handlerContext)) + .verifyComplete(); + + // Verify both steps were executed in the correct order + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, duplicatedEventFiltering, intermediateEventsBuilder, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(duplicatedEventFiltering).execute(handlerContext); + inOrder.verify(intermediateEventsBuilder).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildRetryEventHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(retrySender.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + // Act + StepVerifier.create(handlersFactoryAr.buildRetryEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, retrySender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(retrySender).execute(handlerContext); + } + + @Test + void buildNotRetryableEventHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(notRetryableErrorInserting.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryAr.buildNotRetryableEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, duplicatedEventFiltering, notRetryableErrorInserting, intermediateEventsBuilder, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(duplicatedEventFiltering).execute(handlerContext); + inOrder.verify(notRetryableErrorInserting).execute(handlerContext); + inOrder.verify(intermediateEventsBuilder).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildOcrResponseHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + when(checkOcrResponse.execute(handlerContext)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryAr.buildOcrResponseHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(checkOcrResponse, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(checkOcrResponse).execute(handlerContext); + inOrder.verify(finalEventBuilder).execute(handlerContext); + inOrder.verify(m10RetryTrigger).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildEventsHandler_WithSingleStep_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(handlersFactoryAr.build(EventTypeEnum.INTERMEDIATE_EVENT, handlerContext).execute(handlerContext)) + .verifyComplete(); + } + + @Test + void buildEventsHandler_VerifyContextPassedToAllSteps() { + // Arrange + + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryAr.build(EventTypeEnum.INTERMEDIATE_EVENT, handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert - verify the same context instance is passed to all steps + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState,duplicatedEventFiltering, outputTargetSender, intermediateEventsBuilder); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + inOrder.verify(duplicatedEventFiltering).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildSaveOnlyEventHandler_ExecutesMetadataUpserter() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryAr.buildSaveOnlyEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN003CMessageHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN003CMessageHandlerTest.java new file mode 100644 index 000000000..b0d5db1a4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN003CMessageHandlerTest.java @@ -0,0 +1,185 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.eventBridge.EventBridgePublisher; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.service.handler_step.RIR.HandlersFactoryRir; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.service.handler_step.TestUtils.getPaperTrackings; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.*; + +@Slf4j +@TestPropertySource(properties = { + "pn.paper-tracker.send-output-to-delivery-push=true" +}) +class RECRN003CMessageHandlerTest extends BaseTest.WithLocalStack { + private static final String STATUS_RECRN010 = "RECRN010"; + private static final String STATUS_RECRN011 = "RECRN011"; + private static final String STATUS_RECRN003A = "RECRN003A"; + private static final String STATUS_RECRN003B = "RECRN003B"; + private static final String STATUS_RECRN003C = "RECRN003C"; + private static final String STATUS_PNRN012 = "PNRN012"; + + private static final int DAYS_REFINEMENT = 10; + + @Autowired + private ExternalChannelHandler externalChannelHandler; + @Autowired + private PaperTrackingsDAO paperTrackingsDAO; + @Autowired + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + @Autowired + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + @Autowired + private PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + @Autowired + private HandlersFactoryAr handlersFactoryAr; + @Autowired + private HandlersFactoryRir handlersFactoryRir; + + @MockitoBean + private SafeStorageClient safeStorageClient; + @MockitoBean + private PaperChannelClient paperChannelClient; + @MockitoBean + private DataVaultClient dataVaultClient; + @MockitoBean + private EventBridgePublisher eventBridgePublisher; + + + @Test + void when_RECRN003AGreaterThanRECRN010Of10Days_then_pushPNRN012Status() { + // Arrange + var now = Instant.now(); + String eventId = "eventId"; + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, now.minus(DAYS_REFINEMENT + 1, ChronoUnit.DAYS)); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN003A = getEventMeta(STATUS_RECRN003A, now); + Event eventMetaRECRN003B = getEventMeta(STATUS_RECRN003B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN003A, eventMetaRECRN003B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusCode(STATUS_RECRN003C) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR"); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + + // Assert + verify(eventBridgePublisher, times(2)).publish(capturedSendEvent.capture()); + assertNotNull(capturedSendEvent.getAllValues()); + assertEquals(2, capturedSendEvent.getAllValues().size()); + assertEquals(STATUS_PNRN012, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.OK, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusCode()); + assertEquals(STATUS_RECRN003C, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.PROGRESS, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusCode()); + } + + @Test + void when_RECRN003ALessThanOrEqualToRECRN010Of10Days_then_pushOnQueue() { + // Arrange + var now = Instant.now(); + String eventId = "eventId"; + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, now.minus(DAYS_REFINEMENT, ChronoUnit.DAYS)); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN003A = getEventMeta(STATUS_RECRN003A, now); + Event eventMetaRECRN003B = getEventMeta(STATUS_RECRN003B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN003A, eventMetaRECRN003B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusCode(STATUS_RECRN003C) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR"); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + + // Assert + verify(eventBridgePublisher).publish(capturedSendEvent.capture()); + log.info(capturedSendEvent.getAllValues().toString()); + assertNotNull(capturedSendEvent.getAllValues()); + SendEvent sendEvent = capturedSendEvent.getValue().getSendEvent(); + assertNotNull(sendEvent); + Assertions.assertEquals(StatusCodeEnum.OK, sendEvent.getStatusCode()); + Assertions.assertEquals(STATUS_RECRN003C, sendEvent.getStatusDetail()); + + } + + private Event getEventMeta(String statusCode, Instant time) { + var eventMeta = new Event(); + eventMeta.setId(UUID.randomUUID().toString()); + eventMeta.setStatusCode(statusCode); + eventMeta.setStatusTimestamp(time); + eventMeta.setRegisteredLetterCode("registeredLetterCode"); + eventMeta.setRequestTimestamp(time); //aggiunto + if(statusCode.equalsIgnoreCase("RECRN003B")){ + Attachment attachment = new Attachment(); + attachment.setDocumentType("AR"); + attachment.setUri("test.pdf"); + eventMeta.setAttachments(List.of(attachment)); + } + return eventMeta; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN004CMessageHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN004CMessageHandlerTest.java new file mode 100644 index 000000000..b3adc55cd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN004CMessageHandlerTest.java @@ -0,0 +1,184 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.eventBridge.EventBridgePublisher; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.service.handler_step.RIR.HandlersFactoryRir; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.service.handler_step.TestUtils.getPaperTrackings; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +@Slf4j +@TestPropertySource(properties = { + "pn.paper-tracker.send-output-to-delivery-push=true" +}) +class RECRN004CMessageHandlerTest extends BaseTest.WithLocalStack { + private static final String STATUS_RECRN010 = "RECRN010"; + private static final String STATUS_RECRN011 = "RECRN011"; + private static final String STATUS_RECRN004A = "RECRN004A"; + private static final String STATUS_RECRN004C = "RECRN004C"; + private static final String STATUS_RECRN004B = "RECRN004B"; + private static final String STATUS_PNRN012 = "PNRN012"; + + @Autowired + private ExternalChannelHandler externalChannelHandler; + @Autowired + private PaperTrackingsDAO paperTrackingsDAO; + @Autowired + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + @Autowired + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + @Autowired + private PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + @Autowired + private HandlersFactoryAr handlersFactoryAr; + @Autowired + private HandlersFactoryRir handlersFactoryRir; + + @MockitoBean + private SafeStorageClient safeStorageClient; + @MockitoBean + private PaperChannelClient paperChannelClient; + @MockitoBean + private DataVaultClient dataVaultClient; + @MockitoBean + private EventBridgePublisher eventBridgePublisher; + + private static final int DAYS_REFINEMENT = 10; + + + @Test + void when_RECRN004AGreaterThanRECRN010of10Days_then_pushPNRN012Status() { + // Arrange + var now = Instant.now(); + String eventId = "eventId"; + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, now.minus(DAYS_REFINEMENT+1, ChronoUnit.DAYS)); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN004A = getEventMeta(STATUS_RECRN004A, now); + Event eventMetaRECRN004B = getEventMeta(STATUS_RECRN004B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN004A, eventMetaRECRN004B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN004C); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + + // Assert + verify(eventBridgePublisher, times(2)).publish(capturedSendEvent.capture()); + assertNotNull(capturedSendEvent.getAllValues()); + assertEquals(2, capturedSendEvent.getAllValues().size()); + assertEquals(STATUS_PNRN012, capturedSendEvent.getAllValues().get(0).getSendEvent().getStatusDetail()); + assertEquals(StatusCodeEnum.OK, capturedSendEvent.getAllValues().get(0).getSendEvent().getStatusCode()); + assertEquals(STATUS_RECRN004C, capturedSendEvent.getAllValues().get(1).getSendEvent().getStatusDetail()); + assertEquals(StatusCodeEnum.PROGRESS, capturedSendEvent.getAllValues().get(1).getSendEvent().getStatusCode()); + } + + @Test + void when_RECRN004ALessThanOrEqualToRECRN010Of10Days_then_pushOnQueue(){ + // Arrange + var now = Instant.now(); + String eventId = "eventId"; + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, now.minus(DAYS_REFINEMENT, ChronoUnit.DAYS)); + Event eventMetaRECRN004A = getEventMeta(STATUS_RECRN004A, now); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN004B = getEventMeta(STATUS_RECRN004B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN004A, eventMetaRECRN004B))).block(); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN004C); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + + // Assert + verify(eventBridgePublisher).publish(capturedSendEvent.capture()); + log.info(capturedSendEvent.getAllValues().toString()); + SendEvent sendEvent = capturedSendEvent.getValue().getSendEvent(); + assertNotNull(sendEvent); + Assertions.assertEquals(StatusCodeEnum.OK, sendEvent.getStatusCode()); + Assertions.assertEquals(STATUS_RECRN004C, sendEvent.getStatusDetail()); + + } + + + private Event getEventMeta(String statusCode, Instant time) { + var eventMeta = new Event(); + eventMeta.setId(UUID.randomUUID().toString()); + eventMeta.setStatusCode(statusCode); + eventMeta.setStatusTimestamp(time); + eventMeta.setRegisteredLetterCode("registeredLetterCode"); + eventMeta.setRequestTimestamp(time); //aggiunto + if(statusCode.equalsIgnoreCase("RECRN004B")){ + Attachment attachment = new Attachment(); + attachment.setDocumentType("Plico"); + attachment.setUri("test.pdf"); + eventMeta.setAttachments(List.of(attachment)); + } + return eventMeta; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN005CMessageHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN005CMessageHandlerTest.java new file mode 100644 index 000000000..dd3866e2c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN005CMessageHandlerTest.java @@ -0,0 +1,257 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.BaseTest; +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Attachment; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.eventBridge.EventBridgePublisher; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.consumer.internal.ExternalChannelHandler; +import it.pagopa.pn.papertracker.service.handler_step.RIR.HandlersFactoryRir; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.temporal.ChronoUnit; +import java.util.List; +import java.util.Objects; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.service.handler_step.TestUtils.getPaperTrackings; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.*; + +@Slf4j +@TestPropertySource(properties = { + "pn.paper-tracker.send-output-to-delivery-push=true" +}) +class RECRN005CMessageHandlerTest extends BaseTest.WithLocalStack { + private static final String STATUS_RECRN010 = "RECRN010"; + private static final String STATUS_RECRN011 = "RECRN011"; + private static final String STATUS_RECRN005A = "RECRN005A"; + private static final String STATUS_RECRN005C = "RECRN005C"; + private static final String STATUS_RECRN005B = "RECRN005B"; + private static final String STATUS_PNRN012 = "PNRN012"; + + private static final int DAYS_REFINEMENT = 10; + private static final int STORAGE_DURATION_AR_DAYS = 30; + + private final String eventId = "eventId"; + + @Autowired + private ExternalChannelHandler externalChannelHandler; + @Autowired + private PaperTrackingsDAO paperTrackingsDAO; + @Autowired + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + @Autowired + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + @Autowired + private PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + @Autowired + private HandlersFactoryAr handlersFactoryAr; + @Autowired + private HandlersFactoryRir handlersFactoryRir; + + @MockitoBean + private SafeStorageClient safeStorageClient; + @MockitoBean + private PaperChannelClient paperChannelClient; + @MockitoBean + private DataVaultClient dataVaultClient; + @MockitoBean + private EventBridgePublisher eventBridgePublisher; + + @Test + void should_pushPNRN012_when_RECRN005AGreaterOrEqualsRECRN010By30Days (){ + // Arrange + var now = Instant.parse("2025-04-09T09:02:10Z"); + // minus 30 because the month of now (April) has 30 days + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010,now.minus(STORAGE_DURATION_AR_DAYS, ChronoUnit.DAYS)); + Event eventMetaRECRN005A = getEventMeta(STATUS_RECRN005A, now); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN005B = getEventMeta(STATUS_RECRN005B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN005A, eventMetaRECRN005B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN005C); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + // Assert + verify(eventBridgePublisher, times(2)).publish(capturedSendEvent.capture()); + assertNotNull(capturedSendEvent.getAllValues()); + assertEquals(2, capturedSendEvent.getAllValues().size()); + assertEquals(STATUS_PNRN012, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.OK, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusCode()); + assertEquals(STATUS_RECRN005C, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.PROGRESS, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusCode()); + } + + @Test + void should_savePnEventError_when_RECRN005ALessRECRN010By1Days() { + // Arrange + var now = Instant.parse("2025-04-09T09:02:10Z"); + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, now); + Event eventMetaRECRN005A = getEventMeta(STATUS_RECRN005A, now.minus(1, ChronoUnit.DAYS)); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, now); + Event eventMetaRECRN005B = getEventMeta(STATUS_RECRN005B, now); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN005A, eventMetaRECRN005B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(now.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN005C); + + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, true, null, eventId, null); + + // Assert + verify(eventBridgePublisher, never()).publish(any(PaperChannelUpdate.class)); + + + } + + // Test troncamento + @Test + void should_pushPNRN012_when_RECRN005GreaterOrEqualsRECRN010By30Days_withRemoveTime(){ + // Arrange + var recrn010StatusDateTime = Instant.parse("2025-01-09T09:02:10Z"); + var recrn005AStatusDateTime = Instant.parse("2025-02-08T06:55:24Z"); + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, recrn010StatusDateTime); + Event eventMetaRECRN005A = getEventMeta(STATUS_RECRN005A, recrn005AStatusDateTime); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, recrn010StatusDateTime); + Event eventMetaRECRN005B = getEventMeta(STATUS_RECRN005B, recrn005AStatusDateTime); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN005A, eventMetaRECRN005B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(recrn005AStatusDateTime.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN005C); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + ArgumentCaptor capturedSendEvent = ArgumentCaptor.forClass(PaperChannelUpdate.class); + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, false, null, eventId, null); + + // Assert + verify(eventBridgePublisher, times(2)).publish(capturedSendEvent.capture()); + assertNotNull(capturedSendEvent.getAllValues()); + assertEquals(2, capturedSendEvent.getAllValues().size()); + assertEquals(STATUS_PNRN012, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.OK, Objects.requireNonNull(capturedSendEvent.getAllValues().get(0).getSendEvent()).getStatusCode()); + assertEquals(STATUS_RECRN005C, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusDetail()); + assertEquals(StatusCodeEnum.PROGRESS, Objects.requireNonNull(capturedSendEvent.getAllValues().get(1).getSendEvent()).getStatusCode()); + + } + + // test utile per capire se ci sono problemi con la timezone + @Test + void should_savePnEventError_when_RECRN005LessRECRN010_testTimezone(){ + // Arrange + var recrn010StatusDateTime = Instant.parse("2025-02-10T09:02:10Z"); + var recrn005AStatusDateTime = Instant.parse("2025-03-07T23:55:24Z"); + Event eventMetaRECRN010 = getEventMeta(STATUS_RECRN010, recrn010StatusDateTime); + Event eventMetaRECRN005A = getEventMeta(STATUS_RECRN005A, recrn005AStatusDateTime); + Event eventMetaRECRN011 = getEventMeta(STATUS_RECRN011, recrn010StatusDateTime); + Event eventMetaRECRN005B = getEventMeta(STATUS_RECRN005B, recrn005AStatusDateTime); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("url")); + + String iun = UUID.randomUUID().toString(); + String requestId = "PREPARE_ANALOG_DOMICILE.IUN_" + iun + ".RECINDEX_0.ATTEMPT_0.PCRETRY_0"; + paperTrackingsDAO.putIfAbsent(getPaperTrackings(requestId, List.of(eventMetaRECRN010, eventMetaRECRN011, eventMetaRECRN005A, eventMetaRECRN005B))).block(); + + PaperProgressStatusEvent paperRequest = new PaperProgressStatusEvent() + .requestId(requestId) + .statusDateTime(recrn005AStatusDateTime.atOffset(ZoneOffset.UTC)) + .clientRequestTimeStamp(OffsetDateTime.now()) + .registeredLetterCode("registeredLetterCode") + .productType("AR") + .statusCode(STATUS_RECRN005C); + + SingleStatusUpdate singleStatusUpdate = new SingleStatusUpdate(); + singleStatusUpdate.setAnalogMail(paperRequest); + + + // Act + externalChannelHandler.handleExternalChannelMessage(singleStatusUpdate, true, null, eventId, null); + + // Assert + verify(eventBridgePublisher, never()).publish(any(PaperChannelUpdate.class)); + } + + private Event getEventMeta(String statusCode, Instant time) { + var eventMeta = new Event(); + eventMeta.setId(UUID.randomUUID().toString()); + eventMeta.setStatusCode(statusCode); + eventMeta.setStatusTimestamp(time); + eventMeta.setRegisteredLetterCode("registeredLetterCode"); + eventMeta.setRequestTimestamp(time); //aggiunto + if(statusCode.equalsIgnoreCase("RECRN005B")){ + Attachment attachment = new Attachment(); + attachment.setDocumentType("Plico"); + attachment.setUri("test.pdf"); + eventMeta.setAttachments(List.of(attachment)); + } + return eventMeta; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN00XCAbstractMessageHandlerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN00XCAbstractMessageHandlerTest.java new file mode 100644 index 000000000..7faac3b9b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/RECRN00XCAbstractMessageHandlerTest.java @@ -0,0 +1,419 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; + +import java.time.Duration; +import java.time.Instant; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class RECRN00XCAbstractMessageHandlerTest { + + @InjectMocks + private FinalEventBuilderAr finalEventBuilder; + + @Mock + private PnPaperTrackerConfigs pnPaperTrackerConfigs; + + @Test + void testGetDurationBetweenDates_NoTruncate() { + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + // Arrange + var instant1 = Instant.parse("2025-03-05T09:00:00Z"); + var instant2 = Instant.parse("2025-03-06T08:00:00Z"); + + // Act + Duration duration = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + instant1, + instant2 + ); + + // Assert + assertThat(duration).isEqualTo(Duration.ofHours(23)); + } + + @Test + void testGetDurationBetweenDates_Truncate() { + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + var instant1 = Instant.parse("2025-03-05T09:00:00Z"); + var instant2 = Instant.parse("2025-03-06T08:00:00Z"); + + // Act + Duration duration = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + instant1, + instant2 + ); + + // Assert + assertThat(duration).isEqualTo(Duration.ofDays(1)); + } + + @Test + void testIsDifferenceGreaterRefinementDuration() { + when(pnPaperTrackerConfigs.getRefinementDuration()).thenReturn(Duration.ofDays(10)); + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + // Arrange + Instant now = Instant.now(); + Instant nineDaysAfter = now.plus(Duration.ofDays(9)); + Instant tenDaysAfter = now.plus(Duration.ofDays(10)); + Instant elevenDaysAfter = now.plus(Duration.ofDays(11)); + + // Act + Boolean result9 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterRefinementDuration", + now, + nineDaysAfter + ); + Boolean result10 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterRefinementDuration", + now, + tenDaysAfter + ); + Boolean result11 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterRefinementDuration", + now, + elevenDaysAfter + ); + + // Assert + assertThat(result9).isFalse(); + assertThat(result10).isFalse(); + assertThat(result11).isTrue(); + } + + @Test + void testIsDifferenceGreaterOrEqualToStockDuration() { + when(pnPaperTrackerConfigs.getCompiutaGiacenzaArDuration()).thenReturn(Duration.ofDays(30)); + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + // Arrange + Instant now = Instant.now(); + Instant twentyNineDays = now.plus(Duration.ofDays(29)); + Instant thirtyDays = now.plus(Duration.ofDays(30)); + Instant thirtyOneDays = now.plus(Duration.ofDays(31)); + + // Act + Boolean result29 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterOrEqualToStockDuration", + now, + twentyNineDays + ); + Boolean result30 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterOrEqualToStockDuration", + now, + thirtyDays + ); + Boolean result31 = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "isDifferenceGreaterOrEqualToStockDuration", + now, + thirtyOneDays + ); + + // Assert + assertThat(result29).isFalse(); + assertThat(result30).isTrue(); + assertThat(result31).isTrue(); + } + + @Test + void addDuration_when_truncateDisabled_addsFullDuration() { + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + + Instant base = Instant.parse("2023-01-15T10:00:00Z"); + Duration delta = Duration.ofHours(5); + + // Act + Instant result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "addDurationToInstant", + base, + delta + ); + + // Assert + assertEquals(base.plus(delta), result); + } + + // Si considerano solo i "giorni civili" in Europe/Rome. + @Test + void addDuration_when_truncateEnabled_zeroDays() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + Instant base = Instant.parse("2023-01-15T10:00:00Z"); + Duration delta = Duration.ofHours(5); // <24h = 0giorni + + // Inizio del giorno 2023-01-15 in UTC + Instant expected = Instant.parse("2023-01-14T23:00:00Z"); + + // Act + Instant result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "addDurationToInstant", + base, + delta + ); + + // Assert + assertEquals(expected, result); + } + + // Si considerano solo i "giorni civili" in Europe/Rome. + @Test + void addDuration_when_truncateEnabled_usesWholeDays() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + Instant base = Instant.parse("2023-01-15T10:00:00Z"); + Duration delta = Duration.ofDays(5); + + // Inizio del giorno 2023-01-20 in UTC + Instant expected = Instant.parse("2023-01-19T23:00:00Z"); + + // Act + Instant result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "addDurationToInstant", + base, + delta + ); + + // Assert + assertEquals(expected, result); + } + + // Salto DST: 1 giorno prima dell’ora legale → mezzanotte locale corretta. + @Test + void addDuration_when_truncateEnabled_handlesDstGap() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + Instant base = Instant.parse("2025-03-29T12:00:00Z"); // vigilia cambio DST + Duration delta = Duration.ofDays(1); // +1 giorno civile + + // Inizio del giorno 2025-03-30 in UTC + Instant expected = Instant.parse("2025-03-29T23:00:00Z"); + + // Act + Instant result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "addDurationToInstant", + base, + delta + ); + + // Assert + assertEquals(expected, result); + } + + @Test + void getDuration_when_truncateDisabled_returns24h() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + + Instant i1 = Instant.parse("2023-02-01T12:00:00Z"); + Instant i2 = Instant.parse("2023-02-02T12:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofHours(24), result); + } + + //Salto avanti (primavera): notte di 23 ore -> PT23H. + + @Test + void getDuration_when_truncateDisabled_dstSpringForward_returns23h() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + + // 2025-03-30T00:00 Europe/Rome (UTC‑01:00) + Instant i1 = Instant.parse("2025-03-29T23:00:00Z"); + // 2025-03-31T00:00 Europe/Rome (UTC‑02:00) + Instant i2 = Instant.parse("2025-03-30T22:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofHours(23), result); + } + + //Ritorno all’ora solare (autunno): notte di 25 ore -> PT25H. + + @Test + void getDuration_when_truncateDisabled_dstFallBack_returns25h() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(false); + + // 2025‑10‑25T00:00 Europe/Rome (UTC‑02:00) + Instant i1 = Instant.parse("2025-10-24T22:00:00Z"); + // 2025‑10‑26T00:00 Europe/Rome (UTC‑01:00) + Instant i2 = Instant.parse("2025-10-25T23:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofHours(25), result); + } + + @Test + void getDuration_when_truncateEnabled_returns10Days() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + Instant i1 = Instant.parse("2023-02-01T16:00:00Z"); + Instant i2 = Instant.parse("2023-02-11T09:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(10), result); + } + + //Salto avanti (primavera): notte di 23 ore + @Test + void getDuration_when_truncateEnabled_dstSpringForward_returns23h() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + // 2025-03-30T00:00 Europe/Rome (UTC‑01:00) + Instant i1 = Instant.parse("2025-03-29T23:00:00Z"); + // 2025-03-31T00:00 Europe/Rome (UTC‑02:00) + Instant i2 = Instant.parse("2025-03-30T22:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(1), result); + } + + //Ritorno all’ora solare (autunno): notte di 25 ore -> PT25H. + @Test + void getDuration_when_truncateEnabled_dstFallBack_returns25h() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + + // 2025‑10‑25T00:00 Europe/Rome (UTC‑02:00) + Instant i1 = Instant.parse("2025-10-24T22:00:00Z"); + // 2025‑10‑26T00:00 Europe/Rome (UTC‑01:00) + Instant i2 = Instant.parse("2025-10-25T23:00:00Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(1), result); + } + + @Test + void getDuration_when_truncateEnabled_returns30Days() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + Instant i2 = Instant.parse("2025-05-03T09:57:04Z"); + Instant i1 = Instant.parse("2025-04-03T09:55:52Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(30), result); + } + + @Test + void getDuration_when_truncateEnabled_returns29Days() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + Instant i2 = Instant.parse("2025-05-03T09:57:04Z"); + Instant i1 = Instant.parse("2025-04-04T09:55:52Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(29), result); + } + + @Test + void getDuration_when_truncateEnabled_returns31Days() { + // Arrange + when(pnPaperTrackerConfigs.isEnableTruncatedDateForRefinementCheck()).thenReturn(true); + Instant i1 = Instant.parse("2025-05-04T09:55:52Z"); + Instant i2 = Instant.parse("2025-06-04T09:57:04Z"); + + // Act + Duration result = ReflectionTestUtils.invokeMethod( + finalEventBuilder, + "getDurationBetweenDates", + i1, + i2 + ); + + // Assert + assertEquals(Duration.ofDays(31), result); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorArTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorArTest.java new file mode 100644 index 000000000..4e603b804 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/AR/SequenceValidatorArTest.java @@ -0,0 +1,714 @@ +package it.pagopa.pn.papertracker.service.handler_step.AR; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.DocumentTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static org.mockito.Mockito.*; + +class SequenceValidatorArTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + private SequenceValidatorAr sequenceValidatorAr; + + @InjectMocks + private HandlerContext context; + + @BeforeEach + void setUp() { + MockitoAnnotations.openMocks(this); + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusCode("RECRN001C"); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + PaperTrackings paperTrackings = getPaperTrackings(); + context.setPaperTrackings(paperTrackings); + sequenceValidatorAr = new SequenceValidatorAr(paperTrackingsDAO, paperTrackerErrorService); + } + + private PaperTrackings getPaperTrackings() { + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.setValidationFlow(new ValidationFlow()); + paperTrackings.setValidationConfig(new ValidationConfig()); + return paperTrackings; + } + + @Test + void validateSequenceValidMultipleFlow1() { + + //Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN003C"); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN010", timestamp.plusSeconds(2), businessTimestamp.plusSeconds(1), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN011", timestamp.plusSeconds(3), businessTimestamp.plusSeconds(2), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN010", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(3), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN011", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(4), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN003A", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(5), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN004A", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(6), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN003B", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(7), "REG1", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN003A", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(8), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN003B", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(9), "REG1", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN003C", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(11), "REG1", "", null) + )); + context.setEventId(eventIdC); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void sequenceRECRN002FDocumentsSplitted() { + + //Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + String eventIdC = UUID.randomUUID().toString(); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(1), "REG1", "M01", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(2), "REG1", "", List.of(DocumentTypeEnum.INDAGINE.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(4), "REG1", "", List.of(DocumentTypeEnum.PLICO.getValue(), DocumentTypeEnum.INDAGINE.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(5), "REG1", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002F", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(6), "REG1", "", null) + )); + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void sequenceRECRN002FDocumentsSplittedWithInvalidAttachments() { + + //Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + String eventIdC = UUID.randomUUID().toString(); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(1), "", "M01", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(2), "", "", List.of(DocumentTypeEnum.INDAGINE.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(4), "", "", List.of(DocumentTypeEnum.PLICO.getValue(), DocumentTypeEnum.AR.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(5), "", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002F", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(6), "", "", null) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyErrorMatches(throwable -> throwable.getMessage() + .contains("Event RECRN002E contains invalid attachments: [AR]")); + + // Assert + verify(paperTrackingsDAO, times(0)).updateItem(any(), any()); + } + + + @Test + void validateSequenceValidFlowABC() { + //Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidFlowABCAllWithDocuments() { + //Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyErrorMatches(throwable -> throwable.getMessage().contains("Event RECRN001C contains invalid attachments: [AR]")); + + // Assert + verify(paperTrackingsDAO, times(0)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidFlowDEF() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp, businessTimestamp, "REG123", "M03", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue(), DocumentTypeEnum.INDAGINE.getValue())), + buildEvent(eventIdC, "RECRN002F", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidFlowDEFMultiDocumentFailure() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp, businessTimestamp.plusSeconds(1), "REG123", "M01", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN002F", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Missed required attachments for the sequence validation: [Plico]")) + .verify(); + } + + @Test + void validateSequenceValidFlowDEFMultiDocumentDuplicateFailure() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp, businessTimestamp.plusSeconds(1), "REG123", "M01", List.of(DocumentTypeEnum.AR.getValue(), DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN002F", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Missed required attachments for the sequence validation: [Plico]")) + .verify(); + } + + @Test + void validateSequenceInvalidEventCount() { + // Arrange + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", Instant.now(), Instant.now(), "REG123", "", null), + buildEvent(eventIdC, "RECRN001C", Instant.now(), Instant.now(), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void validateSequenceInvalidReworkEventCount() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + context.setReworkId("reworkId"); + String eventIdC = UUID.randomUUID().toString(); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + Event reworkEventD = buildEvent(UUID.randomUUID().toString(), "RECRN002D", timestamp, businessTimestamp, "REG123", "", null); + reworkEventD.setNotificationReworkId("reworkId"); + Event reworkEventF = buildEvent(eventIdC, "RECRN002F", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null); + reworkEventF.setNotificationReworkId("reworkId"); + + context.getPaperTrackings().setEvents(List.of( + reworkEventD, + buildEvent(UUID.randomUUID().toString(), "RECRN002E", timestamp, businessTimestamp.plusSeconds(1), "REG123", "M01", List.of(DocumentTypeEnum.AR.getValue(), DocumentTypeEnum.AR.getValue())), + reworkEventF + )); + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void invalidBusinessTimestamp() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "TESTERR", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp.plus(1, ChronoUnit.DAYS), businessTimestamp.plusSeconds(2), "REG123", "TESTERR", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(3), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid business timestamps")) + .verify(); + } + + @Test + void validateSequenceInvalidSequenceSize() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, Instant.now(), "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, Instant.now(), "REG123", "", null), + buildEvent(eventIdC, "RECRN002C", timestamp, Instant.now(), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void validateSequenceInvalidSequenceLetters() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002F"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", null), + buildEvent(eventIdC, "RECRN002F", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void validateSequenceInvalidSequenceCodes() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", null), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void validateSequenceInvalidTimestamps() { + // Arrange + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", Instant.now(), businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", Instant.now().plusSeconds(10), businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", Instant.now(), businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid business timestamps")) + .verify(); + } + + @Test + void validateSequenceInvalidRegisteredLetterCode() { + // Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG444", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Registered letter codes do not match in sequence")) + .verify(); + } + + @Test + void validateSequenceRegisteredLetterCodeNotFound() { + // Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, null, "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), null, "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Registered letter code is null or empty in one or more events")) + .verify(); + } + + @Test + void validateSequenceInvalidNullDeliveryFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + context.getPaperTrackings().getValidationConfig().setStrictDeliveryFailureCause(false); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Missing deliveryFailureCause")) + .verify(); + } + + @Test + void validateSequenceDifferentDeliveryFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "M02", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "m02", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "M03", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid deliveryFailureCause on events: ")) + .verify(); + } + + @Test + void validateSequenceCorrectDeliveryFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "M02", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "M02", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "M02", null) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + } + + @Test + void validateSequenceStrictDeliveryFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + context.getPaperTrackings().getValidationConfig().setStrictDeliveryFailureCause(true); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "M02", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "M02", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", null, null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Missing deliveryFailureCause")) + .verify(); + } + + @Test + void validateSequenceInvalidDeliveryFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN002C"); + context.getPaperTrackings().getValidationConfig().setStrictDeliveryFailureCause(false); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN002A", timestamp, businessTimestamp, "REG123", "TESTERR", null), + buildEvent(UUID.randomUUID().toString(), "RECRN002B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(eventIdC, "RECRN002C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid deliveryFailureCause: TESTERR")) + .verify(); + } + + @Test + void validateSequenceInvalidDeliveryFailureCauseExpectedEmpty() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN001C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "TESTERR", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid deliveryFailureCause: TESTERR")) + .verify(); + } + + @Test + void validateSequenceDeliveryFailureCauseExpectedEmptyOK() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN001C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + } + + @Test + void validateSequenceInvalidDeliveryFailureCauseExpectedEmpty_2() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRN001C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRN001A", timestamp, businessTimestamp, "REG123", null, null), + buildEvent(UUID.randomUUID().toString(), "RECRN001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", null, List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(eventIdC, "RECRN001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "TESTERR", null) + )); + + context.setEventId(eventIdC); + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid deliveryFailureCause: TESTERR")) + .verify(); + } + + @Test + void validateSequenceDeliveryFailureCauseExpectedNullOK() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECAG001C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String eventIdC = UUID.randomUUID().toString(); + + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECAG001A", timestamp, businessTimestamp, "REG123", null, null), + buildEvent(UUID.randomUUID().toString(), "RECAG001B", timestamp, businessTimestamp.plusSeconds(1), "REG123", null, List.of(DocumentTypeEnum._23L.getValue())), + buildEvent(eventIdC, "RECAG001C", timestamp, businessTimestamp.plusSeconds(2), "REG123", null, null) + )); + + context.setEventId(eventIdC); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(sequenceValidatorAr.execute(context)) + .verifyComplete(); + } + + private Event buildEvent(String id, String statusCode, Instant statusTimestamp, Instant requestTimestamp, String registeredLetterCode, String deliveryFailureCause, List attachmentTypes) { + Event event = new Event(); + event.setAttachments(new ArrayList<>()); + event.setStatusCode(statusCode); + event.setId(id); + event.setRegisteredLetterCode(registeredLetterCode); + event.setStatusTimestamp(statusTimestamp); + event.setRequestTimestamp(requestTimestamp); + event.setDeliveryFailureCause(deliveryFailureCause); + + if (!CollectionUtils.isEmpty(attachmentTypes)) { + for (String type : attachmentTypes) { + Attachment attachment = new Attachment(); + attachment.setDocumentType(type); + event.getAttachments().add(attachment); + } + } + + return event; + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java new file mode 100644 index 000000000..7c45cbd70 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/FinalEventBuilderRirTest.java @@ -0,0 +1,205 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class FinalEventBuilderRirTest { + + @Mock + DataVaultClient dataVaultClient; + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + + FinalEventBuilderRir finalEventBuilder; + + HandlerContext handlerContext; + + PaperTrackings paperTrackings; + + private static final String EVENT_ID = UUID.randomUUID().toString(); + + @BeforeEach + void setUp() { + Instant now = Instant.now(); + handlerContext = new HandlerContext(); + handlerContext.setTrackingId("req-123"); + finalEventBuilder = new FinalEventBuilderRir(dataVaultClient, paperTrackingsDAO); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.getPaperStatus().setRegisteredLetterCode("RL123"); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M02"); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + Event event = new Event(); + event.setStatusCode("RECRI003A"); + event.setDeliveryFailureCause("M02"); + event.setStatusTimestamp(now); + event.setRequestTimestamp(now); + event.setId(EVENT_ID + "1"); + + Event event1 = new Event(); + event1.setStatusCode("RECRN003B"); + event1.setStatusTimestamp(now); + event1.setRequestTimestamp(now); + event1.setId(EVENT_ID + "2"); + + Event event2 = new Event(); + event2.setStatusCode("RECRI003C"); + event2.setStatusTimestamp(now); + event2.setRequestTimestamp(now); + event2.setId(EVENT_ID); + + paperTrackings.setEvents(List.of(event, event1, event2)); + paperTrackings.getPaperStatus().setValidatedEvents(List.of(EVENT_ID + "1", EVENT_ID + "2", EVENT_ID)); + handlerContext.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + } + + @Test + void buildRIRFinalEvent_withDiscoveredAddress() { + // Arrange + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRI003C.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertNull(handlerContext.getEventsToSend().getFirst().getDiscoveredAddress()); + Assertions.assertEquals(StatusCodeEnum.OK, handlerContext.getEventsToSend().getFirst().getStatusCode()); + Assertions.assertEquals("M02", handlerContext.getEventsToSend().getFirst().getDeliveryFailureCause()); + } + + @Test + void buildRIRFinalEvent_withoutDiscoveredAddress() { + // Arrange + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRI003C.name()); + handlerContext.setEventId(EVENT_ID); + handlerContext.setPaperProgressStatusEvent(finalEvent); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertNull(handlerContext.getEventsToSend().getFirst().getDiscoveredAddress()); + Assertions.assertEquals(StatusCodeEnum.OK, handlerContext.getEventsToSend().getLast().getStatusCode()); + Assertions.assertEquals("M02", handlerContext.getEventsToSend().getFirst().getDeliveryFailureCause()); + } + + @Test + void buildRIRFinalEvent_withRECRI004C_statusCode() { + // Arrange + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRI004C.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID); + Event event = new Event(); + event.setStatusCode(RECRI004C.name()); + event.setStatusTimestamp(Instant.now()); + event.setRequestTimestamp(Instant.now()); + event.setId(EVENT_ID); + handlerContext.getPaperTrackings().setEvents(List.of(event)); + + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + String expectedStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECRI004C.name(), RECRI004C.name(), handlerContext.getPaperTrackings()).name(); + Assertions.assertNotNull(handlerContext.getEventsToSend().getFirst().getStatusCode()); + Assertions.assertEquals(expectedStatus, handlerContext.getEventsToSend().getFirst().getStatusCode().name()); + } + + @Test + void buildRIRFinalEvent_withRECRI004C_andM02_shouldSetOkStatus() { + // Arrange + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRI004C.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID); + Event event = new Event(); + event.setStatusCode(RECRI004C.name()); + event.setStatusTimestamp(Instant.now()); + event.setRequestTimestamp(Instant.now()); + event.setId(EVENT_ID); + handlerContext.getPaperTrackings().setEvents(List.of(event)); + handlerContext.getPaperTrackings().getPaperStatus().setDeliveryFailureCause("M02"); + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(StatusCodeEnum.OK, handlerContext.getEventsToSend().getFirst().getStatusCode()); + String expectedStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECRI004C.name(), RECRI004C.name(), handlerContext.getPaperTrackings()).name(); + Assertions.assertEquals(expectedStatus, handlerContext.getEventsToSend().getFirst().getStatusCode().name()); + } + + @Test + void buildRIRFinalEvent_withRECRI004C_andM06_shouldSetKoStatus() { + // Arrange + PaperProgressStatusEvent finalEvent = getFinalEvent(RECRI004C.name()); + handlerContext.setPaperProgressStatusEvent(finalEvent); + handlerContext.setEventId(EVENT_ID); + Event event = new Event(); + event.setStatusCode(RECRI004C.name()); + event.setStatusTimestamp(Instant.now()); + event.setRequestTimestamp(Instant.now()); + event.setId(EVENT_ID); + handlerContext.getPaperTrackings().setEvents(List.of(event)); + handlerContext.getPaperTrackings().getPaperStatus().setDeliveryFailureCause("M06"); + // Act + StepVerifier.create(finalEventBuilder.execute(handlerContext)) + .verifyComplete(); + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(StatusCodeEnum.KO, handlerContext.getEventsToSend().getFirst().getStatusCode()); + String expectedStatus = TrackerUtility.evaluateStatusCodeAndRetrieveStatus(RECRI004C.name(), RECRI004C.name(), handlerContext.getPaperTrackings()).name(); + Assertions.assertEquals(expectedStatus, handlerContext.getEventsToSend().getFirst().getStatusCode().name()); + } + + private PaperProgressStatusEvent getFinalEvent(String statusCode) { + PaperProgressStatusEvent finalEvent = new PaperProgressStatusEvent(); + finalEvent.setStatusCode(statusCode); + finalEvent.setRequestId("req-123"); + finalEvent.setClientRequestTimeStamp(OffsetDateTime.now()); + finalEvent.setRegisteredLetterCode("RL123"); + finalEvent.setAttachments(new ArrayList<>()); + finalEvent.setStatusDateTime(OffsetDateTime.now()); + finalEvent.setProductType("RIR"); + return finalEvent; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRirTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRirTest.java new file mode 100644 index 000000000..d2a86714a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/HandlersFactoryRirTest.java @@ -0,0 +1,270 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.HandlerStep; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + + +@ExtendWith(MockitoExtension.class) +class HandlersFactoryRirTest { + + @Mock + private MetadataUpserter metadataUpserter; + + @Mock + private CheckTrackingProduct checkTrackingProduct; + + @Mock + private SequenceValidatorRir sequenceValidatorRir; + + @Mock + private DematValidatorRir dematValidator; + + @Mock + private FinalEventBuilderRir finalEventBuilder; + + @Mock + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private RetrySender retrySender; + + @Mock + private M10RetryTrigger m10RetryTrigger; + + @Mock + private OutputTargetSender outputTargetSender; + + @Mock + private IntermediateEventsBuilder intermediateEventsBuilder; + + @Mock + private NotRetryableErrorInserting notRetryableErrorInserting; + + @Mock + private HandlerStep mockHandlerStep1; + + @Mock + private HandlerStep mockHandlerStep2; + + @Mock + private CheckTrackingState checkTrackingState; + + @Mock + private CheckOcrResponse checkOcrResponse; + + @Mock + private RetrySenderCON996 retrySenderCON996; + + private HandlersFactoryRir handlersFactoryRir; + + private HandlerContext handlerContext; + + @BeforeEach + void setUp() { + handlerContext = new HandlerContext(); + handlersFactoryRir = new HandlersFactoryRir( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidatorRir, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996 + ); + } + + @Test + void buildEventsHandler_WithValidSteps_ExecutesAllStepsInOrder() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(sequenceValidatorRir.execute(handlerContext)).thenReturn(Mono.empty()); + when(dematValidator.execute(handlerContext)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildFinalEventsHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, sequenceValidatorRir, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(sequenceValidatorRir).execute(handlerContext); + inOrder.verify(dematValidator).execute(handlerContext); + inOrder.verify(finalEventBuilder).execute(handlerContext); + inOrder.verify(m10RetryTrigger).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + + @Test + void buildEventsHandler_WhenSecondStepFails_FirstStepStillExecuted() { + // Arrange + RuntimeException testException = new RuntimeException("Second step failed"); + + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.error(testException)); + + // Act & Assert + StepVerifier.create(handlersFactoryRir.build(EventTypeEnum.INTERMEDIATE_EVENT, handlerContext).execute(handlerContext)) + .expectError(RuntimeException.class) + .verify(); + + InOrder inOrder = inOrder(metadataUpserter, checkTrackingState); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingState).execute(handlerContext); + + } + + @Test + void buildFinalEventsHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(sequenceValidatorRir.execute(handlerContext)).thenReturn(Mono.empty()); + when(dematValidator.execute(handlerContext)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildFinalEventsHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, sequenceValidatorRir, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(sequenceValidatorRir).execute(handlerContext); + inOrder.verify(dematValidator).execute(handlerContext); + inOrder.verify(finalEventBuilder).execute(handlerContext); + inOrder.verify(m10RetryTrigger).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildIntermediateEventsHandler_ExecutesMetadataUpserterAndDeliveryPushSender() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(handlersFactoryRir.buildIntermediateEventsHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Verify both steps were executed in the correct order + InOrder inOrder = inOrder(metadataUpserter, intermediateEventsBuilder, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(intermediateEventsBuilder).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildRetryEventHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(retrySender.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildRetryEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, retrySender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(retrySender).execute(handlerContext); + } + + @Test + void buildNotRetryableEventHandler_ExecutesSuccessfully() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(handlerContext)).thenReturn(Mono.empty()); + when(duplicatedEventFiltering.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + when(intermediateEventsBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(notRetryableErrorInserting.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildNotRetryableEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, duplicatedEventFiltering, notRetryableErrorInserting, intermediateEventsBuilder, outputTargetSender); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + inOrder.verify(duplicatedEventFiltering).execute(handlerContext); + inOrder.verify(notRetryableErrorInserting).execute(handlerContext); + inOrder.verify(intermediateEventsBuilder).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildOcrResponseHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + when(checkOcrResponse.execute(handlerContext)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(handlerContext)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(handlerContext)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildOcrResponseHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(checkOcrResponse, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(checkOcrResponse).execute(handlerContext); + inOrder.verify(finalEventBuilder).execute(handlerContext); + inOrder.verify(m10RetryTrigger).execute(handlerContext); + inOrder.verify(outputTargetSender).execute(handlerContext); + } + + @Test + void buildSaveOnlyEventHandler_ExecutesMetadataUpserter() { + // Arrange + when(metadataUpserter.execute(handlerContext)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(handlerContext)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRir.buildSaveOnlyEventHandler(handlerContext).execute(handlerContext)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct); + inOrder.verify(metadataUpserter).execute(handlerContext); + inOrder.verify(checkTrackingProduct).execute(handlerContext); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRirTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRirTest.java new file mode 100644 index 000000000..1c6e6ac35 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIR/SequenceValidatorRirTest.java @@ -0,0 +1,346 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIR; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.DocumentTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static org.mockito.Mockito.*; + +class SequenceValidatorRirTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + private SequenceValidatorRir sequenceValidatorRir; + + @InjectMocks + private HandlerContext context; + + @BeforeEach + void setUp() { + MockitoAnnotations.openMocks(this); + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusCode("RECRI003C"); + PaperTrackings paperTrackings = getPaperTrackings(); + context.setPaperTrackings(paperTrackings); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + sequenceValidatorRir = new SequenceValidatorRir(paperTrackingsDAO, paperTrackerErrorService); + } + + private PaperTrackings getPaperTrackings() { + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.setValidationFlow(new ValidationFlow()); + paperTrackings.setValidationConfig(new ValidationConfig()); + return paperTrackings; + } + + @Test + void validateSequenceValidMultipleFlow1() { + + //Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp.plusSeconds(2), businessTimestamp.plusSeconds(1), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp.plusSeconds(3), businessTimestamp.plusSeconds(2), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(3), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(4), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(5), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(6), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp.plusSeconds(4), businessTimestamp.plusSeconds(7), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(8), "REG1", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(9), "REG1", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(finalEventId, "RECRI003C", timestamp.plusSeconds(5), businessTimestamp.plusSeconds(11), "REG1", "", null) + )); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidFlow003() { + //Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(finalEventId, "RECRI003C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + + @Test + void validateSequenceValidFlow004() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidFlow004MultiDocumentFailure() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "F01", List.of(DocumentTypeEnum.INDAGINE.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + // Act & Assert + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Missed required attachments for the sequence validation: [Plico]")) + .verify(); + } + + + @Test + void validateSequenceInvalidEventCount() { + // Arrange + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI003A", Instant.now(), Instant.now(), "REG123", "", null) + )); + + // Act & Assert + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + @Test + void invalidBusinessTimestamp() { + // Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp.plusSeconds(1), businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(finalEventId, "RECRI003C", timestamp.plusSeconds(2), businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + // Act & Assert + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Invalid business timestamps")) + .verify(); + } + + @Test + void validateSequenceInvalidSequenceSize() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp, businessTimestamp, "REG123", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp, "REG123", "", null) + )); + + // Act & Assert + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Necessary status code not found in events")) + .verify(); + } + + + @Test + void validateSequenceInvalidRegisteredLetterCode() { + // Arrange + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + + String finalEventId = UUID.randomUUID().toString(); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI003B", timestamp, businessTimestamp.plusSeconds(1), "REG444", "", List.of(DocumentTypeEnum.AR.getValue())), + buildEvent(finalEventId, "RECRI003C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + + // Act & Assert + context.setEventId(finalEventId); + StepVerifier.create(sequenceValidatorRir.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Registered letter codes do not match in sequence")) + .verify(); + } + + @Test + void validateSequenceValidRECRI004A() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.setEventId(finalEventId); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004A", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorRir.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidRECRI004AWithFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.setEventId(finalEventId); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004A", timestamp, businessTimestamp, "REG123", "M01", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(sequenceValidatorRir.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateSequenceValidRECRI004AWithInvalidFailureCause() { + // Arrange + context.getPaperProgressStatusEvent().setStatusCode("RECRI004C"); + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + String finalEventId = UUID.randomUUID().toString(); + context.setEventId(finalEventId); + context.getPaperTrackings().setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECRI001", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI002", timestamp, businessTimestamp, "REG123", "", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004A", timestamp, businessTimestamp, "REG123", "INVALID", null), + buildEvent(UUID.randomUUID().toString(), "RECRI004B", timestamp, businessTimestamp.plusSeconds(1), "REG123", "", List.of(DocumentTypeEnum.PLICO.getValue())), + buildEvent(finalEventId, "RECRI004C", timestamp, businessTimestamp.plusSeconds(2), "REG123", "", null) + )); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + // Act & Assert + StepVerifier.create(sequenceValidatorRir.execute(context)) +// .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && +// throwable.getMessage().contains("Invalid deliveryFailureCause: INVALID")) + .verifyComplete(); // Per ora la validazione del deliveryFailureCause per RIR non è strict + } + + private Event buildEvent(String id, String statusCode, Instant statusTimestamp, Instant requestTimestamp, String registeredLetterCode, String deliveryFailureCause, List attachmentTypes) { + Event event = new Event(); + event.setAttachments(new ArrayList<>()); + event.setStatusCode(statusCode); + event.setId(id); + event.setRegisteredLetterCode(registeredLetterCode); + event.setStatusTimestamp(statusTimestamp); + event.setRequestTimestamp(requestTimestamp); + event.setDeliveryFailureCause(deliveryFailureCause); + + if (!CollectionUtils.isEmpty(attachmentTypes)) { + for (String type : attachmentTypes) { + Attachment attachment = new Attachment(); + attachment.setDocumentType(type); + event.getAttachments().add(attachment); + } + } + + return event; + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRisTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRisTest.java new file mode 100644 index 000000000..7f0776c33 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/DematValidatorRisTest.java @@ -0,0 +1,66 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class DematValidatorRisTest { + + + @Mock + private OcrUtility ocrUtility; + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + @Mock + private HandlerContext context; + + @Mock + private PaperProgressStatusEvent paperProgressStatusEvent; + + private DematValidatorRis DematValidatorRis; + + @BeforeEach + void setUp() { + DematValidatorRis = spy(new DematValidatorRis(ocrUtility, paperTrackerErrorService)); + when(context.getPaperProgressStatusEvent()).thenReturn(paperProgressStatusEvent); + } + + @Test + void validateDematRs_whenStatusCodeIsRECRS001C_shouldReturnEmptyMono() { + + when(paperProgressStatusEvent.getStatusCode()).thenReturn(RECRSI003C.name()); + + Mono result = DematValidatorRis.execute(context); + StepVerifier.create(result) + .verifyComplete(); + verify(DematValidatorRis, never()).validateDemat(any()); + } + + @Test + void validateDematRs_whenStatusCodeIsNotExcluded_shouldCallValidateDemat() { + + String otherStatusCode = RECRS005C.name(); + when(paperProgressStatusEvent.getStatusCode()).thenReturn(otherStatusCode); + doReturn(Mono.empty()).when(DematValidatorRis).validateDemat(context); + + Mono result = DematValidatorRis.execute(context); + StepVerifier.create(result) + .verifyComplete(); + verify(DematValidatorRis, times(1)).validateDemat(context); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRisTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRisTest.java new file mode 100644 index 000000000..24d4c580b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RIS/HandlersFactoryRisTest.java @@ -0,0 +1,144 @@ +package it.pagopa.pn.papertracker.service.handler_step.RIS; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class HandlersFactoryRisTest { + + @Mock + private MetadataUpserter metadataUpserter; + + @Mock + private CheckTrackingProduct checkTrackingProduct; + + @Mock + private OutputTargetSender outputTargetSender; + + @Mock + private FinalEventBuilderRis finalEventBuilder; + + @Mock + private IntermediateEventsBuilder intermediateEventsBuilder; + + @Mock + private DematValidatorRis dematValidator; + + @Mock + private SequenceValidatorRis sequenceValidator; + + @Mock + private RetrySender retrySender; + + @Mock + private M10RetryTrigger m10RetryTrigger; + + @Mock + private NotRetryableErrorInserting notRetryableErrorInserting; + + @Mock + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private CheckTrackingState checkTrackingState; + + @Mock + private CheckOcrResponse checkOcrResponse; + + @Mock + private RetrySenderCON996 retrySenderCON996; + + private HandlersFactoryRis handlersFactoryRis; + + @BeforeEach + void setUp() { + handlersFactoryRis = new HandlersFactoryRis( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996 + ); + } + + @Test + void getProductType_returnsRisProductType() { + // Arrange / Act + ProductType productType = handlersFactoryRis.getProductType(); + + // Assert + assertEquals(ProductType.RIS, productType); + } + + @Test + void buildFinalEventsHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(metadataUpserter.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(context)).thenReturn(Mono.empty()); + when(sequenceValidator.execute(context)).thenReturn(Mono.empty()); + when(dematValidator.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRis.buildFinalEventsHandler(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, sequenceValidator, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(context); + inOrder.verify(checkTrackingProduct).execute(context); + inOrder.verify(checkTrackingState).execute(context); + inOrder.verify(sequenceValidator).execute(context); + inOrder.verify(dematValidator).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } + + @Test + void buildOcrResponseHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(checkOcrResponse.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRis.buildOcrResponseHandler(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(checkOcrResponse, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(checkOcrResponse).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRsTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRsTest.java new file mode 100644 index 000000000..07c1c1a23 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/DematValidatorRsTest.java @@ -0,0 +1,76 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class DematValidatorRsTest { + + @Mock + private OcrUtility ocrUtility; + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + @Mock + private HandlerContext context; + + @Mock + private PaperProgressStatusEvent paperProgressStatusEvent; + + private DematValidatorRs dematValidatorRs; + + @BeforeEach + void setUp() { + dematValidatorRs = spy(new DematValidatorRs(ocrUtility, paperTrackerErrorService)); + when(context.getPaperProgressStatusEvent()).thenReturn(paperProgressStatusEvent); + } + + @Test + void validateDematRs_whenStatusCodeIsRECRS001C_shouldReturnEmptyMono() { + + when(paperProgressStatusEvent.getStatusCode()).thenReturn(RECRS001C.name()); + + Mono result = dematValidatorRs.execute(context); + StepVerifier.create(result) + .verifyComplete(); + verify(dematValidatorRs, never()).validateDemat(any()); + } + + @Test + void validateDematRs_whenStatusCodeIsRECRS003C_shouldReturnEmptyMono() { + + when(paperProgressStatusEvent.getStatusCode()).thenReturn(RECRS003C.name()); + + Mono result = dematValidatorRs.execute(context); + StepVerifier.create(result) + .verifyComplete(); + verify(dematValidatorRs, never()).validateDemat(any()); + } + + @Test + void validateDematRs_whenStatusCodeIsNotExcluded_shouldCallValidateDemat() { + + String otherStatusCode = RECRS005C.name(); + when(paperProgressStatusEvent.getStatusCode()).thenReturn(otherStatusCode); + doReturn(Mono.empty()).when(dematValidatorRs).validateDemat(context); + + Mono result = dematValidatorRs.execute(context); + StepVerifier.create(result) + .verifyComplete(); + verify(dematValidatorRs, times(1)).validateDemat(context); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRsTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRsTest.java new file mode 100644 index 000000000..8d7e111ca --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/RS/HandlersFactoryRsTest.java @@ -0,0 +1,144 @@ +package it.pagopa.pn.papertracker.service.handler_step.RS; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class HandlersFactoryRsTest { + + @Mock + private MetadataUpserter metadataUpserter; + + @Mock + private CheckTrackingProduct checkTrackingProduct; + + @Mock + private OutputTargetSender outputTargetSender; + + @Mock + private FinalEventBuilderRs finalEventBuilder; + + @Mock + private IntermediateEventsBuilder intermediateEventsBuilder; + + @Mock + private DematValidatorRs dematValidator; + + @Mock + private SequenceValidatorRs sequenceValidator; + + @Mock + private RetrySender retrySender; + + @Mock + private M10RetryTrigger m10RetryTrigger; + + @Mock + private NotRetryableErrorInserting notRetryableErrorInserting; + + @Mock + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private CheckTrackingState checkTrackingState; + + @Mock + private CheckOcrResponse checkOcrResponse; + + @Mock + private RetrySenderCON996 retrySenderCON996; + + private HandlersFactoryRs handlersFactoryRs; + + @BeforeEach + void setUp() { + handlersFactoryRs = new HandlersFactoryRs( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996 + ); + } + + @Test + void getProductType_returnsRsProductType() { + // Arrange / Act + ProductType productType = handlersFactoryRs.getProductType(); + + // Assert + assertEquals(ProductType.RS, productType); + } + + @Test + void buildFinalEventsHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(metadataUpserter.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(context)).thenReturn(Mono.empty()); + when(sequenceValidator.execute(context)).thenReturn(Mono.empty()); + when(dematValidator.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRs.buildFinalEventsHandler(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, sequenceValidator, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(context); + inOrder.verify(checkTrackingProduct).execute(context); + inOrder.verify(checkTrackingState).execute(context); + inOrder.verify(sequenceValidator).execute(context); + inOrder.verify(dematValidator).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } + + @Test + void buildOcrResponseHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(checkOcrResponse.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactoryRs.buildOcrResponseHandler(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(checkOcrResponse, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(checkOcrResponse).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/TestUtils.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/TestUtils.java new file mode 100644 index 000000000..bcabf694c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/TestUtils.java @@ -0,0 +1,249 @@ +package it.pagopa.pn.papertracker.service.handler_step; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.utils.TrackerUtility; +import org.springframework.util.CollectionUtils; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Predicate; + +import static org.junit.jupiter.api.Assertions.*; + + +public class TestUtils { + + public static PaperTrackings getPaperTrackings(String requestId, ProductType productType) { + PaperTrackings pt = new PaperTrackings(); + pt.setTrackingId(requestId); + pt.setProductType(productType.getValue()); + pt.setUnifiedDeliveryDriver("POSTE"); + pt.setState(PaperTrackingsState.AWAITING_REFINEMENT); + pt.setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + pt.setCreatedAt(Instant.now()); + pt.setValidationFlow(new ValidationFlow()); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setPaperDeliveryTimestamp(Instant.now()); + pt.setPaperStatus(paperStatus); + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setStrictFinalValidationStock890(Boolean.TRUE); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(List.of("ARCAD","CAD")); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of("Plico","AR","23L")); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setSendOcrAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + pt.setValidationConfig(validationConfig); + return pt; + } + + public static PaperTrackings getPaperTrackingsOldVersion(String requestId, ProductType productType) { + PaperTrackings pt = new PaperTrackings(); + pt.setTrackingId(requestId); + pt.setProductType(productType.getValue()); + pt.setUnifiedDeliveryDriver("POSTE"); + pt.setState(PaperTrackingsState.AWAITING_FINAL_STATUS_CODE); + pt.setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + pt.setCreatedAt(Instant.now()); + pt.setValidationFlow(new ValidationFlow()); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setPaperDeliveryTimestamp(Instant.now()); + pt.setPaperStatus(paperStatus); + return pt; + } + + public static PaperTrackings getPaperTrackings(String requestId, List events) { + PaperTrackings pt = new PaperTrackings(); + pt.setTrackingId(requestId); + pt.setProductType(ProductType.AR.getValue()); + pt.setUnifiedDeliveryDriver("POSTE"); + pt.setState(PaperTrackingsState.AWAITING_REFINEMENT); + pt.setCreatedAt(Instant.now()); + pt.setValidationFlow(new ValidationFlow()); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setPaperDeliveryTimestamp(Instant.now()); + pt.setPaperStatus(paperStatus); + pt.setEvents(events); + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setStrictFinalValidationStock890(Boolean.TRUE); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(List.of("ARCAD","CAD")); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of("Plico","AR","23L")); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + pt.setValidationConfig(validationConfig); + return pt; + } + + public static List constructAttachments(String statusCode, List documents) { + List matches = documents.stream() + .filter(s -> s.split("-")[0].equalsIgnoreCase(statusCode)) + .toList(); + if (!CollectionUtils.isEmpty(matches)) { + String first = matches.getFirst(); + documents.remove(first); + return buildAttachmentDetails(first); + } + return Collections.emptyList(); + } + + public static List buildAttachmentDetails(String token) { + List types = Arrays.asList(token.split("-")[1].split("#")); + return types.stream().map(type -> AttachmentDetails.builder() + .documentType(type) + .sha256("sha256") + .id("id-" + token) + .uri("https://example.com/" + token + ".pdf") + .date(OffsetDateTime.now()) + .build()).toList(); + } + + public static PaperProgressStatusEvent createSimpleAnalogMail(String requestId, OffsetDateTime now, AtomicInteger delay, String productType) { + PaperProgressStatusEvent ev = new PaperProgressStatusEvent(); + ev.requestId(requestId); + ev.setClientRequestTimeStamp(now.plusSeconds(delay.getAndIncrement())); + ev.setStatusDateTime(now); + ev.setIun("iun"); + ev.setProductType(productType); + ev.setRegisteredLetterCode("registeredLetterCode"); + return ev; + } + + public static void assertValidatedDoneSubset(PaperTrackings pt, int totalEvents, int validated, String failure, List expectedValidatedCodes, PaperTrackingsState state, BusinessState businessState) { + assertEquals(state, pt.getState()); + assertEquals(businessState, pt.getBusinessState()); + assertEquals(totalEvents, pt.getEvents().size()); + assertEquals(validated, pt.getPaperStatus().getValidatedEvents().size()); + assertTrue(TrackerUtility.validatedEvents(pt.getPaperStatus().getValidatedEvents(), pt.getEvents()).stream().map(Event::getStatusCode).toList() + .containsAll(expectedValidatedCodes)); + + assertNull(pt.getNextRequestIdPcretry()); + assertEquals(failure, pt.getPaperStatus().getDeliveryFailureCause()); + assertNotNull(pt.getValidationFlow().getSequencesValidationTimestamp()); + assertNotNull(pt.getValidationFlow().getFinalEventDematValidationTimestamp()); + assertNotNull(pt.getValidationFlow().getFinalEventBuilderTimestamp()); + assertNotNull(pt.getPaperStatus().getRegisteredLetterCode()); + assertNotNull(pt.getPaperStatus().getFinalStatusCode()); + assertNotNull(pt.getPaperStatus().getValidatedSequenceTimestamp()); + assertNotNull(pt.getPaperStatus().getFinalDematFound()); + assertNotNull(pt.getPaperStatus().getPaperDeliveryTimestamp()); + } + + public static void assertError(PaperTrackingsErrors e, ErrorCategory cat, FlowThrow flow, String msgContains) { + assertEquals(cat, e.getErrorCategory()); + assertEquals(flow, e.getFlowThrow()); + assertEquals(ErrorType.ERROR, e.getType()); + assertNotNull(e.getCreated()); + assertNotNull(e.getTrackingId()); + assertNotNull(e.getProductType()); + assertTrue(e.getDetails().getMessage().contains(msgContains)); + assertNotNull(e.getDetails().getCause()); + } + + + public static void assertSingleError(List errs, ErrorCategory cat, FlowThrow flow, String msgContains) { + assertEquals(1, errs.size()); + PaperTrackingsErrors e = errs.getFirst(); + assertEquals(cat, e.getErrorCategory()); + assertEquals(flow, e.getFlowThrow()); + assertEquals(ErrorType.ERROR, e.getType()); + assertNotNull(e.getCreated()); + assertNotNull(e.getTrackingId()); + assertNotNull(e.getProductType()); + assertTrue(e.getDetails().getMessage().contains(msgContains)); + assertNotNull(e.getDetails().getCause()); + } + + public static void assertSingleWarning(List errs, ErrorCategory cat, FlowThrow flow, String msgContains) { + assertEquals(1, errs.size()); + PaperTrackingsErrors e = errs.getFirst(); + assertEquals(cat, e.getErrorCategory()); + assertEquals(flow, e.getFlowThrow()); + assertEquals(ErrorType.WARNING, e.getType()); + assertNotNull(e.getCreated()); + assertNotNull(e.getTrackingId()); + assertNotNull(e.getProductType()); + assertTrue(e.getDetails().getMessage().contains(msgContains)); + assertNull(e.getDetails().getCause()); + } + + public static void assertWarning(PaperTrackingsErrors e, ErrorCategory cat, FlowThrow flow, String msgContains) { + assertEquals(cat, e.getErrorCategory()); + assertEquals(flow, e.getFlowThrow()); + assertEquals(ErrorType.WARNING, e.getType()); + assertNotNull(e.getCreated()); + assertNotNull(e.getTrackingId()); + assertNotNull(e.getProductType()); + assertTrue(e.getDetails().getMessage().contains(msgContains)); + assertNull(e.getDetails().getCause()); + } + + public static void assertBaseDryRun(PaperTrackerDryRunOutputs e) { + assertNotNull(e.getTrackingId()); + assertNotNull(e.getCreated()); + assertNotNull(e.getStatusDetail()); + assertNotNull(e.getStatusCode()); + assertNotNull(e.getStatusDescription()); + assertNotNull(e.getStatusDateTime()); + assertNull(e.getAnonymizedDiscoveredAddressId()); + assertNotNull(e.getClientRequestTimestamp()); + } + + public static void assertSameRegisteredLetter(List list, int... idx) { + String last = list.get(idx[idx.length - 1]).getRegisteredLetterCode(); + for (int i : idx) assertEquals(last, list.get(i).getRegisteredLetterCode()); + } + + public static void assertAttach(PaperTrackerDryRunOutputs e, String type) { + assertEquals(1, e.getAttachments().size()); + assertEquals(type, e.getAttachments().getFirst().getDocumentType()); + } + + public static void assertAttachAnyOf(PaperTrackerDryRunOutputs e, String... types) { + assertEquals(1, e.getAttachments().size()); + String t = e.getAttachments().getFirst().getDocumentType(); + assertTrue(Arrays.stream(types).anyMatch(t::equalsIgnoreCase)); + } + + public static void assertNoAttach(PaperTrackerDryRunOutputs e) { + assertTrue(CollectionUtils.isEmpty(e.getAttachments())); + } + + public static void assertProgress(PaperTrackerDryRunOutputs e) { assertEquals("PROGRESS", e.getStatusCode()); } + public static void assertOk(PaperTrackerDryRunOutputs e) { assertEquals("OK", e.getStatusCode()); } + public static void assertKo(PaperTrackerDryRunOutputs e) { assertEquals("KO", e.getStatusCode()); } + + public static boolean is(PaperTrackerDryRunOutputs e, String status) { return status.equalsIgnoreCase(e.getStatusDetail()); } + public static boolean isOneOf(String v, String... values) { return Arrays.stream(values).anyMatch(s -> s.equalsIgnoreCase(v)); } + + public static void assertContainsStatus(List list, List expected) { + List details = list.stream().map(PaperTrackerDryRunOutputs::getStatusDetail).toList(); + assertTrue(details.containsAll(expected)); + } + + public static long count(List list, Predicate p) { + return list.stream().filter(p).count(); + } + + public static void assertValidatedDone(PaperTrackings pt, int totalEvents, int validated, String failure, PaperTrackingsState state, BusinessState businessState) { + List eventsWithoutCon = pt.getEvents().stream().filter(event -> !event.getStatusCode().startsWith("CON")).toList(); + assertEquals(state, pt.getState()); + assertEquals(businessState, pt.getBusinessState()); + assertEquals(totalEvents, pt.getEvents().size()); + assertEquals(validated, pt.getPaperStatus().getValidatedEvents().size()); + assertTrue(TrackerUtility.validatedEvents(pt.getPaperStatus().getValidatedEvents(), pt.getEvents()).stream().map(Event::getStatusCode).toList() + .containsAll(eventsWithoutCon.stream().map(Event::getStatusCode).toList())); + assertNull(pt.getNextRequestIdPcretry()); + assertEquals(failure, pt.getPaperStatus().getDeliveryFailureCause()); + assertNotNull(pt.getValidationFlow().getSequencesValidationTimestamp()); + assertNotNull(pt.getValidationFlow().getFinalEventDematValidationTimestamp()); + assertNotNull(pt.getPaperStatus().getRegisteredLetterCode()); + assertNotNull(pt.getPaperStatus().getFinalStatusCode()); + assertNotNull(pt.getPaperStatus().getValidatedSequenceTimestamp()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890Test.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890Test.java new file mode 100644 index 000000000..31e9a6325 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/FinalEventBuilder890Test.java @@ -0,0 +1,197 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.List; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class FinalEventBuilder890Test { + + @Mock + private DataVaultClient dataVaultClient; + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + private HandlerContext context; + + private PaperTrackings paperTrackings; + + private FinalEventBuilder890 finalEventBuilder890; + + private static final String EVENT_ID = UUID.randomUUID().toString(); + private Event event = new Event(); + private Event event1 = new Event(); + + @BeforeEach + void setUp() { + Instant now = Instant.now(); + context = new HandlerContext(); + context.setTrackingId("req-123"); + context.setEventId(EVENT_ID); + finalEventBuilder890 = new FinalEventBuilder890(dataVaultClient, paperTrackingsDAO); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType._890.getValue()); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.getPaperStatus().setRegisteredLetterCode("RL123"); + + event.setStatusTimestamp(now); + event.setRequestTimestamp(now); + event.setId(EVENT_ID); + + event1.setStatusTimestamp(now); + event1.setRequestTimestamp(now); + event1.setId(EVENT_ID + "1"); + + context.setPaperTrackings(paperTrackings); + } + + @Test + void executeWithStockStatus() { + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG005C.name()); + event1.setStatusCode(RECAG005A.name()); + paperTrackings.setEvents(List.of(event, event1)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(1, context.getEventsToSend().size()); + assertEquals(RECAG005C.name(), context.getEventsToSend().getFirst().getStatusDetail()); + assertNull(context.getEventsToSend().getFirst().getDeliveryFailureCause()); + assertNull(context.getEventsToSend().getFirst().getDiscoveredAddress()); + assertEquals(StatusCodeEnum.PROGRESS, context.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void executeWithoutStockStatus2COK() { + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG002C.name()); + event1.setStatusCode(RECAG002A.name()); + paperTrackings.setEvents(List.of(event, event1)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(1, context.getEventsToSend().size()); + assertEquals(RECAG002C.name(), context.getEventsToSend().getFirst().getStatusDetail()); + assertNull(context.getEventsToSend().getFirst().getDeliveryFailureCause()); + assertNull(context.getEventsToSend().getFirst().getDiscoveredAddress()); + assertEquals(StatusCodeEnum.OK, context.getEventsToSend().getFirst().getStatusCode()); + } + + + @Test + void executeWithoutStockStatus3COK() { + PaperAddress paperAddress = new PaperAddress(); + paperAddress.setCity("city"); + paperAddress.setName("name"); + paperAddress.setAddress("address"); + when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())) + .thenReturn(Mono.just(paperAddress)); + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG003C.name()); + event1.setStatusCode(RECAG003A.name()); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M02"); + paperTrackings.getPaperStatus().setAnonymizedDiscoveredAddress("discAddr"); + paperTrackings.setEvents(List.of(event, event1)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(1, context.getEventsToSend().size()); + assertEquals(RECAG003C.name(), context.getEventsToSend().getFirst().getStatusDetail()); + assertNotNull(context.getEventsToSend().getFirst().getDeliveryFailureCause()); + assertNotNull(context.getEventsToSend().getFirst().getDiscoveredAddress()); + assertEquals(StatusCodeEnum.OK, context.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void executeWithoutStockStatus3CKO() { + PaperAddress paperAddress = new PaperAddress(); + paperAddress.setCity("city"); + paperAddress.setName("name"); + paperAddress.setAddress("address"); + when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())) + .thenReturn(Mono.just(paperAddress)); + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG003C.name()); + event1.setStatusCode(RECAG003A.name()); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M06"); + paperTrackings.getPaperStatus().setAnonymizedDiscoveredAddress("discAddr"); + paperTrackings.setEvents(List.of(event, event1)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(1, context.getEventsToSend().size()); + assertEquals(RECAG003C.name(), context.getEventsToSend().getFirst().getStatusDetail()); + assertNotNull(context.getEventsToSend().getFirst().getDeliveryFailureCause()); + assertNotNull(context.getEventsToSend().getFirst().getDiscoveredAddress()); + assertEquals(StatusCodeEnum.KO, context.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void executeWithoutStockStatusF() { + PaperAddress paperAddress = new PaperAddress(); + paperAddress.setCity("city"); + paperAddress.setName("name"); + paperAddress.setAddress("address"); + when(dataVaultClient.deAnonymizeDiscoveredAddress(any(), any())) + .thenReturn(Mono.just(paperAddress)); + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG003F.name()); + event1.setStatusCode(RECAG003D.name()); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M01"); + paperTrackings.getPaperStatus().setAnonymizedDiscoveredAddress("discAddr"); + paperTrackings.setEvents(List.of(event, event1)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(1, context.getEventsToSend().size()); + assertEquals(RECAG003F.name(), context.getEventsToSend().getFirst().getStatusDetail()); + assertNotNull(context.getEventsToSend().getFirst().getDeliveryFailureCause()); + assertNotNull(context.getEventsToSend().getFirst().getDiscoveredAddress()); + assertEquals(StatusCodeEnum.KO, context.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void executeWithRECAG012event() { + context.setEventId(EVENT_ID); + event.setStatusCode(RECAG012.name()); + paperTrackings.getPaperStatus().setDeliveryFailureCause("M01"); + paperTrackings.getPaperStatus().setAnonymizedDiscoveredAddress("discAddr"); + paperTrackings.setEvents(List.of(event, event1)); + StepVerifier.create(finalEventBuilder890.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(0, context.getEventsToSend().size()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890Test.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890Test.java new file mode 100644 index 000000000..f29d2ff5d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/HandlersFactory890Test.java @@ -0,0 +1,194 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.model.EventTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.service.handler_step.Handler; +import it.pagopa.pn.papertracker.service.handler_step.HandlerImpl; +import it.pagopa.pn.papertracker.service.handler_step.generic.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InOrder; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.function.Function; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class HandlersFactory890Test { + + @Mock + private MetadataUpserter metadataUpserter; + + @Mock + private CheckTrackingProduct checkTrackingProduct; + + @Mock + private OutputTargetSender outputTargetSender; + + @Mock + private FinalEventBuilder890 finalEventBuilder; + + @Mock + private IntermediateEventsBuilder intermediateEventsBuilder; + + @Mock + private DematValidator890 dematValidator; + + @Mock + private SequenceValidator890 sequenceValidator; + + @Mock + private RetrySender retrySender; + + @Mock + private M10RetryTrigger m10RetryTrigger; + + @Mock + private NotRetryableErrorInserting notRetryableErrorInserting; + + @Mock + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private CheckTrackingState checkTrackingState; + + @Mock + private CheckOcrResponse checkOcrResponse; + + @Mock + private RetrySenderCON996 retrySenderCON996; + + @Mock + private RECAG012EventChecker recag012EventChecker; + + @Mock + private RECAG012EventBuilder recag012EventBuilder; + + @Mock + private PendingFinalEventTrigger pendingFinalEventTrigger; + + private HandlersFactory890 handlersFactory; + + @BeforeEach + void setUp() { + handlersFactory = new HandlersFactory890( + metadataUpserter, + checkTrackingProduct, + outputTargetSender, + finalEventBuilder, + intermediateEventsBuilder, + dematValidator, + sequenceValidator, + retrySender, + m10RetryTrigger, + notRetryableErrorInserting, + duplicatedEventFiltering, + checkTrackingState, + checkOcrResponse, + retrySenderCON996, + recag012EventChecker, + recag012EventBuilder, + pendingFinalEventTrigger + ); + } + + @Test + void getProductTypeReturnsCorrectProductType() { + assertEquals(ProductType._890, handlersFactory.getProductType()); + } + + @Test + void getDispatcherReturnsStockIntermediateEventHandler() { + // Arrange & Act + Function dispatcher = handlersFactory.getDispatcher(EventTypeEnum.STOCK_INTERMEDIATE_EVENT); + HandlerContext context = mock(HandlerContext.class); + Handler handler = dispatcher.apply(context); + + // Assert + assertNotNull(handler); + assertInstanceOf(HandlerImpl.class, handler); + } + + @Test + void getDispatcherReturnsRecag012EventHandler() { + // Arrange & Act + Function dispatcher = handlersFactory.getDispatcher(EventTypeEnum.RECAG012_EVENT); + HandlerContext context = mock(HandlerContext.class); + Handler handler = dispatcher.apply(context); + + // Assert + assertNotNull(handler); + assertInstanceOf(HandlerImpl.class, handler); + } + + @Test + void buildFinalEventsHandler_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(metadataUpserter.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingProduct.execute(context)).thenReturn(Mono.empty()); + when(checkTrackingState.execute(context)).thenReturn(Mono.empty()); + when(sequenceValidator.execute(context)).thenReturn(Mono.empty()); + when(dematValidator.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactory.buildFinalEventsHandler(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(metadataUpserter, checkTrackingProduct, checkTrackingState, sequenceValidator, dematValidator, finalEventBuilder, m10RetryTrigger, outputTargetSender); + inOrder.verify(metadataUpserter).execute(context); + inOrder.verify(checkTrackingProduct).execute(context); + inOrder.verify(checkTrackingState).execute(context); + inOrder.verify(sequenceValidator).execute(context); + inOrder.verify(dematValidator).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } + + @Test + void buildOcrResponseHandler890_executesM10RetryTriggerBeforeOutputTargetSender() { + // Arrange + HandlerContext context = new HandlerContext(); + when(checkOcrResponse.execute(context)).thenReturn(Mono.empty()); + when(finalEventBuilder.execute(context)).thenReturn(Mono.empty()); + when(recag012EventBuilder.execute(context)).thenReturn(Mono.empty()); + when(outputTargetSender.execute(context)).thenReturn(Mono.empty()); + when(pendingFinalEventTrigger.execute(context)).thenReturn(Mono.empty()); + when(sequenceValidator.execute(context)).thenReturn(Mono.empty()); + when(dematValidator.execute(context)).thenReturn(Mono.empty()); + when(m10RetryTrigger.execute(context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(handlersFactory.buildOcrResponseHandler890(context).execute(context)) + .verifyComplete(); + + // Assert + InOrder inOrder = inOrder(checkOcrResponse, finalEventBuilder, m10RetryTrigger, recag012EventBuilder, + outputTargetSender, pendingFinalEventTrigger, sequenceValidator, dematValidator); + inOrder.verify(checkOcrResponse).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(m10RetryTrigger).execute(context); + inOrder.verify(recag012EventBuilder).execute(context); + inOrder.verify(outputTargetSender).execute(context); + inOrder.verify(pendingFinalEventTrigger).execute(context); + inOrder.verify(sequenceValidator).execute(context); + inOrder.verify(dematValidator).execute(context); + inOrder.verify(finalEventBuilder).execute(context); + inOrder.verify(outputTargetSender).execute(context); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilderTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilderTest.java new file mode 100644 index 000000000..ab4e6ce07 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventBuilderTest.java @@ -0,0 +1,467 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.FileType; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +@DisplayName("RECAG012EventBuilder Tests") +class RECAG012EventBuilderTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @InjectMocks + private RECAG012EventBuilder recag012EventBuilder; + + private HandlerContext context; + private PaperTrackings paperTrackings; + private ValidationConfig validationConfig; + private ValidationFlow validationFlow; + private List eventsToSend; + + @BeforeEach + void setUp() { + // Common setup + eventsToSend = new ArrayList<>(); + context = new HandlerContext(); + context.setTrackingId("TEST_TRACKING_ID"); + context.setEventId("TEST_EVENT_ID"); + context.setEventsToSend(eventsToSend); + + paperTrackings = new PaperTrackings(); + validationConfig = new ValidationConfig(); + validationFlow = new ValidationFlow(); + + validationFlow.setOcrRequests(new ArrayList<>()); + + paperTrackings.setValidationConfig(validationConfig); + paperTrackings.setValidationFlow(validationFlow); + context.setPaperTrackings(paperTrackings); + } + + @Nested + class SkipScenarios { + + @Test + void shouldSkipWhenStateIsDone() { + // Arrange + paperTrackings.setState(PaperTrackingsState.DONE); + addEventToPaperTrackings("RECAG011B"); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void shouldSkipWhenEventIsFinalEventType() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + addEventToPaperTrackings("RECAG005C"); // FINAL_EVENT + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void shouldSkipWhenRecag012EventNotFound() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(false); + addEventToPaperTrackings("RECAG011B"); + // No RECAG012 event added + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + verifyNoInteractions(paperTrackingsDAO); + } + } + + @Nested + class RECAG012AEventBuilding { + + @Test + void shouldBuildRECAG012AWhenAttachmentsMissingButRECAG012Received() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(true); + addEventToPaperTrackings("RECAG012"); + + PaperProgressStatusEvent progressEvent = new PaperProgressStatusEvent(); + progressEvent.setStatusCode("RECAG012"); + progressEvent.setRequestId("TEST_REQUEST_ID"); + context.setPaperProgressStatusEvent(progressEvent); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isNotEmpty(); + assertThat(eventsToSend.get(0).getStatusCode()).isEqualTo(StatusCodeEnum.PROGRESS); + assertThat(eventsToSend.get(0).getStatusDetail()).isEqualTo("RECAG012A"); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void shouldNotBuildRECAG012AWhenFlagIsFalse() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(false); + addEventToPaperTrackings("RECAG012"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + } + + @Test + void shouldNotBuildRECAG012AWhenStatusCodeIsNotRECAG012() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(true); + addEventToPaperTrackings("RECAG011B"); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + } + } + + @Nested + class OcrDisabledOrDryMode { + + @Test + void shouldBuildFeedbackWhenOcrDisabled() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isNotEmpty(); + assertThat(eventsToSend.get(0).getStatusCode()).isEqualTo(StatusCodeEnum.OK); + assertThat(eventsToSend.get(0).getStatusDetail()).isEqualTo("RECAG012"); + } + + @Test + void shouldBuildFeedbackWhenOcrDry() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.DRY); + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isNotEmpty(); + } + } + + @Nested + class OcrRunModeEmptyRequests { + + @Test + void shouldNotBuildFeedbackWhenNoOcrRequestsMatchRequiredDocs() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(Arrays.asList("DOC_TYPE_A", "DOC_TYPE_B")); + validationConfig.setSendOcrAttachmentsRefinementStock890(List.of("DOC_TYPE_A")); + validationConfig.setOcrFileTypes(List.of(FileType.PDF.getValue())); + + OcrRequest ocrRequest = new OcrRequest(); + ocrRequest.setDocumentType("DOC_TYPE_C"); // Different type + validationFlow.setOcrRequests(Collections.singletonList(ocrRequest)); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + } + + @Test + void shouldBuildFeedbackWhenOcrRequestsListIsEmpty() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of()); + validationFlow.setOcrRequests(Collections.emptyList()); + context.setEventId("RECAG012_EVENT_ID"); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isNotEmpty(); + } + } + + @Nested + class OcrRunModeWithRequests { + + @Test + void shouldBuildFeedbackWhenAllOcrResponsesReceived() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(Arrays.asList("DOC_TYPE_A", "DOC_TYPE_B")); + + OcrRequest request1 = new OcrRequest(); + request1.setDocumentType("DOC_TYPE_A"); + request1.setResponseTimestamp(Instant.now()); + + OcrRequest request2 = new OcrRequest(); + request2.setDocumentType("DOC_TYPE_B"); + request2.setResponseTimestamp(Instant.now()); + + validationFlow.setOcrRequests(Arrays.asList(request1, request2)); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + context.setEventId("RECAG012_EVENT_ID"); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isNotEmpty(); + } + + @Test + void shouldWaitWhenNotAllOcrResponsesReceived() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(Arrays.asList("DOC_TYPE_A", "DOC_TYPE_B")); + validationConfig.setSendOcrAttachmentsRefinementStock890(Arrays.asList("DOC_TYPE_A", "DOC_TYPE_B")); + validationConfig.setOcrFileTypes(List.of(FileType.PDF.getValue())); + + OcrRequest request1 = new OcrRequest(); + request1.setDocumentType("DOC_TYPE_A"); + request1.setUri("DOC_TYPE_A.pdf"); + request1.setResponseTimestamp(Instant.now()); + + OcrRequest request2 = new OcrRequest(); + request2.setDocumentType("DOC_TYPE_B"); + request2.setUri("DOC_TYPE_B.pdf"); + request2.setResponseTimestamp(null); // Missing response + + validationFlow.setOcrRequests(Arrays.asList(request1, request2)); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void shouldWaitWhenSomeResponsesAreForDifferentDocTypes() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("DOC_TYPE_A", "DOC_TYPE_B")); + validationConfig.setSendOcrAttachmentsRefinementStock890(List.of("DOC_TYPE_A", "DOC_TYPE_B")); + validationConfig.setOcrFileTypes(List.of(FileType.PDF.getValue())); + + OcrRequest request1 = new OcrRequest(); + request1.setDocumentType("DOC_TYPE_A"); + request1.setUri("DOC_TYPE_A.pdf"); + request1.setResponseTimestamp(Instant.now()); + + OcrRequest request2 = new OcrRequest(); + request2.setDocumentType("DOC_TYPE_C"); // Wrong type + request2.setUri("DOC_TYPE_C.pdf"); + request2.setResponseTimestamp(Instant.now()); + + validationFlow.setOcrRequests(Arrays.asList(request1, request2)); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + assertThat(eventsToSend).isEmpty(); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void shouldHandleEmptyRequiredDocsList() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.RUN); + validationConfig.setRequiredAttachmentsRefinementStock890(Collections.emptyList()); + + OcrRequest request = new OcrRequest(); + request.setDocumentType("DOC_TYPE_A"); + request.setResponseTimestamp(Instant.now()); + validationFlow.setOcrRequests(Collections.singletonList(request)); + + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + context.setEventId("RECAG012_EVENT_ID"); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + } + } + + @Nested + class EdgeCases { + + @Test + void shouldNotUpdateWhenEventsListIsEmpty() { + // Arrange + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.setNeedToSendRECAG012A(false); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + addEventToPaperTrackings("RECAG011B"); + addRECAG012Event(); + + // Act + Mono result = recag012EventBuilder.execute(context); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + } + } + + // Helper methods + private void addEventToPaperTrackings(String statusCode) { + Event event = new Event(); + event.setId("TEST_EVENT_ID"); + event.setStatusCode(statusCode); + event.setStatusTimestamp(Instant.now()); + event.setRequestTimestamp(Instant.now()); + + if (paperTrackings.getEvents() == null) { + paperTrackings.setEvents(new ArrayList<>()); + } + paperTrackings.getEvents().add(event); + } + + private void addRECAG012Event() { + Event recag012Event = new Event(); + recag012Event.setId("RECAG012_EVENT_ID"); + recag012Event.setStatusCode("RECAG012"); + recag012Event.setStatusTimestamp(Instant.now()); + recag012Event.setRequestTimestamp(Instant.now()); + + if (paperTrackings.getEvents() == null) { + paperTrackings.setEvents(new ArrayList<>()); + } + paperTrackings.getEvents().add(recag012Event); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventCheckerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventCheckerTest.java new file mode 100644 index 000000000..37bb4eeb1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/RECAG012EventCheckerTest.java @@ -0,0 +1,458 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import com.sngular.apigenerator.asyncapi.business_model.model.event.DataDTO; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataPayloadDTO; +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.DocumentTypeEnum; +import it.pagopa.pn.papertracker.model.FileType; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class RECAG012EventCheckerTest { + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + @Mock + PnPaperTrackerConfigs cfg; + @Mock + OcrMomProducer ocrMomProducer; + @Mock + SafeStorageClient safeStorageClient; + + @InjectMocks + private RECAG012EventChecker recag012EventChecker; + + private HandlerContext context; + + @BeforeEach + void setUp() { + OcrUtility ocrUtility = new OcrUtility(ocrMomProducer, safeStorageClient, cfg, paperTrackingsDAO); + recag012EventChecker = new RECAG012EventChecker(ocrUtility); + context = new HandlerContext(); + context.setTrackingId("trackingId"); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("trackingId"); + paperTrackings.setProductType(ProductType._890.getValue()); + paperTrackings.setValidationConfig(new ValidationConfig()); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setRegisteredLetterCode("RL123"); + paperTrackings.setPaperStatus(paperStatus); + context.setPaperTrackings(paperTrackings); + } + + @Test + void execute_CurrentEventIsStockIntermediate_RequiredAttachmentsAndRecag012Present_OcrEnabled() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG005B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG005B"), + getEvent("RECAG012", null, "eventIdRECAG012") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("uri.pdf"); + + ArgumentCaptor ocrEventArgumentCaptor = ArgumentCaptor.forClass(OcrEvent.class); + verify(ocrMomProducer, times(1)).push(ocrEventArgumentCaptor.capture()); + OcrDataPayloadDTO pushedEventPayload = ocrEventArgumentCaptor.getValue().getPayload(); + assertEquals("trackingId#eventIdRECAG012#23L", pushedEventPayload.getCommandId()); + assertEquals(DataDTO.ProductType._890, pushedEventPayload.getData().getProductType()); + assertEquals(DataDTO.DocumentType._23L, pushedEventPayload.getData().getDocumentType()); + assertNull(pushedEventPayload.getData().getUnifiedDeliveryDriver()); + assertEquals("presigned-url", pushedEventPayload.getData().getDetails().getAttachment()); + assertEquals("RL123", pushedEventPayload.getData().getDetails().getRegisteredLetterCode()); + assertNotNull(pushedEventPayload.getData().getDetails().getNotificationDate()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryFailureCause()); + assertEquals("RECAG012", pushedEventPayload.getData().getDetails().getDeliveryDetailCode()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryAttemptDate()); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.RUN, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertEquals(PaperTrackingsState.AWAITING_OCR, updatedPaperTracking.getState()); + assertEquals(1, updatedPaperTracking.getValidationFlow().getOcrRequests().size()); + assertEquals("eventIdRECAG005B", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("uri.pdf", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getUri()); + assertEquals("23L", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + assertNotNull(updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getRequestTimestamp()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsStockIntermediate_RequiredAttachmentsAndRecag012Present_OcrDisabled() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG005B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG005B"), + getEvent("RECAG012", null, "eventIdRECAG012") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verifyNoInteractions(safeStorageClient); + verifyNoInteractions(ocrMomProducer); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.DISABLED, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertTrue(updatedPaperTracking.getValidationFlow().getOcrRequests().isEmpty()); + assertNotNull(updatedPaperTracking.getValidationFlow().getRefinementDematValidationTimestamp()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsStockIntermediate_RequiredAttachmentsMissingAndRecag012Present() { + //Arrange + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.CAD.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG005B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG005B"), + getEvent("RECAG012", null, "eventIdRECAG012") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verifyNoInteractions(safeStorageClient); + verifyNoInteractions(ocrMomProducer); + verifyNoInteractions(paperTrackingsDAO); + + assertTrue(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsStockIntermediate_RequiredAttachmentsPresentAndRecag012Missing() { + //Arrange + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG005B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG005B"), + getEvent("RECAG005A", null, "eventIdRECAG005A") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verifyNoInteractions(safeStorageClient); + verifyNoInteractions(ocrMomProducer); + verifyNoInteractions(paperTrackingsDAO); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsRECAG012_RequiredAttachmentsPresent_OcrEnabled() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("uri.pdf"); + + ArgumentCaptor ocrEventArgumentCaptor = ArgumentCaptor.forClass(OcrEvent.class); + verify(ocrMomProducer, times(1)).push(ocrEventArgumentCaptor.capture()); + OcrDataPayloadDTO pushedEventPayload = ocrEventArgumentCaptor.getValue().getPayload(); + assertEquals("trackingId#eventIdRECAG012#23L", pushedEventPayload.getCommandId()); + assertEquals(DataDTO.ProductType._890, pushedEventPayload.getData().getProductType()); + assertEquals(DataDTO.DocumentType._23L, pushedEventPayload.getData().getDocumentType()); + assertNull(pushedEventPayload.getData().getUnifiedDeliveryDriver()); + assertEquals("presigned-url", pushedEventPayload.getData().getDetails().getAttachment()); + assertEquals("RL123", pushedEventPayload.getData().getDetails().getRegisteredLetterCode()); + assertNotNull(pushedEventPayload.getData().getDetails().getNotificationDate()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryFailureCause()); + assertEquals("RECAG012", pushedEventPayload.getData().getDetails().getDeliveryDetailCode()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryAttemptDate()); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.RUN, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertEquals(PaperTrackingsState.AWAITING_OCR, updatedPaperTracking.getState()); + assertEquals(1, updatedPaperTracking.getValidationFlow().getOcrRequests().size()); + assertEquals("eventIdRECAG007B", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("uri.pdf", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getUri()); + assertEquals("23L", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + assertNotNull(updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getRequestTimestamp()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsRECAG012_TwoRequiredAttachmentsPresent_OcrEnabled() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.CAD.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue())); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verify(safeStorageClient, times(2)).getSafeStoragePresignedUrl("uri.pdf"); + + ArgumentCaptor ocrEventArgumentCaptor = ArgumentCaptor.forClass(OcrEvent.class); + verify(ocrMomProducer, times(2)).push(ocrEventArgumentCaptor.capture()); + List pushedEvents = ocrEventArgumentCaptor.getAllValues(); + OcrDataPayloadDTO secondPushedEventPayload = pushedEvents.getFirst().getPayload(); + OcrDataPayloadDTO firstPushedEventPayload = pushedEvents.getLast().getPayload(); + assertEquals("trackingId#eventIdRECAG012#ARCAD", firstPushedEventPayload.getCommandId()); + assertEquals("presigned-url-1", firstPushedEventPayload.getData().getDetails().getAttachment()); + assertEquals("RL123", firstPushedEventPayload.getData().getDetails().getRegisteredLetterCode()); + assertNotNull(firstPushedEventPayload.getData().getDetails().getNotificationDate()); + assertNull(firstPushedEventPayload.getData().getDetails().getDeliveryFailureCause()); + assertEquals("RECAG012", firstPushedEventPayload.getData().getDetails().getDeliveryDetailCode()); + assertNull(firstPushedEventPayload.getData().getDetails().getDeliveryAttemptDate()); + + assertEquals("trackingId#eventIdRECAG012#23L", secondPushedEventPayload.getCommandId()); + assertEquals("presigned-url-1", secondPushedEventPayload.getData().getDetails().getAttachment()); + assertEquals("RL123", secondPushedEventPayload.getData().getDetails().getRegisteredLetterCode()); + assertNotNull(secondPushedEventPayload.getData().getDetails().getNotificationDate()); + assertNull(secondPushedEventPayload.getData().getDetails().getDeliveryFailureCause()); + assertEquals("RECAG012", secondPushedEventPayload.getData().getDetails().getDeliveryDetailCode()); + assertNull(secondPushedEventPayload.getData().getDetails().getDeliveryAttemptDate()); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.RUN, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertEquals(PaperTrackingsState.AWAITING_OCR, updatedPaperTracking.getState()); + assertEquals(2, updatedPaperTracking.getValidationFlow().getOcrRequests().size()); + assertEquals("eventIdRECAG007B", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("uri.pdf", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getUri()); + assertEquals("23L", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + assertNotNull(updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getRequestTimestamp()); + + assertEquals("eventIdRECAG007B", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getFinalEventId()); + assertEquals("uri.pdf", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getUri()); + assertEquals("ARCAD", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getDocumentType()); + assertNotNull(updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getRequestTimestamp()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void execute_CurrentEventIsRECAG012_Only23LPresentForOcr_OcrEnabled() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.CAD.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B") + )); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("uri.pdf"); + + ArgumentCaptor ocrEventArgumentCaptor = ArgumentCaptor.forClass(OcrEvent.class); + verify(ocrMomProducer, times(1)).push(ocrEventArgumentCaptor.capture()); + OcrDataPayloadDTO pushedEventPayload = ocrEventArgumentCaptor.getValue().getPayload(); + assertEquals("trackingId#eventIdRECAG012#23L", pushedEventPayload.getCommandId()); + assertEquals("presigned-url-1", pushedEventPayload.getData().getDetails().getAttachment()); + assertEquals("RL123", pushedEventPayload.getData().getDetails().getRegisteredLetterCode()); + assertNotNull(pushedEventPayload.getData().getDetails().getNotificationDate()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryFailureCause()); + assertEquals("RECAG012", pushedEventPayload.getData().getDetails().getDeliveryDetailCode()); + assertNull(pushedEventPayload.getData().getDetails().getDeliveryAttemptDate()); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.RUN, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertEquals(PaperTrackingsState.AWAITING_OCR, updatedPaperTracking.getState()); + assertEquals(1, updatedPaperTracking.getValidationFlow().getOcrRequests().size()); + + assertEquals("eventIdRECAG007B", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("uri.pdf", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getUri()); + assertEquals("23L", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + assertNotNull(updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getRequestTimestamp()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void notSendToOCRForInvalidStateWhenReceiveIntermediateStockEvent() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().setState(PaperTrackingsState.DONE); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.CAD.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B") + )); + context.setEventId("eventIdRECAG007B"); + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verifyNoInteractions(safeStorageClient); + verifyNoInteractions(ocrMomProducer); + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void notSendToOCRForInvalidStateWhenReceiveRECAG012Event() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().setState(PaperTrackingsState.AWAITING_OCR); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.CAD.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B") + )); + context.setEventId("eventIdRECAG012"); + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verifyNoInteractions(safeStorageClient); + verifyNoInteractions(ocrMomProducer); + assertFalse(context.isNeedToSendRECAG012A()); + } + + @Test + void sendToOCROnlyLastAttachmentsForDocumentType() { + //Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + context.getPaperTrackings().getValidationConfig().setRequiredAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.CAD.getValue(), DocumentTypeEnum.PLICO.getValue())); + context.getPaperTrackings().getValidationConfig().setSendOcrAttachmentsRefinementStock890(List.of(DocumentTypeEnum._23L.getValue(), DocumentTypeEnum.ARCAD.getValue(), DocumentTypeEnum.PLICO.getValue())); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECAG012", null, "eventIdRECAG012"), + getEvent("RECAG007B", DocumentTypeEnum._23L.getValue(), "eventIdRECAG007B"), + getEvent("RECAG011B", DocumentTypeEnum.PLICO.getValue(), "eventIdRECAG011B"), + getEvent("RECAG007B", DocumentTypeEnum.INDAGINE.getValue(), "eventIdRECAG007B2") + )); + context.setEventId("eventIdRECAG011B2"); + + //Act + StepVerifier.create(recag012EventChecker.execute(context)) + .verifyComplete(); + + //Assert + verify(safeStorageClient, times(3)).getSafeStoragePresignedUrl("uri.pdf"); + + verify(ocrMomProducer, times(3)).push(any(OcrEvent.class)); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTracking = paperTrackingsArgumentCaptor.getValue(); + assertEquals(OcrStatusEnum.RUN, updatedPaperTracking.getValidationConfig().getOcrEnabled()); + assertEquals(PaperTrackingsState.AWAITING_OCR, updatedPaperTracking.getState()); + assertEquals(3, updatedPaperTracking.getValidationFlow().getOcrRequests().size()); + + assertEquals("eventIdRECAG007B", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("23L", updatedPaperTracking.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + assertEquals("eventIdRECAG011B", updatedPaperTracking.getValidationFlow().getOcrRequests().get(1).getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().get(1).getFinalEventId()); + assertEquals("Plico", updatedPaperTracking.getValidationFlow().getOcrRequests().get(1).getDocumentType()); + assertEquals("eventIdRECAG007B2", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getAttachmentEventId()); + assertEquals("eventIdRECAG012", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getFinalEventId()); + assertEquals("ARCAD", updatedPaperTracking.getValidationFlow().getOcrRequests().getLast().getDocumentType()); + + assertFalse(context.isNeedToSendRECAG012A()); + } + + private Event getEvent(String statusCode, String documentType, String eventId) { + Event event = new Event(); + event.setStatusCode(statusCode); + event.setProductType(ProductType._890.getValue()); + event.setId(eventId); + event.setRegisteredLetterCode("RL123"); + event.setCreatedAt(Instant.now()); + event.setStatusTimestamp(Instant.now()); + if (StringUtils.hasText(documentType)) { + Attachment attachment = new Attachment(); + attachment.setUri("uri.pdf"); + attachment.setDocumentType("ARCAD"); + Attachment attachment1 = new Attachment(); + attachment1.setUri("uri.pdf"); + attachment1.setDocumentType(documentType); + event.setAttachments(List.of(attachment, attachment1)); + } + return event; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890Test.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890Test.java new file mode 100644 index 000000000..7783d7a1c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/_890/SequenceValidator890Test.java @@ -0,0 +1,286 @@ +package it.pagopa.pn.papertracker.service.handler_step._890; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.DocumentTypeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +import static it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState.DONE; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class SequenceValidator890Test { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackerErrorService paperTrackerErrorService; + + private SequenceValidator890 sequenceValidator890; + + private HandlerContext context; + + @BeforeEach + void setUp() { + sequenceValidator890 = new SequenceValidator890(paperTrackingsDAO, paperTrackerErrorService); + context = new HandlerContext(); + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusDateTime(OffsetDateTime.now()); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + } + + @Test + void executeWithStockStatusFalse() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + Attachment attach = new Attachment(); + attach.setDocumentType("23L"); + paperTrackings.setState(DONE); + paperTrackings.getEvents().forEach(event -> event.setStatusCode(event.getStatusCode().replaceAll("RECAG005", "RECAG002"))); + context.getPaperProgressStatusEvent().setStatusCode("RECAG002C"); + context.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void executeWithStockStatusTrueAndStateDONE() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.setState(DONE); + Attachment attach = new Attachment(); + attach.setDocumentType("23L"); + Attachment attach2 = new Attachment(); + attach2.setDocumentType("ARCAD"); + paperTrackings.getEvents().stream().filter(event -> event.getStatusCode().equalsIgnoreCase("RECAG005B")) + .findFirst() + .map(event -> { + event.setAttachments(List.of(attach, attach2)); + return event; + }); + Event event1 = buildEvent(UUID.randomUUID().toString(), "RECAG010", Instant.now(), Instant.now(), null); + Event event2 = buildEvent(UUID.randomUUID().toString(), "RECAG011A", Instant.now(), Instant.now(), null); + Event event3 = buildEvent(UUID.randomUUID().toString(), "RECAG012", Instant.now(), Instant.now(), null); + + List tmpList = new ArrayList<>(paperTrackings.getEvents()); + tmpList.add(event1); + tmpList.add(event2); + tmpList.add(event3); + paperTrackings.setEvents(tmpList); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setEventId(eventId); + context.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .verifyComplete(); + + // Assert + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void executeWithStockStatusTrueAndStateAWAITING_REFINEMENT() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.setState(PaperTrackingsState.AWAITING_REFINEMENT); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setPaperTrackings(paperTrackings); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException) + .verify(); + + // Assert + verify(paperTrackingsDAO, never()).updateItem(any(), any()); + } + + @Test + void executeWithStockStatusTrueAndStateAWAITING_OCR() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(new PaperTrackings())); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .verifyComplete(); + + // Assert + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), captor.capture()); + assertEquals(BusinessState.AWAITING_REFINEMENT_OCR, captor.getValue().getBusinessState()); + assertTrue(context.isStopExecution()); + } + + @Test + void executeWithStockStatusTrueAndStateKO() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.setState(PaperTrackingsState.KO); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setPaperTrackings(paperTrackings); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException) + .verify(); + + // Assert + verify(paperTrackingsDAO, never()).updateItem(any(), any()); + } + + @Test + void executeWithStockStatusFalseStrictFinalValidationStock890FalseSaveFourErrors() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.getValidationConfig().setStrictFinalValidationStock890(Boolean.FALSE); + paperTrackings.setState(DONE); + paperTrackings.setEvents(paperTrackings.getEvents() + .stream() + .filter(event -> !event.getStatusCode().equalsIgnoreCase("RECAG005B")) + .collect(Collectors.toList())); + paperTrackings.getEvents().getFirst().setStatusTimestamp(Instant.now().plusSeconds(10)); + paperTrackings.getEvents().getFirst().setRegisteredLetterCode("REG999"); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + when(paperTrackerErrorService.insertPaperTrackingsError(any())).thenReturn(Mono.just(new PaperTrackingsErrors())); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .verifyComplete(); + + // Assert + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackerErrorService, times(4)).insertPaperTrackingsError(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + assertNull(paperTrackingsArgumentCaptor.getValue().getPaperStatus().getValidatedSequenceTimestamp()); + assertNull(paperTrackingsArgumentCaptor.getValue().getPaperStatus().getRegisteredLetterCode()); + assertEquals(2, paperTrackingsArgumentCaptor.getValue().getPaperStatus().getValidatedEvents().size()); + assertNull(paperTrackingsArgumentCaptor.getValue().getPaperStatus().getDeliveryFailureCause()); + assertNotNull(paperTrackingsArgumentCaptor.getValue().getValidationFlow().getSequencesValidationTimestamp()); + } + + @Test + void executeWithDifferentRegisteredLetterCodeForRECAG012() { + // Arrange + String eventId = UUID.randomUUID().toString(); + PaperTrackings paperTrackings = getPaperTrackings(eventId); + paperTrackings.setState(DONE); + Attachment attach = new Attachment(); + attach.setDocumentType("ARCAD"); + paperTrackings.getEvents().stream().filter(event -> event.getStatusCode().equalsIgnoreCase("RECAG005B")) + .findFirst() + .map(event -> { + event.getAttachments().add(attach); + return event; + }); + Event event1 = buildEvent(UUID.randomUUID().toString(), "RECAG010", Instant.now(), Instant.now(), null); + Event event2 = buildEvent(UUID.randomUUID().toString(), "RECAG011A", Instant.now(), Instant.now(), null); + Event event3 = buildEvent(UUID.randomUUID().toString(), "RECAG012", Instant.now(), Instant.now(), null); + event3.setRegisteredLetterCode("REG999"); + + List tmpList = new ArrayList<>(paperTrackings.getEvents()); + tmpList.add(event1); + tmpList.add(event2); + tmpList.add(event3); + paperTrackings.setEvents(tmpList); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.setPaperTrackings(paperTrackings); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + context.setEventId(eventId); + // Act + StepVerifier.create(sequenceValidator890.execute(context)) + .verifyComplete(); + + // Assert + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + assertEquals("REG123", paperTrackingsArgumentCaptor.getValue().getPaperStatus().getRegisteredLetterCode()); + } + + private PaperTrackings getPaperTrackings(String eventId) { + Instant timestamp = Instant.now(); + Instant businessTimestamp = Instant.now(); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.setValidationFlow(new ValidationFlow()); + paperTrackings.setEvents(List.of( + buildEvent(UUID.randomUUID().toString(), "RECAG005A", timestamp, businessTimestamp, null), + buildEvent(UUID.randomUUID().toString(), "RECAG005B", timestamp, businessTimestamp.plusSeconds(1), List.of(DocumentTypeEnum._23L.getValue())), + buildEvent(eventId, "RECAG005C", timestamp, businessTimestamp.plusSeconds(2), null) + )); + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setStrictFinalValidationStock890(Boolean.TRUE); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(List.of("ARCAD", "CAD")); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of("Plico", "AR", "23L")); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + paperTrackings.setValidationConfig(validationConfig); + return paperTrackings; + } + + private Event buildEvent(String id, String statusCode, Instant statusTimestamp, Instant requestTimestamp, List attachmentTypes) { + Event event = new Event(); + event.setAttachments(new ArrayList<>()); + event.setStatusCode(statusCode); + event.setId(id); + event.setRegisteredLetterCode("REG123"); + event.setStatusTimestamp(statusTimestamp); + event.setRequestTimestamp(requestTimestamp); + event.setDeliveryFailureCause(""); + + if (!CollectionUtils.isEmpty(attachmentTypes)) { + for (String type : attachmentTypes) { + Attachment attachment = new Attachment(); + attachment.setDocumentType(type); + event.getAttachments().add(attachment); + } + } + + return event; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponseTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponseTest.java new file mode 100644 index 000000000..b0087d72e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckOcrResponseTest.java @@ -0,0 +1,119 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.sngular.apigenerator.asyncapi.business_model.model.event.Data; +import com.sngular.apigenerator.asyncapi.business_model.model.event.OcrDataResultPayload; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class CheckOcrResponseTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + private CheckOcrResponse checkOcrResponse; + + private HandlerContext context; + private PaperTrackings paperTrackings; + + @BeforeEach + void setUp() { + context = new HandlerContext(); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("trackingId-1"); + ValidationConfig config = new ValidationConfig(); + config.setOcrEnabled(OcrStatusEnum.RUN); + paperTrackings.setValidationConfig(config); + Event event = new Event(); + event.setDryRun(false); + event.setId("event-1"); + paperTrackings.setState(PaperTrackingsState.AWAITING_OCR); + paperTrackings.setEvents(List.of(event)); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setOcrRequests(List.of()); + paperTrackings.setValidationFlow(validationFlow); + context.setPaperTrackings(paperTrackings); + OcrDataResultPayload ocrPayload = OcrDataResultPayload.builder() + .commandId("trackingId-1#event-1#AR") + .data(Data.builder().validationStatus(Data.ValidationStatus.OK).build()) + .build(); + context.setOcrDataResultPayload(ocrPayload); + checkOcrResponse = new CheckOcrResponse(paperTrackingsDAO, new ObjectMapper()); + } + + @Test + void execute_invalidState_ocrRUN() { + paperTrackings.setState(PaperTrackingsState.DONE); + StepVerifier.create(checkOcrResponse.execute(context)) + .expectError(PnPaperTrackerValidationException.class) + .verify(); + } + + @Test + void execute_invalidState_ocrDRY_ocrValidationStatusOK() { + paperTrackings.setState(PaperTrackingsState.DONE); + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.DRY); + when(paperTrackingsDAO.updateOcrRequests(any(), any(), eq(Data.ValidationStatus.OK))).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(checkOcrResponse.execute(context)) + .verifyComplete(); + assertTrue(context.isStopExecution()); + } + + @Test + void execute_invalidState_ocrDRY_ocrValidationStatusKO() { + paperTrackings.setState(PaperTrackingsState.DONE); + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.DRY); + context.getOcrDataResultPayload().setData(Data.builder().validationStatus(Data.ValidationStatus.KO).build()); + when(paperTrackingsDAO.updateOcrRequests(any(), any(), eq(Data.ValidationStatus.KO))).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(checkOcrResponse.execute(context)) + .expectError(PnPaperTrackerValidationException.class) + .verify(); + } + + @Test + void execute_ocrRUN_ocrValidationStatusKO() { + context.getOcrDataResultPayload().setData(Data.builder().validationStatus(Data.ValidationStatus.KO).build()); + when(paperTrackingsDAO.updateOcrRequests(any(), any(), eq(Data.ValidationStatus.KO))).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(checkOcrResponse.execute(context)) + .expectError(PnPaperTrackerValidationException.class) + .verify(); + } + + @Test + void execute_ocrRUN_ocrValidationStatusOK() { + when(paperTrackingsDAO.updateOcrRequests(any(), any(), eq(Data.ValidationStatus.OK))).thenReturn(Mono.just(paperTrackings)); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + StepVerifier.create(checkOcrResponse.execute(context)) + .verifyComplete(); + assertFalse(context.isStopExecution()); + } + + @Test + void execute_ocrRUN_ocrValidationStatusPENDING() { + when(paperTrackingsDAO.updateOcrRequests(any(), any(), eq(Data.ValidationStatus.PENDING))).thenReturn(Mono.just(paperTrackings)); + context.getOcrDataResultPayload().setData(Data.builder().validationStatus(Data.ValidationStatus.PENDING).build()); + StepVerifier.create(checkOcrResponse.execute(context)) + .verifyComplete(); + assertTrue(context.isStopExecution()); + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProductTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProductTest.java new file mode 100644 index 000000000..9ea5d0a27 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingProductTest.java @@ -0,0 +1,118 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.test.StepVerifier; + +import java.time.OffsetDateTime; +import java.util.List; + + +@ExtendWith(MockitoExtension.class) +public class CheckTrackingProductTest { + + @InjectMocks + private CheckTrackingProduct checkTrackingProduct; + + private HandlerContext context; + + @BeforeEach + void setUp() { + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + PaperTrackings paperTrackings = new PaperTrackings(); + context = new HandlerContext(); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + context.setPaperTrackings(paperTrackings); + } + + @Test + void execute_shouldCompleteWhenProductTypeMatch() { + + context.getPaperTrackings().setProductType("AR"); + context.getPaperProgressStatusEvent().setStatusCode("RECRN006"); + context.getPaperProgressStatusEvent().setProductType("AR"); + + StepVerifier.create(checkTrackingProduct.execute(context)) + .verifyComplete(); + } + + @Test + void execute_shouldCompleteWhenProductTypeAll() { + + context.getPaperTrackings().setProductType("AR"); + context.getPaperProgressStatusEvent().setStatusCode("CON998"); + context.getPaperProgressStatusEvent().setProductType("AR"); + + StepVerifier.create(checkTrackingProduct.execute(context)) + .verifyComplete(); + } + + @Test + void execute_shouldReturnErrorWhenProductTypeDontMatchWithStatusCodeALL() { + + Event event = new Event(); + event.setId("eventId"); + event.setStatusCode("CON020"); + OffsetDateTime offsetDateTime = OffsetDateTime.now(); + + context.setEventId("eventId"); + context.getPaperTrackings().setProductType("AR"); + context.getPaperTrackings().setEvents(List.of(event)); + context.getPaperProgressStatusEvent().setStatusCode("CON020"); + context.getPaperProgressStatusEvent().setProductType("RIR"); + context.getPaperProgressStatusEvent().setStatusDateTime(offsetDateTime); + + StepVerifier.create(checkTrackingProduct.execute(context)) + .verifyComplete(); + } + + @Test + void execute_shouldReturnErrorWhenEnumProductTypeDontMatch() { + + Event event = new Event(); + event.setId("eventId"); + event.setStatusCode("RECAG005C"); + OffsetDateTime offsetDateTime = OffsetDateTime.now(); + + context.setEventId("eventId"); + context.getPaperTrackings().setProductType("AR"); + context.getPaperTrackings().setEvents(List.of(event)); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.getPaperProgressStatusEvent().setProductType("AR"); + context.getPaperProgressStatusEvent().setStatusDateTime(offsetDateTime); + + StepVerifier.create(checkTrackingProduct.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Product type mismatch for trackingId null: expected AR, but got 890")) + .verify(); + } + + @Test + void execute_shouldReturnErrorWhenPayloadProductTypeDontMatch() { + + Event event = new Event(); + event.setId("eventId"); + event.setStatusCode("RECAG005C"); + OffsetDateTime offsetDateTime = OffsetDateTime.now(); + + context.setEventId("eventId"); + context.getPaperTrackings().setProductType("AR"); + context.getPaperTrackings().setEvents(List.of(event)); + context.getPaperProgressStatusEvent().setStatusCode("RECAG005C"); + context.getPaperProgressStatusEvent().setProductType("RIR"); + context.getPaperProgressStatusEvent().setStatusDateTime(offsetDateTime); + + StepVerifier.create(checkTrackingProduct.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Product type mismatch for trackingId null: expected AR, but got RIR")) + .verify(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingStateTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingStateTest.java new file mode 100644 index 000000000..9249c67cf --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/CheckTrackingStateTest.java @@ -0,0 +1,142 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.BusinessState; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.test.StepVerifier; + +import java.time.OffsetDateTime; + +@ExtendWith(MockitoExtension.class) +class CheckTrackingStateTest { + + @InjectMocks + private CheckTrackingState checkTrackingState; + + private HandlerContext context; + + @BeforeEach + void setUp() { + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusDateTime(OffsetDateTime.now()); + PaperTrackings paperTrackings = new PaperTrackings(); + Event event = new Event(); + event.setId("id"); + paperTrackings.setEvents(java.util.List.of(event)); + context = new HandlerContext(); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + context.setPaperTrackings(paperTrackings); + context.setEventId("id"); + } + + @Test + void execute_shouldCompleteWhenStatusCodeStartsWithCON() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("CON998"); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .verifyComplete(); + } + + @Test + void execute_shouldThrowExceptionWhenStateIsDone() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECRN002A"); + context.getPaperTrackings().setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + context.getPaperTrackings().setState(PaperTrackingsState.DONE); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Tracking in state DONE")) + .verify(); + } + + @Test + void execute_shouldThrowExceptionWhenStateIsDoneForRecAg012() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECAG012"); + context.getPaperTrackings().setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + context.getPaperTrackings().setState(PaperTrackingsState.DONE); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Tracking in state DONE")) + .verify(); + } + + @Test + void execute_shouldThrowExceptionWhenStateIsAwaitingOcr() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECRN004C"); + context.getPaperTrackings().setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + context.getPaperTrackings().setState(PaperTrackingsState.AWAITING_OCR); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Tracking in state AWAITING_OCR")) + .verify(); + } + + @Test + void execute_shouldThrowExceptionWhenStateIsAwaitingOcrForRecAg012() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECAG012"); + context.getPaperTrackings().setBusinessState(BusinessState.AWAITING_FINAL_STATUS_CODE); + context.getPaperTrackings().setState(PaperTrackingsState.AWAITING_OCR); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().contains("Tracking in state AWAITING_OCR")) + .verify(); + + } + + @Test + void execute_shouldCompleteWhenStateIsNotDoneOrAwaitingOcr() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECRN006"); + context.getPaperTrackings().setBusinessState(BusinessState.DONE); + context.getPaperTrackings().setState(PaperTrackingsState.AWAITING_REFINEMENT); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .verifyComplete(); + + } + + @Test + void execute_shouldCompleteWhenStateIsNotDoneOrAwaitingOcrfRecAG012() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECAG012"); + context.getPaperTrackings().setBusinessState(BusinessState.DONE); + context.getPaperTrackings().setState(PaperTrackingsState.AWAITING_REFINEMENT); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .verifyComplete(); + } + + @Test + void execute_shouldCompleteWhenStatusCodeIsFinalDemat() { + // Arrange + context.getPaperTrackings().getEvents().getFirst().setStatusCode("RECRS002B"); + + // Act & Assert + StepVerifier.create(checkTrackingState.execute(context)) + .verifyComplete(); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFilteringTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFilteringTest.java new file mode 100644 index 000000000..163ce4d9d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/DuplicatedEventFilteringTest.java @@ -0,0 +1,236 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.pndatavault.model.PaperAddress; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class DuplicatedEventFilteringTest { + + @InjectMocks + private DuplicatedEventFiltering duplicatedEventFiltering; + + @Mock + private DataVaultClient dataVaultClient; + + private HandlerContext context; + private OffsetDateTime offsetDateTime = OffsetDateTime.now(); + + @BeforeEach + void setup(){ + context = new HandlerContext(); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setState(PaperTrackingsState.DONE); + Attachment attachment1 = new Attachment(); + attachment1.setId("attachment-id-1"); + attachment1.setDocumentType("DOCUMENT_TYPE"); + attachment1.setSha256("sha256hash"); + attachment1.setDate(offsetDateTime.toInstant()); + Event event = new Event(); + event.setId("event-id-1"); + event.setRequestTimestamp(Instant.now()); + event.setStatusCode("RECRN003C"); + event.setStatusTimestamp(Instant.now()); + event.setProductType(ProductType.AR.getValue()); + event.setAttachments(new ArrayList<>()); + event.setAnonymizedDiscoveredAddressId("anonymized_addr_377a1b51-d241-4ce3-b1c8-0802650e48f4"); + Event event1 = new Event(); + event1.setId("event-id-1"); + event1.setRequestTimestamp(Instant.now()); + event1.setStatusCode("RECRN004C"); + event1.setStatusTimestamp(Instant.now()); + event1.setProductType(ProductType.AR.getValue()); + event1.setAttachments(List.of(attachment1)); + event1.setAnonymizedDiscoveredAddressId("anonymized_addr_377a1b51-d241-4ce3-b1c8-0802650e48f4"); + Attachment attachment2 = new Attachment(); + attachment2.setId("attachment-id-2"); + attachment2.setDocumentType("DOCUMENT_TYPE2"); + attachment2.setDate(offsetDateTime.toInstant()); + Event event2 = new Event(); + event2.setId("event-id-2"); + event2.setRequestTimestamp(Instant.now()); + event2.setStatusCode("RECRN001B"); + event2.setStatusTimestamp(Instant.now()); + event2.setProductType(ProductType.AR.getValue()); + event2.setAttachments(List.of(attachment2)); + Attachment attachment3 = new Attachment(); + attachment3.setId("attachment-id-3"); + attachment3.setDocumentType("DOCUMENT_TYPE3"); + attachment3.setDate(offsetDateTime.toInstant()); + Event event3 = new Event(); + event3.setId("event-id-3"); + event3.setRequestTimestamp(Instant.now()); + event3.setStatusCode("RECRN002A"); + event3.setStatusTimestamp(Instant.now()); + event3.setProductType(ProductType.AR.getValue()); + event3.setAttachments(List.of(attachment3)); + paperTrackings.setEvents(List.of(event, event1, event2, event3)); + context.setPaperTrackings(paperTrackings); + } + + @Test + void duplicateEvent() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setRequestId("request-id"); + newEvent.setStatusCode("RECRN004C"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().getFirst().getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + AttachmentDetails attachmentDetails = new AttachmentDetails(); + attachmentDetails.setId("attachment-id-1"); + attachmentDetails.setDocumentType("DOCUMENT_TYPE"); + attachmentDetails.setUri("http://document-uri"); //verifico che l'uri non venga considerato nel confronto + attachmentDetails.setSha256("sha256hash"); + attachmentDetails.setDate(offsetDateTime); + newEvent.setAttachments(List.of(attachmentDetails)); + DiscoveredAddress discoveredAddress = new DiscoveredAddress(); + discoveredAddress.setAddress("Via Roma"); + discoveredAddress.setAddressRow2("Civico 1"); + discoveredAddress.setCap("00100"); + discoveredAddress.setCity("Roma"); + discoveredAddress.setPr("RM"); + discoveredAddress.setCountry("IT"); + newEvent.setDiscoveredAddress(discoveredAddress); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id-4"); + + when(dataVaultClient.deAnonymizeDiscoveredAddress(newEvent.getRequestId(), context.getPaperTrackings().getEvents().getFirst().getAnonymizedDiscoveredAddressId())) + .thenReturn(Mono.just(getPaperAddress())); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyError(PnPaperTrackerValidationException.class); + } + + @Test + void sameEventWithDifferentField() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setStatusCode("RECRN004C"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().getFirst().getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + AttachmentDetails attachmentDetails = new AttachmentDetails(); + attachmentDetails.setId("attachment-id-1"); + attachmentDetails.setDocumentType("DOCUMENT_TYPE2"); + attachmentDetails.setDate(offsetDateTime); + newEvent.setAttachments(List.of(attachmentDetails)); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id-4"); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + @Test + void sameEventWithDifferentNoAttachments() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setStatusCode("RECRN003C"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().getFirst().getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + newEvent.setAttachments(Collections.emptyList()); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id"); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + @Test + void newEvent() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setStatusCode("RECRN004B"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().getFirst().getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + AttachmentDetails attachmentDetails = new AttachmentDetails(); + attachmentDetails.setId("attachment-id-1"); + attachmentDetails.setDocumentType("DOCUMENT_TYPE2"); + newEvent.setAttachments(List.of(attachmentDetails)); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id-4"); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + @Test + void sameEventWithAnonymizedDiscoveredAddressIdNull() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setStatusCode("RECRN001B"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().get(1).getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + AttachmentDetails attachmentDetails = new AttachmentDetails(); + attachmentDetails.setId("attachment-id-2"); + attachmentDetails.setDocumentType("DOCUMENT_TYPE2"); + attachmentDetails.setDate(offsetDateTime); + newEvent.setAttachments(List.of(attachmentDetails)); + newEvent.setDiscoveredAddress(new DiscoveredAddress()); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id-4"); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + @Test + void retryEventWithSameEventId() { + PaperProgressStatusEvent newEvent = new PaperProgressStatusEvent(); + newEvent.setStatusCode("RECRN002A"); + newEvent.setStatusDateTime(context.getPaperTrackings().getEvents().getLast().getStatusTimestamp().atOffset(java.time.ZoneOffset.UTC)); + newEvent.setProductType(ProductType.AR.getValue()); + AttachmentDetails attachmentDetails = new AttachmentDetails(); + attachmentDetails.setId("attachment-id-3"); + attachmentDetails.setDocumentType("DOCUMENT_TYPE3"); + newEvent.setAttachments(List.of(attachmentDetails)); + context.setPaperProgressStatusEvent(newEvent); + context.setEventId("event-id-3"); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + @Test + void executeWithIsRedriveTrue() { + context.setTrackingId("tracking-id-1"); + context.setRedrive(true); + + StepVerifier.create(duplicatedEventFiltering.execute(context)) + .verifyComplete(); + verifyNoInteractions(dataVaultClient); + } + + private PaperAddress getPaperAddress() { + PaperAddress paperAddress = new PaperAddress(); + paperAddress.setAddress("Via Roma"); + paperAddress.setAddressRow2("Civico 1"); + paperAddress.setCap("00100"); + paperAddress.setCity("Roma"); + paperAddress.setPr("RM"); + paperAddress.setCountry("IT"); + return paperAddress; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericDematValidatorTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericDematValidatorTest.java new file mode 100644 index 000000000..89e0a43c9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericDematValidatorTest.java @@ -0,0 +1,293 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.FileType; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.OcrStatusEnum; +import it.pagopa.pn.papertracker.model.SourceType; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.utils.OcrUtility; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class GenericDematValidatorTest { + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + @Mock + PnPaperTrackerConfigs cfg; + @Mock + OcrMomProducer ocrMomProducer; + @Mock + SafeStorageClient safeStorageClient; + @Mock + PaperTrackerErrorService paperTrackerErrorService; + + GenericDematValidator dematValidator; + + PaperTrackings paperTrackings; + + HandlerContext context; + + @BeforeEach + void setUp() { + context = new HandlerContext(); + OcrUtility ocrUtility = new OcrUtility(ocrMomProducer, safeStorageClient, cfg, paperTrackingsDAO); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.getPaperStatus().setRegisteredLetterCode("RL123"); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + context.setPaperTrackings(paperTrackings); + context.setEventId("eventId1"); + ValidationConfig validationConfig = new ValidationConfig(); + validationConfig.setStrictFinalValidationStock890(Boolean.TRUE); + validationConfig.setSendOcrAttachmentsFinalValidationStock890(List.of("ARCAD", "CAD")); + validationConfig.setSendOcrAttachmentsFinalValidation(List.of("Plico", "AR", "23L")); + validationConfig.setRequiredAttachmentsRefinementStock890(List.of("23L")); + validationConfig.setOcrEnabled(OcrStatusEnum.DISABLED); + paperTrackings.setValidationConfig(validationConfig); + dematValidator = new GenericDematValidator(ocrUtility, paperTrackerErrorService) { }; + } + + private Event getEvent(String statusCode, String documentType, String eventId) { + return getEvent(statusCode, documentType, eventId, "uri.pdf", null); + } + + private Event getEvent(String statusCode, String documentType, String eventId, String uri, String sourceType) { + Event event = new Event(); + event.setStatusCode(statusCode); + event.setProductType(ProductType.AR.getValue()); + event.setId(eventId); + event.setStatusTimestamp(Instant.now()); + if (StringUtils.hasText(documentType)) { + Attachment attachment = new Attachment(); + attachment.setUri("uri.pdf"); + attachment.setDocumentType("Indagine"); + Attachment attachment1 = new Attachment(); + attachment1.setUri(uri); + attachment1.setDocumentType(documentType); + attachment1.setSourceType(sourceType); + event.setAttachments(List.of(attachment, attachment1)); + } + return event; + + } + + @Test + void validateDemat_OcrEnabled_UpdatesItemAndPushesEvent() { + // Arrange + context.getPaperTrackings().setEvents(List.of(getEvent("RECRN005C", null, "eventId1"), getEvent("RECRN005A", null, "eventId2"), getEvent("RECRN005B", "Plico", "eventId3"))); + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId2", "eventId3")); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("presigned-url")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verify(ocrMomProducer, times(1)).push(any(OcrEvent.class)); + assertTrue(context.isStopExecution()); + } + + @Test + void validateDemat_OcrEnabled_UpdatesItemAndPushesEvent2() { + // Arrange + context.getPaperTrackings().setEvents(List.of(getEvent("RECRN002F", null, "eventId1"), getEvent("RECRN002D", null, "eventId2"), getEvent("RECRN002E", "AR", "eventId3"))); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId2", "eventId3")); + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("presigned-url")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verify(ocrMomProducer, times(1)).push(any(OcrEvent.class)); + assertTrue(context.isStopExecution()); + } + + @Test + void validateDemat_OcrDisabled_UpdatesItemAndDoesNotPushEvent() { + // Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.empty()); + context.getPaperTrackings().setEvents(List.of(getEvent("RECRN005C", null, "eventId1"), getEvent("RECRN005A", null, "eventId2"), getEvent("RECRN005B", "Plico", "eventId3"))); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId2", "eventId3")); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verifyNoInteractions(safeStorageClient); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verify(ocrMomProducer, never()).push(any(OcrEvent.class)); + assertFalse(context.isStopExecution()); + } + + @Test + void validateDemat_UpdateItemThrowsError_PropagatesError() { + // Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + + when(safeStorageClient.getSafeStoragePresignedUrl(any())).thenReturn(Mono.just("presigned-url")); + context.getPaperTrackings().setEvents(List.of(getEvent("RECRN005C", null, "eventId1"), getEvent("RECRN005A", null, "eventId2"), getEvent("RECRN005B", "Plico", "eventId3"))); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId2", "eventId3")); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.error(new RuntimeException("DB error"))); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .expectErrorMatches(e -> e instanceof PaperTrackerException && e.getMessage().contains("Error during Demat Validation")) + .verify(); + + // Assert + verify(ocrMomProducer, times(1)).push(any(OcrEvent.class)); + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + } + + @Test + void validateDemat_OcrEnabled_EmptyAttachmentList_Stock890() { + // Arrange + context.getPaperTrackings().setEvents(List.of(getEvent("RECAG005C", null, "eventId1"), getEvent("RECAG005A", null, "eventId2"), getEvent("RECAG005B", "Plico", "eventId3"))); + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId2", "eventId3")); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verify(safeStorageClient, never()).getSafeStoragePresignedUrl(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verify(ocrMomProducer, never()).push(any(OcrEvent.class)); + assertFalse(context.isStopExecution()); + } + + @Test + void validateDemat_IncoherentSourceTypeFileType_InsertsWarning() { + // Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECRN005C", null, "eventId1"), + getEvent("RECRN005B", "Plico", "eventId3", "uri.png", SourceType.SCANNED.name()) + )); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId3")); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + when(paperTrackerErrorService.insertPaperTrackingsError(any())).thenReturn(Mono.just(new PaperTrackingsErrors())); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + ArgumentCaptor warningCaptor = ArgumentCaptor.forClass(PaperTrackingsErrors.class); + verify(paperTrackerErrorService, times(1)).insertPaperTrackingsError(warningCaptor.capture()); + + PaperTrackingsErrors warning = warningCaptor.getValue(); + assertEquals("eventId3", warning.getEventIdThrow()); + assertEquals("RECRN005B", warning.getEventThrow()); + assertEquals("png", warning.getDetails().getAdditionalDetails().get("fileType")); + assertEquals(SourceType.SCANNED.name(), warning.getDetails().getAdditionalDetails().get("sourceType")); + assertEquals("uri.png", warning.getDetails().getAdditionalDetails().get("uri")); + + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verifyNoInteractions(safeStorageClient); + verify(ocrMomProducer, never()).push(any(OcrEvent.class)); + assertFalse(context.isStopExecution()); + } + + @Test + void validateDemat_CoherentSourceTypeFileType_DoesNotInsertWarning() { + // Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECRN005C", null, "eventId1"), + getEvent("RECRN005B", "Plico", "eventId3", "uri.pdf", SourceType.SCANNED.name()) + )); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId3")); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verify(paperTrackerErrorService, never()).insertPaperTrackingsError(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verifyNoInteractions(safeStorageClient); + verify(ocrMomProducer, never()).push(any(OcrEvent.class)); + assertFalse(context.isStopExecution()); + } + + @Test + void validateDemat_InsertWarningFails_DoesNotBreakFlow() { + // Arrange + context.getPaperTrackings().getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + context.getPaperTrackings().setEvents(List.of( + getEvent("RECRN005C", null, "eventId1"), + getEvent("RECRN005B", "Plico", "eventId3", "uri.png", SourceType.SCANNED.name()) + )); + context.getPaperTrackings().getPaperStatus().setValidatedEvents(List.of("eventId1", "eventId3")); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(context.getPaperTrackings())); + when(paperTrackerErrorService.insertPaperTrackingsError(any())).thenReturn(Mono.error(new RuntimeException("warning insert failed"))); + + // Act + StepVerifier.create(dematValidator.validateDemat(context)) + .verifyComplete(); + + // Assert + verify(paperTrackerErrorService, times(1)).insertPaperTrackingsError(any()); + verify(paperTrackingsDAO, times(1)).updateItem(any(), any()); + verifyNoInteractions(safeStorageClient); + verify(ocrMomProducer, never()).push(any(OcrEvent.class)); + assertFalse(context.isStopExecution()); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilderTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilderTest.java new file mode 100644 index 000000000..3bcd036bc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericFinalEventBuilderTest.java @@ -0,0 +1,134 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class GenericFinalEventBuilderTest { + + @Mock + DataVaultClient dataVaultClient; + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + + GenericFinalEventBuilder genericFinalEventBuilder; + + HandlerContext handlerContext; + + PaperTrackings paperTrackings; + + private static final String EVENT_ID = UUID.randomUUID().toString(); + + @BeforeEach + void setUp() { + Instant now = Instant.now(); + handlerContext = new HandlerContext(); + handlerContext.setTrackingId("req-123"); + genericFinalEventBuilder = new GenericFinalEventBuilder(dataVaultClient, paperTrackingsDAO) { }; + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setUnifiedDeliveryDriver("POSTE"); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.getPaperStatus().setRegisteredLetterCode("RL123"); + paperTrackings.getPaperStatus().setDeliveryFailureCause("F01"); + ValidationFlow validationFlow = new ValidationFlow(); + validationFlow.setSequencesValidationTimestamp(Instant.now()); + paperTrackings.setValidationFlow(validationFlow); + Event event = new Event(); + event.setStatusCode("RECRI004A"); + event.setStatusTimestamp(now); + event.setRequestTimestamp(now); + event.setId(EVENT_ID + "1"); + + Event event1 = new Event(); + event1.setStatusCode("RECRI004C"); + event1.setStatusTimestamp(now); + event1.setRequestTimestamp(now); + event1.setId(EVENT_ID + "2"); + + Event event2 = new Event(); + event2.setStatusCode("RECRI003C"); + event2.setStatusTimestamp(now); + event2.setRequestTimestamp(now); + event2.setId(EVENT_ID); + + Event event3 = new Event(); + event3.setStatusCode("RECRI003A"); + event3.setStatusTimestamp(now); + event3.setRequestTimestamp(now); + event3.setId(EVENT_ID); + + paperTrackings.setEvents(List.of(event, event1, event2, event3)); + paperTrackings.getPaperStatus().setValidatedEvents(List.of(EVENT_ID + "1", EVENT_ID + "2", EVENT_ID)); + handlerContext.setPaperTrackings(paperTrackings); + + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + } + + @Test + void genericFinalEvent_RECRI003C() { + // Arrange + handlerContext.setPaperProgressStatusEvent(getFinalEvent("RECRI003C")); + handlerContext.setEventId(EVENT_ID); + + // Act + StepVerifier.create(genericFinalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(RECRI003C.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertEquals(StatusCodeEnum.OK, handlerContext.getEventsToSend().getFirst().getStatusCode()); + } + + @Test + void genericFinalEvent_RECRI004C() { + // Arrange + handlerContext.setPaperProgressStatusEvent(getFinalEvent("RECRI004C")); + handlerContext.setEventId(EVENT_ID + "2"); + + // Act + StepVerifier.create(genericFinalEventBuilder.execute(handlerContext)) + .verifyComplete(); + + // Assert + Assertions.assertEquals(1, handlerContext.getEventsToSend().size()); + Assertions.assertEquals(RECRI004C.name(), handlerContext.getEventsToSend().getFirst().getStatusDetail()); + Assertions.assertEquals(StatusCodeEnum.KO, handlerContext.getEventsToSend().getFirst().getStatusCode()); + } + + private PaperProgressStatusEvent getFinalEvent(String statusCode) { + PaperProgressStatusEvent finalEvent = new PaperProgressStatusEvent(); + finalEvent.setStatusCode(statusCode); + finalEvent.setRequestId("req-123"); + finalEvent.setClientRequestTimeStamp(OffsetDateTime.now()); + finalEvent.setRegisteredLetterCode("RL123"); + finalEvent.setAttachments(new ArrayList<>()); + finalEvent.setStatusDateTime(OffsetDateTime.now()); + return finalEvent; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidatorTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidatorTest.java new file mode 100644 index 000000000..8baf859ec --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/GenericSequenceValidatorTest.java @@ -0,0 +1,201 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.service.PaperTrackerErrorService; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfig; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +@ExtendWith(MockitoExtension.class) +class GenericSequenceValidatorTest { + + @Mock + PaperTrackingsDAO paperTrackingsDAO; + + @Mock + PaperTrackerErrorService paperTrackerErrorService; + + GenericSequenceValidator validator; + + HandlerContext context; + PaperTrackings paperTrackings; + List events; + SequenceConfig config; + + @BeforeEach + void setUp() { + validator = new GenericSequenceValidator(paperTrackingsDAO, paperTrackerErrorService) { + }; + context = new HandlerContext(); + context.setTrackingId("track-1"); + context.setEventId("event-1"); + context.setPaperProgressStatusEvent(new it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent()); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("track-1"); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.setValidationFlow(new ValidationFlow()); + paperTrackings.setValidationConfig(new ValidationConfig()); + + Instant statusTimestamp = Instant.now(); + Event e1 = new Event(); + e1.setId("e1"); + e1.setStatusCode("RECRN002A"); + e1.setStatusTimestamp(statusTimestamp); + e1.setRequestTimestamp(Instant.now()); + e1.setRegisteredLetterCode("RL1"); + e1.setDeliveryFailureCause("M08"); + e1.setAnonymizedDiscoveredAddressId("anon-addr-1"); + + Event e2 = new Event(); + e2.setId("e2"); + e2.setStatusCode("RECRN002B"); + e2.setStatusTimestamp(statusTimestamp); + e2.setRequestTimestamp(Instant.now()); + e2.setRegisteredLetterCode("RL1"); + e2.setDeliveryFailureCause("M08"); + + events = List.of(e1, e2); + + config = SequenceConfiguration.getConfig("RECRN002C"); + } + + @Test + void testValidatePresenceOfStatusCodes() { + Set required = new HashSet<>(Arrays.asList("RECRN002A", "RECRN002B")); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validatePresenceOfStatusCodes", events, paperTrackings, context, required, true + ); + StepVerifier.create(result) + .expectNext(events) + .verifyComplete(); + } + + @Test + void testValidatePresenceOfStatusCodes_MissingStatusCode() { + Set required = new HashSet<>(Arrays.asList("RECRN002A", "RECRN002C")); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validatePresenceOfStatusCodes", events, paperTrackings, context, required, true + ); + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().equals("Necessary status code not found in events: [RECRN002C]")) + .verify(); + } + + @Test + void testValidateBusinessTimestamps() { + PaperTrackings toUpdate = new PaperTrackings(); + toUpdate.setPaperStatus(new PaperStatus()); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateBusinessTimestamps", events, paperTrackings, context, config, true, toUpdate + ); + StepVerifier.create(result) + .expectNext(events) + .verifyComplete(); + } + + @Test + void testValidateBusinessTimestamps_InvalidTimestamps() { + events.getFirst().setStatusTimestamp(Instant.now().plusSeconds(1000)); + PaperTrackings toUpdate = new PaperTrackings(); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateBusinessTimestamps", events, paperTrackings, context, config, true, toUpdate + ); + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().equals("Invalid business timestamps")) + .verify(); + } + + @Test + void testValidateAttachments_MissingAttachment() { + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateAttachments", events, paperTrackings, context, config.validAttachments(), config.requiredAttachments(), true + ); + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().equals("Missed required attachments for the sequence validation: [Plico]")) + .verify(); + } + + @Test + void testValidateRegisteredLetterCode() { + PaperTrackings toUpdate = new PaperTrackings(); + toUpdate.setPaperStatus(new PaperStatus()); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateRegisteredLetterCode", events, paperTrackings, toUpdate, context, true + ); + StepVerifier.create(result) + .expectNext(events) + .verifyComplete(); + assertEquals("RL1", toUpdate.getPaperStatus().getRegisteredLetterCode()); + } + + @Test + void testValidateRegisteredLetterCode_MismatchedCodes() { + events.getFirst().setRegisteredLetterCode("RL2"); + PaperTrackings toUpdate = new PaperTrackings(); + toUpdate.setPaperStatus(new PaperStatus()); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateRegisteredLetterCode", events, paperTrackings, toUpdate, context, true + ); + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().equals("Registered letter codes do not match in sequence: [RL2, RL1]")) + .verify(); + } + + @Test + void testValidateDeliveryFailureCause() { + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateDeliveryFailureCause", events, paperTrackings, context, true + ); + StepVerifier.create(result) + .expectNext(events) + .verifyComplete(); + } + + @Test + void testValidateDeliveryFailureCause_MismatchedCauses() { + events.getFirst().setDeliveryFailureCause("F01"); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "validateDeliveryFailureCause", events, paperTrackings, context, true + ); + StepVerifier.create(result) + .expectErrorMatches(throwable -> throwable instanceof PnPaperTrackerValidationException && + throwable.getMessage().equals("Invalid deliveryFailureCause: F01")) + .verify(); + } + + @Test + void testEnrichPaperTrackingToUpdateWithAddressAndFailureCause() { + PaperTrackings toUpdate = new PaperTrackings(); + toUpdate.setPaperStatus(new PaperStatus()); + Mono> result = ReflectionTestUtils.invokeMethod( + validator, "enrichPaperTrackingToUpdateWithAddressAndFailureCause", events, toUpdate, "RECRN002C" + ); + StepVerifier.create(result) + .expectNext(events) + .verifyComplete(); + assertEquals("anon-addr-1", toUpdate.getPaperStatus().getAnonymizedDiscoveredAddress()); + assertEquals("M08", toUpdate.getPaperStatus().getDeliveryFailureCause()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilderTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilderTest.java new file mode 100644 index 000000000..7f96c54c0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/IntermediateEventsBuilderTest.java @@ -0,0 +1,63 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.test.StepVerifier; + +import java.util.List; + +@ExtendWith(MockitoExtension.class) +class IntermediateEventsBuilderTest { + + private HandlerContext context; + + @InjectMocks + private IntermediateEventsBuilder intermediateEventsBuilder; + + @BeforeEach + void setUp() { + context = new HandlerContext(); + } + + @Test + void execute_shouldAddSendEventToContext_whenFluxEmitsEvent() { + // Arrange + context.setPaperProgressStatusEvent(getPaperProgressStatusEvent("RECRN001C", null)); + + // Act & Assert + StepVerifier.create(intermediateEventsBuilder.execute(context)) + .expectSubscription() + .verifyComplete(); + + Assertions.assertEquals(1, context.getEventsToSend().size()); + } + + @Test + void execute_shouldCompleteWithoutAddingEvent_whenFluxIsEmpty() { + // Arrange + context.setPaperProgressStatusEvent(getPaperProgressStatusEvent("RECRN001B", null)); + + // Act & Assert + StepVerifier.create(intermediateEventsBuilder.execute(context)) + .expectSubscription() + .verifyComplete(); + + Assertions.assertEquals(0, context.getEventsToSend().size()); + } + + private PaperProgressStatusEvent getPaperProgressStatusEvent(String statusCode, List attachments) { + PaperProgressStatusEvent event = new PaperProgressStatusEvent(); + event.setRequestId("req_123"); + event.setStatusCode(statusCode); + event.setAttachments(attachments); + return event; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTriggerTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTriggerTest.java new file mode 100644 index 000000000..fa88d5f8c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/M10RetryTriggerTest.java @@ -0,0 +1,143 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class M10RetryTriggerTest { + + @Mock + private PaperChannelClient paperChannelClient; + + @Mock + private PcRetryService pcRetryService; + + @InjectMocks + private M10RetryTrigger m10RetryTrigger; + + @ParameterizedTest + @ValueSource(strings = {"RECRS002C", "RECRN002C", "RECAG003C", "RECRI004C", "RECRSI004C"}) + void execute_m10FailureCauseWithSupportedFinalStatusCode_convertsFeedbackEventsToProgressAndExecutesRetrySender(String finalStatusCode) { + // Arrange + HandlerContext context = contextWithFailureCause("M10"); + context.setFinalStatusCode(finalStatusCode); + context.setEventsToSend(List.of( + sendEventWithStatus(StatusCodeEnum.OK, "PNRN012"), + sendEventWithStatus(StatusCodeEnum.OK, finalStatusCode), + sendEventWithStatus(StatusCodeEnum.KO, finalStatusCode), + sendEventWithStatus(StatusCodeEnum.PROGRESS, finalStatusCode) + )); + PcRetryResponse pcRetryResponse = new PcRetryResponse(); + when(paperChannelClient.getPcRetry(context, Boolean.FALSE)).thenReturn(Mono.just(pcRetryResponse)); + when(pcRetryService.handlePcRetryResponse(pcRetryResponse, Boolean.FALSE, context)).thenReturn(Mono.empty()); + + // Act + StepVerifier.create(m10RetryTrigger.execute(context)) + .verifyComplete(); + + // Assert + assertEquals( + List.of(StatusCodeEnum.OK, StatusCodeEnum.PROGRESS, StatusCodeEnum.PROGRESS, StatusCodeEnum.PROGRESS), + context.getEventsToSend().stream().map(SendEvent::getStatusCode).toList() + ); + verify(paperChannelClient).getPcRetry(context, Boolean.FALSE); + verify(pcRetryService).handlePcRetryResponse(pcRetryResponse, Boolean.FALSE, context); + verifyNoMoreInteractions(paperChannelClient, pcRetryService); + } + + @Test + void execute_m10FailureCauseWithUnsupportedFinalStatusCode_doesNotExecuteRetrySender() { + // Arrange + HandlerContext context = contextWithFailureCause("M10"); + context.setFinalStatusCode("RECRN002A"); + context.setEventsToSend(List.of(sendEventWithStatus(StatusCodeEnum.OK, "RECRN002A"))); + + // Act + StepVerifier.create(m10RetryTrigger.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(StatusCodeEnum.OK, context.getEventsToSend().getFirst().getStatusCode()); + verifyNoInteractions(paperChannelClient, pcRetryService); + } + + @Test + void execute_m10FailureCauseAbsent_doesNotExecuteRetrySender() { + // Arrange + HandlerContext context = contextWithFailureCause("M09"); + context.setEventsToSend(List.of(sendEventWithStatus(StatusCodeEnum.OK))); + + // Act + StepVerifier.create(m10RetryTrigger.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(StatusCodeEnum.OK, context.getEventsToSend().get(0).getStatusCode()); + verifyNoInteractions(paperChannelClient, pcRetryService); + } + + @Test + void execute_missingFailureCause_doesNotExecuteRetrySender() { + // Arrange + HandlerContext context = contextWithFailureCause(null); + context.setEventsToSend(List.of(sendEventWithStatus(StatusCodeEnum.KO))); + + // Act + StepVerifier.create(m10RetryTrigger.execute(context)) + .verifyComplete(); + + // Assert + assertEquals(StatusCodeEnum.KO, context.getEventsToSend().get(0).getStatusCode()); + verifyNoInteractions(paperChannelClient, pcRetryService); + } + + private HandlerContext contextWithFailureCause(String deliveryFailureCause) { + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("tracking-id"); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setDeliveryFailureCause(deliveryFailureCause); + paperTrackings.setPaperStatus(paperStatus); + + HandlerContext context = new HandlerContext(); + context.setTrackingId("tracking-id"); + context.setPaperTrackings(paperTrackings); + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusCode("RECRN002A"); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + return context; + } + + private SendEvent sendEventWithStatus(StatusCodeEnum statusCode) { + return sendEventWithStatus(statusCode, "RECRN002C"); + } + + private SendEvent sendEventWithStatus(StatusCodeEnum statusCode, String statusDetail) { + SendEvent sendEvent = new SendEvent(); + sendEvent.setStatusCode(statusCode); + sendEvent.setStatusDetail(statusDetail); + return sendEvent; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserterTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserterTest.java new file mode 100644 index 000000000..abf6d20e3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/MetadataUpserterTest.java @@ -0,0 +1,137 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.DiscoveredAddress; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.msclient.DataVaultClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.OffsetDateTime; +import java.util.ArrayList; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +class MetadataUpserterTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private DataVaultClient dataVaultClient; + + @Mock + private PnPaperTrackerConfigs PnPaperTrackerConfigs; + + @InjectMocks + private MetadataUpserter metadataUpserter; + + private HandlerContext handlerContext; + private PaperProgressStatusEvent paperProgressStatusEvent; + private PaperTrackings paperTrackings; + private String anonymizedDiscoveredAddressId; + + @BeforeEach + void setUp() { + anonymizedDiscoveredAddressId = "anonymized_addr_uuid"; + + paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setRequestId("req-123"); + paperProgressStatusEvent.setStatusCode("RECRN002A"); + paperProgressStatusEvent.setStatusDateTime(OffsetDateTime.now()); + paperProgressStatusEvent.setClientRequestTimeStamp(OffsetDateTime.now()); + paperProgressStatusEvent.setProductType("AR"); + + handlerContext = new HandlerContext(); + handlerContext.setPaperProgressStatusEvent(paperProgressStatusEvent); + handlerContext.setReworkId("reworkId"); + + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("req-123"); + paperTrackings.setProductType(ProductType.AR.getValue()); + PaperStatus paperStatus = new PaperStatus(); + paperStatus.setAnonymizedDiscoveredAddress("anonymized_addr_uuid"); + paperTrackings.setPaperStatus(paperStatus); + paperTrackings.setEvents(new ArrayList<>()); + + handlerContext.setPaperTrackings(paperTrackings); + } + + @Test + void execute_WithDiscoveredAddress_SetsAnonimizedDiscoveredAddress() { + // Arrange + paperProgressStatusEvent.setDiscoveredAddress(new DiscoveredAddress()); + when(dataVaultClient.anonymizeDiscoveredAddress(any(), any())).thenReturn(Mono.just(anonymizedDiscoveredAddressId)); + + when(paperTrackingsDAO.updateItem(any(), any(PaperTrackings.class))) + .thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(metadataUpserter.execute(handlerContext)) + .verifyComplete(); + + // Assert + assertEquals(anonymizedDiscoveredAddressId, handlerContext.getPaperTrackings().getPaperStatus().getAnonymizedDiscoveredAddress()); + verify(paperTrackingsDAO).updateItem(eq("req-123"), any()); + + } + + @Test + void execute_WithNullDiscoveredAddress_DoesNotSetAnonimizedAddress() { + // Arrange + paperProgressStatusEvent.setDiscoveredAddress(null); + paperTrackings.getPaperStatus().setAnonymizedDiscoveredAddress(null); + + when(paperTrackingsDAO.updateItem(eq("req-123"), any(PaperTrackings.class))) + .thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(metadataUpserter.execute(handlerContext)) + .verifyComplete(); + + // Assert + assertNull(handlerContext.getPaperTrackings().getPaperStatus().getAnonymizedDiscoveredAddress()); + verify(paperTrackingsDAO).updateItem(eq("req-123"), any()); + + } + + @Test + void execute_WithPrinterAndDu_MapsFieldsIntoEvent() { + // Arrange + paperProgressStatusEvent.setPrinter("printer-123"); + paperProgressStatusEvent.setDu("du-456"); + handlerContext.setEventId("event-id-1"); + + when(paperTrackingsDAO.updateItem(eq("req-123"), any(PaperTrackings.class))) + .thenAnswer(invocation -> { + PaperTrackings updated = invocation.getArgument(1); + paperTrackings.setEvents(updated.getEvents()); + return Mono.just(paperTrackings); + }); + + // Act + StepVerifier.create(metadataUpserter.execute(handlerContext)) + .verifyComplete(); + + // Assert + assertEquals("printer-123", handlerContext.getPaperTrackings().getEvents().get(0).getPrinter()); + assertEquals("du-456", handlerContext.getPaperTrackings().getEvents().get(0).getDu()); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSenderTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSenderTest.java new file mode 100644 index 000000000..dc9d9ac8e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/OutputTargetSenderTest.java @@ -0,0 +1,203 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.AttachmentDetails; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PaperChannelUpdate; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.SendEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.StatusCodeEnum; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperStatus; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import it.pagopa.pn.papertracker.middleware.eventBridge.EventBridgePublisher; +import it.pagopa.pn.papertracker.model.HandlerContext; +import it.pagopa.pn.papertracker.utils.LogUtility; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import software.amazon.awssdk.services.eventbridge.model.PutEventsResponse; + +import java.time.OffsetDateTime; +import java.util.Collections; + +import static org.mockito.Mockito.*; +import static org.mockito.Mockito.times; + +@ExtendWith(MockitoExtension.class) +class OutputTargetSenderTest { + + @Mock + private PnPaperTrackerConfigs config; + + @Mock + private PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private EventBridgePublisher eventBridgePublisher; + + @Mock + private LogUtility logUtility; + + @InjectMocks + private OutputTargetSender outputTargetSender; + + @Test + void testSendToOutputTarget_SendToExternalChannelOutputs() { + // Arrange + SendEvent event = getSendEvent(); + PaperTrackings paperTrackings = new PaperTrackings(); + HandlerContext context = new HandlerContext(); + context.setPaperTrackings(paperTrackings); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + // Act + outputTargetSender.sendToOutputTarget(event, context).block(); + + // Assert + verify(eventBridgePublisher, times(1)).publish(any(PaperChannelUpdate.class)); + verify(paperTrackerDryRunOutputsDAO, never()).insertOutputEvent(any()); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void testSendToOutputTarget_SendToDryRunOutputs() { + // Arrange + SendEvent event = getSendEvent(); + HandlerContext context = new HandlerContext(); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setPaperStatus(new PaperStatus()); + context.setDryRunEnabled(true); + context.setPaperTrackings(paperTrackings); + + when(paperTrackerDryRunOutputsDAO.insertOutputEvent(any())).thenReturn(Mono.empty()); + + // Act + outputTargetSender.sendToOutputTarget(event, context).block(); + + // Assert + verify(paperTrackerDryRunOutputsDAO, times(1)).insertOutputEvent(any()); + verify(eventBridgePublisher, never()).publish(any(PaperChannelUpdate.class)); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void testBuildDeliveryPushEvent() { + // Arrange + SendEvent event = getSendEvent(); + PaperTrackings paperTrackings = new PaperTrackings(); + HandlerContext context = new HandlerContext(); + context.setPaperTrackings(paperTrackings); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + // Act + outputTargetSender.sendToOutputTarget(event, context).block(); + + // Assert + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperChannelUpdate.class); + verify(eventBridgePublisher).publish(captor.capture()); + Assertions.assertEquals(event, captor.getValue().getSendEvent()); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void testExecuteFinalStatusCodeNullAndNextRequestIdPcretryNull() { + // Arrange + SendEvent event = getSendEvent(); + HandlerContext context = new HandlerContext(); + PaperTrackings paperTrackings = new PaperTrackings(); + context.setPaperTrackings(paperTrackings); + context.setEventsToSend(Collections.singletonList(event)); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + // Act + outputTargetSender.execute(context).block(); + + // Assert + verify(eventBridgePublisher, times(1)).publish(any(PaperChannelUpdate.class)); + verify(paperTrackerDryRunOutputsDAO, never()).insertOutputEvent(any()); + verify(paperTrackingsDAO, never()).updateItem(anyString(), any(PaperTrackings.class)); + verifyNoInteractions(paperTrackingsDAO); + } + + @Test + void testExecuteFinalStatusCodeNotNull() { + // Arrange + HandlerContext context = getFinalEventHandlerContext(); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(new PaperTrackings())); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + // Act + outputTargetSender.execute(context).block(); + + // Assert + verify(eventBridgePublisher, times(1)).publish(any(PaperChannelUpdate.class)); + verify(paperTrackerDryRunOutputsDAO, never()).insertOutputEvent(any()); + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), captor.capture()); + Assertions.assertEquals(PaperTrackingsState.DONE, captor.getValue().getState()); + } + + @Test + void testExecuteMextPcRetryNotNull() { + // Arrange + HandlerContext context = getPcRetryHandlerContext(); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(new PaperTrackings())); + when(eventBridgePublisher.publish(any(PaperChannelUpdate.class))).thenReturn(Mono.just(PutEventsResponse.builder().build())); + + // Act + outputTargetSender.execute(context).block(); + + // Assert + verify(eventBridgePublisher, times(1)).publish(any(PaperChannelUpdate.class)); + verify(paperTrackerDryRunOutputsDAO, never()).insertOutputEvent(any()); + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), captor.capture()); + Assertions.assertEquals(PaperTrackingsState.DONE, captor.getValue().getState()); + } + + private HandlerContext getFinalEventHandlerContext() { + SendEvent event = new SendEvent(); + event.setStatusCode(StatusCodeEnum.OK); + event.setStatusDetail("RECRN001C"); + HandlerContext context = new HandlerContext(); + context.setFinalStatusCode("RECRN001C"); + PaperTrackings paperTrackings = new PaperTrackings(); + context.setPaperTrackings(paperTrackings); + context.setEventsToSend(Collections.singletonList(event)); + return context; + } + + private HandlerContext getPcRetryHandlerContext() { + SendEvent event = new SendEvent(); + event.setStatusCode(StatusCodeEnum.PROGRESS); + event.setStatusDetail("RECRN006"); + HandlerContext context = new HandlerContext(); + context.setNextRequestIdPcRetry("nextRequestIdPcRetry"); + PaperTrackings paperTrackings = new PaperTrackings(); + context.setPaperTrackings(paperTrackings); + context.setEventsToSend(Collections.singletonList(event)); + return context; + } + + + private SendEvent getSendEvent() { + SendEvent event = new SendEvent(); + event.setStatusCode(StatusCodeEnum.PROGRESS); + AttachmentDetails attachment = new AttachmentDetails(); + attachment.setDate(OffsetDateTime.now()); + event.setAttachments(Collections.singletonList(attachment)); + event.setStatusDateTime(OffsetDateTime.now()); + event.setClientRequestTimeStamp(OffsetDateTime.now()); + return event; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryServiceTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryServiceTest.java new file mode 100644 index 000000000..d5a6086d0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/PcRetryServiceTest.java @@ -0,0 +1,123 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.exception.PaperTrackerExceptionHandler; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.CON996; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECRN006; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class PcRetryServiceTest { + + @InjectMocks + private PcRetryService pcRetryService; + + @Mock + private PaperTrackerExceptionHandler paperTrackerExceptionHandler; + + @Test + void handlePcRetryResponseCon996RetryFound() { + //ARRANGE + PcRetryResponse response = getPcRetryResponse(true); + HandlerContext context = getHandlerContext(CON996.name()); + + //ACT + StepVerifier.create(pcRetryService.handlePcRetryResponse(response, Boolean.TRUE, context)) + .verifyComplete(); + + //ASSERT + Assertions.assertEquals(response.getRequestId(), context.getNextRequestIdPcRetry()); + verify(paperTrackerExceptionHandler, never()).handleRetryError(any()); + } + + @Test + void handlePcRetryResponseCon996RetryNotFound() { + //ARRANGE + PcRetryResponse response = getPcRetryResponse(false); + HandlerContext context = getHandlerContext(CON996.name()); + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperTrackingsErrors.class); + when(paperTrackerExceptionHandler.handleRetryError(captor.capture())).thenReturn(Mono.empty()); + + //ACT + StepVerifier.create(pcRetryService.handlePcRetryResponse(response, Boolean.TRUE, context)) + .verifyComplete(); + + //ASSERT + PaperTrackingsErrors paperTrackingsErrors = captor.getValue(); + Assertions.assertEquals(ErrorCategory.NOT_RETRYABLE_EVENT_ERROR, paperTrackingsErrors.getErrorCategory()); + verify(paperTrackerExceptionHandler, times(1)).handleRetryError(any()); + } + + @Test + void handlePcRetryResponseRetryFound() { + //ARRANGE + PcRetryResponse response = getPcRetryResponse(true); + HandlerContext context = getHandlerContext(RECRN006.name()); + + //ACT + StepVerifier.create(pcRetryService.handlePcRetryResponse(response, Boolean.FALSE, context)) + .verifyComplete(); + + //ASSERT + Assertions.assertEquals(response.getRequestId(), context.getNextRequestIdPcRetry()); + verify(paperTrackerExceptionHandler, never()).handleRetryError(any()); + } + + @Test + void handlePcRetryResponseRetryNotFound() { + //ARRANGE + PcRetryResponse response = getPcRetryResponse(false); + HandlerContext context = getHandlerContext(RECRN006.name()); + ArgumentCaptor captor = ArgumentCaptor.forClass(PaperTrackingsErrors.class); + when(paperTrackerExceptionHandler.handleRetryError(captor.capture())).thenReturn(Mono.empty()); + + //ACT + StepVerifier.create(pcRetryService.handlePcRetryResponse(response, Boolean.FALSE, context)) + .verifyComplete(); + + //ASSERT + PaperTrackingsErrors paperTrackingsErrors = captor.getValue(); + Assertions.assertEquals(ErrorCategory.MAX_RETRY_REACHED_ERROR, paperTrackingsErrors.getErrorCategory()); + verify(paperTrackerExceptionHandler, times(1)).handleRetryError(captor.capture()); + } + + + private HandlerContext getHandlerContext(String statusCode) { + HandlerContext context = new HandlerContext(); + PaperProgressStatusEvent paperProgressStatusEvent = new PaperProgressStatusEvent(); + paperProgressStatusEvent.setStatusCode(statusCode); + context.setPaperProgressStatusEvent(paperProgressStatusEvent); + PaperTrackings paperTrackings = new PaperTrackings(); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setAttemptId("requestId"); + context.setPaperTrackings(paperTrackings); + return context; + } + + private PcRetryResponse getPcRetryResponse(boolean found) { + PcRetryResponse response = new PcRetryResponse(); + response.setRetryFound(found); + response.setParentRequestId("parentRequestId"); + if (found) { + response.setRequestId("requestId"); + response.setPcRetry("1"); + response.setDeliveryDriverId("unifiedDeliveryDriverId"); + } + return response; + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCon996Test.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCon996Test.java new file mode 100644 index 000000000..f3d6c17bb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderCon996Test.java @@ -0,0 +1,112 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class RetrySenderCon996Test { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + + @Mock + private PnPaperTrackerConfigs pnPaperTrackerConfigs; + + @Mock + private PcRetryService pcRetryService; + + @Mock + private PaperChannelClient pcRetryApi; + + @InjectMocks + private RetrySenderCON996 retrySender; + + @Test + void execute_retryFound() { + //ARRANGE + HandlerContext context = getHandlerContext(); + PcRetryResponse response = getPcRetryResponse(true); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.just(response)); + when(pcRetryService.handlePcRetryResponse(any(), anyBoolean(), any())).thenReturn(Mono.empty()); + //ACT + StepVerifier.create(retrySender.execute(context)) + .verifyComplete(); + + //ASSERT + verify(pcRetryService, times(1)).handlePcRetryResponse(any(), anyBoolean(), any()); + } + + @Test + void execute_retryNotFound() { + HandlerContext context = getHandlerContext(); + PcRetryResponse response = getPcRetryResponse(false); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.just(response)); + when(pcRetryService.handlePcRetryResponse(any(), anyBoolean(), any())).thenReturn(Mono.empty()); + //ACT + StepVerifier.create(retrySender.execute(context)) + .verifyComplete(); + + //ASSERT + verify(pcRetryService, times(1)).handlePcRetryResponse(any(), anyBoolean(), any()); + } + + @Test + void execute_errorFromApi() { + //ARRANGE + HandlerContext context = getHandlerContext(); + PnPaperTrackerNotFoundException webClientResponseException = mock(PnPaperTrackerNotFoundException.class); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.error(webClientResponseException)); + + //ACT + StepVerifier.create(retrySender.execute(context)) + .expectError(PnPaperTrackerNotFoundException.class) + .verify(); + + //ASSERT + verifyNoInteractions(paperTrackingsDAO); + verifyNoInteractions(paperTrackingsErrorsDAO); + } + + private HandlerContext getHandlerContext() { + HandlerContext context = new HandlerContext(); + context.setPaperTrackings(new PaperTrackings()); + context.getPaperTrackings().setTrackingId("requestId"); + context.getPaperTrackings().setProductType(ProductType.AR.getValue()); + context.setPaperProgressStatusEvent(new PaperProgressStatusEvent()); + context.getPaperProgressStatusEvent().setRequestId("requestId"); + context.getPaperProgressStatusEvent().setStatusCode("statusCode"); + return context; + } + + private PcRetryResponse getPcRetryResponse(boolean retryFound) { + PcRetryResponse response = new PcRetryResponse(); + response.setRequestId("requestId"); + response.setParentRequestId("parentRequestId"); + response.setDeliveryDriverId("deliveryDriverId"); + response.setRetryFound(retryFound); + return response; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderTest.java new file mode 100644 index 000000000..7b10a7121 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/handler_step/generic/RetrySenderTest.java @@ -0,0 +1,115 @@ +package it.pagopa.pn.papertracker.service.handler_step.generic; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerNotFoundException; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerValidationException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import it.pagopa.pn.papertracker.middleware.msclient.PaperChannelClient; +import it.pagopa.pn.papertracker.model.HandlerContext; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +public class RetrySenderTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + + @Mock + private PnPaperTrackerConfigs pnPaperTrackerConfigs; + + @Mock + private PcRetryService pcRetryService; + + @Mock + private PaperChannelClient pcRetryApi; + + @InjectMocks + private RetrySender retrySender; + + @Test + void execute_retryFound() { + //ARRANGE + HandlerContext context = getHandlerContext(); + PcRetryResponse response = getPcRetryResponse(true); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.just(response)); + when(pcRetryService.handlePcRetryResponse(any(), anyBoolean(), any())).thenReturn(Mono.empty()); + //ACT + StepVerifier.create(retrySender.execute(context)) + .verifyComplete(); + + //ASSERT + verify(pcRetryService, times(1)).handlePcRetryResponse(any(), anyBoolean(), any()); + } + + @Test + void execute_retryNotFound() { + HandlerContext context = getHandlerContext(); + PcRetryResponse response = getPcRetryResponse(false); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.just(response)); + when(pcRetryService.handlePcRetryResponse(any(), anyBoolean(), any())).thenReturn(Mono.empty()); + //ACT + StepVerifier.create(retrySender.execute(context)) + .verifyComplete(); + + //ASSERT + verify(pcRetryService, times(1)).handlePcRetryResponse(any(), anyBoolean(), any()); + } + + @Test + void execute_errorFromApi() { + //ARRANGE + HandlerContext context = getHandlerContext(); + PnPaperTrackerNotFoundException webClientResponseException = mock(PnPaperTrackerNotFoundException.class); + + when(pcRetryApi.getPcRetry(any(), any())).thenReturn(Mono.error(webClientResponseException)); + + //ACT + StepVerifier.create(retrySender.execute(context)) + .expectError(PnPaperTrackerNotFoundException.class) + .verify(); + + //ASSERT + verifyNoInteractions(paperTrackingsDAO); + verifyNoInteractions(paperTrackingsErrorsDAO); + } + + private HandlerContext getHandlerContext() { + HandlerContext context = new HandlerContext(); + context.setPaperTrackings(new PaperTrackings()); + context.getPaperTrackings().setTrackingId("requestId"); + context.getPaperTrackings().setProductType(ProductType.AR.getValue()); + context.setPaperProgressStatusEvent(new PaperProgressStatusEvent()); + context.getPaperProgressStatusEvent().setRequestId("requestId"); + context.getPaperProgressStatusEvent().setStatusCode("statusCode"); + return context; + } + + private PcRetryResponse getPcRetryResponse(boolean retryFound) { + PcRetryResponse response = new PcRetryResponse(); + response.setRequestId("requestId"); + response.setParentRequestId("parentRequestId"); + response.setDeliveryDriverId("deliveryDriverId"); + response.setRetryFound(retryFound); + return response; + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImplTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImplTest.java new file mode 100644 index 000000000..f5f289b08 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/NotificationReworkServiceImplTest.java @@ -0,0 +1,353 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.exception.PnPaperTrackerBadRequestException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.SequenceResponse; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsState; +import it.pagopa.pn.papertracker.model.sequence.SequenceConfiguration; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Objects; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class NotificationReworkServiceImplTest { + + @InjectMocks + private NotificationReworkServiceImpl service; + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Test + void retrieveSequenceAndEventStatus_InvalidProductType() { + String statusCode = "RECRN005C"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"890")) + .expectErrorMatches(throwable -> { + if (throwable instanceof PnPaperTrackerBadRequestException ex) { + assertNotNull(ex.getProblem().getDetail()); + return ex.getProblem().getDetail().contains("statusCode RECRN005C is invalid"); + } + return false; + }); + } + + @Test + void retrieveSequenceAndEventStatus_InvalidRIR() { + String statusCode = "RECRI003C"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"AR")) + .expectErrorMatches(throwable -> { + if (throwable instanceof PnPaperTrackerBadRequestException ex) { + assertNotNull(ex.getProblem().getDetail()); + return ex.getProblem().getDetail().contains("statusCode RECRN005C is invalid"); + } + return false; + }); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnSequenceForValidStatusCode() { + String statusCode = "RECRN005C"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.OK, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnSequenceForStock890() { + String statusCode = "RECAG005C"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"890")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.OK, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnSequenceForKOStatusCode() { + String statusCode = "RECRN002F"; + String deliveryFailureCause = "M01"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.KO, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnSequenceForKOStatusCodeWithoutDeliveryFailureCause() { + String statusCode = "RECRN002F"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"AR")) + .expectErrorMatches(throwable -> { + if (throwable instanceof PnPaperTrackerBadRequestException ex) { + assertNotNull(ex.getProblem().getDetail()); + return Objects.requireNonNull(ex.getProblem().getErrors().getFirst().getDetail()).equalsIgnoreCase("deliveryFailureCause null is invalid"); + } + return false; + }) + .verify(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnOKForRECRN002CWithM02() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M02"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.OK, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnOKForRECRN002CWithM05() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M05"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.OK, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnKOForRECRN002CWithM06() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M06"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.KO, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnKOForRECRN002CWithM07() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M07"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.KO, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnKOForRECRN002CWithM08() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M08"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.KO, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldReturnKOForRECRN002CWithM09() { + String statusCode = "RECRN002C"; + String deliveryFailureCause = "M09"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, deliveryFailureCause,"AR")) + .assertNext(response -> { + assertEquals(SequenceResponse.FinalStatusCodeEnum.KO, response.getFinalStatusCode()); + assertNotNull(response.getSequence()); + assertFalse(response.getSequence().isEmpty()); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldThrowExceptionForProgressStatusCode() { + String progressStatusCode = "RECRN010"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(progressStatusCode, null,"AR")) + .expectErrorMatches(throwable -> { + if (throwable instanceof PnPaperTrackerBadRequestException ex) { + assertNotNull(ex.getProblem().getDetail()); + return Objects.requireNonNull(ex.getProblem().getErrors().getFirst().getDetail()).equalsIgnoreCase("statusCode RECRN010 is PROGRESS"); + } + return false; + }) + .verify(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldVerifySequenceContent() { + String statusCode = "RECRN005C"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(statusCode, null,"AR")) + .assertNext(response -> { + assertNotNull(response.getSequence()); + response.getSequence().forEach(item -> assertTrue(StringUtils.hasText(item.getStatusCode()))); + assertEquals( + SequenceConfiguration.getConfig(statusCode).sequenceStatusCodes().size(), + response.getSequence().size() + ); + response.getSequence().forEach(sequenceItem -> { + if(!CollectionUtils.isEmpty(sequenceItem.getAttachments())) { + assertTrue(sequenceItem.getAttachments().containsAll(SequenceConfiguration.getConfig(statusCode).validAttachments().get(sequenceItem.getStatusCode()))); + } + }); + }) + .verifyComplete(); + } + + @Test + void retrieveSequenceAndEventStatus_shouldThrowExceptionForInvalidStatusCode() { + String invalidStatusCode = "INVALID"; + String deliveryFailureCause = "M02"; + + StepVerifier.create(service.retrieveSequenceAndEventStatus(invalidStatusCode, deliveryFailureCause,"AR")) + .expectErrorMatches(throwable -> { + if (throwable instanceof PnPaperTrackerBadRequestException ex) { + assertNotNull(ex.getProblem().getDetail()); + return Objects.requireNonNull(ex.getProblem().getErrors().getFirst().getDetail()).equalsIgnoreCase("statusCode INVALID is invalid"); + } + return false; + }) + .verify(); + } + + @Test + void updatePaperTrackingsStatusForRework(){ + + String trackingId = "tracking123"; + String reworkId = "rework123"; + PaperTrackings existingPaperTracking = new PaperTrackings(); + existingPaperTracking.setTrackingId(trackingId); + when(paperTrackingsDAO.updateItemForRework(eq(trackingId), any(PaperTrackings.class))) + .thenReturn(Mono.just(existingPaperTracking)); + + Mono response = service.updatePaperTrackingsStatusForRework(trackingId, reworkId); + + StepVerifier.create(response) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).updateItemForRework(eq(trackingId), argThat(pt -> + pt.getState().equals(PaperTrackingsState.AWAITING_REWORK_EVENTS) && + pt.getNotificationReworkId().equals(reworkId) && + pt.getNotificationReworkRequestTimestamp() != null + )); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImplTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImplTest.java new file mode 100644 index 000000000..434dbb7a1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerErrorServiceImplTest.java @@ -0,0 +1,152 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingErrorsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsErrorsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ErrorDetails; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackingsErrors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mapstruct.factory.Mappers; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Collections; +import java.util.List; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerErrorServiceImplTest { + + @Mock + private PaperTrackingsErrorsDAO paperTrackingsErrorsDAO; + + @Spy + private PaperTrackerMapStructMapper mapper = Mappers.getMapper(PaperTrackerMapStructMapper.class); + + private PaperTrackerErrorServiceImpl paperTrackerErrorService; + + @BeforeEach + void setUp() { + paperTrackerErrorService = new PaperTrackerErrorServiceImpl(paperTrackingsErrorsDAO, mapper); + } + + @Test + void retrieveTrackingErrorsReturnsResponseWithErrors() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + PaperTrackingsErrors paperTrackingsErrors1 = new PaperTrackingsErrors(); + paperTrackingsErrors1.setTrackingId("tracking1"); + PaperTrackingsErrors paperTrackingsErrors2 = new PaperTrackingsErrors(); + paperTrackingsErrors2.setTrackingId("tracking2"); + + when(paperTrackingsErrorsDAO.retrieveErrors("tracking1")) + .thenReturn(Flux.just(paperTrackingsErrors1)); + when(paperTrackingsErrorsDAO.retrieveErrors("tracking2")) + .thenReturn(Flux.just(paperTrackingsErrors2)); + + //ACT + Mono response = paperTrackerErrorService.retrieveTrackingErrors(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getResults().getFirst().getTrackingId().equals("tracking1") && + res.getResults().getLast().getTrackingId().equals("tracking2")) + .verifyComplete(); + verify(paperTrackingsErrorsDAO, times(1)).retrieveErrors("tracking1"); + verify(paperTrackingsErrorsDAO, times(1)).retrieveErrors("tracking2"); + } + + @Test + void retrieveTrackingErrorsReturnsResponseWithoutErrors() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + PaperTrackingsErrors paperTrackingsErrors1 = new PaperTrackingsErrors(); + paperTrackingsErrors1.setTrackingId("tracking1"); + PaperTrackingsErrors paperTrackingsErrors2 = new PaperTrackingsErrors(); + paperTrackingsErrors2.setTrackingId("tracking2"); + + when(paperTrackingsErrorsDAO.retrieveErrors("tracking1")) + .thenReturn(Flux.empty()); + when(paperTrackingsErrorsDAO.retrieveErrors("tracking2")) + .thenReturn(Flux.empty()); + + //ACT + Mono response = paperTrackerErrorService.retrieveTrackingErrors(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> { + Assertions.assertNotNull(res.getResults()); + return CollectionUtils.isEmpty(res.getResults().getFirst().getErrors()) && + CollectionUtils.isEmpty(res.getResults().getLast().getErrors()); + }) + .verifyComplete(); + verify(paperTrackingsErrorsDAO, times(1)).retrieveErrors("tracking1"); + verify(paperTrackingsErrorsDAO, times(1)).retrieveErrors("tracking2"); + } + + @Test + void retrieveTrackingErrorsHandlesEmptyTrackingIds() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(Collections.emptyList()); + + //ACT + Mono response = paperTrackerErrorService.retrieveTrackingErrors(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getResults().isEmpty()) + .verifyComplete(); + verifyNoInteractions(paperTrackingsErrorsDAO); + } + + @Test + void retrieveTrackingErrorsHandlesErrorFromDAO() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1")); + + when(paperTrackingsErrorsDAO.retrieveErrors("tracking1")) + .thenReturn(Flux.error(new RuntimeException("DAO error"))); + + //ACT + Mono response = paperTrackerErrorService.retrieveTrackingErrors(request); + + //ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "DAO error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackingsErrorsDAO, times(1)).retrieveErrors("tracking1"); + } + + @Test + void insertPaperTrackingsErrorSuccessfully() { + //ARRANGE + PaperTrackingsErrors paperTrackingsErrors = new PaperTrackingsErrors(); + paperTrackingsErrors.setDetails(ErrorDetails.builder().build()); + when(paperTrackingsErrorsDAO.insertError(paperTrackingsErrors)).thenReturn(Mono.just(paperTrackingsErrors)); + + //ACT + Mono response = paperTrackerErrorService.insertPaperTrackingsError(paperTrackingsErrors); + + //ASSERT + StepVerifier.create(response) + .expectNext(paperTrackingsErrors) + .verifyComplete(); + verify(paperTrackingsErrorsDAO, times(1)).insertError(paperTrackingsErrors); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImplTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImplTest.java new file mode 100644 index 000000000..af2c98474 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerOutputServiceImplTest.java @@ -0,0 +1,136 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.PaperTrackerOutputsResponse; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackerDryRunOutputsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackerDryRunOutputs; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mapstruct.factory.Mappers; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Collections; +import java.util.List; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerOutputServiceImplTest { + + @Mock + private PaperTrackerDryRunOutputsDAO paperTrackerDryRunOutputsDAO; + + @Spy + private PaperTrackerMapStructMapper mapper = Mappers.getMapper(PaperTrackerMapStructMapper.class); + + private PaperTrackerOutputServiceImpl paperTrackerOutputService; + + @BeforeEach + void setUp() { + paperTrackerOutputService = new PaperTrackerOutputServiceImpl(paperTrackerDryRunOutputsDAO,mapper); + } + + @Test + void retrieveTrackingOutputsReturnsResponseWithOutputs() { + // Arrange + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + PaperTrackerDryRunOutputs paperTrackerDryRunOutputs1 = new PaperTrackerDryRunOutputs(); + paperTrackerDryRunOutputs1.setTrackingId("tracking1"); + PaperTrackerDryRunOutputs paperTrackerDryRunOutputs2 = new PaperTrackerDryRunOutputs(); + paperTrackerDryRunOutputs2.setTrackingId("tracking2"); + + when(paperTrackerDryRunOutputsDAO.retrieveOutputEvents("tracking1")) + .thenReturn(Flux.just(paperTrackerDryRunOutputs1)); + when(paperTrackerDryRunOutputsDAO.retrieveOutputEvents("tracking2")) + .thenReturn(Flux.just(paperTrackerDryRunOutputs2)); + + // Act + Mono response = paperTrackerOutputService.retrieveTrackingOutputs(request); + + // Assert + StepVerifier.create(response) + .expectNextMatches(res -> res.getResults().getFirst().getTrackingId().equals("tracking1") && + res.getResults().getLast().getTrackingId().equals("tracking2")) + .verifyComplete(); + + verify(paperTrackerDryRunOutputsDAO, times(1)).retrieveOutputEvents("tracking1"); + verify(paperTrackerDryRunOutputsDAO, times(1)).retrieveOutputEvents("tracking2"); + } + + @Test + void retrieveTrackingOutputsReturnsResponseWithoutOutputs() { + // Arrange + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + PaperTrackerDryRunOutputs paperTrackerDryRunOutputs1 = new PaperTrackerDryRunOutputs(); + paperTrackerDryRunOutputs1.setTrackingId("tracking1"); + PaperTrackerDryRunOutputs paperTrackerDryRunOutputs2 = new PaperTrackerDryRunOutputs(); + paperTrackerDryRunOutputs2.setTrackingId("tracking2"); + + when(paperTrackerDryRunOutputsDAO.retrieveOutputEvents("tracking1")) + .thenReturn(Flux.empty()); + when(paperTrackerDryRunOutputsDAO.retrieveOutputEvents("tracking2")) + .thenReturn(Flux.empty()); + + // Act + Mono response = paperTrackerOutputService.retrieveTrackingOutputs(request); + + // Assert + StepVerifier.create(response) + .expectNextMatches(res -> { + Assertions.assertNotNull(res.getResults()); + return CollectionUtils.isEmpty(res.getResults().getFirst().getOutputs()) && + CollectionUtils.isEmpty(res.getResults().getLast().getOutputs()); + }) + .verifyComplete(); + verify(paperTrackerDryRunOutputsDAO, times(1)).retrieveOutputEvents("tracking1"); + verify(paperTrackerDryRunOutputsDAO, times(1)).retrieveOutputEvents("tracking2"); + } + + @Test + void retrieveTrackingOutputsHandlesEmptyTrackingIds() { + // Arrange + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(Collections.emptyList()); + + // Act + Mono response = paperTrackerOutputService.retrieveTrackingOutputs(request); + + // Assert + StepVerifier.create(response) + .expectNextMatches(res -> res.getResults().isEmpty()) + .verifyComplete(); + verifyNoInteractions(paperTrackerDryRunOutputsDAO); + } + + @Test + void retrieveTrackingOutputsHandlesErrorFromDAO() { + // Arrange + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1")); + + when(paperTrackerDryRunOutputsDAO.retrieveOutputEvents("tracking1")) + .thenReturn(Flux.error(new RuntimeException("DAO error"))); + + // Act + Mono response = paperTrackerOutputService.retrieveTrackingOutputs(request); + + // Assert + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "DAO error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackerDryRunOutputsDAO, times(1)).retrieveOutputEvents("tracking1"); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImplTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImplTest.java new file mode 100644 index 000000000..38b688d0b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/PaperTrackerTrackingServiceImplTest.java @@ -0,0 +1,287 @@ +package it.pagopa.pn.papertracker.service.impl; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.config.TrackerConfigUtils; +import it.pagopa.pn.papertracker.exception.PnPaperTrackerConflictException; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingCreationRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsRequest; +import it.pagopa.pn.papertracker.generated.openapi.server.v1.dto.TrackingsResponse; +import it.pagopa.pn.papertracker.mapper.PaperTrackerMapStructMapper; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProcessingMode; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProductType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mapstruct.factory.Mappers; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.util.CollectionUtils; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.util.Collections; +import java.util.List; + +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class PaperTrackerTrackingServiceImplTest { + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @Mock + private PnPaperTrackerConfigs pnPaperTrackerConfigs; + + private PaperTrackerTrackingServiceImpl paperTrackerEventService; + + @Spy + private PaperTrackerMapStructMapper mapper = Mappers.getMapper(PaperTrackerMapStructMapper.class); + + @BeforeEach + void setUp() { + when(pnPaperTrackerConfigs.getRequiredAttachmentsRefinementStock890()).thenReturn(List.of("1970-01-01;23L")); + when(pnPaperTrackerConfigs.getSendOcrAttachmentsRefinementStock890()).thenReturn(List.of("1970-01-01;23L")); + when(pnPaperTrackerConfigs.getSendOcrAttachmentsFinalValidationStock890()).thenReturn(List.of("1970-01-01;ARCAD;CAD")); + when(pnPaperTrackerConfigs.getSendOcrAttachmentsFinalValidation()).thenReturn(List.of("1970-01-01;Plico;AR;23L")); + when(pnPaperTrackerConfigs.getStrictFinalValidationStock890()).thenReturn(List.of("1970-01-01;true")); + when(pnPaperTrackerConfigs.getStrictDeliveryFailureCause()).thenReturn(List.of("1970-01-01;false")); + when(pnPaperTrackerConfigs.getProductsProcessingModes()).thenReturn(List.of("1970-01-01;AR:RUN;RS:DRY")); + when(pnPaperTrackerConfigs.getEnableOcrValidationFor()).thenReturn(List.of("1970-01-01;AR:RUN;RIR:RUN;")); + TrackerConfigUtils trackerConfigUtils = new TrackerConfigUtils(pnPaperTrackerConfigs); + paperTrackerEventService = new PaperTrackerTrackingServiceImpl(paperTrackingsDAO,trackerConfigUtils,pnPaperTrackerConfigs, mapper); + } + + @Test + void insertPaperTrackingsValidRequest() { + //ARRANGE + TrackingCreationRequest request = getTrackerCreationRequest(); + String xOriginClientId = "clientId"; + + when(paperTrackingsDAO.putIfAbsent(argThat(pt -> + pt.getTrackingId().equals(String.join(".", request.getAttemptId(), request.getPcRetry())) && + pt.getUnifiedDeliveryDriver().equals(request.getUnifiedDeliveryDriver()) && + pt.getProductType() == ProductType.RS.getValue() && + pt.getProcessingMode() == ProcessingMode.DRY && + pt.getAnalogRequestClientId().equals(xOriginClientId) + ))).thenReturn(Mono.just(new PaperTrackings())); + + //ACT + Mono response = paperTrackerEventService.insertPaperTrackings(request, xOriginClientId); + + //ASSERT + StepVerifier.create(response) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).putIfAbsent(argThat(pt -> + pt.getTrackingId().equals(String.join(".", request.getAttemptId(), request.getPcRetry())) && + pt.getUnifiedDeliveryDriver().equals(request.getUnifiedDeliveryDriver()) && + pt.getProductType() == ProductType.RS.getValue() && + pt.getProcessingMode() == ProcessingMode.DRY && + pt.getAnalogRequestClientId().equals(xOriginClientId) + )); + } + + @Test + void insertPaperTrackingsConflictException() { + //ARRANGE + TrackingCreationRequest request = getTrackerCreationRequest(); + String xOriginClientId = "clientId"; + + when(paperTrackingsDAO.putIfAbsent(argThat(pt -> + pt.getTrackingId().equals(String.join(".", request.getAttemptId(), request.getPcRetry())) && + pt.getUnifiedDeliveryDriver().equals(request.getUnifiedDeliveryDriver()) && + pt.getProductType() == ProductType.RS.getValue() + ))).thenReturn(Mono.error(new PnPaperTrackerConflictException("", ""))); + + //ACT + Mono response = paperTrackerEventService.insertPaperTrackings(request, xOriginClientId); + + //ASSERT + StepVerifier.create(response) + .expectError(PnPaperTrackerConflictException.class) + .verify(); + verify(paperTrackingsDAO, times(1)).putIfAbsent(argThat(pt -> + pt.getTrackingId().equals(String.join(".", request.getAttemptId(), request.getPcRetry())) && + pt.getUnifiedDeliveryDriver().equals(request.getUnifiedDeliveryDriver()) && + pt.getProductType() == ProductType.RS.getValue() + )); + } + + @Test + void retrieveTrackingsReturnsResponseWithTrackings() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + PaperTrackings paperTracking1 = new PaperTrackings(); + PaperTrackings paperTracking2 = new PaperTrackings(); + TrackingsResponse expectedResponse = new TrackingsResponse(); + expectedResponse.setTrackings(List.of(mapper.toTracking(paperTracking1), mapper.toTracking(paperTracking2))); + + when(paperTrackingsDAO.retrieveAllByTrackingIds(request.getTrackingIds())) + .thenReturn(Flux.just(paperTracking1, paperTracking2)); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackings(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getTrackings().equals(expectedResponse.getTrackings())) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveAllByTrackingIds(request.getTrackingIds()); + } + + @Test + void retrieveTrackingsReturnsResponseWithoutTrackings() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1", "tracking2")); + + when(paperTrackingsDAO.retrieveAllByTrackingIds(request.getTrackingIds())) + .thenReturn(Flux.empty()); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackings(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> CollectionUtils.isEmpty(res.getTrackings())) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveAllByTrackingIds(request.getTrackingIds()); + } + + + + @Test + void retrieveTrackingsHandlesEmptyTrackingIds() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(Collections.emptyList()); + + when(paperTrackingsDAO.retrieveAllByTrackingIds(request.getTrackingIds())) + .thenReturn(Flux.empty()); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackings(request); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getTrackings().isEmpty()) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveAllByTrackingIds(request.getTrackingIds()); + } + + @Test + void retrieveTrackingsHandlesErrorFromDAO() { + //ARRANGE + TrackingsRequest request = new TrackingsRequest(); + request.setTrackingIds(List.of("tracking1")); + + when(paperTrackingsDAO.retrieveAllByTrackingIds(request.getTrackingIds())) + .thenReturn(Flux.error(new RuntimeException("DAO error"))); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackings(request); + + //ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "DAO error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackingsDAO, times(1)).retrieveAllByTrackingIds(request.getTrackingIds()); + } + + @Test + void retrieveTrackingsByAttemptIdReturnsResponseWithTrackings() { + //ARRANGE + String attemptId = "attempt123"; + String pcRetry = "PCRETRY_0"; + PaperTrackings paperTracking1 = new PaperTrackings(); + PaperTrackings paperTracking2 = new PaperTrackings(); + TrackingsResponse expectedResponse = new TrackingsResponse(); + expectedResponse.setTrackings(List.of(mapper.toTracking(paperTracking1), mapper.toTracking(paperTracking2))); + + when(paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, pcRetry)) + .thenReturn(Flux.just(paperTracking1, paperTracking2)); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackingsByAttemptId(attemptId, pcRetry); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getTrackings().equals(expectedResponse.getTrackings())) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveEntityByAttemptId(attemptId, pcRetry); + } + + @Test + void retrieveTrackingsByAttemptIdReturnsResponseWithoutTrackings() { + //ARRANGE + String attemptId = "attempt123"; + String pcRetry = "PCRETRY_0"; + + when(paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, pcRetry)) + .thenReturn(Flux.empty()); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackingsByAttemptId(attemptId, pcRetry); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> CollectionUtils.isEmpty(res.getTrackings())) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveEntityByAttemptId(attemptId, pcRetry); + } + + @Test + void retrieveTrackingsByAttemptIdHandlesEmptyTrackingIds() { + //ARRANGE + String attemptId = "attempt123"; + String pcRetry = "PCRETRY_0"; + + when(paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, pcRetry)) + .thenReturn(Flux.empty()); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackingsByAttemptId(attemptId, pcRetry); + + //ASSERT + StepVerifier.create(response) + .expectNextMatches(res -> res.getTrackings().isEmpty()) + .verifyComplete(); + verify(paperTrackingsDAO, times(1)).retrieveEntityByAttemptId(attemptId, pcRetry); + } + + @Test + void retrieveTrackingsByAttemptIdHandlesErrorFromDAO() { + //ARRANGE + String attemptId = "attempt123"; + String pcRetry = "PCRETRY_0"; + + when(paperTrackingsDAO.retrieveEntityByAttemptId(attemptId, pcRetry)) + .thenReturn(Flux.error(new RuntimeException("DAO error"))); + + //ACT + Mono response = paperTrackerEventService.retrieveTrackingsByAttemptId(attemptId, pcRetry); + + //ASSERT + StepVerifier.create(response) + .expectErrorMatches(throwable -> throwable instanceof RuntimeException + && "DAO error".equals(throwable.getMessage())) + .verify(); + verify(paperTrackingsDAO, times(1)).retrieveEntityByAttemptId(attemptId, pcRetry); + } + + private TrackingCreationRequest getTrackerCreationRequest() { + TrackingCreationRequest request = new TrackingCreationRequest(); + request.setAttemptId("request123"); + request.setPcRetry("PCRETRY_0"); + request.setUnifiedDeliveryDriver("driver456"); + request.setProductType("RS"); + return request; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImplTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImplTest.java new file mode 100644 index 000000000..8cc77a583 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/service/impl/SourceQueueProxyServiceImplTest.java @@ -0,0 +1,482 @@ +package it.pagopa.pn.papertracker.service.impl; + +import com.fasterxml.jackson.databind.ObjectMapper; +import it.pagopa.pn.papertracker.exception.PaperTrackerException; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.PaperProgressStatusEvent; +import it.pagopa.pn.papertracker.generated.openapi.msclient.externalchannel.model.SingleStatusUpdate; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.ProcessingMode; +import it.pagopa.pn.papertracker.middleware.queue.model.ExternalChannelEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperChannelDryRunMomProducer; +import it.pagopa.pn.papertracker.middleware.queue.producer.ExternalChannelToPaperTrackerMomProducer; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; +import software.amazon.awssdk.services.sqs.model.MessageAttributeValue; + +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class SourceQueueProxyServiceImplTest { + + @Mock + private ObjectMapper objectMapper; + + @Mock + private ExternalChannelToPaperTrackerMomProducer paperTrackerProducer; + + @Mock + private ExternalChannelToPaperChannelDryRunMomProducer paperChannelDryRunProducer; + + @Mock + private PaperTrackingsDAO paperTrackingsDAO; + + @InjectMocks + private SourceQueueProxyServiceImpl service; + + @Captor + private ArgumentCaptor eventCaptor; + + private SingleStatusUpdate message; + private Map attributes; + private PaperProgressStatusEvent analogMail; + private static final String REQUEST_ID = "test-request-id-123"; + + @BeforeEach + void setUp() { + analogMail = new PaperProgressStatusEvent(); + analogMail.setRequestId(REQUEST_ID); + + message = new SingleStatusUpdate(); + message.setAnalogMail(analogMail); + + attributes = Map.of(); + } + + @Test + void handleExternalChannelMessage_trackingNotFound_shouldSendToPaperChannelOnly() { + // Arrange + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.empty()); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, never()).push(any(ExternalChannelEvent.class)); + verify(paperTrackingsDAO, times(1)).retrieveEntityByTrackingId(REQUEST_ID); + } + + @Test + void handleExternalChannelMessage_nullProcessingMode_shouldSendToBothQueues() { + // Arrange + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(null); + tracking.setTrackingId(REQUEST_ID); + + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(eventCaptor.capture()); + verify(paperTrackerProducer, times(1)).push(eventCaptor.capture()); + verify(paperTrackingsDAO, times(1)).retrieveEntityByTrackingId(REQUEST_ID); + + // Verifica che l'evento abbia il flag dryRun impostato a true + var capturedEvents = eventCaptor.getAllValues(); + assertEquals(2, capturedEvents.size()); + capturedEvents.forEach(event -> { + assertNotNull(event.getHeader()); + assertNotNull(event.getPayload()); + assertEquals(message, event.getPayload()); + }); + } + + @Test + void handleExternalChannelMessage_dryMode_shouldSendToBothQueues() { + // Arrange + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.DRY); + tracking.setTrackingId(REQUEST_ID); + + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(eventCaptor.capture()); + verify(paperTrackerProducer, times(1)).push(eventCaptor.capture()); + verify(paperTrackingsDAO, times(1)).retrieveEntityByTrackingId(REQUEST_ID); + + // Verifica che l'evento abbia il flag dryRun impostato a true + var capturedEvents = eventCaptor.getAllValues(); + assertEquals(2, capturedEvents.size()); + capturedEvents.forEach(event -> { + assertNotNull(event.getHeader()); + assertNotNull(event.getPayload()); + assertEquals(message, event.getPayload()); + }); + } + + @Test + void handleExternalChannelMessage_runMode_shouldSendToPaperTrackerOnly() { + // Arrange + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.RUN); + tracking.setTrackingId(REQUEST_ID); + + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + + verify(paperTrackerProducer, times(1)).push(eventCaptor.capture()); + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + verify(paperTrackingsDAO, times(1)).retrieveEntityByTrackingId(REQUEST_ID); + + // Verifica l'evento catturato + ExternalChannelEvent capturedEvent = eventCaptor.getValue(); + assertNotNull(capturedEvent.getHeader()); + assertEquals(message, capturedEvent.getPayload()); + } + + @Test + void handleExternalChannelMessage_nullAnalogMail_shouldReturnError() { + // Arrange + SingleStatusUpdate invalidMessage = new SingleStatusUpdate(); + invalidMessage.setAnalogMail(null); + + // Act + Mono result = service.handleExternalChannelMessage(invalidMessage, attributes); + + // Assert + StepVerifier.create(result) + .expectError(PaperTrackerException.class) + .verify(); + + verify(paperTrackingsDAO, never()).retrieveEntityByTrackingId(any()); + verify(paperTrackerProducer, never()).push((ExternalChannelEvent) any()); + verify(paperChannelDryRunProducer, never()).push((ExternalChannelEvent) any()); + } + + @Test + void handleExternalChannelMessage_nullRequestId_shouldReturnError() { + // Arrange + PaperProgressStatusEvent mailWithoutRequestId = new PaperProgressStatusEvent(); + mailWithoutRequestId.setRequestId(null); + + SingleStatusUpdate messageWithoutRequestId = new SingleStatusUpdate(); + messageWithoutRequestId.setAnalogMail(mailWithoutRequestId); + + when(paperTrackingsDAO.retrieveEntityByTrackingId(null)) + .thenReturn(Mono.empty()); + + // Act + Mono result = service.handleExternalChannelMessage(messageWithoutRequestId, attributes); + + // Assert + StepVerifier.create(result) + .verifyComplete(); + } + + @Test + void handleExternalChannelMessage_daoError_shouldPropagateError() { + // Arrange + RuntimeException daoException = new RuntimeException("DAO error"); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.error(daoException)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result) + .expectError(RuntimeException.class) + .verify(); + + verify(paperTrackerProducer, never()).push((ExternalChannelEvent) any()); + verify(paperChannelDryRunProducer, never()).push((ExternalChannelEvent) any()); + } + + @Test + void buildOutputMessage_shouldPropagateOriginalMessageHeaders() { + // Arrange + Map messageAttributes = Map.of( + "customHeader1", MessageAttributeValue.builder() + .dataType("String") + .stringValue("customValue1") + .build(), + "customHeader2", MessageAttributeValue.builder() + .dataType("String") + .stringValue("12345") + .build(), + "customHeader3", MessageAttributeValue.builder() + .dataType("String") + .stringValue("true") + .build() + ); + + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.RUN); + tracking.setTrackingId(REQUEST_ID); + + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, messageAttributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperTrackerProducer).push(eventCaptor.capture()); + + ExternalChannelEvent event = eventCaptor.getValue(); + assertNotNull(event); + assertNotNull(event.getHeader()); + assertNotNull(event.getHeader().getMessageAttributes()); + + // Verifica che gli header originali siano stati propagati + var messageAttributesOut = event.getHeader().getMessageAttributes(); + assertTrue(messageAttributesOut.containsKey("customHeader1")); + assertTrue(messageAttributesOut.containsKey("customHeader2")); + assertTrue(messageAttributesOut.containsKey("customHeader3")); + + assertEquals("customValue1", messageAttributesOut.get("customHeader1").stringValue()); + assertEquals("12345", messageAttributesOut.get("customHeader2").stringValue()); + assertEquals("true", messageAttributesOut.get("customHeader3").stringValue()); + + // Verifica che sia stato aggiunto anche il dryRun header + assertTrue(messageAttributesOut.containsKey("dryRun")); + assertEquals("false", messageAttributesOut.get("dryRun").stringValue()); + } + + + @Test + void handleExternalChannelMessage_dryMode_shouldSetDryRunHeaderToTrue() { + // Arrange + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.DRY); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer).push(eventCaptor.capture()); + + ExternalChannelEvent event = eventCaptor.getValue(); + assertNotNull(event.getHeader().getMessageAttributes()); + } + + @Test + void handleExternalChannelMessage_runMode_shouldSetDryRunHeaderToFalse() { + // Arrange + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.RUN); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperTrackerProducer).push(eventCaptor.capture()); + + ExternalChannelEvent event = eventCaptor.getValue(); + assertNotNull(event.getHeader().getMessageAttributes()); + } + + // ===== Test filtro eventi duplicati (isDuplicate) ===== + + @Test + void handleExternalChannelMessage_trackingNotFound_duplicate_shouldNotSend() { + // Arrange + analogMail.setIsDuplicate(true); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.empty()); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, never()).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_trackingNotFound_notDuplicate_shouldSendToPaperChannelOnly() { + // Arrange + analogMail.setIsDuplicate(false); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.empty()); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, never()).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_dryMode_duplicate_shouldSendToPaperTrackerOnly() { + // Arrange + analogMail.setIsDuplicate(true); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.DRY); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_dryMode_notDuplicate_shouldSendToBothQueues() { + // Arrange + analogMail.setIsDuplicate(false); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.DRY); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_runMode_notDuplicate_shouldSendToPaperTrackerOnly() { + // Arrange + analogMail.setIsDuplicate(false); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.RUN); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_runMode_duplicate_shouldSendToPaperTrackerOnly() { + // Arrange + analogMail.setIsDuplicate(true); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(ProcessingMode.RUN); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_nullProcessingMode_duplicate_shouldSendToPaperTrackerOnly() { + // Arrange + analogMail.setIsDuplicate(true); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(null); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, never()).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + } + + @Test + void handleExternalChannelMessage_nullProcessingMode_notDuplicate_shouldSendToBothQueues() { + // Arrange + analogMail.setIsDuplicate(false); + PaperTrackings tracking = new PaperTrackings(); + tracking.setProcessingMode(null); + tracking.setTrackingId(REQUEST_ID); + when(paperTrackingsDAO.retrieveEntityByTrackingId(REQUEST_ID)) + .thenReturn(Mono.just(tracking)); + + // Act + Mono result = service.handleExternalChannelMessage(message, attributes); + + // Assert + StepVerifier.create(result).verifyComplete(); + + verify(paperChannelDryRunProducer, times(1)).push(any(ExternalChannelEvent.class)); + verify(paperTrackerProducer, times(1)).push(any(ExternalChannelEvent.class)); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/LogUtilityTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/LogUtilityTest.java new file mode 100644 index 000000000..1ae0c29d6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/LogUtilityTest.java @@ -0,0 +1,212 @@ +package it.pagopa.pn.papertracker.utils; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.awspring.cloud.sqs.listener.SqsHeaders; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.messaging.Message; +import org.springframework.messaging.MessageHeaders; +import org.springframework.messaging.support.GenericMessage; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; + +class LogUtilityTest { + + private LogUtility logUtility; + private ObjectMapper objectMapper; + + private static final String REQUEST_ID = "TEST"; + + @BeforeEach + void setUp() { + objectMapper = new ObjectMapper(); + logUtility = new LogUtility(objectMapper); + } + + // POJO helper classes + static class Payload { + public AnalogMail analogMail; + } + + static class AnalogMail { + public String requestId; + public DiscoveredAddress discoveredAddress; + } + + static class DiscoveredAddress { + public String name; + public String nameRow2; + public String address; + public String addressRow2; + public String cap; + public String city; + public String city2; + public String pr; + public String country; + } + + static class User { + public String name; + public String fiscalCode; + public Contacts contacts; + } + + static class Contacts { + public String email; + public String phone; + } + + static class Item { + public int id; + public DiscoveredAddress discoveredAddress; + } + + static class ContainerWithItems { + public List items; + } + + + @Test + void shouldMaskDiscoveredAddressAtAnyDepth() throws Exception { + // Arrange + DiscoveredAddress address = new DiscoveredAddress(); + address.name = "Mario Rossi"; + address.address = "Via Roma 123"; + + AnalogMail analogMail = new AnalogMail(); + analogMail.requestId = REQUEST_ID; + analogMail.discoveredAddress = address; + + Payload payload = new Payload(); + payload.analogMail = analogMail; + + // Act + String maskedJson = logUtility.maskSensitiveData(payload, "discoveredAddress"); + JsonNode node = objectMapper.readTree(maskedJson); + + // Assert + assertThat(node.at("/analogMail/discoveredAddress").asText()).isEqualTo("***"); + assertThat(node.at("/analogMail/requestId").asText()).isEqualTo(REQUEST_ID); + } + + @Test + void shouldMaskObjectsInsideArrays() throws Exception { + // Arrange + Item item1 = new Item(); + item1.id = 1; + item1.discoveredAddress = new DiscoveredAddress(); + item1.discoveredAddress.address = "Via Roma 1"; + + Item item2 = new Item(); + item2.id = 2; + item2.discoveredAddress = new DiscoveredAddress(); + item2.discoveredAddress.address = "Via Milano 2"; + + ContainerWithItems container = new ContainerWithItems(); + container.items = List.of(item1, item2); + + // Act + String maskedJson = logUtility.maskSensitiveData(container, "discoveredAddress"); + JsonNode root = objectMapper.readTree(maskedJson); + + // Assert + for (JsonNode item : root.at("/items")) { + assertThat(item.get("discoveredAddress").asText()).isEqualTo("***"); + } + } + + @Test + void shouldMaskMultipleSensitiveFields() throws Exception { + // Arrange + Contacts contacts = new Contacts(); + contacts.email = "mario.rossi@test.it"; + contacts.phone = "3331234567"; + + User user = new User(); + user.name = "Mario Rossi"; + user.fiscalCode = "RSSMRA80A01H501U"; + user.contacts = contacts; + + // Act + String maskedJson = logUtility.maskSensitiveData( + user, + "fiscalCode", + "email", + "phone" + ); + JsonNode root = objectMapper.readTree(maskedJson); + + // Assert + assertThat(root.at("/fiscalCode").asText()).isEqualTo("***"); + assertThat(root.at("/contacts/email").asText()).isEqualTo("***"); + assertThat(root.at("/contacts/phone").asText()).isEqualTo("***"); + assertThat(root.at("/name").asText()).isEqualTo("Mario Rossi"); + } + + @Test + void shouldHandleNullInputSafely() { + // Arrange + Object obj = null; + + // Act + String masked = logUtility.maskSensitiveData(obj, "anyField"); + + // Assert + assertThat(masked).isEqualTo("null"); + } + + @Test + void shouldNotFailIfFieldIsAbsent() throws Exception { + // Arrange + Map map = Map.of("foo", "bar"); + + // Act + String maskedJson = logUtility.maskSensitiveData(map, "discoveredAddress"); + JsonNode node = objectMapper.readTree(maskedJson); + + // Assert + assertThat(node.get("foo").asText()).isEqualTo("bar"); + } + + @Test + void shouldAnonymizePayloadAndExcludeBodyFromHeaders() { + // Arrange + DiscoveredAddress address = new DiscoveredAddress(); + address.name = "Mario Rossi"; + address.address = "Via Roma 123"; + + AnalogMail analogMail = new AnalogMail(); + analogMail.requestId = REQUEST_ID; + analogMail.discoveredAddress = address; + + Payload payload = new Payload(); + payload.analogMail = analogMail; + + Map headers = new LinkedHashMap<>(); + headers.put("SomeHeader", "SomeValue"); + headers.put("Body", "{\"analogMail\":{}}"); // Simula header Body + + Message message = new GenericMessage<>(payload, new MessageHeaders(headers)); + + // Act + String result = logUtility.messageToString(message, Set.of("discoveredAddress")); + + // Assert + // Il payload deve essere mascherato + assertThat(result).contains("\"discoveredAddress\":\"***\""); + // Il campo non sensibile resta invariato + assertThat(result).contains(REQUEST_ID); + // L'header "Body" non deve essere presente + assertThat(result).doesNotContain(SqsHeaders.SQS_SOURCE_DATA_HEADER); + // Gli altri header devono essere presenti + assertThat(result).contains("SomeHeader=SomeValue"); + + System.out.println(result); + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/MetricUtilsTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/MetricUtilsTest.java new file mode 100644 index 000000000..9330b2b1e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/MetricUtilsTest.java @@ -0,0 +1,54 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.commons.log.dto.metrics.Dimension; +import it.pagopa.pn.commons.log.dto.metrics.GeneralMetric; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +class MetricUtilsTest { + + @Test + void generateDimension_createsCorrectDimension() { + Dimension dimension = MetricUtils.generateDimension(MetricUtils.DimensionName.ERROR_CATEGORY, "TestValue"); + assertEquals("errorCategory", dimension.getName()); + assertEquals("TestValue", dimension.getValue()); + } + + @Test + void generateGeneralMetric_createsMetricWithoutUnit() { + GeneralMetric metric = MetricUtils.generateGeneralMetric( + MetricUtils.MetricName.ERROR_COUNT, + 5, + List.of(new Dimension("key", "value")) + ); + + assertEquals("paper-tracker-errors", metric.getNamespace()); + assertEquals("ERROR_COUNT", metric.getMetrics().getFirst().getName()); + assertEquals(5, metric.getMetrics().getFirst().getValue()); + assertEquals("key", metric.getDimensions().getFirst().getName()); + assertEquals("value", metric.getDimensions().getFirst().getValue()); + assertTrue(metric.getTimestamp() > 0); + assertNull(metric.getUnit()); + } + + @Test + void generateGeneralMetric_createsMetricWithUnit() { + GeneralMetric metric = MetricUtils.generateGeneralMetric( + MetricUtils.MetricName.ERROR_COUNT, + 10, + List.of(new Dimension("key", "value")), + MetricUtils.MetricUnit.COUNT + ); + + assertEquals("paper-tracker-errors", metric.getNamespace()); + assertEquals("ERROR_COUNT", metric.getMetrics().getFirst().getName()); + assertEquals(10, metric.getMetrics().getFirst().getValue()); + assertEquals("key", metric.getDimensions().getFirst().getName()); + assertEquals("value", metric.getDimensions().getFirst().getValue()); + assertTrue(metric.getTimestamp() > 0); + assertEquals("Count", metric.getUnit()); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/OcrUtilityTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/OcrUtilityTest.java new file mode 100644 index 000000000..49dee9fec --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/OcrUtilityTest.java @@ -0,0 +1,315 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.papertracker.config.PnPaperTrackerConfigs; +import it.pagopa.pn.papertracker.middleware.dao.PaperTrackingsDAO; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.*; +import it.pagopa.pn.papertracker.middleware.msclient.SafeStorageClient; +import it.pagopa.pn.papertracker.middleware.queue.model.OcrEvent; +import it.pagopa.pn.papertracker.middleware.queue.producer.OcrMomProducer; +import it.pagopa.pn.papertracker.model.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneOffset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG010A; +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.RECAG012; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +@ExtendWith(MockitoExtension.class) +class OcrUtilityTest { + @Mock + OcrMomProducer ocrMomProducer; + @Mock + SafeStorageClient safeStorageClient; + @Mock + PnPaperTrackerConfigs cfg; + @Mock + PaperTrackingsDAO paperTrackingsDAO; + + @InjectMocks + OcrUtility ocrUtility; + + private HandlerContext context; + private PaperTrackings paperTrackings; + + @BeforeEach + void setUp() { + ocrUtility = new OcrUtility(ocrMomProducer, safeStorageClient, cfg, paperTrackingsDAO); + context = new HandlerContext(); + paperTrackings = new PaperTrackings(); + paperTrackings.setTrackingId("trackingId"); + paperTrackings.setProductType(ProductType.AR.getValue()); + paperTrackings.setValidationConfig(new ValidationConfig()); + paperTrackings.setPaperStatus(new PaperStatus()); + paperTrackings.setEvents(new ArrayList<>()); + context.setPaperTrackings(paperTrackings); + } + + @Test + void checkAndSendToOcr_OcrEnabled_ValidAttachments() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + Map> attachments = new HashMap<>(); + Attachment att = new Attachment(); + att.setUri("uri.pdf"); + att.setDocumentType("ARCAD"); + attachments.put("attachmentEventId", List.of(att)); + Event event = new Event(); + event.setId("finalEventId"); + event.setStatusCode(RECAG012.name()); + event.setStatusTimestamp(Instant.now()); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(true) + .verifyComplete(); + + // Assert + verify(ocrMomProducer, times(1)).push(any(OcrEvent.class)); + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + assertEquals(1, updatedPaperTrackings.getValidationFlow().getOcrRequests().size()); + assertEquals("attachmentEventId", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("finalEventId", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("ARCAD", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + } + + @Test + void checkAndSendToOcr_OcrDisabled() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.DISABLED); + Map> attachments = new HashMap<>(); + Event event = new Event(); + event.setStatusCode(RECAG012.name()); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(false) + .verifyComplete(); + + // Assert + verifyNoInteractions(ocrMomProducer); + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + assertTrue(updatedPaperTrackings.getValidationFlow().getOcrRequests().isEmpty()); + } + + @Test + void checkAndSendToOcr_OcrEnabled_NoValidAttachments() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + Map> attachments = new HashMap<>(); + Attachment att = new Attachment(); + att.setUri("uri.txt"); + att.setDocumentType("ARCAD"); + attachments.put("eventId", List.of(att)); + Event event = new Event(); + event.setStatusCode(RECAG012.name()); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(false) + .verifyComplete(); + + // Assert + verifyNoInteractions(ocrMomProducer); + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + assertTrue(updatedPaperTrackings.getValidationFlow().getOcrRequests().isEmpty()); + } + + @Test + void checkAndSendToOcr_OcrEnabled_EmptyAttachments() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + Event event = new Event(); + event.setStatusCode(RECAG012.name()); + Map> attachments = new HashMap<>(); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(false) + .verifyComplete(); + + // Assert + verifyNoInteractions(ocrMomProducer); + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + assertTrue(updatedPaperTrackings.getValidationFlow().getOcrRequests().isEmpty()); + } + + @Test + void checkAndSendToOcr_OcrDry_ValidAttachments() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.DRY); + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + Map> attachments = new HashMap<>(); + Attachment att = new Attachment(); + att.setUri("uri.pdf"); + att.setDocumentType("ARCAD"); + attachments.put("attachmentEventId", List.of(att)); + Event event = new Event(); + event.setId("finalEventId"); + event.setStatusCode(RECAG012.name()); + event.setStatusTimestamp(Instant.now()); + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(false) + .verifyComplete(); + + // Assert + verify(ocrMomProducer, times(1)).push(any(OcrEvent.class)); + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + assertEquals(1, updatedPaperTrackings.getValidationFlow().getOcrRequests().size()); + assertEquals("attachmentEventId", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getAttachmentEventId()); + assertEquals("finalEventId", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getFinalEventId()); + assertEquals("ARCAD", updatedPaperTrackings.getValidationFlow().getOcrRequests().getFirst().getDocumentType()); + } + + @Test + void checkAndSendToOcr_OcrEnabled_MixedAttachments_OnlyValidAreProcessed() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + + Map> attachments = new HashMap<>(); + attachments.put("eventId1", List.of(buildAttachment("valid.pdf", "ARCAD", null, null))); + attachments.put("eventId2", List.of(buildAttachment("valid2.PDF", "ARCAD", SourceType.SCANNED.name(), OriginType.ORIGINAL.name()))); + attachments.put("eventId3", List.of(buildAttachment("valid3.pdf", "ARCAD", SourceType.SCANNED.name(), null))); + attachments.put("eventId4", List.of(buildAttachment("invalid-source.pdf", "ARCAD", SourceType.DIGITAL.name(), OriginType.ORIGINAL.name()))); + attachments.put("eventId5", List.of(buildAttachment("invalid-origin.pdf", "ARCAD", SourceType.SCANNED.name(), OriginType.DUPLICATED.name()))); + attachments.put("eventId6", List.of(buildAttachment("invalid.txt", "ARCAD", null, null))); + + Event event = buildEvent(); + + when(safeStorageClient.getSafeStoragePresignedUrl("valid.pdf")).thenReturn(Mono.just("presigned-valid")); + when(safeStorageClient.getSafeStoragePresignedUrl("valid2.PDF")).thenReturn(Mono.just("presigned-valid2")); + when(safeStorageClient.getSafeStoragePresignedUrl("valid3.pdf")).thenReturn(Mono.just("presigned-valid3")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(event, attachments, context)) + .expectNext(true) + .verifyComplete(); + + // Assert + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("valid.pdf"); + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("valid2.PDF"); + verify(safeStorageClient, times(1)).getSafeStoragePresignedUrl("valid3.pdf"); + verify(safeStorageClient, never()).getSafeStoragePresignedUrl("invalid-source.pdf"); + verify(safeStorageClient, never()).getSafeStoragePresignedUrl("invalid-origin.pdf"); + verify(safeStorageClient, never()).getSafeStoragePresignedUrl("invalid.txt"); + + ArgumentCaptor paperTrackingsArgumentCaptor = ArgumentCaptor.forClass(PaperTrackings.class); + verify(paperTrackingsDAO, times(1)).updateItem(any(), paperTrackingsArgumentCaptor.capture()); + PaperTrackings updatedPaperTrackings = paperTrackingsArgumentCaptor.getValue(); + + assertEquals(OcrStatusEnum.RUN, updatedPaperTrackings.getValidationConfig().getOcrEnabled()); + assertEquals(3, updatedPaperTrackings.getValidationFlow().getOcrRequests().size()); + assertTrue(updatedPaperTrackings.getValidationFlow().getOcrRequests().stream() + .map(OcrRequest::getUri) + .toList() + .containsAll(List.of("valid.pdf", "valid2.PDF", "valid3.pdf"))); + } + + @Test + void checkAndSendToOcr_OcrEnabled_DeliveryAttemptDate() { + // Arrange + paperTrackings.getValidationConfig().setOcrEnabled(OcrStatusEnum.RUN); + paperTrackings.getValidationConfig().setOcrFileTypes(List.of(FileType.PDF.getValue())); + + Event recag010aEvent = new Event(); + recag010aEvent.setStatusCode(RECAG010A.name()); + recag010aEvent.setRequestTimestamp(Instant.parse("2026-01-10T11:00:00Z")); + recag010aEvent.setStatusTimestamp(Instant.parse("2026-01-10T12:00:00Z")); + + Event ignoredEvent = new Event(); + ignoredEvent.setStatusCode(RECAG012.name()); + ignoredEvent.setRequestTimestamp(Instant.parse("2026-01-10T13:00:00Z")); + ignoredEvent.setStatusTimestamp(Instant.parse("2026-01-10T14:00:00Z")); + + paperTrackings.setEvents(List.of(recag010aEvent, ignoredEvent)); + + Map> attachments = new HashMap<>(); + Attachment attachment = new Attachment(); + attachment.setUri("uri.pdf"); + attachment.setDocumentType("ARCAD"); + attachments.put("attachmentEventId", List.of(attachment)); + + Event finalEvent = new Event(); + finalEvent.setId("finalEventId"); + finalEvent.setStatusCode(RECAG012.name()); + finalEvent.setStatusTimestamp(Instant.parse("2026-01-10T15:00:00Z")); + + when(safeStorageClient.getSafeStoragePresignedUrl("uri.pdf")).thenReturn(Mono.just("presigned-url-1")); + when(paperTrackingsDAO.updateItem(any(), any())).thenReturn(Mono.just(paperTrackings)); + + // Act + StepVerifier.create(ocrUtility.checkAndSendToOcr(finalEvent, attachments, context)) + .expectNext(true) + .verifyComplete(); + + // Assert + ArgumentCaptor ocrEventArgumentCaptor = ArgumentCaptor.forClass(OcrEvent.class); + verify(ocrMomProducer, times(1)).push(ocrEventArgumentCaptor.capture()); + + LocalDateTime expectedDeliveryAttemptDate = LocalDateTime.ofInstant(recag010aEvent.getStatusTimestamp(), ZoneOffset.UTC); + LocalDateTime actualDeliveryAttemptDate = ocrEventArgumentCaptor.getValue() + .getPayload() + .getData() + .getDetails() + .getDeliveryAttemptDate(); + + assertEquals(expectedDeliveryAttemptDate, actualDeliveryAttemptDate); + } + + private Event buildEvent() { + Event event = new Event(); + event.setId("finalEventId"); + event.setStatusCode(RECAG012.name()); + event.setStatusTimestamp(Instant.now()); + return event; + } + + private Attachment buildAttachment(String uri, String documentType, String sourceType, String originType) { + Attachment attachment = new Attachment(); + attachment.setUri(uri); + attachment.setDocumentType(documentType); + attachment.setSourceType(sourceType); + attachment.setOriginType(originType); + return attachment; + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMockTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMockTest.java new file mode 100644 index 000000000..9d8e48d1d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/PcRetryUtilsMockTest.java @@ -0,0 +1,158 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.papertracker.generated.openapi.msclient.paperchannel.model.PcRetryResponse; +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.PaperTrackings; +import org.junit.jupiter.api.Test; +import reactor.test.StepVerifier; + +import static it.pagopa.pn.papertracker.model.EventStatusCodeEnum.CON996; +import static org.junit.jupiter.api.Assertions.*; + +class PcRetryUtilsMockTest { + + private static PaperTrackings tracking(String requestId, String driverId) { + PaperTrackings pt = new PaperTrackings(); + pt.setTrackingId(requestId); + pt.setUnifiedDeliveryDriver(driverId); + return pt; + } + + + @Test + void returnsZero_whenNoSuffixPresent() { + assertEquals(0, PcRetryUtilsMock.getRetryAttempt("REQ-123")); + } + + @Test + void returnsZero_whenSuffixIsZero() { + assertEquals(0, PcRetryUtilsMock.getRetryAttempt("REQ.PCRETRY_0")); + } + + @Test + void returnsNumber_whenSuffixIsMultiDigit() { + assertEquals(1, PcRetryUtilsMock.getRetryAttempt("REQ.PCRETRY_1")); + } + + @Test + void returnsCorrect_whenOtherUnderscoresExist() { + assertEquals(3, PcRetryUtilsMock.getRetryAttempt("A_B_C.PCRETRY_3")); + } + + + @Test + void increments_whenSuffixPresent() { + assertEquals("REQ.PCRETRY_1", PcRetryUtilsMock.setRetryRequestId("REQ.PCRETRY_0")); + assertEquals("REQ.PCRETRY_2", PcRetryUtilsMock.setRetryRequestId("REQ.PCRETRY_1")); + } + + @Test + void unchanged_whenSuffixMissing() { + assertEquals("REQ-123", PcRetryUtilsMock.setRetryRequestId("REQ-123")); + } + + + @Test + void true_whenUnlimitedMinusOne() { + assertTrue(PcRetryUtilsMock.hasOtherAttempt("REQ.PCRETRY_999", -1)); + } + + @Test + void true_whenMaxRetryEqualsCurrentAttempt() { + assertTrue(PcRetryUtilsMock.hasOtherAttempt("REQ.PCRETRY_3", 3)); + } + + @Test + void false_whenMaxRetryEqualsCurrentAttempt() { + assertFalse(PcRetryUtilsMock.hasOtherAttempt("REQ.PCRETRY_4", 3)); + } + + @Test + void true_whenMaxRetryLessThanCurrentAttempt() { + assertTrue(PcRetryUtilsMock.hasOtherAttempt("REQ.PCRETRY_0", 0)); + } + + @Test + void false_whenMaxRetryLessThanCurrentAttempt() { + assertFalse(PcRetryUtilsMock.hasOtherAttempt("REQ.PCRETRY_1", 0)); + } + + + @Test + void setsBothFields_whenSuffixPresent() { + PcRetryResponse resp = new PcRetryResponse(); + PcRetryUtilsMock.setRetryRequestIdAndPcRetry(resp, "REQ.PCRETRY_7"); + + assertEquals("REQ.PCRETRY_7", resp.getRequestId()); + assertEquals("PCRETRY_7", resp.getPcRetry()); + } + + + @Test + void retryFound_nonCon996_andWithinLimit_incrementsSuffixAndSetsFields() { + PaperTrackings pt = tracking("REQ.PCRETRY_3", "DRV-1"); + + StepVerifier.create(PcRetryUtilsMock.getPcRetryPaperMock(pt, 3, "RECRN006")) + .assertNext(resp -> { + assertEquals(Boolean.TRUE, resp.getRetryFound()); + assertEquals(pt.getTrackingId(), resp.getParentRequestId()); + assertEquals(pt.getUnifiedDeliveryDriver(), resp.getDeliveryDriverId()); + assertEquals("REQ.PCRETRY_4", resp.getRequestId()); + assertEquals("PCRETRY_4", resp.getPcRetry()); + }) + .verifyComplete(); + } + + @Test + void noRetryFound_nonCon996_whenOverLimit() { + PaperTrackings pt = tracking("REQ.PCRETRY_4", "DRV-1"); + + StepVerifier.create(PcRetryUtilsMock.getPcRetryPaperMock(pt, 3, "RECRN006")) + .assertNext(resp -> { + assertNotEquals(Boolean.TRUE, resp.getRetryFound()); + assertEquals(pt.getTrackingId(), resp.getParentRequestId()); + assertEquals(pt.getUnifiedDeliveryDriver(), resp.getDeliveryDriverId()); + assertNull(resp.getRequestId()); + assertNull(resp.getPcRetry()); + }) + .verifyComplete(); + } + + @Test + void retryFound_CON996_allowsOnlyIfCurrentAttemptIsZero() { + PaperTrackings pt = tracking("REQ.PCRETRY_0", "DRV-1"); + + StepVerifier.create(PcRetryUtilsMock.getPcRetryPaperMock(pt, 0, CON996.name())) + .assertNext(resp -> { + assertEquals(Boolean.TRUE, resp.getRetryFound()); + assertEquals("REQ.PCRETRY_1", resp.getRequestId()); + assertEquals("PCRETRY_1", resp.getPcRetry()); + }) + .verifyComplete(); + } + + @Test + void noRetryFound_CON996_whenCurrentAttemptGreaterThanZero() { + PaperTrackings pt = tracking("REQ.PCRETRY_1", "DRV-1"); + + StepVerifier.create(PcRetryUtilsMock.getPcRetryPaperMock(pt, 0, CON996.name())) + .assertNext(resp -> { + assertNotEquals(Boolean.TRUE, resp.getRetryFound()); + assertNull(resp.getRequestId()); + assertNull(resp.getPcRetry()); + }) + .verifyComplete(); + } + + @Test + void noRetryFound_whenSuffixMissing_andRetryNotAllowed() { + PaperTrackings pt = tracking("REQ.PCRETRY_0", "DRV-1"); + + StepVerifier.create(PcRetryUtilsMock.getPcRetryPaperMock(pt, -1, "RECRN006")) + .assertNext(resp -> { + assertEquals(Boolean.TRUE, resp.getRetryFound()); + assertEquals("REQ.PCRETRY_1", resp.getRequestId()); + assertEquals("PCRETRY_1", resp.getPcRetry()); + }) + .verifyComplete(); + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/TrackerUtilityTest.java b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/TrackerUtilityTest.java new file mode 100644 index 000000000..38b38cedb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/java/it/pagopa/pn/papertracker/utils/TrackerUtilityTest.java @@ -0,0 +1,133 @@ +package it.pagopa.pn.papertracker.utils; + +import it.pagopa.pn.papertracker.middleware.dao.dynamo.entity.Event; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.List; + +public class TrackerUtilityTest { + + @Test + void checkIfIsFinalDematReturnsTrueForFinalDematStatusCode() { + String eventStatusCode = "RECRN001B"; + Assertions.assertTrue(TrackerUtility.checkIfIsFinalDemat(eventStatusCode)); + } + + @Test + void checkIfIsFinalDematReturnsFalseForNonFinalDematStatusCode() { + String eventStatusCode = "RECRN002A"; + Assertions.assertFalse(TrackerUtility.checkIfIsFinalDemat(eventStatusCode)); + } + + @Test + void checkIfIsP000eventReturnsTrueForP000StatusCode() { + String eventStatusCode = "P000"; + Assertions.assertTrue(TrackerUtility.checkIfIsP000event(eventStatusCode)); + } + + @Test + void checkIfIsP000eventReturnsFalseForNonP000StatusCode() { + String eventStatusCode = "P001"; + Assertions.assertFalse(TrackerUtility.checkIfIsP000event(eventStatusCode)); + } + + @Test + void checkIfIsInternalEventReturnsTrueForInternalEventStatusCodes() { + List internalEvents = List.of("P000", "P011", "P012", "P013"); + + Assertions.assertTrue(TrackerUtility.checkIfIsInternalEvent(internalEvents, "P000")); + Assertions.assertTrue(TrackerUtility.checkIfIsInternalEvent(internalEvents, "P011")); + Assertions.assertTrue(TrackerUtility.checkIfIsInternalEvent(internalEvents, "P012")); + Assertions.assertTrue(TrackerUtility.checkIfIsInternalEvent(internalEvents, "P013")); + } + + @Test + void buildOcrRequestIdReturnsCorrectFormat() { + String trackingId = "trackingId123"; + String eventId = "eventId456"; + String documentType = "CAD"; + String result = TrackerUtility.buildOcrRequestId(trackingId, eventId, documentType); + Assertions.assertEquals("trackingId123#eventId456#CAD", result); + } + + + @Test + void validatedEventsReturnsMatchingEvents() { + List eventsIds = List.of("eventId1", "eventId2"); + Event event1 = new Event(); + event1.setId("eventId1"); + Event event2 = new Event(); + event2.setId("eventId2"); + Event event3 = new Event(); + event3.setId("eventId3"); + List events = List.of(event1, event2, event3); + + List result = TrackerUtility.validatedEvents(eventsIds, events); + + Assertions.assertEquals(2, result.size()); + Assertions.assertTrue(result.stream().anyMatch(event -> "eventId1".equals(event.getId()))); + Assertions.assertTrue(result.stream().anyMatch(event -> "eventId2".equals(event.getId()))); + } + + + @Test + void validatedEventsReturnsMatchingEventsDuplicatedEvent() { + List eventsIds = List.of("eventId1", "eventId2"); + Event event1 = new Event(); + event1.setId("eventId1"); + event1.setCreatedAt(Instant.now()); + event1.setStatusCode("OLD"); + Event event2 = new Event(); + event2.setId("eventId2"); + Event event3 = new Event(); + event3.setId("eventId3"); + Event event4 = new Event(); + event4.setId("eventId1"); + event4.setCreatedAt(Instant.now().plus(10, ChronoUnit.DAYS)); + event4.setStatusCode("NEW"); + List events = List.of(event1, event2, event3, event4); + + List result = TrackerUtility.validatedEvents(eventsIds, events); + + Assertions.assertEquals(2, result.size()); + Assertions.assertTrue(result.stream().anyMatch(event -> "eventId1".equals(event.getId()))); + Assertions.assertTrue(result.stream().anyMatch(event -> "eventId1".equals(event.getId()))); + Assertions.assertTrue(result.stream().anyMatch(event -> "NEW".equals(event.getStatusCode()))); + Assertions.assertTrue(result.stream().noneMatch(event -> "OLD".equals(event.getStatusCode()))); + } + + @Test + void checkIfIsRedriveReturnsTrueWhenSenderIdMatchesDomain() { + String senderId = "ABCDEF:nome.cognome@pagopa.it"; + List redriveEnabledDomains = List.of("@pagopa.it", "@external.pagopa.it"); + + Assertions.assertTrue(TrackerUtility.checkIfIsRedrive(senderId, redriveEnabledDomains)); + } + + @Test + void checkIfIsRedriveReturnsFalseWhenSenderIdDoesNotMatchDomain() { + String senderId = "ABCDEF:nome.cognome@anotherdomain.com"; + List redriveEnabledDomains = List.of("@pagopa.it", "@external.pagopa.it"); + + Assertions.assertFalse(TrackerUtility.checkIfIsRedrive(senderId, redriveEnabledDomains)); + } + + @Test + void checkIfIsRedriveReturnsFalseWhenRedriveEnabledDomainsIsEmpty() { + String senderId = "example@domain.com"; + List redriveEnabledDomains = List.of(); + + Assertions.assertFalse(TrackerUtility.checkIfIsRedrive(senderId, redriveEnabledDomains)); + } + + @Test + void checkIfIsRedriveReturnsFalseWhenSenderIdIsNull() { + List redriveEnabledDomains = List.of("@pagopa.it", "@external.pagopa.it"); + + Assertions.assertFalse(TrackerUtility.checkIfIsRedrive(null, redriveEnabledDomains)); + } + +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/.gitkeep b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/application.test-IT.properties b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/application.test-IT.properties new file mode 100644 index 000000000..5fc4e04f0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/application.test-IT.properties @@ -0,0 +1,67 @@ +logging.config=config/logback-local.xml + +spring.application.name=pn-paper-tracker + +# Runtime mode +pn.env.runtime=DEVELOPMENT +#pn.env.runtime=PROD + +pn.paper-tracker.dao.paper-tracker-dry-run-outputs-table=pn-PaperTrackerDryRunOutputs +pn.paper-tracker.dao.paper-trackings-errors-table=pn-PaperTrackingsErrors +pn.paper-tracker.dao.paper-trackings-table=pn-PaperTrackings +server.port=8081 + +# AWS Configuration +aws.profile-name=default +spring.cloud.aws.credentials.profile-name=${PN_AWS_PROFILE_NAME:default} + +pn.paper-tracker.topics.external-channel-to-paper-tracker-queue=pn-external_channel_to_paper_tracker +pn.paper-tracker.topics.pn-ocr-outputs-queue=pn-paper_tracker_ocr_outputs + +pn.paper-tracker.topics.queue-ocr-inputs-url=http://localhost:4566/000000000000/dl-sqs +pn.paper-tracker.topics.queue-ocr-inputs-region=us-east-1 + +pn.paper-tracker.topics.external-channel-outputs-queue=pn-external_channel_outputs +pn.paper-tracker.topics.external-channel-to-paper-channel-queue=pn-external_channel_to_paper_channel +pn.paper-tracker.topics.external-channel-to-paper-channel_dryrun-queue=pn-external_channel_to_paper_channel_dryrun + +pn.paper-tracker.paper-trackings-ttl-duration=3650d +pn.paper-tracker.paper-trackings-errors-ttl-duration=3650d + +pn.paper-tracker.enable-ocr-validation-for-file=PDF +pn.paper-tracker.save-and-not-send-to-delivery-push=CON018 +pn.paper-tracker.paper-channel-base-url=http://localhost:8080 + +pn.paper-tracker.compiuta-giacenza-ar-duration=30d +pn.paper-tracker.enable-truncated-date-for-refinement-check=true +pn.paper-tracker.refinement-duration=10d + +pn.paper-tracker.required-attachments-refinement-stock890=1970-01-01;23L +pn.paper-tracker.send-ocr-attachments-refinement-stock890=1970-01-01;23L +pn.paper-tracker.send-ocr-attachments-final-validation-stock890=1970-01-01; +pn.paper-tracker.send-ocr-attachments-final-validation=1970-01-01;Plico;AR;23L +pn.paper-tracker.strict-final-validation-stock890=1970-01-01;false +pn.paper-tracker.strict-delivery-failure-cause=1970-01-01;false +pn.paper-tracker.products-processing-modes=1970-01-01;AR:DRY;890:DRY;RIR:DRY;RS:DRY;RIS:DRY +pn.paper-tracker.ocr-filter-temporal=DISABLED +pn.paper-tracker.ocr-filter-unified-delivery-driver=DISABLED +pn.paper-tracker.send-to-consolidatore-error-categories= + +pn.paper-tracker.disable-all-consumers=true + + +# SQS Listener Configuration +spring.cloud.aws.sqs.listener.acknowledgement-mode=manual +spring.cloud.aws.sqs.listener.poll-timeout=10s +spring.cloud.aws.sqs.listener.max-messages-per-poll=10 +spring.cloud.aws.sqs.listener.queue-stop-timeout=30s +spring.cloud.aws.sqs.listener.back-off-time=1s +spring.cloud.aws.sqs.listener.max-concurrent-messages=10 + +# Disable SSL for LocalStack +aws.disable-ssl=true + +# Debug Logging +logging.level.io.awspring.cloud=DEBUG +logging.level.software.amazon.awssdk=DEBUG +logging.level.software.amazon.awssdk.request=DEBUG \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar.json new file mode 100644 index 000000000..61e8ae77d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar.json @@ -0,0 +1,120 @@ +{ + "name": "FAIL_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "events": [ + { + "messageId": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "deliveryFailureCause": "M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"}} + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002A", "statusDescription": "AR - RECRN002A - RECRN002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "deliveryFailureCause": "M02", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002B", "statusDescription": "AR - RECRN002B - RECRN002B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN002C", "statusDescription": "AR - RECRN002C - RECRN002C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "deliveryFailureCause": "M02", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "Poste", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M02", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "documentType": "Plico", + "attachmentEventId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M02", + "finalStatusCode": "RECRN002C", + "validatedEvents": [ + "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M02", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar_2.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar_2.json new file mode 100644 index 000000000..3bf819a5a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_ar_2.json @@ -0,0 +1,124 @@ +{ + "name": "FAIL_AR_2", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "deliveryFailureCause": "M06", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002A", "statusDescription": "AR - RECRN002A - RECRN002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "deliveryFailureCause": "M06", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002B", "statusDescription": "AR - RECRN002B - RECRN002B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRN002C", "statusDescription": "AR - RECRN002C - RECRN002C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "deliveryFailureCause": "M06", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M06", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "documentType": "Plico", + "attachmentEventId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M06", + "finalStatusCode": "RECRN002C", + "validatedEvents": [ + "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M06", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_ar.json new file mode 100644 index 000000000..62ecda651 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_ar.json @@ -0,0 +1,153 @@ +{ + "name": "FAIL_COMPIUTA_GIACENZA_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "RENDICONTAZIONE_SCARTATA", + "flowThrow": "FINAL_EVENT_BUILDING", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN005C", + "eventIdThrow": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "details": { + "cause": "GIACENZA_DATE_ERROR", + "message": "RECRN005A getStatusTimestamp: 2024-01-01T10:00:00Z, RECRN010 getStatusTimestamp: 2024-01-01T09:00:00Z", + "additionalDetails": { + "recrn005aTimestamp": "2024-01-01T10:00:00Z", + "recrn010Timestamp": "2024-01-01T09:00:00Z" + } + } + } + ], + + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005A", "statusDescription": "AR - RECRN005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T09:00:00Z" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_pnrn_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_pnrn_ar.json new file mode 100644 index 000000000..5ef8a94ff --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_compiuta_giacenza_pnrn_ar.json @@ -0,0 +1,138 @@ +{ + "name": "FAIL_COMPIUTA_GIACENZA_PNRN_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2023-11-01T10:00:00Z"} + }, + { + "messageId": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2023-11-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005A", "statusDescription": "AR - RECRN005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDescription": "AR - PNRN012 - desc", "statusDetail": "PNRN012", "deliveryFailureCause": null, "statusDateTime": "2023-11-10T23:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDescription": "AR - RECRN005C - desc", "statusDetail": "RECRN005C", "deliveryFailureCause": null, "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2023-11-01T10:00:00Z", "attachments": []}, + {"id": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN005C", + "validatedEvents": [ + "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2023-11-01T10:00" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_con996_pcretry_furto_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_con996_pcretry_furto_ar.json new file mode 100644 index 000000000..f571b9417 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_con996_pcretry_furto_ar.json @@ -0,0 +1,194 @@ +{ + "name": "FAIL_CON996_PC_RETRY_FURTO_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa996000-0001-4a01-8b01-000000000001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON996", "statusDescription": "CON996 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb020000-0002-4a02-8b02-000000000002", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc006000-0003-4a03-8b03-000000000003", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN006", "statusDescription": "RECRN006 description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + + { + "messageId": "dd080000-0004-4a04-8b04-000000000004", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee020000-0005-4a05-8b05-000000000005", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "001a0000-0007-4a07-8b07-000000000007", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "002b0000-0008-4a08-8b08-000000000008", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "003c0000-0009-4a09-8b09-000000000009", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON996", "statusDescription": "AR - CON996 - CON996 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN006", "statusDescription": "AR - RECRN006 - RECRN006 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "deliveryFailureCause": "F01", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id": "aa996000-0001-4a01-8b01-000000000001", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON996", "statusDescription": "CON996 description", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY_2}}", + + "events": [ + {"id": "bb020000-0002-4a02-8b02-000000000002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc006000-0003-4a03-8b03-000000000003", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN006", "statusDescription": "RECRN006 description", "deliveryFailureCause": "F01", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY_2}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_2", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "dd080000-0004-4a04-8b04-000000000004", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "ee020000-0005-4a05-8b05-000000000005", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "001a0000-0007-4a07-8b07-000000000007", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "002b0000-0008-4a08-8b08-000000000008", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "requestTimestamp": "2024-01-01T10:00:05Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "003c0000-0009-4a09-8b09-000000000009", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "requestTimestamp": "2024-01-01T10:00:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "003c0000-0009-4a09-8b09-000000000009", + "documentType": "AR", + "attachmentEventId": "002b0000-0008-4a08-8b08-000000000008" + } + ] + }, + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "001a0000-0007-4a07-8b07-000000000007", + "002b0000-0008-4a08-8b08-000000000008", + "003c0000-0009-4a09-8b09-000000000009" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY_2}}#003c0000-0009-4a09-8b09-000000000009#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY_2}}#003c0000-0009-4a09-8b09-000000000009#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_discovery_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_discovery_ar.json new file mode 100644 index 000000000..e5bcfb9c2 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_discovery_ar.json @@ -0,0 +1,126 @@ +{ + "name": "FAIL_DISCOVERY_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa01bb02-cc03-4dd4-8ee5-ff0607080901", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb02cc03-dd04-4ee5-9ff6-001122334402", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc03dd04-ee05-4ff6-8aa7-112233445503", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "dd04ee05-ff06-4aa7-9bb8-223344556604", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002D", "statusDescription": "RECRN002D description", "deliveryFailureCause": "M01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee05ff06-aa07-4bb8-8cc9-334455667705", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002E", "statusDescription": "RECRN002E description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z"}, {"documentType": "Indagine", "sha256": "sha256", "id": "id-RECRN002E-Indagine", "uri": "https://example.com/RECRN002E-Indagine.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff06aa07-bb08-4cc9-9dd0-445566778806", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002F", "statusDescription": "RECRN002F description", "deliveryFailureCause": "M01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002D", "statusDescription": "AR - RECRN002D - RECRN002D description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "deliveryFailureCause": "M01", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002E", "statusDescription": "AR - RECRN002E - RECRN002E description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002E", "statusDescription": "AR - RECRN002E - RECRN002E description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Indagine", "sha256": "sha256", "id": "id-RECRN002E-Indagine", "uri": "https://example.com/RECRN002E-Indagine.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRN002F", "statusDescription": "AR - RECRN002F - RECRN002F description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "deliveryFailureCause": "M01", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "aa01bb02-cc03-4dd4-8ee5-ff0607080901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "bb02cc03-dd04-4ee5-9ff6-001122334402", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc03dd04-ee05-4ff6-8aa7-112233445503", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "dd04ee05-ff06-4aa7-9bb8-223344556604", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002D", "statusDescription": "RECRN002D description", "requestTimestamp": "2024-01-01T10:00:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "deliveryFailureCause": "M01", "attachments": []}, + {"id": "ee05ff06-aa07-4bb8-8cc9-334455667705", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002E", "statusDescription": "RECRN002E description", "requestTimestamp": "2024-01-01T10:00:04Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z"}, {"documentType": "Indagine", "sha256": "sha256", "id": "id-RECRN002E-Indagine", "uri": "https://example.com/RECRN002E-Indagine.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "ff06aa07-bb08-4cc9-9dd0-445566778806", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002F", "statusDescription": "RECRN002F description", "requestTimestamp": "2024-01-01T10:00:05Z", "statusTimestamp": "2024-01-01T10:00:00Z", "deliveryFailureCause": "M01", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "ff06aa07-bb08-4cc9-9dd0-445566778806", + "documentType": "Plico", + "attachmentEventId": "ee05ff06-aa07-4bb8-8cc9-334455667705" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M01", + "finalStatusCode": "RECRN002F", + "validatedEvents": [ + "dd04ee05-ff06-4aa7-9bb8-223344556604", + "ee05ff06-aa07-4bb8-8cc9-334455667705", + "ff06aa07-bb08-4cc9-9dd0-445566778806" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#ff06aa07-bb08-4cc9-9dd0-445566778806#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#ff06aa07-bb08-4cc9-9dd0-445566778806#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN002F", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M01", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_ar.json new file mode 100644 index 000000000..04ac9d583 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_ar.json @@ -0,0 +1,137 @@ +{ + "name": "FAIL_GIACENZA_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a101b202-c303-4d04-8e05-1f0607080901", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b202c303-d404-4e05-9f06-2a0708091002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c303d404-e505-4f06-8a07-3b0809101103", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d404e505-f606-4a07-9b08-4c0910111204", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e505f606-a707-4b08-8c09-5d1011121305", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f606a707-b808-4c09-9d10-6e1112131406", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "0708b809-c90a-4d10-8e11-7f1213141507", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN004A", "statusDescription": "AR - RECRN004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN004B", "statusDescription": "AR - RECRN004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN004C", "statusDescription": "AR - RECRN004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a101b202-c303-4d04-8e05-1f0607080901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "b202c303-d404-4e05-9f06-2a0708091002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "c303d404-e505-4f06-8a07-3b0809101103", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "d404e505-f606-4a07-9b08-4c0910111204", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "e505f606-a707-4b08-8c09-5d1011121305", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "f606a707-b808-4c09-9d10-6e1112131406", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "0708b809-c90a-4d10-8e11-7f1213141507", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "0708b809-c90a-4d10-8e11-7f1213141507", + "documentType": "Plico", + "attachmentEventId": "f606a707-b808-4c09-9d10-6e1112131406" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN004C", + "validatedEvents": [ + "c303d404-e505-4f06-8a07-3b0809101103", + "d404e505-f606-4a07-9b08-4c0910111204", + "e505f606-a707-4b08-8c09-5d1011121305", + "f606a707-b808-4c09-9d10-6e1112131406", + "0708b809-c90a-4d10-8e11-7f1213141507" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#0708b809-c90a-4d10-8e11-7f1213141507#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#0708b809-c90a-4d10-8e11-7f1213141507#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T10:00" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_pnrn_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_pnrn_ar.json new file mode 100644 index 000000000..d6986e52d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_giacenza_pnrn_ar.json @@ -0,0 +1,138 @@ +{ + "name": "FAIL_GIACENZA_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a101b202-c303-4d04-8e05-1f0607080901", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b202c303-d404-4e05-9f06-2a0708091002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c303d404-e505-4f06-8a07-3b0809101103", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2023-11-01T10:00:00Z"} + }, + { + "messageId": "d404e505-f606-4a07-9b08-4c0910111204", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e505f606-a707-4b08-8c09-5d1011121305", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f606a707-b808-4c09-9d10-6e1112131406", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "0708b809-c90a-4d10-8e11-7f1213141507", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2023-11-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN004A", "statusDescription": "AR - RECRN004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN004B", "statusDescription": "AR - RECRN004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDescription": "AR - PNRN012 - desc", "statusDetail": "PNRN012", "deliveryFailureCause": null, "statusDateTime": "2023-11-10T23:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []}, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN004C", "statusDescription": "AR - RECRN004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "0708b809-c90a-4d10-8e11-7f1213141507", + "documentType": "Plico", + "attachmentEventId": "f606a707-b808-4c09-9d10-6e1112131406" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "events": [ + {"id": "a101b202-c303-4d04-8e05-1f0607080901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "b202c303-d404-4e05-9f06-2a0708091002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "c303d404-e505-4f06-8a07-3b0809101103", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2023-11-01T10:00:00Z", "attachments": []}, + {"id": "d404e505-f606-4a07-9b08-4c0910111204", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "e505f606-a707-4b08-8c09-5d1011121305", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "f606a707-b808-4c09-9d10-6e1112131406", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN004B-AR", "uri": "https://example.com/RECRN004B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "0708b809-c90a-4d10-8e11-7f1213141507", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN004C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN004C", + "validatedEvents": [ + "c303d404-e505-4f06-8a07-3b0809101103", + "d404e505-f606-4a07-9b08-4c0910111204", + "e505f606-a707-4b08-8c09-5d1011121305", + "f606a707-b808-4c09-9d10-6e1112131406", + "0708b809-c90a-4d10-8e11-7f1213141507" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#0708b809-c90a-4d10-8e11-7f1213141507#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#0708b809-c90a-4d10-8e11-7f1213141507#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2023-11-01T10:00" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_irreperibile_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_irreperibile_ar.json new file mode 100644 index 000000000..1229cd02f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/fail_irreperibile_ar.json @@ -0,0 +1,124 @@ +{ + "name": "FAIL_IRREPERIBILE_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a901b802-c703-4d14-8e25-ff1607081901", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b802c703-d804-4e25-9f36-001122334402", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d804e905-f016-4a47-9b58-223344556604", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002D", "statusDescription": "RECRN002D description", "deliveryFailureCause": "M04", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "e905f016-a127-4b58-8c69-334455667705", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002E", "statusDescription": "RECRN002E description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f016a127-b238-4c69-9d70-445566778806", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002F", "statusDescription": "RECRN002F description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002D", "statusDescription": "AR - RECRN002D - RECRN002D description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "deliveryFailureCause": "M04", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002E", "statusDescription": "AR - RECRN002E - RECRN002E description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRN002F", "statusDescription": "AR - RECRN002F - RECRN002F description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "deliveryFailureCause": "M04", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a901b802-c703-4d14-8e25-ff1607081901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "b802c703-d804-4e25-9f36-001122334402", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d804e905-f016-4a47-9b58-223344556604", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002D", "statusDescription": "RECRN002D description", "requestTimestamp": "2024-01-01T10:00:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "deliveryFailureCause": "M04", "attachments": []}, + {"id": "e905f016-a127-4b58-8c69-334455667705", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002E", "statusDescription": "RECRN002E description", "requestTimestamp": "2024-01-01T10:00:04Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002E-Plico", "uri": "https://example.com/RECRN002E-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "f016a127-b238-4c69-9d70-445566778806", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002F", "statusDescription": "RECRN002F description", "requestTimestamp": "2024-01-01T10:00:05Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "f016a127-b238-4c69-9d70-445566778806", + "documentType": "Plico", + "attachmentEventId": "e905f016-a127-4b58-8c69-334455667705" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M04", + "finalStatusCode": "RECRN002F", + "validatedEvents": [ + "d804e905-f016-4a47-9b58-223344556604", + "e905f016-a127-4b58-8c69-334455667705", + "f016a127-b238-4c69-9d70-445566778806" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#f016a127-b238-4c69-9d70-445566778806#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#f016a127-b238-4c69-9d70-445566778806#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN002F", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M04", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/disable/fail_compiuta_giacenza_ar_2.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/disable/fail_compiuta_giacenza_ar_2.json new file mode 100644 index 000000000..b4cf2b9b1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/disable/fail_compiuta_giacenza_ar_2.json @@ -0,0 +1,160 @@ +{ + "name": "FAIL_COMPIUTA_GIACENZA_AR_2", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T08:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:02:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "RENDICONTAZIONE_SCARTATA", + "flowThrow": "FINAL_EVENT_BUILDING", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN005C", + "eventIdThrow": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "details": { + "cause": "GIACENZA_DATE_ERROR", + "message": "RECRN005A getStatusTimestamp: 2024-01-01T10:00:00Z, RECRN010 getStatusTimestamp: 2024-01-01T09:00:00Z", + "additionalDetails": { + "recrn005aTimestamp": "2024-01-01T10:00:00Z", + "recrn010Timestamp": "2024-01-01T09:00:00Z" + } + } + } + ], + + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T08:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:02:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005A", "statusDescription": "AR - RECRN005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T08:00:00Z", "attachments": []}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:02:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T09:00:00Z" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_KO.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_KO.json new file mode 100644 index 000000000..4f26bfd47 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_KO.json @@ -0,0 +1,163 @@ +{ + "name": "FAIL_COMPIUTA_GIACENZA_AR_2", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T08:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:02:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN005C", + "eventIdThrow": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "details": { + "cause": "OCR_KO", + "message": "Invalid demat", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "KO", + "description": "Invalid demat", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T08:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:02:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005A", "statusDescription": "AR - RECRN005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T08:00:00Z", "attachments": []}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:02:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"KO", + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "KO", + "description": "Invalid demat", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T09:00:00Z" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_OK.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_OK.json new file mode 100644 index 000000000..716afff36 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/fail_compiuta_giacenza_ar_2_OK.json @@ -0,0 +1,237 @@ +{ + "name": "FAIL_COMPIUTA_GIACENZA_AR_2", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T08:00:00Z"} + }, + { + "messageId": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:02:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b15", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR-2", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 2 + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN005C", + "eventIdThrow": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26", + "details": { + "cause": "OCR_KO", + "message": "Invalid demat", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "KO", + "description": "Invalid demat", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "RENDICONTAZIONE_SCARTATA", + "flowThrow": "FINAL_EVENT_BUILDING", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN005C", + "eventIdThrow": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "details": { + "cause": "GIACENZA_DATE_ERROR", + "message": "RECRN005A getStatusTimestamp: 2024-01-01T10:00:00Z, RECRN010 getStatusTimestamp: 2024-01-01T09:00:00Z", + "additionalDetails": { + "recrn005aTimestamp": "2024-01-01T10:00:00Z", + "recrn010Timestamp": "2024-01-01T09:00:00Z" + } + } + } + ], + + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T08:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:02:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005A", "statusDescription": "AR - RECRN005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN005B", "statusDescription": "AR - RECRN005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR-2", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "11a2b3c4-1111-4a2b-8c3d-1e2f3a4b5c61", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "22b3c4d5-2222-4b3c-9d4e-2f3a4b5c6d72", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T08:00:00Z", "attachments": []}, + {"id": "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:02:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b15", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:05Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN005B-AR-2", "uri": "https://example.com/RECRN005B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN005C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"KO", + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b15" + }, + { + "finalEventId": "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27", + "documentType": "Plico", + "attachmentEventId": "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "responseStatus":"OK" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "33c4d5e6-3333-4c4d-8e5f-3a4b5c6d7e83", + "44d5e6f7-4444-4d5e-9f6a-4b5c6d7e8f94", + "55e6f7a8-5555-4e6f-8a7b-5c6d7e8f9a05", + "66f7a8b9-6666-4f7a-9b8c-6d7e8f9a0b16", + "77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [ + { + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "KO", + "description": "Invalid demat", + "predictedRefinementType": null, + "validationType": "ai" + } + }, + { + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + } + ], + "ocrDataPayload": [ + { + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c26#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T09:00:00Z" + } + } + }, + { + "commandId": "{{REQUEST_ID}}#77a8b9c0-7777-4a8b-8c9d-7e8f9a0b1c27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T09:00:00Z" + } + } + } + ], + "sentToOcr": 2 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_duplicate_ocr_response.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_duplicate_ocr_response.json new file mode 100644 index 000000000..ed3a6c961 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_duplicate_ocr_response.json @@ -0,0 +1,148 @@ +{ + "name": "OK_DUPLICATE_OCR_RESPONSE_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "WARNING", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "OCR_DUPLICATED_EVENT", + "message": "CommandId: PREPARE_ANALOG_DOMICILE", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_ocr_pending.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_ocr_pending.json new file mode 100644 index 000000000..6dc102dbc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/multiple_ocr_request/run/ok_ar_ocr_pending.json @@ -0,0 +1,124 @@ +{ + "name": "OK_AR_OCR_PENDING", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "AWAITING_OCR", + "businessState": "AWAITING_OCR", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"PENDING", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "PENDING", + "description": "PENDING", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/not_retryable_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/not_retryable_event.json new file mode 100644 index 000000000..e91a50f4b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/not_retryable_event.json @@ -0,0 +1,76 @@ +{ + "name": "NOT_RETRYABLE_EVENT_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON998", + "statusDescription": "CON998 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "NOT_RETRYABLE_EVENT_ERROR", + "flowThrow": "NOT_RETRYABLE_EVENT_HANDLER", + "type": "WARNING", + "productType": "AR", + "eventThrow": "CON998", + "eventIdThrow": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "details": { + "message": "Scartato NODOC" + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON998", "statusDescription": "AR - CON998 - CON998 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "AWAITING_REFINEMENT", + "businessState": "AWAITING_FINAL_STATUS_CODE", + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON998", "statusDescription": "CON998 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar.json new file mode 100644 index 000000000..d039edb07 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar.json @@ -0,0 +1,130 @@ +{ + "name": "OK_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "REC090", "statusDescription": "REC090 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", "statusCode": "REC090", "statusDescription": "REC090 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_dematAfterDone.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_dematAfterDone.json new file mode 100644 index 000000000..a6265dd8f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_dematAfterDone.json @@ -0,0 +1,140 @@ +{ + "name": "OK_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "REC090", "statusDescription": "REC090 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d78", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B_1-AR", "uri": "https://example.com/RECRN001B_1-AR.pdf", "date": "2024-01-03T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-03T10:00:04Z", "statusDateTime": "2024-01-03T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-03T10:00:00Z", "clientRequestTimestamp": "2024-01-03T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B_1-AR", "uri": "https://example.com/RECRN001B_1-AR.pdf", "date": "2024-01-03T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", "statusCode": "REC090", "statusDescription": "REC090 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d78", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-03T10:00:00Z", "requestTimestamp": "2024-01-03T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B_1-AR", "uri": "https://example.com/RECRN001B_1-AR.pdf", "date": "2024-01-03T10:00:04Z"}]} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_duplicate_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_duplicate_event.json new file mode 100644 index 000000000..74d345173 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_duplicate_event.json @@ -0,0 +1,147 @@ +{ + "name": "OK_AR_DUPLICATE_EVENT", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "AR", + "eventThrow": "RECRN001A", + "eventIdThrow": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "details": { + "message": "Duplicated event found for statusCode: RECRN001A", + "additionalDetails": { + "statusCode": "RECRN001A", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_sourceType_originType.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_sourceType_originType.json new file mode 100644 index 000000000..b84700b1b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_sourceType_originType.json @@ -0,0 +1,98 @@ +{ + "name": "OK_AR_SOURCE_TYPE_ORIGIN_TYPE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "DIGITAL", "originType": "ORIGINAL"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "REC090", "statusDescription": "REC090 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "DIGITAL", "originType": "ORIGINAL" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "DIGITAL", "originType": "ORIGINAL"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c79", "statusCode": "REC090", "statusDescription": "REC090 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrDataPayload": [], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_zip.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_zip.json new file mode 100644 index 000000000..8f770f83e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_ar_zip.json @@ -0,0 +1,91 @@ +{ + "name": "OK_AR_ZIP", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.zip", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.zip", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.zip", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_causa_forza_maggiore_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_causa_forza_maggiore_ar.json new file mode 100644 index 000000000..d326efc27 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_causa_forza_maggiore_ar.json @@ -0,0 +1,142 @@ +{ + "name": "OK_CAUSA_FORZA_MAGGIORE_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1111aa22-bb33-4c44-8d55-ee6600000001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2222bb33-cc44-4d55-9e66-ff7700000002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3333cc44-dd55-4e66-8f77-008800000003", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN015", "statusDescription": "desc", "deliveryFailureCause": "C02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "4444dd55-ee66-4f77-9a88-009900000004", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "5555ee66-ff77-4a88-8b99-001100000005", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T09:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6666ff77-aa88-4b99-8c00-112200000006", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7777aa88-bb99-4c00-9d11-223300000007", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8888bb99-cc00-4d11-8e22-334400000008", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN015", "statusDescription": "AR - RECRN015 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": [], "deliveryFailureCause": "C02"}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T09:00:00Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [], "deliveryFailureCause": null} + ], + + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "1111aa22-bb33-4c44-8d55-ee6600000001", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "2222bb33-cc44-4d55-9e66-ff7700000002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3333cc44-dd55-4e66-8f77-008800000003", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN015", "statusDescription": "desc", "deliveryFailureCause": "C02", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "4444dd55-ee66-4f77-9a88-009900000004", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "5555ee66-ff77-4a88-8b99-001100000005", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T09:00:00Z"}]}, + {"id": "6666ff77-aa88-4b99-8c00-112200000006", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "7777aa88-bb99-4c00-9d11-223300000007", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "8888bb99-cc00-4d11-8e22-334400000008", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "8888bb99-cc00-4d11-8e22-334400000008", + "documentType": "AR", + "attachmentEventId": "7777aa88-bb99-4c00-9d11-223300000007" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "6666ff77-aa88-4b99-8c00-112200000006", + "7777aa88-bb99-4c00-9d11-223300000007", + "8888bb99-cc00-4d11-8e22-334400000008" + ], + "finalDematFound": true + } + } + + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#8888bb99-cc00-4d11-8e22-334400000008#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#8888bb99-cc00-4d11-8e22-334400000008#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_ar.json new file mode 100644 index 000000000..8b11b883e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_ar.json @@ -0,0 +1,136 @@ +{ + "name": "OK_GIACENZA_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "101a202b-1c2d-4e3f-8a4b-5c6d7e8f9001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "202b303c-2d3e-4f4a-9b5c-6d7e8f900112", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "303c404d-3e4f-4a5b-8c6d-7e8f90011223", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "404d505e-4f5a-4b6c-9d7e-8f9001122334", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "505e606f-5a6b-4c7d-8e9f-900112233445", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "606f7071-6b7c-4d8e-9f00-011223344556", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003B", "statusDescription": "desc", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "70718081-7c8d-4e9f-8a11-122334455667", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN003A", "statusDescription": "AR - RECRN003A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN003B", "statusDescription": "AR - RECRN003B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN003C", "statusDescription": "AR - RECRN003C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "101a202b-1c2d-4e3f-8a4b-5c6d7e8f9001", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "202b303c-2d3e-4f4a-9b5c-6d7e8f900112", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "303c404d-3e4f-4a5b-8c6d-7e8f90011223", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "404d505e-4f5a-4b6c-9d7e-8f9001122334", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "505e606f-5a6b-4c7d-8e9f-900112233445", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "606f7071-6b7c-4d8e-9f00-011223344556", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "70718081-7c8d-4e9f-8a11-122334455667", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "70718081-7c8d-4e9f-8a11-122334455667", + "documentType": "AR", + "attachmentEventId": "606f7071-6b7c-4d8e-9f00-011223344556" + } + ] + }, + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN003C", + "validatedEvents": [ + "303c404d-3e4f-4a5b-8c6d-7e8f90011223", + "404d505e-4f5a-4b6c-9d7e-8f9001122334", + "505e606f-5a6b-4c7d-8e9f-900112233445", + "606f7071-6b7c-4d8e-9f00-011223344556", + "70718081-7c8d-4e9f-8a11-122334455667" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#70718081-7c8d-4e9f-8a11-122334455667#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#70718081-7c8d-4e9f-8a11-122334455667#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN003C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T10:00" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_pnrn_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_pnrn_ar.json new file mode 100644 index 000000000..06fc17c70 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_giacenza_pnrn_ar.json @@ -0,0 +1,150 @@ +{ + "name": "OK_GIACENZA_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "101a202b-1c2d-4e3f-8a4b-5c6d7e8f9001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "202b303c-2d3e-4f4a-9b5c-6d7e8f900112", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "303c404d-3e4f-4a5b-8c6d-7e8f90011223", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2023-11-01T10:00:00Z"} + }, + { + "messageId": "404d505e-4f5a-4b6c-9d7e-8f9001122334", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "505e606f-5a6b-4c7d-8e9f-900112233445", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "606f7071-6b7c-4d8e-9f00-011223344556", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003B", "statusDescription": "desc", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "70718081-7c8d-4e9f-8a11-122334455667", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2023-11-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN003A", "statusDescription": "AR - RECRN003A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN003B", "statusDescription": "AR - RECRN003B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDescription": "AR - PNRN012 - desc", "statusDetail": "PNRN012", "deliveryFailureCause": null, "statusDateTime": "2023-11-10T23:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []}, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN003C", "statusDescription": "AR - RECRN003C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [] } + + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + + "events": [ + {"id": "101a202b-1c2d-4e3f-8a4b-5c6d7e8f9001", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "202b303c-2d3e-4f4a-9b5c-6d7e8f900112", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "303c404d-3e4f-4a5b-8c6d-7e8f90011223", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2023-11-01T10:00:00Z", "attachments": []}, + {"id": "404d505e-4f5a-4b6c-9d7e-8f9001122334", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "505e606f-5a6b-4c7d-8e9f-900112233445", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "606f7071-6b7c-4d8e-9f00-011223344556", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN003B-AR", "uri": "https://example.com/RECRN003B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "70718081-7c8d-4e9f-8a11-122334455667", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN003C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationFlow": { + "ocrRequests": [ + { + "finalEventId": "70718081-7c8d-4e9f-8a11-122334455667", + "documentType": "AR", + "attachmentEventId": "606f7071-6b7c-4d8e-9f00-011223344556", + "responseStatus": "OK" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN003C", + "validatedEvents": [ + "303c404d-3e4f-4a5b-8c6d-7e8f90011223", + "404d505e-4f5a-4b6c-9d7e-8f9001122334", + "505e606f-5a6b-4c7d-8e9f-900112233445", + "606f7071-6b7c-4d8e-9f00-011223344556", + "70718081-7c8d-4e9f-8a11-122334455667" + ], + "finalDematFound": true + } + } + ], + "validationFlow": { + "ocrRequests": [ + { + "finalEventId": "606f7071-6b7c-4d8e-9f00-011223344556", + "documentType": "AR", + "attachmentEventId": "606f7071-6b7c-4d8e-9f00-011223344556" + } + ] + }, + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#70718081-7c8d-4e9f-8a11-122334455667#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#70718081-7c8d-4e9f-8a11-122334455667#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN003C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2023-11-01T10:00" + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_non_rendicontabile_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_non_rendicontabile_ar.json new file mode 100644 index 000000000..5a105970d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_non_rendicontabile_ar.json @@ -0,0 +1,168 @@ +{ + "name": "OK_NON_RENDICONTABILE_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11bb22-cc33-4d44-8e55-000000000001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb22cc33-dd44-4e55-9f66-000000000002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc33dd44-ee55-4f66-8a77-000000000003", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN013", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + + { + "messageId": "dd44ee55-ff66-4a77-9b88-000000000004", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee55ff66-aa77-4b88-8c99-000000000005", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66aa77-bb88-4c99-9d00-000000000006", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "0011bb88-cc99-4d00-8e11-000000000007", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "1122cc99-dd00-4e11-9f22-000000000008", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN013", "statusDescription": "AR - RECRN013 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id": "aa11bb22-cc33-4d44-8e55-000000000001", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "bb22cc33-dd44-4e55-9f66-000000000002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc33dd44-ee55-4f66-8a77-000000000003", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN013", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "1122cc99-dd00-4e11-9f22-000000000008", + "documentType": "AR", + "attachmentEventId": "0011bb88-cc99-4d00-8e11-000000000007" + } + ] + }, + + "events": [ + {"id": "dd44ee55-ff66-4a77-9b88-000000000004", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "ee55ff66-aa77-4b88-8c99-000000000005", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"id": "ff66aa77-bb88-4c99-9d00-000000000006", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "0011bb88-cc99-4d00-8e11-000000000007", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "1122cc99-dd00-4e11-9f22-000000000008", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "ff66aa77-bb88-4c99-9d00-000000000006", + "0011bb88-cc99-4d00-8e11-000000000007", + "1122cc99-dd00-4e11-9f22-000000000008" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#1122cc99-dd00-4e11-9f22-000000000008#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#1122cc99-dd00-4e11-9f22-000000000008#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar.json new file mode 100644 index 000000000..ae4b4165a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar.json @@ -0,0 +1,276 @@ +{ + "name": "OK_RETRY_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1001aa02-bb03-4c04-8d05-ee0607080901", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "2002bb03-cc04-4d05-9e06-ff0708091002", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:01Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "3003cc04-dd05-4e06-8f07-001122334403", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN006", + "statusDescription": "desc", + "deliveryFailureCause": "F01", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:02Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + + { + "messageId": "4004dd05-ee06-4f07-9a08-112233445504", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "5005ee06-ff07-4a08-8b09-223344556605", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:01Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "6006ff07-aa08-4b09-9c10-334455667706", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001A", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:02Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7007aa08-bb09-4c10-8d11-445566778807", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001B", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id-RECRN001B-AR", + "uri": "https://example.com/RECRN001B-AR.pdf", + "date": "2024-01-01T10:00:00Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:03Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "8008bb09-cc10-4d11-9e12-556677889908", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001C", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z" } ] }, + + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN006", "statusDescription": "AR - RECRN006 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "deliveryFailureCause": "F01", "attachments": [] }, + + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [] }, + + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z" } ] }, + + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": [] }, + + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z" } ] }, + + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + {"id": "1001aa02-bb03-4c04-8d05-ee0607080901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, {"id": "2002bb03-cc04-4d05-9e06-ff0708091002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3003cc04-dd05-4e06-8f07-001122334403", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN006", "statusDescription": "desc", "deliveryFailureCause": "F01", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "4004dd05-ee06-4f07-9a08-112233445504", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "5005ee06-ff07-4a08-8b09-223344556605", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"id": "6006ff07-aa08-4b09-9c10-334455667706", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "7007aa08-bb09-4c10-8d11-445566778807", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "8008bb09-cc10-4d11-9e12-556677889908", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}], + + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "8008bb09-cc10-4d11-9e12-556677889908", + "documentType": "AR", + "attachmentEventId": "7007aa08-bb09-4c10-8d11-445566778807" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "6006ff07-aa08-4b09-9c10-334455667706", + "7007aa08-bb09-4c10-8d11-445566778807", + "8008bb09-cc10-4d11-9e12-556677889908" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#8008bb09-cc10-4d11-9e12-556677889908#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#8008bb09-cc10-4d11-9e12-556677889908#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar_2.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar_2.json new file mode 100644 index 000000000..6e7976c64 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_ar_2.json @@ -0,0 +1,180 @@ +{ + "name": "OK_RETRY_AR_2", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1001aa02-bb03-4c04-8d05-ee0607080901", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2002bb03-cc04-4d05-9e06-ff0708091002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3003cc04-dd05-4e06-8f07-001122334403", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4004dd05-ee06-4f07-9a08-112233445504", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5005ee06-ff07-4a08-8b09-223344556605", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN006", "statusDescription": "desc", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + + { + "messageId": "6006ff07-aa08-4b09-9c10-334455667706", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7007aa08-bb09-4c10-8d11-445566778807", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:01:01Z"} + }, + { + "messageId": "8008bb09-cc10-4d11-9e12-556677889908", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "9009cc10-dd11-4e12-8f13-667788990010", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "a010dd11-ee12-4f13-9a14-778899001122", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN010", "statusDescription": "AR - RECRN010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN011", "statusDescription": "AR - RECRN011 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN006", "statusDescription": "AR - RECRN006 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "deliveryFailureCause": "F01", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - desc", "statusDateTime": "2024-01-01T10:01:01Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id": "1001aa02-bb03-4c04-8d05-ee0607080901", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "2002bb03-cc04-4d05-9e06-ff0708091002", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3003cc04-dd05-4e06-8f07-001122334403", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN010", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "4004dd05-ee06-4f07-9a08-112233445504", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN011", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "5005ee06-ff07-4a08-8b09-223344556605", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN006", "statusDescription": "desc", "deliveryFailureCause": "F01", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "attachmentEventId": "9009cc10-dd11-4e12-8f13-667788990010", + "documentType": "AR", + "finalEventId": "a010dd11-ee12-4f13-9a14-778899001122" + } + ] + }, + + "events": [ + {"id": "6006ff07-aa08-4b09-9c10-334455667706", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "7007aa08-bb09-4c10-8d11-445566778807", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"id": "8008bb09-cc10-4d11-9e12-556677889908", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "9009cc10-dd11-4e12-8f13-667788990010", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:03Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:00Z"}]}, + {"id": "a010dd11-ee12-4f13-9a14-778899001122", "productType": "AR", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "8008bb09-cc10-4d11-9e12-556677889908", + "9009cc10-dd11-4e12-8f13-667788990010", + "a010dd11-ee12-4f13-9a14-778899001122" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#a010dd11-ee12-4f13-9a14-778899001122#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#a010dd11-ee12-4f13-9a14-778899001122#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_m10_ar.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_m10_ar.json new file mode 100644 index 000000000..ebeccae9b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/ok_retry_m10_ar.json @@ -0,0 +1,628 @@ +{ + "name": "OK_RETRY_M10_AR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1001aa02-bb03-4c04-8d05-ee0607080901", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "2002bb03-cc04-4d05-9e06-ff0708091002", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:01Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN002A", + "statusDescription": "RECRN002A description", + "deliveryFailureCause": "M10", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:03Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN002B", + "statusDescription": "RECRN002B description", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRN002B-Plico", + "uri": "https://example.com/RECRN002B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN002C", + "statusDescription": "RECRN002C description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "4004dd05-ee06-4f07-9a08-112233445504", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "5005ee06-ff07-4a08-8b09-223344556605", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:01Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "6006ff07-aa08-4b09-9c10-334455667706", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001A", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:02Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7007aa08-bb09-4c10-8d11-445566778807", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001B", + "statusDescription": "desc", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id-RECRN001B-AR", + "uri": "https://example.com/RECRN001B-AR.pdf", + "date": "2024-01-01T10:00:00Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:03Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "8008bb09-cc10-4d11-9e12-556677889908", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001C", + "statusDescription": "desc", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 2 + } + ], + "expected": { + "errors": [], + "outputs": [ + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "AR - CON080 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "AR - CON020 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRN002A", + "statusDescription": "AR - RECRN002A - RECRN002A description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:03Z", + "deliveryFailureCause": "M10", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRN002B", + "statusDescription": "AR - RECRN002B - RECRN002B description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:04Z", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRN002B-Plico", + "uri": "https://example.com/RECRN002B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRN002C", + "statusDescription": "AR - RECRN002C - RECRN002C description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:05Z", + "deliveryFailureCause": "M10", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "AR - CON080 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "AR - CON020 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRN001A", + "statusDescription": "AR - RECRN001A - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:02Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRN001B", + "statusDescription": "AR - RECRN001B - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:03Z", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id-RECRN001B-AR", + "uri": "https://example.com/RECRN001B-AR.pdf", + "date": "2024-01-01T10:00:00Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "OK", + "statusDetail": "RECRN001C", + "statusDescription": "AR - RECRN001C - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:06Z", + "attachments": [] + } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + { + "id": "1001aa02-bb03-4c04-8d05-ee0607080901", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:00:00Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "id": "2002bb03-cc04-4d05-9e06-ff0708091002", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:00:01Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "id": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "statusCode": "RECRN002A", + "statusDescription": "RECRN002A description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:03Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M10", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "attachments": [] + }, + { + "id": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "statusCode": "RECRN002B", + "statusDescription": "RECRN002B description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRN002B-Plico", + "uri": "https://example.com/RECRN002B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ] + }, + { + "id": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "statusCode": "RECRN002C", + "statusDescription": "RECRN002C description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "AR", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus": "OK", + "finalEventId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "documentType": "Plico", + "attachmentEventId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05" + } + ] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + { + "id": "4004dd05-ee06-4f07-9a08-112233445504", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:01:00Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "id": "5005ee06-ff07-4a08-8b09-223344556605", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:01:01Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ] + }, + { + "id": "6006ff07-aa08-4b09-9c10-334455667706", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001A", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:01:02Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "id": "7007aa08-bb09-4c10-8d11-445566778807", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001B", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:01:03Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id-RECRN001B-AR", + "uri": "https://example.com/RECRN001B-AR.pdf", + "date": "2024-01-01T10:00:00Z" + } + ] + }, + { + "id": "8008bb09-cc10-4d11-9e12-556677889908", + "productType": "AR", + "iun": "{{RANDOM_IUN}}", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRN001C", + "statusDescription": "desc", + "requestTimestamp": "2024-01-01T10:01:06Z", + "statusTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + } + ], + "validationFlow": { + "ocrRequests": [ + { + "responseStatus": "OK", + "finalEventId": "8008bb09-cc10-4d11-9e12-556677889908", + "documentType": "AR", + "attachmentEventId": "7007aa08-bb09-4c10-8d11-445566778807" + } + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "6006ff07-aa08-4b09-9c10-334455667706", + "7007aa08-bb09-4c10-8d11-445566778807", + "8008bb09-cc10-4d11-9e12-556677889908" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [ + { + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }, + { + "commandId": "{{REQUEST_ID_RETRY}}#8008bb09-cc10-4d11-9e12-556677889908#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + } + ], + "ocrDataPayload": [ + { + "commandId": "{{REQUEST_ID}}#f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M10", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }, + { + "commandId": "{{REQUEST_ID_RETRY}}#8008bb09-cc10-4d11-9e12-556677889908#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + } + ], + "sentToOcr": 2 + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/fail_ar_m10_delivery.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/fail_ar_m10_delivery.json new file mode 100644 index 000000000..dcc292e15 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/fail_ar_m10_delivery.json @@ -0,0 +1,103 @@ +{ + "name": "FAIL_AR_M10_DELIVERY", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "deliveryFailureCause": "M10", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: M10", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN001A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M10" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "deliveryFailureCause":"M10", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}","registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "deliveryFailureCause":"M10", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_bad_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_bad_event.json new file mode 100644 index 000000000..4e5b09a49 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_bad_event.json @@ -0,0 +1,132 @@ +{ + "name": "OK_AR_BAD_EVENT", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c54", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002A", "statusDescription": "AR - RECRN002A - RECRN002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c54", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_deliveryfailurecause.json new file mode 100644 index 000000000..3720b867a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_deliveryfailurecause.json @@ -0,0 +1,102 @@ +{ + "name": "FAIL_AR_EMPTY_DELIVERY_FAILURE_CAUSE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "events": [ + { + "messageId": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"}} + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN002C", + "eventIdThrow": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "details": { + "cause": "INVALID_VALUES", + "message": "Missing deliveryFailureCause", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "" + } + ] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002A", "statusDescription": "AR - RECRN002A - RECRN002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002B", "statusDescription": "AR - RECRN002B - RECRN002B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "Poste", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "validatedEvents": [ + ], + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_registeredlettecode.json new file mode 100644 index 000000000..6fa0b4fab --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_empty_registeredlettecode.json @@ -0,0 +1,100 @@ +{ + "name": "OK_AR_EMPTY_REGISTEREDLETTERCODE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN001B", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_event_other_product.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_event_other_product.json new file mode 100644 index 000000000..490cfbe97 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_event_other_product.json @@ -0,0 +1,180 @@ +{ + "name": "OK_AR_EVENT_OTHER_PRODUCT", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c54", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c55", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "AR", + "eventThrow": "RECAG002A", + "eventIdThrow": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c54", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "AR", + "eventThrow": "RECAG002A", + "eventIdThrow": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c55", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c54", "statusCode": "RECAG002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "5d9a2c7e-4b1f-4a8d-9c66-5e1f3a7b8c55", "statusCode": "RECAG002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_inconsistent-state.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_inconsistent-state.json new file mode 100644 index 000000000..68c2884f4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_inconsistent-state.json @@ -0,0 +1,160 @@ +{ + "name": "OK_AR_INCONSISTENT_STATE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "2f6c8a1d-7b3e-4d9a-8c11-1a4e7b9d2c01", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3a7d9b2e-6c4f-4a1d-9b22-2b5e8c1d3f12", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5c9f2d4a-1b7e-4c8d-9d44-4d7e2b6a5c34", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6d1a3f7b-9c4e-4a8f-8e55-5e8c1d7a6b45", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7e2b4c8a-3d1f-4e9b-9f66-6f9a2c5d7e56", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "9a4d6e1b-7c2f-4f8a-9b88-8b2c6d7e4a78", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "ab5e7f2c-8d1a-4c9b-9c99-9c3e7a2d5b89", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_STATE", + "type": "WARNING", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "ab5e7f2c-8d1a-4c9b-9c99-9c3e7a2d5b89", + "details": { + "cause": "VALUE_AFTER_REFINEMENT", + "message": "Tracking in state", + "additionalDetails": { + "statusCode": "RECRN001C", + "statusTimestamp": "2024-01-01T11:00Z" + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "2f6c8a1d-7b3e-4d9a-8c11-1a4e7b9d2c01", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "3a7d9b2e-6c4f-4a1d-9b22-2b5e8c1d3f12", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "5c9f2d4a-1b7e-4c8d-9d44-4d7e2b6a5c34", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6d1a3f7b-9c4e-4a8f-8e55-5e8c1d7a6b45", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7e2b4c8a-3d1f-4e9b-9f66-6f9a2c5d7e56", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "9a4d6e1b-7c2f-4f8a-9b88-8b2c6d7e4a78", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "ab5e7f2c-8d1a-4c9b-9c99-9c3e7a2d5b89", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67", + "documentType": "AR", + "attachmentEventId": "7e2b4c8a-3d1f-4e9b-9f66-6f9a2c5d7e56" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "5c9f2d4a-1b7e-4c8d-9d44-4d7e2b6a5c34", + "7e2b4c8a-3d1f-4e9b-9f66-6f9a2c5d7e56", + "8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#8f3c5d9a-2e7b-4a1c-8a77-7a1d3e9c6f67#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_invalid_datetime.json new file mode 100644 index 000000000..b66b51b46 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_invalid_datetime.json @@ -0,0 +1,113 @@ +{ + "name": "OK_AR_INVALID_DATETIME", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRN001C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRN001B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRN001A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_attachment.json new file mode 100644 index 000000000..3bf656c25 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_attachment.json @@ -0,0 +1,105 @@ +{ + "name": "OK_AR_NO_ATTACHMENT", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [AR]", + "additionalDetails": { + "missingAttachments":["AR"] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_eventB.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_eventB.json new file mode 100644 index 000000000..55dfc6e10 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_no_eventB.json @@ -0,0 +1,78 @@ +{ + "name": "OK_AR_NO_EVENT_B", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_not_ordered.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_not_ordered.json new file mode 100644 index 000000000..7d0efd82e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_not_ordered.json @@ -0,0 +1,126 @@ +{ + "name": "OK_AR_NOT_ORDERED", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "AR", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_notexpected_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_notexpected_deliveryfailurecause.json new file mode 100644 index 000000000..4b41d67d5 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_notexpected_deliveryfailurecause.json @@ -0,0 +1,104 @@ +{ + "name": "OK_AR_NOT_EXPECTED_DELIVERYFAILURECAUSE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "deliveryFailureCause": "M02", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M02", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "deliveryFailureCause": "M02", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: M02", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN001C", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M02" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "deliveryFailureCause":"M02", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "deliveryFailureCause":"M02","registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "deliveryFailureCause":"M02", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "deliveryFailureCause":"M02", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "deliveryFailureCause":"M02", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_timestamp_err.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_timestamp_err.json new file mode 100644 index 000000000..05f42b5c1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_timestamp_err.json @@ -0,0 +1,169 @@ +{ + "name": "OK_AR_TIMESTAMP_ERR", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1a4f7c2d-8b3e-4d9a-9c11-0f2a6b3d5e10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2b5e8d3f-7c4a-4f1d-8b22-1a3c7e9d6f21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4d7a1c8f-3e5b-4f2a-8d44-3c6e9b2a7f43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5e8b2d7a-1c4f-4a9d-9e55-4d7a3c6e1f54", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T11:00:00Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "6f9c3e1a-2d7b-4f8a-8f66-5e1c7a3d9b65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T09:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T09:00:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "7a1d4e9b-3c6f-4a2d-9c77-6f2b4e8a1d76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T09:00:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "8b2e5f1c-4d7a-4a8f-9d88-7a3e6c1b2d87", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T11:00:00Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T11:00:00Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7a1d4e9b-3c6f-4a2d-9c77-6f2b4e8a1d76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRN001A" + }, + { + "statusTimestamp":"2024-01-01T09:00:00Z", + "statusCode":"RECRN001B" + }, + { + "statusTimestamp":"2024-01-01T09:00:00Z", + "statusCode":"RECRN001C" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T09:00:00Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T09:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:00Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:00Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1a4f7c2d-8b3e-4d9a-9c11-0f2a6b3d5e10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2b5e8d3f-7c4a-4f1d-8b22-1a3c7e9d6f21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "4d7a1c8f-3e5b-4f2a-8d44-3c6e9b2a7f43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "5e8b2d7a-1c4f-4a9d-9e55-4d7a3c6e1f54", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6f9c3e1a-2d7b-4f8a-8f66-5e1c7a3d9b65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T09:00:00Z", "requestTimestamp": "2024-01-01T09:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T09:00:04Z"}]}, + {"id": "7a1d4e9b-3c6f-4a2d-9c77-6f2b4e8a1d76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T09:00:00Z", "requestTimestamp": "2024-01-01T09:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "8b2e5f1c-4d7a-4a8f-9d88-7a3e6c1b2d87", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98", + "documentType": "AR", + "attachmentEventId": "8b2e5f1c-4d7a-4a8f-9d88-7a3e6c1b2d87" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98", + "5e8b2d7a-1c4f-4a9d-9e55-4d7a3c6e1f54", + "8b2e5f1c-4d7a-4a8f-9d88-7a3e6c1b2d87" + ], + "finalDematFound": true + } + } + ], + + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98#AR", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#9c3f6a2d-5e1b-4f8a-9c99-8b4e7a1d3c98#AR", + "commandType": "postal", + "data": { + "documentType": "AR", + "productType": "AR", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRN001C", + "notificationDate": "2024-01-01T11:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } + +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_unespected_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_unespected_demat.json new file mode 100644 index 000000000..dc5029e35 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_ar_unespected_demat.json @@ -0,0 +1,106 @@ +{ + "name": "OK_AR_UNESPECTED_DEMAT", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN001B-Plico", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECRN001B contains invalid attachments: [Plico]", + "additionalDetails": { + "invalidAttachments": ["Plico"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRN001B-Plico", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN001B-Plico", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_invalid_registeredlettecode.json new file mode 100644 index 000000000..38a8ce6c0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/AR/validation_error/ok_invalid_registeredlettecode.json @@ -0,0 +1,113 @@ +{ + "name": "OK_AR_INVALID_REGISTEREDLETTECODE", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891012", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "AR", + "eventThrow": "RECRN001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [1234567891011, 1234567891012, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRN001C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRN001B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRN001A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "AR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891012", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_con996_pcretry_furto_rir.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_con996_pcretry_furto_rir.json new file mode 100644 index 000000000..43174ba32 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_con996_pcretry_furto_rir.json @@ -0,0 +1,173 @@ +{ + "name": "FAIL_CON996_PC_RETRY_FURTO_RIR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f9c2e41-7b2d-4f1a-9c55-1a6d8e2b4c01", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON996", "statusDescription": "CON996 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "a7b4c9d2-2e6f-4a8b-8f31-2d7e9c3b5a12", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c2d8f6a1-5b3e-4c7d-9e22-3f1a6b8d9c23", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI005", "statusDescription": "RECRI005 description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "d4e1a7c3-9b5d-4f2a-8c66-4a2e7b9c6d34", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e9a3c5d7-6f2b-4a1e-9b44-5b8c2d7e1f45", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f6b2d9a4-1c7e-4d3f-8a11-6c9e2b7d3a56", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "a1d4e8c7-2f6b-4c9a-9d88-7d2e6b9c4a67", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b7e3c1d9-5a2f-4e6b-8c22-8e1b3c7d9a78", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c8f4a2b6-7d1e-4f3c-9b55-9f2c6d8e1b89", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d9a5c3e7-8b2f-4a1d-9c66-af3d7e2b4c90", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY_2}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON996", "statusDescription": "RIR - CON996 - CON996 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI005", "statusDescription": "RIR - RECRI005 - RECRI005 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "deliveryFailureCause": "F01", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "trackingId": "{{REQUEST_ID_RETRY_2}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + {"id": "3f9c2e41-7b2d-4f1a-9c55-1a6d8e2b4c01", "statusCode": "CON996", "statusDescription": "CON996 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY_2}}", + "events": [ + {"id": "a7b4c9d2-2e6f-4a8b-8f31-2d7e9c3b5a12", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{ + "documentType": "7Z", + "sha256": "sha256", + "id": "id-CON020-7Z", + "uri": "https://example.com/CON020-7Z.pdf", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + {"id": "c2d8f6a1-5b3e-4c7d-9e22-3f1a6b8d9c23", "statusCode": "RECRI005", "statusDescription": "RECRI005 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY_2}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_2", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "d4e1a7c3-9b5d-4f2a-8c66-4a2e7b9c6d34", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "e9a3c5d7-6f2b-4a1e-9b44-5b8c2d7e1f45", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "f6b2d9a4-1c7e-4d3f-8a11-6c9e2b7d3a56", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "a1d4e8c7-2f6b-4c9a-9d88-7d2e6b9c4a67", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "b7e3c1d9-5a2f-4e6b-8c22-8e1b3c7d9a78", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "c8f4a2b6-7d1e-4f3c-9b55-9f2c6d8e1b89", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "d9a5c3e7-8b2f-4a1d-9c66-af3d7e2b4c90", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "f6b2d9a4-1c7e-4d3f-8a11-6c9e2b7d3a56", + "a1d4e8c7-2f6b-4c9a-9d88-7d2e6b9c4a67", + "b7e3c1d9-5a2f-4e6b-8c22-8e1b3c7d9a78", + "c8f4a2b6-7d1e-4f3c-9b55-9f2c6d8e1b89", + "d9a5c3e7-8b2f-4a1d-9c66-af3d7e2b4c90" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_1.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_1.json new file mode 100644 index 000000000..f4a1e8fce --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_1.json @@ -0,0 +1,105 @@ +{ + "name": "FAIL_RIR_KO_1", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"}}, + { + "messageId": "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:03Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "desc", "deliveryFailureCause":"M01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - desc", "statusDateTime": "2024-01-01T10:00:02Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - desc", "statusDateTime": "2024-01-01T10:00:03Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A", "deliveryFailureCause":"M01","statusDescription": "RIR - RECRI004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004B", "statusDescription": "RIR - RECRI004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRI004C","deliveryFailureCause":"M01", "statusDescription": "RIR - RECRI004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:03Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRI004A", "deliveryFailureCause":"M01", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRI004B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRI004C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "deliveryFailureCause": "M01", + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI004C", + "validatedEvents": [ + "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_2.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_2.json new file mode 100644 index 000000000..1cdeb3dbd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_KO_2.json @@ -0,0 +1,104 @@ +{ + "name": "FAIL_RIR_KO_2", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"}}, + { + "messageId": "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:03Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - desc", "statusDateTime": "2024-01-01T10:00:02Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - desc", "statusDateTime": "2024-01-01T10:00:03Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A","statusDescription": "RIR - RECRI004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004B", "statusDescription": "RIR - RECRI004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRI004C", "statusDescription": "RIR - RECRI004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:03Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRI004A", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRI004B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRI004C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI004C", + "validatedEvents": [ + "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_OK.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_OK.json new file mode 100644 index 000000000..97ecb7e8b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/fail_rir_OK.json @@ -0,0 +1,105 @@ +{ + "name": "FAIL_RIR_OK", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"}}, + { + "messageId": "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:03Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "desc", "deliveryFailureCause":"M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - desc", "statusDateTime": "2024-01-01T10:00:02Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - desc", "statusDateTime": "2024-01-01T10:00:03Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A", "deliveryFailureCause":"M02","statusDescription": "RIR - RECRI004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004B", "statusDescription": "RIR - RECRI004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI004C","deliveryFailureCause":"M02", "statusDescription": "RIR - RECRI004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:03Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRI004A", "deliveryFailureCause":"M02", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRI004B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRI004C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "deliveryFailureCause": "M02", + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI004C", + "validatedEvents": [ + "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_pcretry_con996_rir.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_pcretry_con996_rir.json new file mode 100644 index 000000000..d435c7d8a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_pcretry_con996_rir.json @@ -0,0 +1,127 @@ +{ + "name": "OK_PCRETRY_CON996_RIR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "6f3c2a9d-4b1e-4f7a-8c2d-1a9e6b3d5c11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON996", "statusDescription": "CON996 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8b2e4d6f-7a3c-4e1d-9c5a-2d7f1b6a3e22", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "9d4f6a2b-3e1c-4b8d-8f2a-3c6e1a7d4b33", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "1c7e9a4d-5b2f-4d6a-9e3b-4d8a2f6c5e44", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2e8f1a6b-4c3d-4a9e-8b7c-5e1a3d7f6c55", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3f9a2d7e-6b4c-4f1a-9c8d-6f2b4e1a7d66", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4a1d7f6c-8b3e-4c9a-9f2d-7a3e6b1c8d77", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004B", "statusDescription": "RECRI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5b2e8c4a-9d1f-4e7b-8a3c-8b4e2d7f9c88", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004C", "statusDescription": "RECRI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON996", "statusDescription": "RIR - CON996 - CON996 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A", "statusDescription": "RIR - RECRI004A - RECRI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004B", "statusDescription": "RIR - RECRI004B - RECRI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRI004C", "statusDescription": "RIR - RECRI004C - RECRI004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [] } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + {"id": "6f3c2a9d-4b1e-4f7a-8c2d-1a9e6b3d5c11", "statusCode": "CON996", "statusDescription": "CON996 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "8b2e4d6f-7a3c-4e1d-9c5a-2d7f1b6a3e22", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "9d4f6a2b-3e1c-4b8d-8f2a-3c6e1a7d4b33", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "1c7e9a4d-5b2f-4d6a-9e3b-4d8a2f6c5e44", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "2e8f1a6b-4c3d-4a9e-8b7c-5e1a3d7f6c55", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "3f9a2d7e-6b4c-4f1a-9c8d-6f2b4e1a7d66", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "4a1d7f6c-8b3e-4c9a-9f2d-7a3e6b1c8d77", "statusCode": "RECRI004B", "statusDescription": "RECRI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "5b2e8c4a-9d1f-4e7b-8a3c-8b4e2d7f9c88", "statusCode": "RECRI004C", "statusDescription": "RECRI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI004C", + "validatedEvents": [ + "4a1d7f6c-8b3e-4c9a-9f2d-7a3e6b1c8d77", + "3f9a2d7e-6b4c-4f1a-9c8d-6f2b4e1a7d66", + "2e8f1a6b-4c3d-4a9e-8b7c-5e1a3d7f6c55", + "5b2e8c4a-9d1f-4e7b-8a3c-8b4e2d7f9c88", + "1c7e9a4d-5b2f-4d6a-9e3b-4d8a2f6c5e44" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_m10_rir.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_m10_rir.json new file mode 100644 index 000000000..4f21bcd63 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_m10_rir.json @@ -0,0 +1,698 @@ +{ + "name": "OK_RETRY_M10_RIR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:01Z", + "statusDateTime": "2024-01-01T10:00:01Z" + } + }, + { + "messageId": "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI001", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:02Z", + "statusDateTime": "2024-01-01T10:00:02Z" + } + }, + { + "messageId": "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI002", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:03Z", + "statusDateTime": "2024-01-01T10:00:03Z" + } + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI004A", + "statusDescription": "desc", + "deliveryFailureCause": "M10", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI004B", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:05Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI004C", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e04", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:00Z", + "statusDateTime": "2024-01-01T10:01:00Z" + } + }, + { + "messageId": "f2b3c4d5-e6a7-4890-abcd-1e2f3a4b5c06", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:01Z", + "statusDateTime": "2024-01-01T10:01:01Z" + } + }, + { + "messageId": "a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI001", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:02Z", + "statusDateTime": "2024-01-01T10:01:02Z" + } + }, + { + "messageId": "b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI002", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:03Z", + "statusDateTime": "2024-01-01T10:01:03Z" + } + }, + { + "messageId": "c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI003A", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI003B", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id", + "uri": "https://example.com/RECRI003B-AR.pdf", + "date": "2024-01-01T10:01:05Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:01:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRI003C", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + "expected": { + "errors": [], + "outputs": [ + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RIR - CON080 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "RIR - CON020 - desc", + "statusDateTime": "2024-01-01T10:00:01Z", + "clientRequestTimestamp": "2024-01-01T10:00:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI001", + "statusDescription": "RIR - RECRI001 - desc", + "statusDateTime": "2024-01-01T10:00:02Z", + "clientRequestTimestamp": "2024-01-01T10:00:02Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI002", + "statusDescription": "RIR - RECRI002 - desc", + "statusDateTime": "2024-01-01T10:00:03Z", + "clientRequestTimestamp": "2024-01-01T10:00:03Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI004A", + "deliveryFailureCause": "M10", + "statusDescription": "RIR - RECRI004A - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:04Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI004B", + "statusDescription": "RIR - RECRI004B - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:05Z", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:05Z" + } + ], + "deliveryFailureCause": null + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI004C", + "deliveryFailureCause": "M10", + "statusDescription": "RIR - RECRI004C - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RIR - CON080 - desc", + "statusDateTime": "2024-01-01T10:01:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "RIR - CON020 - desc", + "statusDateTime": "2024-01-01T10:01:01Z", + "clientRequestTimestamp": "2024-01-01T10:01:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI001", + "statusDescription": "RIR - RECRI001 - desc", + "statusDateTime": "2024-01-01T10:01:02Z", + "clientRequestTimestamp": "2024-01-01T10:01:02Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI002", + "statusDescription": "RIR - RECRI002 - desc", + "statusDateTime": "2024-01-01T10:01:03Z", + "clientRequestTimestamp": "2024-01-01T10:01:03Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI003A", + "statusDescription": "RIR - RECRI003A - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:04Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRI003B", + "statusDescription": "RIR - RECRI003B - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:05Z", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id", + "uri": "https://example.com/RECRI003B-AR.pdf", + "date": "2024-01-01T10:01:05Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "OK", + "statusDetail": "RECRI003C", + "statusDescription": "RIR - RECRI003C - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:06Z", + "attachments": [] + } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + { + "id": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "statusCode": "CON080", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "statusCode": "CON020", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:01Z", + "requestTimestamp": "2024-01-01T10:00:01Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "id": "3b5d7f9a-2c4e-4a8b-9d3f-4e6a8c0b7d83", + "statusCode": "RECRI001", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:02Z", + "requestTimestamp": "2024-01-01T10:00:02Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "4c6e8a0b-3d5f-4b9c-8e1a-5f7b9d1c8e94", + "statusCode": "RECRI002", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:03Z", + "requestTimestamp": "2024-01-01T10:00:03Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "statusCode": "RECRI004A", + "deliveryFailureCause": "M10", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "statusCode": "RECRI004B", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:00:05Z" + } + ] + }, + { + "id": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "statusCode": "RECRI004C", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + { + "id": "c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e04", + "statusCode": "CON080", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:01:00Z", + "requestTimestamp": "2024-01-01T10:01:00Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "f2b3c4d5-e6a7-4890-abcd-1e2f3a4b5c06", + "statusCode": "CON020", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:01:01Z", + "requestTimestamp": "2024-01-01T10:01:01Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri", + "date": "2024-01-01T10:01:01Z" + } + ] + }, + { + "id": "a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", + "statusCode": "RECRI001", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:01:02Z", + "requestTimestamp": "2024-01-01T10:01:02Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08", + "statusCode": "RECRI002", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:01:03Z", + "requestTimestamp": "2024-01-01T10:01:03Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", + "statusCode": "RECRI003A", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:01:04Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + }, + { + "id": "d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", + "statusCode": "RECRI003B", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:01:05Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [ + { + "documentType": "AR", + "sha256": "sha256", + "id": "id", + "uri": "https://example.com/RECRI003B-AR.pdf", + "date": "2024-01-01T10:01:05Z" + } + ] + }, + { + "id": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "statusCode": "RECRI003C", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:01:06Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RIR", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", + "d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", + "a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", + "b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08" + ], + "finalDematFound": true + } + } + ] + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_rir.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_rir.json new file mode 100644 index 000000000..1c8f72a45 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_retry_rir.json @@ -0,0 +1,147 @@ +{ + "name": "OK_RETRY_RIR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI005", "statusDescription": "desc", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"} + }, + { + "messageId": "c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e04", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:01:00Z"} + }, + { + "messageId": "f2b3c4d5-e6a7-4890-abcd-1e2f3a4b5c06", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:01:01Z"} + }, + { + "messageId": "a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:02Z", "statusDateTime": "2024-01-01T10:01:02Z"} + }, + { + "messageId": "b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:03Z", "statusDateTime": "2024-01-01T10:01:03Z"} + }, + { + "messageId": "c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:01:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI005", "statusDescription": "RIR - RECRI005 - desc", "statusDateTime": "2024-01-01T10:00:02Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "deliveryFailureCause": "F01", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - desc", "statusDateTime": "2024-01-01T10:01:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - desc", "statusDateTime": "2024-01-01T10:01:01Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - desc", "statusDateTime": "2024-01-01T10:01:02Z", "clientRequestTimestamp": "2024-01-01T10:01:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - desc", "statusDateTime": "2024-01-01T10:01:03Z", "clientRequestTimestamp": "2024-01-01T10:01:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:01:05Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id":"7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01","statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02","statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e03","statusCode": "RECRI005", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id":"c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e04", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:01:00Z", "requestTimestamp": "2024-01-01T10:01:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"f2b3c4d5-e6a7-4890-abcd-1e2f3a4b5c06", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:01:01Z", "requestTimestamp": "2024-01-01T10:01:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:01:01Z"}]}, + {"id":"a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", "statusCode": "RECRI001", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:01:02Z", "requestTimestamp": "2024-01-01T10:01:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08", "statusCode": "RECRI002", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:01:03Z", "requestTimestamp": "2024-01-01T10:01:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", "statusCode": "RECRI003A", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:01:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", "statusCode": "RECRI003B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:01:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:01:05Z"}]}, + {"id":"e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", "statusCode": "RECRI003C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:01:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "c5e6f7a8-b9d0-4123-def0-4b5c6d7e8f09", + "d6f7a8b9-c0e1-4234-ef01-5c6d7e8f9a10", + "a3c4d5e6-f7b8-4901-bcde-2f3a4b5c6d07", + "b4d5e6f7-a8c9-4012-cdef-3a4b5c6d7e08" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_rir.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_rir.json new file mode 100644 index 000000000..241ecf855 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/ok_rir.json @@ -0,0 +1,100 @@ +{ + "name": "OK_RIR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", + "c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/fail_rir_no_equals_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/fail_rir_no_equals_deliveryfailurecause.json new file mode 100644 index 000000000..9fe79290c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/fail_rir_no_equals_deliveryfailurecause.json @@ -0,0 +1,117 @@ +{ + "name": "FAIL_RIR_NO_EQUALS_DELIVERYFAILURECAUSE", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPPlicoE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc33b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "dd44c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "deliveryFailureCause": "M01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004B", "statusDescription": "RECRI004B description", "deliveryFailureCause": "M01", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI004B-Plico", "uri": "https://example.com/RECRI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004C", "statusDescription": "RECRI004C description", "deliveryFailureCause": "M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI004C", + "eventIdThrow": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause on events:", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRI004C", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M02" + }, + { + "statusCode": "RECRI004B", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M01" + }, + { + "statusCode": "RECRI004A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M01" + } + ] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description","statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description","statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A", "statusDescription": "RIR - RECRI004A - RECRI004A description", "deliveryFailureCause":"M01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004B", "statusDescription": "RIR - RECRI004B - RECRI004B description", "deliveryFailureCause":"M01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI004B-Plico", "uri": "https://example.com/RECRI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPPlicoE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc33b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "dd44c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI004B", "statusDescription": "RECRI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI004B-Plico", "uri": "https://example.com/RECRI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI004C", "statusDescription": "RECRI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M02", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_duplicate_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_duplicate_event.json new file mode 100644 index 000000000..1efe966ef --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_duplicate_event.json @@ -0,0 +1,121 @@ +{ + "name": "OK_RIR_DUPLICATE_EVENT", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "RIR", + "eventThrow": "RECRI003A", + "eventIdThrow": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "details": { + "message": "Duplicated event found for statusCode: RECRI003A", + "additionalDetails": { + "statusCode": "RECRI003A", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "5e8f7a90-6d21-4c3e-9a8b-1f4c7d2e4444", + "c91e8d12-3f7a-4e55-bb3e-6f7b2c9d3e33" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_empty_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_empty_registeredlettecode.json new file mode 100644 index 000000000..041074d2c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_empty_registeredlettecode.json @@ -0,0 +1,110 @@ +{ + "name": "OK_RIR_EMPTY_REGISTEREDLETTERCODE", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc3b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "dd4c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRI003C", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc3b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "dd4c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_not_expected.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_not_expected.json new file mode 100644 index 000000000..e4e4303d8 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_not_expected.json @@ -0,0 +1,104 @@ +{ + "name": "OK_RIR_EVENT_NOT_EXPECTED", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "101f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "202a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "303b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "404c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "707f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI004A", "statusDescription": "RIR - RECRI004A - RECRI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "101f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "202a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "303b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "404c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "707f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI004A", "statusDescription": "RECRI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "303b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "404c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_other_product.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_other_product.json new file mode 100644 index 000000000..4e0d55356 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_event_other_product.json @@ -0,0 +1,152 @@ +{ + "name": "OK_RIR_EVENT_OTHER_PRODUCT", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "333b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "444c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RIR", + "eventThrow": "RECRN002A", + "eventIdThrow": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RIR", + "eventThrow": "RECRN002A", + "eventIdThrow": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "333b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "444c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "333b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "444c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_datetime.json new file mode 100644 index 000000000..e6d676d2a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_datetime.json @@ -0,0 +1,119 @@ +{ + "name": "OK_RIR_INVALID_DATETIME", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c33b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d44c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRI003C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRI003B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI003A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "id": "c33b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "d44c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_registeredlettecode.json new file mode 100644 index 000000000..3106618f4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_invalid_registeredlettecode.json @@ -0,0 +1,126 @@ +{ + "name": "OK_RIR_INVALID_REGISTEREDLETTERCODE", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc3b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "dd4c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "12345643", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [12345643, 1234567891011, 1234567891011, 1234567891011, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI003C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI003B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI003A" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI002" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRI001" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc3b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "dd4c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "12345643", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_attachment.json new file mode 100644 index 000000000..b64e0b632 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_attachment.json @@ -0,0 +1,104 @@ +{ + "name": "OK_RIR_NO_ATTACHMENT", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c23b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d34c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [AR]", + "additionalDetails": { + "missingAttachments":["AR"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + "events": [ + { "id": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "id": "c23b5d7f-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "d34c6e8a-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_demat.json new file mode 100644 index 000000000..1aaa09b94 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_no_demat.json @@ -0,0 +1,83 @@ +{ + "name": "OK_RIR_NO_DEMAT", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c923b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d934c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "id": "c923b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "d934c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_not_ordered.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_not_ordered.json new file mode 100644 index 000000000..db15059b3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_not_ordered.json @@ -0,0 +1,99 @@ +{ + "name": "OK_RIR_NOT_ORDERED", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c333b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d444c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + { "id": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "id": "c333b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "d444c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] }, + { "id": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "c333b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "d444c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", + "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_notexpected_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_notexpected_deliveryfailurecause.json new file mode 100644 index 000000000..52e744b0a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_notexpected_deliveryfailurecause.json @@ -0,0 +1,107 @@ +{ + "name": "OK_RIR_NOTEXPECTED_DELIVERYFAILURECAUSE", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc33b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "dd44c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "deliveryFailureCause": "F01", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: F01", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRI003C", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "F01" + } + ] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description","statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description","statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "deliveryFailureCause":"F01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "deliveryFailureCause":"F01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc33b5d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "dd44c6e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_timestamp_err.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_timestamp_err.json new file mode 100644 index 000000000..d0c721895 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_timestamp_err.json @@ -0,0 +1,118 @@ +{ + "name": "OK_RIR_TIMESTAMP_ERR", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { "messageId": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "c3f223d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "d4f334e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T11:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z" } }, + { "messageId": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T11:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T12:00:05Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:04Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:01:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRI003C" + }, + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRI003B" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRI003A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRI003C", "statusDescription": "RIR - RECRI003C - RECRI003C description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:01:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "c3f223d7-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "d4f334e8-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T11:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:01:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRI003C", + "validatedEvents": [ + "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", + "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", + "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", + "c3f223d7-9a2c-44e8-8b9d-4e6a8c0b7d83", + "d4f334e8-0b3d-45f9-8e1a-5f7b9d1c8e94" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_unespected_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_unespected_demat.json new file mode 100644 index 000000000..cf105c3b1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIR/validation_error/ok_rir_unespected_demat.json @@ -0,0 +1,119 @@ +{ + "name": "OK_RIR_UNEXPECTED_DEMAT", + "productType": "RIR", + "initialTracking": { + "productType": "RIR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "c33cc333-9a2c-44e8-8b9d-4e6a8c0b7d83", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d44dd444-0b3d-45f9-8e1a-5f7b9d1c8e94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g77gg777-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "registeredLetterCode": "1234567891011", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIR", + "eventThrow": "RECRI003C", + "eventIdThrow": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECRI003B contains invalid attachments", + "additionalDetails": { + "invalidAttachments": ["Plico"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI001", "statusDescription": "RIR - RECRI001 - RECRI001 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI002", "statusDescription": "RIR - RECRI002 - RECRI002 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003A", "statusDescription": "RIR - RECRI003A - RECRI003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRI003B", "statusDescription": "RIR - RECRI003B - RECRI003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIR", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "c33cc333-9a2c-44e8-8b9d-4e6a8c0b7d83", "statusCode": "RECRI001", "statusDescription": "RECRI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "d44dd444-0b3d-45f9-8e1a-5f7b9d1c8e94", "statusCode": "RECRI002", "statusDescription": "RECRI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRI003A", "statusDescription": "RECRI003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []}, + {"id": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRI003B-Plico", "uri": "https://example.com/RECRI003B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "g77gg777-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRI003B", "statusDescription": "RECRI003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRI003B-AR", "uri": "https://example.com/RECRI003B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRI003C", "statusDescription": "RECRI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIR", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/fail_ris.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/fail_ris.json new file mode 100644 index 000000000..969a2c4ff --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/fail_ris.json @@ -0,0 +1,98 @@ +{ + "name": "FAIL_RIS", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7778", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7779", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7778", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7779", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7778", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7779" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_m10_ris.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_m10_ris.json new file mode 100644 index 000000000..5872653e9 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_m10_ris.json @@ -0,0 +1,499 @@ +{ + "name": "OK_RETRY_M10_RIS", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a10", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "CON080 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI001", + "statusDescription": "RECRSI001 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI002", + "statusDescription": "RECRSI002 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI004A", + "statusDescription": "RECRSI004A description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M10" + } + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7778", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI004B", + "statusDescription": "RECRSI004B description", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRS004B-Plico", + "uri": "https://example.com/RECRS004B-Plico.pdf", + "date": "2024-01-01T11:00:05Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7779", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI004C", + "statusDescription": "RECRSI004C description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "CON080 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "CON020 description", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id-CON020-7Z", + "uri": "https://example.com/CON020-7Z.pdf", + "date": "2024-01-01T10:00:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:01Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI001", + "statusDescription": "RECRSI001 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI002", + "statusDescription": "RECRSI002 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRSI003C", + "statusDescription": "RECRSI003C description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + "expected": { + "errors": [], + "outputs": [ + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RIS - CON080 - CON080 description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRSI004A", + "statusDescription": "RIS - RECRSI004A - RECRSI004A description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [], + "deliveryFailureCause": "M10" + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRSI004B", + "statusDescription": "RIS - RECRSI004B - RECRSI004B description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRS004B-Plico", + "uri": "https://example.com/RECRS004B-Plico.pdf", + "date": "2024-01-01T11:00:05Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRSI004C", + "statusDescription": "RIS - RECRSI004C - RECRSI004C description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [], + "deliveryFailureCause": "M10" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RIS - CON080 - CON080 description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "RIS - CON020 - CON020 description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id-CON020-7Z", + "uri": "https://example.com/CON020-7Z.pdf", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "OK", + "statusDetail": "RECRSI003C", + "statusDescription": "RIS - RECRSI003C - RECRSI003C description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [] + } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + { + "id": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a10", + "statusCode": "CON080", + "statusDescription": "CON080 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "statusCode": "RECRSI001", + "statusDescription": "RECRSI001 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "statusCode": "RECRSI002", + "statusDescription": "RECRSI002 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "statusCode": "RECRSI004A", + "statusDescription": "RECRSI004A description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M10", + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7778", + "statusCode": "RECRSI004B", + "statusDescription": "RECRSI004B description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECRS004B-Plico", + "uri": "https://example.com/RECRS004B-Plico.pdf", + "date": "2024-01-01T11:00:05Z" + } + ] + }, + { + "id": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7779", + "statusCode": "RECRSI004C", + "statusDescription": "RECRSI004C description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + { + "id": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "statusCode": "CON080", + "statusDescription": "CON080 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "statusCode": "CON020", + "statusDescription": "CON020 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:01Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id-CON020-7Z", + "uri": "https://example.com/CON020-7Z.pdf", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "statusCode": "RECRSI001", + "statusDescription": "RECRSI001 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "statusCode": "RECRSI002", + "statusDescription": "RECRSI002 description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + }, + { + "id": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "statusCode": "RECRSI003C", + "statusDescription": "RECRSI003C description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "iun": "{{RANDOM_IUN}}", + "productType": "RIS", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI003C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777" + ] + } + } + ] + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_ris.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_ris.json new file mode 100644 index 000000000..7bf8f0609 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_retry_ris.json @@ -0,0 +1,121 @@ +{ + "name": "OK_RETRY_RIS", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a09", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI005", "deliveryFailureCause":"F01","statusDescription": "RECRSI005 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI003C", "statusDescription": "RECRSI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI005", "statusDescription": "RIS - RECRSI005 - RECRSI005 description", "deliveryFailureCause":"F01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRSI003C", "statusDescription": "RIS - RECRSI003C - RECRSI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a09", "statusCode": "RECRSI005", "statusDescription": "RECRSI005 description", "deliveryFailureCause":"F01","statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011","iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRSI003C", "statusDescription": "RECRSI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI003C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777" + ] + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_ris.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_ris.json new file mode 100644 index 000000000..0fc8d2d08 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/ok_ris.json @@ -0,0 +1,83 @@ +{ + "name": "OK_RIS", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI003C", "statusDescription": "RECRSI003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRSI003C", "statusDescription": "RIS - RECRSI003C - RECRSI003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRSI003C", "statusDescription": "RECRSI003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI003C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777" + ] + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_deliveryfailurecause.json new file mode 100644 index 000000000..147f5d711 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_deliveryfailurecause.json @@ -0,0 +1,95 @@ +{ + "name": "OK_RIS_DELIVERYFAILURECAUSE", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "deliveryFailureCause": "M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "deliveryFailureCause": "M02", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "deliveryFailureCause":"M02", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "deliveryFailureCause":"M02", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "deliveryFailureCause":"M02", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011","deliveryFailureCause":"M02", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause":"M02", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M02", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_duplicate_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_duplicate_event.json new file mode 100644 index 000000000..5df6ed1bd --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_duplicate_event.json @@ -0,0 +1,119 @@ +{ + "name": "FAIL_RIS_DUPLICATE_EVENT", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5554", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6665", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "RIS", + "eventThrow": "RECRSI004A", + "eventIdThrow": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "details": { + "message": "Duplicated event found for statusCode: RECRSI004A", + "additionalDetails": { + "statusCode": "RECRSI004A", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5554", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6665", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5554", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6665", + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_empty_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_empty_registeredlettecode.json new file mode 100644 index 000000000..2fe03c1e7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_empty_registeredlettecode.json @@ -0,0 +1,108 @@ +{ + "name": "FAIL_RIS_EMPTY_REGISTEREDLETTERCODE", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRSI004C", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_event_other_product.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_event_other_product.json new file mode 100644 index 000000000..4e27d9542 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_event_other_product.json @@ -0,0 +1,150 @@ +{ + "name": "FAIL_RIS_EVENT_OTHER_PRODUCT", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RIS", + "eventThrow": "RECRN002A", + "eventIdThrow": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RIS", + "eventThrow": "RECRN002A", + "eventIdThrow": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_datetime.json new file mode 100644 index 000000000..e5acbe753 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_datetime.json @@ -0,0 +1,117 @@ +{ + "name": "FAIL_RIS_INVALID_DATETIME", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRSI004C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRSI004B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + { "id": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_registeredlettecode.json new file mode 100644 index 000000000..9693eb4b1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_invalid_registeredlettecode.json @@ -0,0 +1,124 @@ +{ + "name": "FAIL_RIS_INVALID_REGISTEREDLETTERCODE", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "12345643", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [12345643, 1234567891011, 1234567891011, 1234567891011, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI004C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI002" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI004B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI001" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRSI004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "12345643", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_attachment.json new file mode 100644 index 000000000..b84c65d38 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_attachment.json @@ -0,0 +1,102 @@ +{ + "name": "FAIL_RIS_NO_ATTACHMENT", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico]", + "additionalDetails": { + "missingAttachments":["Plico"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + "events": [ + { "id": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + { "id": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_demat.json new file mode 100644 index 000000000..1d2a22d0f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_no_demat.json @@ -0,0 +1,81 @@ +{ + "name": "FAIL_RIS_NO_DEMAT", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + { "id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + { "id": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_not_ordered.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_not_ordered.json new file mode 100644 index 000000000..7abe2ad08 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_not_ordered.json @@ -0,0 +1,97 @@ +{ + "name": "FAIL_RIS_NOT_ORDERED", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + { "id": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + { "id": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] }, + { "id": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_timestamp_err.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_timestamp_err.json new file mode 100644 index 000000000..18f75f457 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_timestamp_err.json @@ -0,0 +1,122 @@ +{ + "name": "FAIL_RIS_TIMESTAMP_ERR", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { "messageId": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { "messageId": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T11:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z" } }, + { "messageId": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T11:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T12:00:05Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:04Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:01:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRSI004C" + }, + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRSI004B" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRSI004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRSI004C", "statusDescription": "RIS - RECRSI004C - RECRSI004C description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:01:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T11:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:01:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRSI004C", + "validatedEvents": [ + "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", + "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", + "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666" + ], + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_unespected_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_unespected_demat.json new file mode 100644 index 000000000..6603078f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RIS/validation_error/fail_ris_unespected_demat.json @@ -0,0 +1,117 @@ +{ + "name": "FAIL_RIS_UNEXPECTED_DEMAT", + "productType": "RIS", + "initialTracking": { + "productType": "RIS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRSI004B-AR", "uri": "https://example.com/RECRSI004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e17", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "registeredLetterCode": "1234567891011", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RIS", + "eventThrow": "RECRSI004C", + "eventIdThrow": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECRSI004B contains invalid attachments", + "additionalDetails": { + "invalidAttachments": ["AR"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RIS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RIS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004A", "statusDescription": "RIS - RECRSI004A - RECRSI004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRSI004B-AR", "uri": "https://example.com/RECRSI004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRSI004B", "statusDescription": "RIS - RECRSI004B - RECRSI004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RIS", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRSI001", "statusDescription": "RECRSI001 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRSI002", "statusDescription": "RECRSI002 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRSI004A", "statusDescription": "RECRSI004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []}, + {"id": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRSI004B-AR", "uri": "https://example.com/RECRSI004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e17", "statusCode": "RECRSI004B", "statusDescription": "RECRSI004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRSI004B-Plico", "uri": "https://example.com/RECRSI004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRSI004C", "statusDescription": "RECRSI004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RIS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_deceduto_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_deceduto_rs.json new file mode 100644 index 000000000..b7025b3c1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_deceduto_rs.json @@ -0,0 +1,129 @@ +{ + "name": "FAIL_DECEDUTO_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002A", "statusDescription": "desc", "deliveryFailureCause":"M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002A", "deliveryFailureCause":"M02","statusDescription": "RS - RECRS002A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002B", "statusDescription": "RS - RECRS002B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS002C","deliveryFailureCause":"M02", "statusDescription": "RS - RECRS002C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRS002A", "deliveryFailureCause":"M02", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRS002B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRS002C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "deliveryFailureCause": "M02", + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS002C", + "validatedEvents": [ + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M02", + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + } + ], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_irreperibile_assoluto_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_irreperibile_assoluto_rs.json new file mode 100644 index 000000000..93ccb2f25 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_irreperibile_assoluto_rs.json @@ -0,0 +1,128 @@ +{ + "name": "FAIL_IRREPERIBILE_ASSOLUTO_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002D", "statusDescription": "desc", "deliveryFailureCause":"M01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002E", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002F", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002D", "deliveryFailureCause":"M01","statusDescription": "RS - RECRS002D - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002E", "statusDescription": "RS - RECRS002E - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS002F","deliveryFailureCause":"M01", "statusDescription": "RS - RECRS002F - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRS002D", "deliveryFailureCause":"M01", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRS002E", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRS002F", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "deliveryFailureCause": "M01", + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS002F", + "validatedEvents": [ + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS002F", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M01", + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_mancata_consegna_giacenza.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_mancata_consegna_giacenza.json new file mode 100644 index 000000000..da832bb2d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_mancata_consegna_giacenza.json @@ -0,0 +1,140 @@ +{ + "name": "FAIL_MANCATA_CONSEGNA_GIACENZA_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_rs.json new file mode 100644 index 000000000..26d93193e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/fail_rs.json @@ -0,0 +1,128 @@ +{ + "name": "FAIL_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002A", "statusDescription": "desc", "deliveryFailureCause":"M07", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002B", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002A", "deliveryFailureCause":"M07","statusDescription": "RS - RECRS002A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002B", "statusDescription": "RS - RECRS002B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS002C","deliveryFailureCause":"M07", "statusDescription": "RS - RECRS002C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRS002A", "deliveryFailureCause":"M07", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRS002B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRS002C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "deliveryFailureCause": "M07", + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS002C", + "validatedEvents": [ + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M07", + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_causa_forza_maggiore_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_causa_forza_maggiore_rs.json new file mode 100644 index 000000000..faf912f15 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_causa_forza_maggiore_rs.json @@ -0,0 +1,93 @@ +{ + "name": "CAUSA_FORZA_MAGGIORE_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1111aa22-bb33-4c44-8d55-ee6600000001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2222bb33-cc44-4d55-9e66-ff7700000002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3333cc44-dd55-4e66-8f77-008800000003", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS015", "statusDescription": "desc", "deliveryFailureCause": "C02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "4444dd55-ee66-4f77-9a88-009900000004", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T09:00:00Z"} + }, + { + "messageId": "5555ee66-ff77-4a88-8b99-001100000005", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T09:00:00Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8888bb99-cc00-4d11-8e22-334400000008", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS015", "statusDescription": "RS - RECRS015 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": [], "deliveryFailureCause": "C02"}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T09:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": [], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T09:00:00Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRS001C", "statusDescription": "RS - RECRS001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": [], "deliveryFailureCause": null} + ], + + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "1111aa22-bb33-4c44-8d55-ee6600000001", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "2222bb33-cc44-4d55-9e66-ff7700000002", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3333cc44-dd55-4e66-8f77-008800000003", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRS015", "statusDescription": "desc", "deliveryFailureCause": "C02", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "4444dd55-ee66-4f77-9a88-009900000004", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T09:00:00Z", "attachments": []}, + {"id": "5555ee66-ff77-4a88-8b99-001100000005", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T09:00:00Z"}]}, + {"id": "8888bb99-cc00-4d11-8e22-334400000008", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + + "validationFlow": { + "ocrRequests": [ + ] + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS001C", + "validatedEvents": [ + "8888bb99-cc00-4d11-8e22-334400000008" + ] + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_compiuta_giacenza_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_compiuta_giacenza_rs.json new file mode 100644 index 000000000..4b902aee7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_compiuta_giacenza_rs.json @@ -0,0 +1,140 @@ +{ + "name": "OK_COMPIUTA_GIACENZA_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS005A", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS005B", "statusDescription": "desc", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS005C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS005A", "statusDescription": "RS - RECRS005A - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS005B", "statusDescription": "RS - RECRS005B - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}], "deliveryFailureCause": null}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS005C", "statusDescription": "RS - RECRS005C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id":"1f3d5a7c-9b2e-4d6f-8a1c-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"2a4c6e8f-1b3d-4f7a-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", "statusCode": "RECRS005A", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", "statusCode": "RECRS005B", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", "statusCode": "RECRS005C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS005C", + "validatedEvents": [ + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS005C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_non_rendicontabile_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_non_rendicontabile_rs.json new file mode 100644 index 000000000..056af9400 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_non_rendicontabile_rs.json @@ -0,0 +1,119 @@ +{ + "name": "OK_NON_RENDICONTABILE_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11bb22-cc33-4d44-8e55-000000000001", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb22cc33-dd44-4e55-9f66-000000000002", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "cc33dd44-ee55-4f66-8a77-000000000003", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS013", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + + { + "messageId": "dd44ee55-ff66-4a77-9b88-000000000004", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee55ff66-aa77-4b88-8c99-000000000005", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:01:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:01:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "1122cc99-dd00-4e11-9f22-000000000008", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS013", "statusDescription": "RS - RECRS013 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:01:01Z"}]}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRS001C", "statusDescription": "RS - RECRS001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id": "aa11bb22-cc33-4d44-8e55-000000000001", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "bb22cc33-dd44-4e55-9f66-000000000002", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "cc33dd44-ee55-4f66-8a77-000000000003", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRS013", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:00:02Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "finalDematFound": false + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + + "validationFlow": { + "ocrRequests": [ + ] + }, + + "events": [ + {"id": "dd44ee55-ff66-4a77-9b88-000000000004", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:00Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"id": "ee55ff66-aa77-4b88-8c99-000000000005", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:01Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:01:01Z"}]}, + {"id": "1122cc99-dd00-4e11-9f22-000000000008", "productType": "RS", "iun": "{{RANDOM_IUN}}", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "desc", "requestTimestamp": "2024-01-01T10:01:06Z", "statusTimestamp": "2024-01-01T10:00:00Z", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS001C", + "validatedEvents": [ + "1122cc99-dd00-4e11-9f22-000000000008" + ] + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_m10_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_m10_rs.json new file mode 100644 index 000000000..1efb0017e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_m10_rs.json @@ -0,0 +1,437 @@ +{ + "name": "OK_RETRY_M10_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON020", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:01Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:01Z", + "statusDateTime": "2024-01-01T10:00:01Z" + } + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRS002A", + "statusDescription": "desc", + "deliveryFailureCause": "M10", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRS002B", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:05Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRS002C", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c02", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "CON080", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "registeredLetterCode": "1234567891011", + "statusCode": "RECRS001C", + "statusDescription": "desc", + "deliveryFailureCause": null, + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:01:06Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + "expected": { + "errors": [], + "outputs": [ + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RS - CON080 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON020", + "statusDescription": "RS - CON020 - desc", + "statusDateTime": "2024-01-01T10:00:01Z", + "clientRequestTimestamp": "2024-01-01T10:00:01Z", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRS002A", + "deliveryFailureCause": "M10", + "statusDescription": "RS - RECRS002A - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:04Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRS002B", + "statusDescription": "RS - RECRS002B - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:05Z", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:05Z" + } + ], + "deliveryFailureCause": null + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECRS002C", + "deliveryFailureCause": "M10", + "statusDescription": "RS - RECRS002C - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:06Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "CON080", + "statusDescription": "RS - CON080 - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:00Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "registeredLetterCode": "1234567891011", + "statusCode": "OK", + "statusDetail": "RECRS001C", + "statusDescription": "RS - RECRS001C - desc", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:01:06Z", + "attachments": [] + } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "events": [ + { + "id": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "statusCode": "CON080", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [] + }, + { + "id": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "statusCode": "CON020", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:01Z", + "requestTimestamp": "2024-01-01T10:00:01Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [ + { + "documentType": "7Z", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:01Z" + } + ] + }, + { + "id": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f05", + "statusCode": "RECRS002A", + "deliveryFailureCause": "M10", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [] + }, + { + "id": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16", + "statusCode": "RECRS002B", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id", + "uri": "uri.pdf", + "date": "2024-01-01T10:00:05Z" + } + ] + }, + { + "id": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "statusCode": "RECRS002C", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:06Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus": "OK", + "finalEventId": "7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "6e8a0b2d-5f7b-4d1e-8a3c-7b9d1f3a0e16" + } + ] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + { + "id": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c02", + "statusCode": "CON080", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [] + }, + { + "id": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "statusCode": "RECRS001C", + "statusDescription": "desc", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:01:06Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "RS", + "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS001C", + "validatedEvents": [ + "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11" + ] + } + } + ], + "sentToOcr": 1, + "ocrResultPayload": [ + { + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + } + ], + "ocrDataPayload": [ + { + "commandId": "{{REQUEST_ID}}#7f9a1c3e-6a8c-4e2f-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M10", + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + } + ] + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_rs.json new file mode 100644 index 000000000..68d702b15 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_retry_rs.json @@ -0,0 +1,113 @@ +{ + "name": "OK_RETRY_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:01Z"} + }, + { + "messageId": "c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS006", "statusDescription": "desc", "deliveryFailureCause": "F03", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"} + }, + { + "messageId": "7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c02", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "desc", "deliveryFailureCause": null, "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:01:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - desc", "statusDateTime": "2024-01-01T10:00:01Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS006", "statusDescription": "RS - RECRS006 - desc", "statusDateTime": "2024-01-01T10:00:02Z", "clientRequestTimestamp": "2024-01-01T10:00:02Z", "deliveryFailureCause": "F03", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRS001C", "statusDescription": "RS - RECRS001C - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:01:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + + "events": [ + {"id":"7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c01","statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"91b4e7d2-3a6f-4c8e-9d2a-5f7b1c3e6a02","statusCode": "CON020", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:01Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"c2d7a4e1-6f3b-4a9d-8c2e-7b1f5d3a9e03","statusCode": "RECRS006", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F03", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] + } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + } + }, + + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id":"7c3f2a1e-5b6d-4f98-9a3c-2d1e4f6b8c02", "statusCode": "CON080", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11", "statusCode": "RECRS001C", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:01:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS001C", + "validatedEvents": [ + "e7a8b9c0-d1f2-4345-f012-6d7e8f9a0b11" + ] + } + } + ] + , + "sentToOcr": 0 }} +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_rs.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_rs.json new file mode 100644 index 000000000..2b133e845 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/ok_rs.json @@ -0,0 +1,73 @@ +{ + "name": "OK_RS", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS001C", "statusDescription": "RECRS001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRS001C", "statusDescription": "RS - RECRS001C - RECRS001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRS001C", "statusDescription": "RECRS001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS001C", + "validatedEvents": [ + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777" + ] + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/fail_rs_no_equals_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/fail_rs_no_equals_deliveryfailurecause.json new file mode 100644 index 000000000..4eb6b3225 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/fail_rs_no_equals_deliveryfailurecause.json @@ -0,0 +1,108 @@ +{ + "name": "FAIL_RS_NO_EQUALS_DELIVERYFAILURECAUSE", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPPlicoE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002A", "statusDescription": "RECRS002A description", "deliveryFailureCause": "M05", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002B", "statusDescription": "RECRS002B description", "deliveryFailureCause": "M05", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS002B-Plico", "uri": "https://example.com/RECRS002B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS002C", "statusDescription": "RECRS002C description", "deliveryFailureCause": "M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS002C", + "eventIdThrow": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause on events:", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRS002C", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M02" + }, + { + "statusCode": "RECRS002B", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M05" + }, + { + "statusCode": "RECRS002A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M05" + } + ] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002A", "statusDescription": "RS - RECRS002A - RECRS002A description", "deliveryFailureCause":"M05", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS002B", "statusDescription": "RS - RECRS002B - RECRS002B description", "deliveryFailureCause":"M05", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS002B-Plico", "uri": "https://example.com/RECRS002B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPPlicoE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS002A", "statusDescription": "RECRS002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M05", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS002B", "statusDescription": "RECRS002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M05", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS002B-Plico", "uri": "https://example.com/RECRS002B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS002C", "statusDescription": "RECRS002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M02", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_duplicate_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_duplicate_event.json new file mode 100644 index 000000000..2626aad43 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_duplicate_event.json @@ -0,0 +1,156 @@ +{ + "name": "OK_RS_DUPLICATE_EVENT", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "RS", + "eventThrow": "RECRS004A", + "eventIdThrow": "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", + "details": { + "message": "Duplicated event found for statusCode: RECRS004A", + "additionalDetails": { + "statusCode": "RECRS004A", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - RECRS004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "nextRequestIdPcretry": null, + "events": [ + {"id":"3f7c9b2e-4e1b-4c6b-9f22-5a2c5d1e8a11", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"7a2d1c44-9b4d-4c3a-88e5-2e5c8f4d1b22", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5556", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id":"4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": null, "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "documentType": "Plico", + "attachmentEventId": "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "d2a4b6c8-1e2f-4a3b-9c5d-7e8f9a0b5555", + "8f3e2d1c-7b6a-4d5c-9e0f-1a2b3c4d6666", + "4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#4c1d2e3f-8a9b-4c7d-b2e1-3f4a5b6c7777#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_empty_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_empty_registeredlettecode.json new file mode 100644 index 000000000..49277930d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_empty_registeredlettecode.json @@ -0,0 +1,110 @@ +{ + "name": "OK_RS_EMPTY_REGISTEREDLETTERCODE", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRS004C", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_not_expected.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_not_expected.json new file mode 100644 index 000000000..2f61d7d2b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_not_expected.json @@ -0,0 +1,139 @@ +{ + "name": "OK_RS_EVENT_NOT_EXPECTED", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "101f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "202a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "707f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS005A", "statusDescription": "RECRS005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS005A", "statusDescription": "RS - RECRS005A - RECRS005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - RECRS004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "101f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "202a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "707f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS005A", "statusDescription": "RECRS005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "documentType": "Plico", + "attachmentEventId": "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "505d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "606e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#808a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_other_product.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_other_product.json new file mode 100644 index 000000000..7b8b3304c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_event_other_product.json @@ -0,0 +1,187 @@ +{ + "name": "OK_RS_EVENT_OTHER_PRODUCT", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RS", + "eventThrow": "RECRN002A", + "eventIdThrow": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "RS", + "eventThrow": "RECRN002A", + "eventIdThrow": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - RECRS004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "111f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "222a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "888a1c3e-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "documentType": "Plico", + "attachmentEventId": "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "555d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "666e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#999b2d4f-5a6c-4e8f-9d3a-0e1b2c3d4f59#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_datetime.json new file mode 100644 index 000000000..6ff9720d6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_datetime.json @@ -0,0 +1,119 @@ +{ + "name": "OK_RS_INVALID_DATETIME", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRS004C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRS004B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a11f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "b22a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + { "id": "e55d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "f66e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "g77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_registeredlettecode.json new file mode 100644 index 000000000..484ed4b7c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_invalid_registeredlettecode.json @@ -0,0 +1,125 @@ +{ + "name": "OK_RS_INVALID_REGISTEREDLETTERCODE", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "12345643", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [12345643, 1234567891011, 1234567891011, 1234567891011, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS004C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS004B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS010" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS011" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECRS004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa1f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "bb2a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ee5d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ff6e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "aa7f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "12345643", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 }} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_attachment.json new file mode 100644 index 000000000..7fb6a79cb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_attachment.json @@ -0,0 +1,104 @@ +{ + "name": "OK_RS_NO_ATTACHMENT", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico]", + "additionalDetails": { + "missingAttachments":["Plico"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + "events": [ + { "id": "a01f3d5a-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "b12a4c6e-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + { "id": "e45d7f9a-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "f56e8a0b-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "g67f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_demat.json new file mode 100644 index 000000000..eaf6f45f3 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_no_demat.json @@ -0,0 +1,83 @@ +{ + "name": "OK_RS_NO_DEMAT", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + { "id": "a901f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "b912a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + { "id": "e945d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "f956e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_not_ordered.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_not_ordered.json new file mode 100644 index 000000000..a28bf0796 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_not_ordered.json @@ -0,0 +1,134 @@ +{ + "name": "OK_RS_NOT_ORDERED", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - RECRS004C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": []} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + { "id": "a111f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "b222a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + { "id": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ] }, + { "id": "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] }, + { "id": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [] } + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "documentType": "Plico", + "attachmentEventId": "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "f666e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "e555d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#g777f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_notexpected_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_notexpected_deliveryfailurecause.json new file mode 100644 index 000000000..1ecb0d0fe --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_notexpected_deliveryfailurecause.json @@ -0,0 +1,109 @@ +{ + "name": "OK_RS_NOTEXPECTED_DELIVERYFAILURECAUSE", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "deliveryFailureCause": "F01", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "deliveryFailureCause": "F01", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: F01", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRS004C", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "F01" + } + ] + } + } + } + ], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "deliveryFailureCause":"F01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "deliveryFailureCause":"F01", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "aa11f3d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "bb22a4c6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ee55d7f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "ff66e8a0-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "gg77f9a1c-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "F01", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_timestamp_err.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_timestamp_err.json new file mode 100644 index 000000000..a7b39f91f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_timestamp_err.json @@ -0,0 +1,159 @@ +{ + "name": "OK_RS_TIMESTAMP_ERR", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { "messageId": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { "messageId": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T11:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z" } }, + { "messageId": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T11:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z" } }, + { "messageId": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z" } ], "clientRequestTimeStamp": "2024-01-01T12:00:05Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:00:04Z", "statusDateTime": "2024-01-01T12:00:00Z" } }, + { "messageId": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "analogMail": { "requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T12:01:06Z", "statusDateTime": "2024-01-01T12:00:00Z" } } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRS004C" + }, + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECRS004B" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECRS004A" + } + ] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T11:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECRS004C", "statusDescription": "RS - RECRS004C - RECRS004C description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T12:01:06Z", "attachments": []} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "a1f001d5-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "b2f112d6-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "e5f445f9-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "f6f5560a-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T11:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "g7f6671b-3e6a-48c2-9b4d-8c0e2f4a1b27", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T11:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T11:00:05Z"}]}, + {"id": "i9f8893d-5a6c-4e8f-9d3a-0e1b2c3d4f59", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T12:01:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", + "documentType": "Plico", + "attachmentEventId": "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRS004C", + "validatedEvents": [ + "k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "j0f9904e-6b7d-4f9a-8c4b-1f2c3d4e5f60", + "h8f7782c-4f7b-49d3-9c5e-9d1f3a0e2f38", + "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04" + ], + "finalDematFound": true + } + } + ] + , + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#k1fa015f-7c8e-4a0b-9d5c-2a3b4c5d6e71#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "RS", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECRS004C", + "notificationDate": "2024-01-01T12:00", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "uri.pdf", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 +}} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_unespected_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_unespected_demat.json new file mode 100644 index 000000000..1eb1c4e65 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/RS/validation_error/mancata_consegna_giacenza_rs_unespected_demat.json @@ -0,0 +1,119 @@ +{ + "name": "OK_RS_UNEXPECTED_DEMAT", + "productType": "RS", + "initialTracking": { + "productType": "RS", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS010", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS011", "statusDescription": "desc", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e15", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRS004B-AR", "uri": "https://example.com/RECRS004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "RS", "registeredLetterCode": "1234567891011", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "RS", + "eventThrow": "RECRS004C", + "eventIdThrow": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECRS004B contains invalid attachments", + "additionalDetails": { + "invalidAttachments": ["AR"] + } + } + } + ], + + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "RS - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "RS - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS010", "statusDescription": "RS - RECRS010 - desc", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004A", "statusDescription": "RS - RECRS004A - RECRS004A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRS004B-AR", "uri": "https://example.com/RECRS004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRS004B", "statusDescription": "RS - RECRS004B - RECRS004B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]} + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "RS", + "state": "KO", + "businessState": "KO", + "events": [ + {"id": "a11aa111-7c9b-42e1-8d6f-0e2b3d4f5a61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "b22bb222-8f1b-43d7-9c2e-3d5f7a9b6c72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f03", "statusCode": "RECRS010", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id":"5d7f9a1c-4e6a-4c0d-9f2b-6a8c0e2d9f04", "statusCode": "RECRS011", "statusDescription": "desc", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "e55ee555-1c4e-46a0-9f2b-6a8c0e2d9f05", "statusCode": "RECRS004A", "statusDescription": "RECRS004A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []}, + {"id": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e15", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRS004B-AR", "uri": "https://example.com/RECRS004B-AR.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "f66ff666-2d5f-47b1-8a3c-7b9d1f3a0e16", "statusCode": "RECRS004B", "statusDescription": "RECRS004B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRS004B-Plico", "uri": "https://example.com/RECRS004B-Plico.pdf", "date": "2024-01-01T10:00:05Z"}]}, + {"id": "h88hh888-4f7b-49d3-9c5e-9d1f3a0e2f38", "statusCode": "RECRS004C", "statusDescription": "RECRS004C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "RS", "attachments": []} + ], + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "finalDematFound": true + } + } + ] + , + "sentToOcr": 0 } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_890.json new file mode 100644 index 000000000..428b4bc15 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_890.json @@ -0,0 +1,121 @@ +{ + "name": "FAIL_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003A", "statusDescription": "RECAG003A description", "attachments": [], "deliveryFailureCause":"M05","clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003A", "deliveryFailureCause":"M05","statusDescription": "890 - RECAG003A - RECAG003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003B", "statusDescription": "890 - RECAG003B - RECAG003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG003C", "deliveryFailureCause":"M05", "statusDescription": "890 - RECAG003C - RECAG003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG003A", "deliveryFailureCause":"M05", "statusDescription": "RECAG003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "Plico", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG003C", + "deliveryFailureCause":"M05", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M05", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_890.json new file mode 100644 index 000000000..65b50f570 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_890.json @@ -0,0 +1,137 @@ + +{ + "name": "FAIL_DISCOVERY_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "createAttempt1": true, + "events": [ + { + "messageId": "316d96c9-b4bd-44c5-9664-416edb784dd5", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": null, "productType": "890", "registeredLetterCode": null, "statusCode": "P000", "statusDescription": null, "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:29Z", "statusDateTime": "2025-11-28T08:30:29Z"} + }, + { + "messageId": "b9942f7f-e7f9-4f73-9084-55187c7908a8", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON080", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:34.370484Z", "statusDateTime": "2025-11-28T08:30:34Z"} + }, + { + "messageId": "b12158a9-4b40-4316-b742-00662b87140c", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003D", "statusDescription": "Mock status", "deliveryFailureCause": "M03", + "discoveredAddress":{"name": "test","address": "via roma 10", "cap": "00100", "city":"Roma", "pr": "RM"},"attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:47.365656600Z", "statusDateTime": "2025-11-28T08:30:47Z"} + }, + { + "messageId": "d7934c65-f3b0-43e6-a22e-76c6e5378941", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON020", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:42.438051520Z", "statusDateTime": "2025-11-28T08:30:39Z"} + }, + { + "messageId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003E", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:52.785067600Z", "statusDateTime": "2025-11-28T08:30:47Z"}}, + { + "messageId": "d65d149f-2634-48ab-8d83-599a30898708", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003F", "statusDescription": "Mock status", "deliveryFailureCause": "M03", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:58.863198300Z", "statusDateTime": "2025-11-28T08:30:47Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:34.370484Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:34Z", "statusDescription": "890 - CON080 - Mock status", "statusDetail": "CON080"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:47.365656600Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003D - Mock status", "statusDetail": "RECAG003D"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": null, "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:42.438051520Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:39Z", "statusDescription": "890 - CON020 - Mock status", "statusDetail": "CON020"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:58.863198300Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "KO", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003F - Mock status", "statusDetail": "RECAG003F"} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_0", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "Poste", + "events": [ + {"attachments": [], "id": "316d96c9-b4bd-44c5-9664-416edb784dd5", "productType": "890", "statusCode": "P000", "statusTimestamp": "2025-11-28T08:30:29Z", "requestTimestamp": "2025-11-28T08:30:29Z"}, + {"attachments": [], "id": "b9942f7f-e7f9-4f73-9084-55187c7908a8", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:34.370484Z", "statusCode": "CON080", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:34Z"}, + {"anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "attachments": [], "deliveryFailureCause": "M03", "id": "b12158a9-4b40-4316-b742-00662b87140c", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:47.365656600Z", "statusCode": "RECAG003D", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "id": "d7934c65-f3b0-43e6-a22e-76c6e5378941", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:42.438051520Z", "statusCode": "CON020", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:39Z"}, + {"attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "id": "669452b6-ee9a-4550-b620-2d4bb0db37ab", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:52.785067600Z", "statusCode": "RECAG003E", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [], "id": "d65d149f-2634-48ab-8d83-599a30898708", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "deliveryFailureCause": "M03", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:58.863198300Z", "statusCode": "RECAG003F", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"} + ], + "paperStatus": { + "anonymizedDiscoveredAddress": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", + "deliveryFailureCause": "M03", + "finalDematFound": true, + "finalStatusCode": "RECAG003F", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "validatedEvents": [ + "d65d149f-2634-48ab-8d83-599a30898708", + "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "b12158a9-4b40-4316-b742-00662b87140c" + ] + }, + "validationConfig": { + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [ + ], + "strictFinalValidationStock890": true + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "attachmentEventId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "documentType": "Plico", + "finalEventId": "d65d149f-2634-48ab-8d83-599a30898708", + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf" + } + ] + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003F", + "notificationDate": "2025-11-28T08:30:47Z", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "deliveryFailureCause": "M03", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_irreperibile_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_irreperibile_890.json new file mode 100644 index 000000000..0e7320995 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_discovery_irreperibile_890.json @@ -0,0 +1,138 @@ + +{ + "name": "FAIL_DISCOVERY_IRREPERIBILE_890", + + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "createAttempt1": true, + "events": [ + { + "messageId": "316d96c9-b4bd-44c5-9664-416edb784dd5", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": null, "productType": "890", "registeredLetterCode": null, "statusCode": "P000", "statusDescription": null, "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:29Z", "statusDateTime": "2025-11-28T08:30:29Z"} + }, + { + "messageId": "b9942f7f-e7f9-4f73-9084-55187c7908a8", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON080", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:34.370484Z", "statusDateTime": "2025-11-28T08:30:34Z"} + }, + { + "messageId": "b12158a9-4b40-4316-b742-00662b87140c", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003D", "statusDescription": "Mock status", "deliveryFailureCause": "M03", + "discoveredAddress":{"name": "test","address": "via roma 10", "cap": "00100", "city":"Roma", "pr": "RM"},"attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:47.365656600Z", "statusDateTime": "2025-11-28T08:30:47Z"} + }, + { + "messageId": "d7934c65-f3b0-43e6-a22e-76c6e5378941", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON020", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:42.438051520Z", "statusDateTime": "2025-11-28T08:30:39Z"} + }, + { + "messageId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003E", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:52.785067600Z", "statusDateTime": "2025-11-28T08:30:47Z"}}, + { + "messageId": "d65d149f-2634-48ab-8d83-599a30898708", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003F", "statusDescription": "Mock status", "deliveryFailureCause": "M03", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:58.863198300Z", "statusDateTime": "2025-11-28T08:30:47Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:34.370484Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:34Z", "statusDescription": "890 - CON080 - Mock status", "statusDetail": "CON080"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:47.365656600Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003D - Mock status", "statusDetail": "RECAG003D"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": null, "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:42.438051520Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:39Z", "statusDescription": "890 - CON020 - Mock status", "statusDetail": "CON020"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:58.863198300Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "KO", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003F - Mock status", "statusDetail": "RECAG003F"} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_0", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "Poste", + "events": [ + {"attachments": [], "id": "316d96c9-b4bd-44c5-9664-416edb784dd5", "productType": "890", "statusCode": "P000", "statusTimestamp": "2025-11-28T08:30:29Z", "requestTimestamp": "2025-11-28T08:30:29Z"}, + {"attachments": [], "id": "b9942f7f-e7f9-4f73-9084-55187c7908a8", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:34.370484Z", "statusCode": "CON080", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:34Z"}, + {"anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "attachments": [], "deliveryFailureCause": "M03", "id": "b12158a9-4b40-4316-b742-00662b87140c", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:47.365656600Z", "statusCode": "RECAG003D", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "id": "d7934c65-f3b0-43e6-a22e-76c6e5378941", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:42.438051520Z", "statusCode": "CON020", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:39Z"}, + {"attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "id": "669452b6-ee9a-4550-b620-2d4bb0db37ab", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:52.785067600Z", "statusCode": "RECAG003E", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [], "id": "d65d149f-2634-48ab-8d83-599a30898708", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "deliveryFailureCause": "M03", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:58.863198300Z", "statusCode": "RECAG003F", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"} + ], + "paperStatus": { + "anonymizedDiscoveredAddress": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", + "deliveryFailureCause": "M03", + "finalDematFound": true, + "finalStatusCode": "RECAG003F", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "validatedEvents": [ + "d65d149f-2634-48ab-8d83-599a30898708", + "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "b12158a9-4b40-4316-b742-00662b87140c" + ] + }, + "validationConfig": { + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [ + ], + "strictFinalValidationStock890": true + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "attachmentEventId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "documentType": "Plico", + "finalEventId": "d65d149f-2634-48ab-8d83-599a30898708", + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf" + } + ] + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003F", + "notificationDate": "2025-11-28T08:30:47Z", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "deliveryFailureCause": "M03", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_evento_inesistente_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_evento_inesistente_890.json new file mode 100644 index 000000000..27cde7639 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_evento_inesistente_890.json @@ -0,0 +1,90 @@ +{ + "name": "FAIL_EVENTO_INESISTENTE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "INESISTENTE", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "AWAITING_FINAL_STATUS_CODE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "INESISTENTE", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_indirizzo_inesatto_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_indirizzo_inesatto_890.json new file mode 100644 index 000000000..e966ce0c8 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_indirizzo_inesatto_890.json @@ -0,0 +1,121 @@ +{ + "name": "FAIL_INDIRIZZO_INESATTO_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003A", "statusDescription": "RECAG003A description", "attachments": [], "deliveryFailureCause":"M06","clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003A", "deliveryFailureCause":"M06","statusDescription": "890 - RECAG003A - RECAG003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003B", "statusDescription": "890 - RECAG003B - RECAG003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "KO", "statusDetail": "RECAG003C", "deliveryFailureCause":"M06", "statusDescription": "890 - RECAG003C - RECAG003C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG003A", "deliveryFailureCause":"M06", "statusDescription": "RECAG003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "Plico", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "deliveryFailureCause":"M06", + "finalStatusCode": "RECAG003C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M06", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_irreperibile_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_irreperibile_890.json new file mode 100644 index 000000000..40e13c8f6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/fail_irreperibile_890.json @@ -0,0 +1,137 @@ + +{ + "name": "FAIL_IRREPERIBILE_890", + + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "events": [ + { + "messageId": "316d96c9-b4bd-44c5-9664-416edb784dd5", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": null, "productType": "890", "registeredLetterCode": null, "statusCode": "P000", "statusDescription": null, "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:29Z", "statusDateTime": "2025-11-28T08:30:29Z"} + }, + { + "messageId": "b9942f7f-e7f9-4f73-9084-55187c7908a8", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON080", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:34.370484Z", "statusDateTime": "2025-11-28T08:30:34Z"} + }, + { + "messageId": "b12158a9-4b40-4316-b742-00662b87140c", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003D", "statusDescription": "Mock status", "deliveryFailureCause": "M03", + "discoveredAddress":{"name": "test","address": "via roma 10", "cap": "00100", "city":"Roma", "pr": "RM"},"attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:47.365656600Z", "statusDateTime": "2025-11-28T08:30:47Z"} + }, + { + "messageId": "d7934c65-f3b0-43e6-a22e-76c6e5378941", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "CON020", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:42.438051520Z", "statusDateTime": "2025-11-28T08:30:39Z"} + }, + { + "messageId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003E", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:30:52.785067600Z", "statusDateTime": "2025-11-28T08:30:47Z"}}, + { + "messageId": "d65d149f-2634-48ab-8d83-599a30898708", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "RECAG003F", "statusDescription": "Mock status", "deliveryFailureCause": "M03", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:30:58.863198300Z", "statusDateTime": "2025-11-28T08:30:47Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:34.370484Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:34Z", "statusDescription": "890 - CON080 - Mock status", "statusDetail": "CON080"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:47.365656600Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003D - Mock status", "statusDetail": "RECAG003D"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": null, "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:42.438051520Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:39Z", "statusDescription": "890 - CON020 - Mock status", "statusDetail": "CON020"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "clientRequestTimestamp": "2025-11-28T08:30:52.785067600Z", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003E - Mock status", "statusDetail": "RECAG003E"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:30:58.863198300Z", "deliveryFailureCause": "M03", "anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "statusCode": "KO", "statusDateTime": "2025-11-28T08:30:47Z", "statusDescription": "890 - RECAG003F - Mock status", "statusDetail": "RECAG003F"} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_0", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "Poste", + "events": [ + {"attachments": [], "id": "316d96c9-b4bd-44c5-9664-416edb784dd5", "productType": "890", "statusCode": "P000", "statusTimestamp": "2025-11-28T08:30:29Z", "requestTimestamp": "2025-11-28T08:30:29Z"}, + {"attachments": [], "id": "b9942f7f-e7f9-4f73-9084-55187c7908a8", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:34.370484Z", "statusCode": "CON080", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:34Z"}, + {"anonymizedDiscoveredAddressId": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", "attachments": [], "deliveryFailureCause": "M03", "id": "b12158a9-4b40-4316-b742-00662b87140c", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:47.365656600Z", "statusCode": "RECAG003D", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [{"date": "2025-11-28T08:30:46.211881180Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "SY2tbV22sa52qLCken+3p327KU4DXtxtKLZoQmEUEzI=", "uri": "safestorage://PN_PRINTED-a4aeda7298374f11bc90aacdf4fb8394.pdf"}], "id": "d7934c65-f3b0-43e6-a22e-76c6e5378941", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:42.438051520Z", "statusCode": "CON020", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:39Z"}, + {"attachments": [{"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Plico", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf"}, {"date": "2025-11-28T08:30:47.365635200Z", "documentType": "Indagine", "id": "1", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-ed3a16eb62f8405384602e07ee3696f9.pdf"}], "id": "669452b6-ee9a-4550-b620-2d4bb0db37ab", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:52.785067600Z", "statusCode": "RECAG003E", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"}, + {"attachments": [], "id": "d65d149f-2634-48ab-8d83-599a30898708", "iun": "XHWX-RWZK-UEPA-202511-W-1", "productType": "890", "deliveryFailureCause": "M03", "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", "requestTimestamp": "2025-11-28T08:30:58.863198300Z", "statusCode": "RECAG003F", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:30:47Z"} + ], + "paperStatus": { + "anonymizedDiscoveredAddress": "anonymized_addr_093bcc30-106e-4218-870c-aa9e1d56c4b9", + "deliveryFailureCause": "M03", + "finalDematFound": true, + "finalStatusCode": "RECAG003F", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "validatedEvents": [ + "d65d149f-2634-48ab-8d83-599a30898708", + "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "b12158a9-4b40-4316-b742-00662b87140c" + ] + }, + "validationConfig": { + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [ + ], + "strictFinalValidationStock890": true + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "attachmentEventId": "669452b6-ee9a-4550-b620-2d4bb0db37ab", + "documentType": "Plico", + "finalEventId": "d65d149f-2634-48ab-8d83-599a30898708", + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-8bb95d4a7629431790a4acc8ce4bb1dc.pdf" + } + ] + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#d65d149f-2634-48ab-8d83-599a30898708#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003F", + "notificationDate": "2025-11-28T08:30:47Z", + "registeredLetterCode": "8578eebefab7488d96295e716cc26fb0", + "deliveryFailureCause": "M03", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_23L_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_23L_890.json new file mode 100644 index 000000000..a532de2d0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_23L_890.json @@ -0,0 +1,150 @@ +{ + "name": "OK_GIACENZA_GT10_23L_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG007B-23L", "uri": "https://example.com/RECAG007B-23L.pdf", "date": "2024-01-01T10:00:04Z"}, {"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG007B-23L", "uri": "https://example.com/RECAG007B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007C", "statusDescription": "890 - RECAG007C - RECAG007C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG007B-23L", "uri": "https://example.com/RECAG007B-23L.pdf", "date": "2024-01-01T10:00:04Z"}, {"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG007C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_890.json new file mode 100644 index 000000000..f402fb966 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_gt10_890.json @@ -0,0 +1,150 @@ +{ + "name": "FAIL_GIACENZA_GT10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d66", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007C", "statusDescription": "890 - RECAG007C - RECAG007C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d66", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG007C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d66" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_lte10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_lte10_890.json new file mode 100644 index 000000000..091895e25 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/fail_giacenza_lte10_890.json @@ -0,0 +1,150 @@ +{ + "name": "FAIL_GIACENZA_LTE10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007C", "statusDescription": "890 - RECAG007C - RECAG007C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG007C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/disable/ok_giacenza_890_empty_registeredlettercode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/disable/ok_giacenza_890_empty_registeredlettercode.json new file mode 100644 index 000000000..3b18c9161 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/disable/ok_giacenza_890_empty_registeredlettercode.json @@ -0,0 +1,186 @@ +{ + "name": "OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG005B", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG012", + "eventIdThrow": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "details": { + "cause": "OCR_KO", + "message": "Invalid registered letter code", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "responseStatus": "KO" + } + ] + }, + "paperStatus": { + "finalStatusCode": "RECAG005C", + "finalDematFound": true, + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ] + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_KO.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_KO.json new file mode 100644 index 000000000..2b889be2f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_KO.json @@ -0,0 +1,155 @@ +{ + "name": "OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_KO_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG012", + "eventIdThrow": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "details": { + "cause": "OCR_KO", + "message": "Invalid registered letter code", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "AWAITING_REFINEMENT_OCR", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "responseStatus": "KO" + } + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_OK.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_OK.json new file mode 100644 index 000000000..598691ac7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ocr-run_ok_giacenza_890_empty_registeredlettercode_OK.json @@ -0,0 +1,225 @@ +{ + "name": "OK_GIACENZA_EMPTY_REGISTEREDLETTERCODE_OCR_OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d64", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c75", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 2 + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG012", + "eventIdThrow": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "details": { + "cause": "OCR_KO", + "message": "Invalid registered letter code", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d64", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c75", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d64", + "responseStatus": "KO" + }, + { + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "responseStatus": "OK" + } + ] + }, + "paperStatus": { + "finalStatusCode": "RECAG005C", + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [ + { + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "KO", + "description": "Invalid registered letter code", + "predictedRefinementType": null, + "validationType": "ai" + } + }, + { + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + } + ], + "ocrDataPayload": [ + { + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }, + { + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + } + ], + "sentToOcr": 2 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_duplicate_ocr_response.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_duplicate_ocr_response.json new file mode 100644 index 000000000..6c625664a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_duplicate_ocr_response.json @@ -0,0 +1,148 @@ +{ + "name": "OK_DUPLICATE_OCR_RESPONSE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "OCR_VALIDATION", + "flowThrow": "DEMAT_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "OCR_DUPLICATED_EVENT", + "message": "CommandId: PREPARE_ANALOG_DOMICILE", + "additionalDetails": { + "ocrDataResultPayload": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": "", + "validationType": "ai" + } + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_ocr_pending.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_ocr_pending.json new file mode 100644 index 000000000..0b7336355 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/multiple_ocr_request/run/ok_890_ocr_pending.json @@ -0,0 +1,125 @@ +{ + "name": "OK_890_OCR_PENDING", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_OCR", + "businessState": "AWAITING_OCR", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus":"PENDING", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "PENDING", + "description": "PENDING", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890.json new file mode 100644 index 000000000..ec3346e0d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890.json @@ -0,0 +1,150 @@ +{ + "name": "OK_COMPIUTA_GIACENZA_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008B", "statusDescription": "890 - RECAG008B - RECAG008B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008C", "statusDescription": "890 - RECAG008C - RECAG008C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG008C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890_RECAG010A.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890_RECAG010A.json new file mode 100644 index 000000000..a1526283b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_compiuta_giacenza_890_RECAG010A.json @@ -0,0 +1,157 @@ +{ + "name": "OK_COMPIUTA_GIACENZA_890_RECAG010A", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9a4d-2c5f-4a1e-9b44-3c8d2f7a5e32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010A", "statusDescription": "RECAG010A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:02Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008B", "statusDescription": "890 - RECAG008B - RECAG008B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008C", "statusDescription": "890 - RECAG008C - RECAG008C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "3b7e9a4d-2c5f-4a1e-9b44-3c8d2f7a5e32", "statusCode": "RECAG010A", "statusDescription": "RECAG010A description", "statusTimestamp": "2024-01-01T10:00:02Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG008C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "3b7e9a4d-2c5f-4a1e-9b44-3c8d2f7a5e32", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": "2024-01-01T10:00:02Z" + } + } + }], + "sentToOcr": 1 + } +} + diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza-gt10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza-gt10_890.json new file mode 100644 index 000000000..c94df4ef4 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza-gt10_890.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_GT10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_cad_lte10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_cad_lte10_890.json new file mode 100644 index 000000000..1b60b5526 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_cad_lte10_890.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_CAD_LTE10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "CAD", "sha256": "sha256", "id": "id-RECAG005B-CAD", "uri": "https://example.com/RECAG005B-CAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "CAD", "sha256": "sha256", "id": "id-RECAG005B-CAD", "uri": "https://example.com/RECAG005B-CAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "CAD", "sha256": "sha256", "id": "id-RECAG005B-CAD", "uri": "https://example.com/RECAG005B-CAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_23L_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_23L_890.json new file mode 100644 index 000000000..9b993e62e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_23L_890.json @@ -0,0 +1,149 @@ +{ + "name": "OK_GIACENZA_DELEGATO_GT10_23L_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890.json new file mode 100644 index 000000000..067bb7440 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_DELEGATO_GT10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890_zip.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890_zip.json new file mode 100644 index 000000000..7ca2de038 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_gt10_890_zip.json @@ -0,0 +1,109 @@ +{ + "name": "OK_GIACENZA_DELEGATO_GT10_ZIP_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.zip", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.zip", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.zip", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.zip", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.zip", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.zip", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.zip", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_lte10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_lte10_890.json new file mode 100644 index 000000000..7f2f2c0d0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_delegato_lte10_890.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_DELEGATO_LTE10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG006B-ARCAD", "uri": "https://example.com/RECAG006B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG006B-ARCAD", "uri": "https://example.com/RECAG006B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG006B-ARCAD", "uri": "https://example.com/RECAG006B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_gt10_23L_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_gt10_23L_890.json new file mode 100644 index 000000000..e3f473f63 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_gt10_23L_890.json @@ -0,0 +1,149 @@ +{ + "name": "OK_GIACENZA_GT10_23L_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_lte10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_lte10_890.json new file mode 100644 index 000000000..817422e79 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_giacenza_lte10_890.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_LTE10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890.json new file mode 100644 index 000000000..53137cd64 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890.json @@ -0,0 +1,149 @@ +{ + "name": "OK_REC008_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008B", "statusDescription": "890 - RECAG008B - RECAG008B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008C", "statusDescription": "890 - RECAG008C - RECAG008C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG008C", + "validatedEvents": [ + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890_e.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890_e.json new file mode 100644 index 000000000..d0c025cfe --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/ok_rec008_890_e.json @@ -0,0 +1,155 @@ +{ + "name": "OK_REC008_E_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG008C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "STOCK_890_REFINEMENT_MISSING", + "message": "invalid AWAITING_REFINEMENT state for stock 890", + "additionalDetails": { + "statusCode": "RECAG008C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008B", "statusDescription": "890 - RECAG008B - RECAG008B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d26", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG008B-Plico", "uri": "https://example.com/RECAG008B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "finalDematFound": true, + "finalStatusCode": "RECAG012" + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_invalid_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_invalid_attachment.json new file mode 100644 index 000000000..94ca28e5c --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_invalid_attachment.json @@ -0,0 +1,183 @@ +{ + "name": "OK_COMPIUTA_GIACENZA_INVALID_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [{"documentType": "CAD", "sha256": "sha256", "id": "id-RECAG008B-CAD", "uri": "https://example.com/RECAG008B-CAD.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG008C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECAG008B contains invalid attachments: [CAD]", + "additionalDetails": { + "invalidAttachments": ["CAD"] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG008C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico]", + "additionalDetails": { + "missingAttachments":["Plico"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008B", "statusDescription": "890 - RECAG008B - RECAG008B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "CAD", "sha256": "sha256", "id": "id-RECAG008B-CAD", "uri": "https://example.com/RECAG008B-CAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008C", "statusDescription": "890 - RECAG008C - RECAG008C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "CAD", "sha256": "sha256", "id": "id-RECAG008B-CAD", "uri": "https://example.com/RECAG008B-CAD.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG008C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_no_attachment.json new file mode 100644 index 000000000..8a213cf56 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/compiuta_giacenza_890_no_attachment.json @@ -0,0 +1,166 @@ +{ + "name": "OK_COMPIUTA_GIACENZA_NO_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG008C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico]", + "additionalDetails": { + "missingAttachments":["Plico"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008A", "statusDescription": "890 - RECAG008A - RECAG008A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG008C", "statusDescription": "890 - RECAG008C - RECAG008C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG011B-ARCAD", "uri": "https://example.com/RECAG011B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG008A", "statusDescription": "RECAG008A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG008B", "statusDescription": "RECAG008B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG008C", "statusDescription": "RECAG008C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG008C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_invalid_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_invalid_attachment.json new file mode 100644 index 000000000..65649ad4f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_invalid_attachment.json @@ -0,0 +1,181 @@ +{ + "name": "FAIL_GIACENZA_INVALID_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECAG007B-AR", "uri": "https://example.com/RECAG007B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECAG007B contains invalid attachments: [AR]", + "additionalDetails": { + "invalidAttachments": ["AR"] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico, CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["Plico","CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECAG007B-AR", "uri": "https://example.com/RECAG007B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007C", "statusDescription": "890 - RECAG007C - RECAG007C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECAG007B-AR", "uri": "https://example.com/RECAG007B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG007C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_no_attachment.json new file mode 100644 index 000000000..5d6867710 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_890_no_attachment.json @@ -0,0 +1,164 @@ +{ + "name": "FAIL_GIACENZA_NO_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [Plico, CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["Plico","CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011B", "statusDescription": "890 - RECAG011B - RECAG011B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007C", "statusDescription": "890 - RECAG007C - RECAG007C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG011B", "statusDescription": "RECAG011B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG011B-23L", "uri": "https://example.com/RECAG011B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG007C", + "validatedEvents": [ + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L.json new file mode 100644 index 000000000..50d57b043 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L.json @@ -0,0 +1,121 @@ +{ + "name": "FAIL_GIACENZA_LTE10_NO_23L_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "STOCK_890_REFINEMENT_MISSING", + "message": "invalid AWAITING_REFINEMENT state for stock 890", + "additionalDetails": { + "statusCode": "RECAG007C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_duplicate_012.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_duplicate_012.json new file mode 100644 index 000000000..9792374fb --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_duplicate_012.json @@ -0,0 +1,127 @@ +{ + "name": "FAIL_GIACENZA_LTE10_NO_23L_890_2", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "STOCK_890_REFINEMENT_MISSING", + "message": "invalid AWAITING_REFINEMENT state for stock 890", + "additionalDetails": { + "statusCode": "RECAG007C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_multiple_012.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_multiple_012.json new file mode 100644 index 000000000..a0e4981fc --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/fail_giacenza_lte10_890_no_23L_multiple_012.json @@ -0,0 +1,142 @@ +{ + "name": "FAIL_GIACENZA_LTE10_NO_23L_890_2", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG007C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "STOCK_890_REFINEMENT_MISSING", + "message": "invalid AWAITING_REFINEMENT state for stock 890", + "additionalDetails": { + "statusCode": "RECAG007C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG012", + "eventIdThrow": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", + "details": { + "message": "Duplicated event found for statusCode: RECAG012", + "additionalDetails": { + "statusCode": "RECAG012", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007A", "statusDescription": "890 - RECAG007A - RECAG007A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG007B", "statusDescription": "890 - RECAG007B - RECAG007B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d25", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG007A", "statusDescription": "RECAG007A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG007B", "statusDescription": "RECAG007B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG007B-ARCAD", "uri": "https://example.com/RECAG007B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG007B-Plico", "uri": "https://example.com/RECAG007B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG007C", "statusDescription": "RECAG007C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_RECAG012_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_RECAG012_registeredlettecode.json new file mode 100644 index 000000000..150b10210 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_RECAG012_registeredlettecode.json @@ -0,0 +1,143 @@ +{ + "name": "OK_GIACENZA_RECAG012_REGISTEREDLETTERCODE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891012", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891012", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_attachment.json new file mode 100644 index 000000000..2c8329aef --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_attachment.json @@ -0,0 +1,176 @@ +{ + "name": "OK_GIACENZA_INVALID_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG005B-Plico", "uri": "https://example.com/RECAG005B-Plico.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECAG005B contains invalid attachments: [Plico]", + "additionalDetails": { + "invalidAttachments": ["Plico"] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG005B-Plico", "uri": "https://example.com/RECAG005B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG005B-Plico", "uri": "https://example.com/RECAG005B-Plico.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_datetime.json new file mode 100644 index 000000000..8d1f9aead --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_datetime.json @@ -0,0 +1,177 @@ +{ + "name": "OK_GIACENZA_INVALID_DATETIME_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents":[ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECAG005B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005A" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG011A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_registeredlettecode.json new file mode 100644 index 000000000..ad2e5900b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_invalid_registeredlettecode.json @@ -0,0 +1,184 @@ +{ + "name": "OK_GIACENZA_INVALID_REGISTEREDLETTERCODE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891012", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [1234567891011, 1234567891012, 1234567891011, 1234567891011, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005A" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG010" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG011A" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG012" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891012", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891012", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_more_error.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_more_error.json new file mode 100644 index 000000000..d3e4339c6 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_more_error.json @@ -0,0 +1,220 @@ +{ + "name": "OK_GIACENZA_MORE_ERROR_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "deliveryFailureCause":"M01", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: M01", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005A", + "deliveryFailureCause":"M01" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG005C", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECAG005B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG005A" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG011A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "deliveryFailureCause":"M01", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "deliveryFailureCause":"M01", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "deliveryFailureCause":"M01", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "deliveryFailureCause":"M01", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_RECAG012.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_RECAG012.json new file mode 100644 index 000000000..37990f202 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_RECAG012.json @@ -0,0 +1,110 @@ +{ + "name": "OK_GIACENZA_NO_RECAG012_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "STOCK_890_REFINEMENT_MISSING", + "message": "invalid AWAITING_REFINEMENT state for stock 890", + "additionalDetails": { + "statusCode": "RECAG005C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG005B-ARCAD", "uri": "https://example.com/RECAG005B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_attachment.json new file mode 100644 index 000000000..80a85916a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_890_no_attachment.json @@ -0,0 +1,159 @@ +{ + "name": "OK_GIACENZA_NO_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG005C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005A", "statusDescription": "890 - RECAG005A - RECAG005A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005B", "statusDescription": "890 - RECAG005B - RECAG005B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG005C", "statusDescription": "890 - RECAG005C - RECAG005C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG005A", "statusDescription": "RECAG005A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG005B", "statusDescription": "RECAG005B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG005B-23L", "uri": "https://example.com/RECAG005B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG005C", "statusDescription": "RECAG005C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG005C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_invalid_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_invalid_attachment.json new file mode 100644 index 000000000..ec622fa59 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_invalid_attachment.json @@ -0,0 +1,176 @@ +{ + "name": "OK_GIACENZA_DELEGATO_INVALID_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG006B-Plico", "uri": "https://example.com/RECAG006B-Plico.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG006C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECAG006B contains invalid attachments: [Plico]", + "additionalDetails": { + "invalidAttachments": ["Plico"] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG006C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG006B-Plico", "uri": "https://example.com/RECAG006B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG006B-Plico", "uri": "https://example.com/RECAG006B-Plico.pdf", "date": "2024-01-01T10:00:04Z"},{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_no_attachment.json new file mode 100644 index 000000000..549acbb63 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/giacenza/validation_error/ok_giacenza_delegato_890_no_attachment.json @@ -0,0 +1,159 @@ +{ + "name": "OK_GIACENZA_DELEGATO_NO_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG006C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [CAD, ARCAD]", + "additionalDetails": { + "missingAttachments":["CAD","ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG010", "statusDescription": "890 - RECAG010 - RECAG010 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG011A", "statusDescription": "890 - RECAG011A - RECAG011A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG012A", "statusDescription": "RECAG012A", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006A", "statusDescription": "890 - RECAG006A - RECAG006A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006B", "statusDescription": "890 - RECAG006B - RECAG006B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG012", "statusDescription": "890 - RECAG012 - RECAG012 description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG006C", "statusDescription": "890 - RECAG006C - RECAG006C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22", "statusCode": "RECAG010", "statusDescription": "RECAG010 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", "statusCode": "RECAG011A", "statusDescription": "RECAG011A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", "statusCode": "RECAG012", "statusDescription": "RECAG012 description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG006A", "statusDescription": "RECAG006A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG006B", "statusDescription": "RECAG006B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG006B-23L", "uri": "https://example.com/RECAG006B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG006C", "statusDescription": "RECAG006C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG006C", + "validatedEvents": [ + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24", + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d23", + "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d22" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d24#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG012", + "notificationDate": "2024-01-01T11:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/not_retryable_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/not_retryable_event.json new file mode 100644 index 000000000..13ad99e4f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/not_retryable_event.json @@ -0,0 +1,76 @@ +{ + "name": "NOT_RETRYABLE_EVENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREP890E_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "1234567891011", + "statusCode": "CON998", + "statusDescription": "CON998 description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:00Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "NOT_RETRYABLE_EVENT_ERROR", + "flowThrow": "NOT_RETRYABLE_EVENT_HANDLER", + "type": "WARNING", + "productType": "890", + "eventThrow": "CON998", + "eventIdThrow": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "details": { + "message": "Scartato NODOC" + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON998", "statusDescription": "890 - CON998 - CON998 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREP890E_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "AWAITING_REFINEMENT", + "businessState": "AWAITING_FINAL_STATUS_CODE", + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON998", "statusDescription": "CON998 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890.json new file mode 100644 index 000000000..0ceefe0f7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890.json @@ -0,0 +1,125 @@ +{ + "name": "OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_duplicate_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_duplicate_event.json new file mode 100644 index 000000000..cdd29d8a0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_duplicate_event.json @@ -0,0 +1,147 @@ +{ + "name": "OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DUPLICATED_EVENT", + "flowThrow": "DUPLICATED_EVENT_VALIDATION", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG001A", + "eventIdThrow": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "details": { + "message": "Duplicated event found for statusCode: RECAG001A", + "additionalDetails": { + "statusCode": "RECAG001A", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_sourceType_originType.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_sourceType_originType.json new file mode 100644 index 000000000..fe0ea329f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_890_sourceType_originType.json @@ -0,0 +1,92 @@ +{ + "name": "OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "SCANNED", "originType": "DUPLICATED"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "SCANNED", "originType": "DUPLICATED" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z", "sourceType": "SCANNED", "originType": "DUPLICATED"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrDataPayload": [], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_causa_forzamaggiore_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_causa_forzamaggiore_890.json new file mode 100644 index 000000000..7d7f2f82f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_causa_forzamaggiore_890.json @@ -0,0 +1,126 @@ +{ + "name": "OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG015", "statusDescription": "RECAG015 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG015", "statusDescription": "890 - RECAG015 - RECAG015 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "RECAG015", "statusDescription": "RECAG015 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_duplicate_final_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_duplicate_final_event.json new file mode 100644 index 000000000..da7882d2b --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_duplicate_final_event.json @@ -0,0 +1,148 @@ +{ + "name": "DUPLICATE_FINAL_EVENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_STATE", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", + "details": { + "cause": "VALUE_AFTER_REFINEMENT", + "message": "Tracking in state", + "additionalDetails": { + "statusCode": "RECAG001C", + "statusTimestamp": "2024-01-01T10:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_nonrendicontabile_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_nonrendicontabile_890.json new file mode 100644 index 000000000..f09d8a17f --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_nonrendicontabile_890.json @@ -0,0 +1,155 @@ +{ + "name": "OK_NON_RENDICONTABILE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG013", "statusDescription": "RECAG013 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG013", "statusDescription": "890 - RECAG013 - RECAG013 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ ] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID_RETRY}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "RECAG013", "statusDescription": "RECAG013 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_1", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_persona_abilitata_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_persona_abilitata_890.json new file mode 100644 index 000000000..1c1eeae60 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_persona_abilitata_890.json @@ -0,0 +1,125 @@ +{ + "name": "OK_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002A", "statusDescription": "RECAG002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002B", "statusDescription": "RECAG002B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG002B-23L", "uri": "https://example.com/RECAG002B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002C", "statusDescription": "RECAG002C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG002A", "statusDescription": "890 - RECAG002A - RECAG002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG002B", "statusDescription": "890 - RECAG002B - RECAG002B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG002B-23L", "uri": "https://example.com/RECAG002B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG002C", "statusDescription": "890 - RECAG002C - RECAG002C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG002A", "statusDescription": "RECAG002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG002B", "statusDescription": "RECAG002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG002B-23L", "uri": "https://example.com/RECAG002B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG002C", "statusDescription": "RECAG002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG002C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG002C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_890.json new file mode 100644 index 000000000..c709cf292 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_890.json @@ -0,0 +1,197 @@ +{ + "name": "OK_RETRY_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + + { + "messageId": "7a73de91-3c11-49e7-80eb-5c19e0354bf6", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": null, "statusCode": "P000", "statusDescription": null, "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:28:00Z", "statusDateTime": "2025-11-28T08:28:00Z"} + }, + + { + "messageId": "d1c0a47a-e503-4694-8627-1b3f877c7e3e", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "CON080", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:28:05.424544300Z", "statusDateTime": "2025-11-28T08:28:05Z"} + }, + + { + "messageId": "c72b3c6b-1971-4fe7-8f84-30b6ecb7e30b", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "RECAG004", "statusDescription": "Mock status", "deliveryFailureCause": "F02", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:28:20.542094Z", "statusDateTime": "2025-11-28T08:28:20Z" + } + }, + + { + "messageId": "7216492f-ecd5-41f8-83da-38648d646a59", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "KWMX-KQZM-AUNK-202511-G-1", "productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "CON020", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:28:21.077652828Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "TS+04ZWNiqMmXb4nhddcWYXKLoqSZiAjoAS9FAeIsSk=", "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:28:15.571747177Z", "statusDateTime": "2025-11-28T08:28:10Z"} + }, + + { + "messageId": "e5421093-8258-4edb-9a56-60d83cbd86cd", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": null, "statusCode": "P000", "statusDescription": null, "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:28:51Z", "statusDateTime": "2025-11-28T08:28:51Z"} + }, + + { + "messageId": "9f34ff8f-1727-4062-bec0-1b3d1818bce5", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "CON080", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:28:56.064632Z", "statusDateTime": "2025-11-28T08:28:56Z"} + }, + + { + "messageId": "83baa2de-0c7d-440a-9226-705cff1c1e51", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "RECAG001A", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:29:10.195108700Z", "statusDateTime": "2025-11-28T08:29:10Z"} + }, + + { + "messageId": "97ac3374-225b-4460-90e6-cc4bcd275501", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "CON020", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:29:09.178707876Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "8/GCE6DC5gSEEvIEx7u3I5WMIJ349MfI79oAhqkmhfA=", "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:29:05.254714346Z", "statusDateTime": "2025-11-28T08:29:01Z"} + }, + + { + "messageId": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "RECAG001B", "statusDescription": "Mock status", "attachments": [{"date": "2025-11-28T08:29:10.195083900Z", "documentType": "23L", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf"}], "clientRequestTimeStamp": "2025-11-28T08:29:15.614621Z", "statusDateTime": "2025-11-28T08:29:10Z"} + }, + + { + "messageId": "be44bcac-cf28-4ad2-8f25-49fa69031b82", + "analogMail": {"requestId": "{{REQUEST_ID_RETRY}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "RECAG001C", "statusDescription": "Mock status", "attachments": [], "clientRequestTimeStamp": "2025-11-28T08:29:21.405720200Z", "statusDateTime": "2025-11-28T08:29:10Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:28:05.424544300Z", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:28:05Z", "statusDescription": "890 - CON080 - Mock status", "statusDetail": "CON080"}, + {"trackingId": "{{REQUEST_ID}}", "clientRequestTimestamp": "2025-11-28T08:28:20.542094Z", "deliveryFailureCause": "F02", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:28:20Z", "statusDescription": "890 - RECAG004 - Mock status", "statusDetail": "RECAG004"}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "attachments": [{"date": "2025-11-28T08:28:21.077652828Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": null, "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf"}], "clientRequestTimestamp": "2025-11-28T08:28:15.571747177Z", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:28:10Z", "statusDescription": "890 - CON020 - Mock status", "statusDetail": "CON020"}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "clientRequestTimestamp": "2025-11-28T08:28:56.064632Z", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:28:56Z", "statusDescription": "890 - CON080 - Mock status", "statusDetail": "CON080"}, {"trackingId": "{{REQUEST_ID_RETRY}}", "clientRequestTimestamp": "2025-11-28T08:29:10.195108700Z", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:29:10Z", "statusDescription": "890 - RECAG001A - Mock status", "statusDetail": "RECAG001A"}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "attachments": [{"date": "2025-11-28T08:29:09.178707876Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": null, "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf"}], "clientRequestTimestamp": "2025-11-28T08:29:05.254714346Z", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:29:01Z", "statusDescription": "890 - CON020 - Mock status", "statusDetail": "CON020"}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "attachments": [{"date": "2025-11-28T08:29:10.195083900Z", "documentType": "23L", "id": "0", "sha256": null, "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf"}], "clientRequestTimestamp": "2025-11-28T08:29:15.614621Z", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "PROGRESS", "statusDateTime": "2025-11-28T08:29:10Z", "statusDescription": "890 - RECAG001B - Mock status", "statusDetail": "RECAG001B"}, + {"trackingId": "{{REQUEST_ID_RETRY}}", "clientRequestTimestamp": "2025-11-28T08:29:21.405720200Z", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "statusCode": "OK", "statusDateTime": "2025-11-28T08:29:10Z", "statusDescription": "890 - RECAG001C - Mock status", "statusDetail": "RECAG001C"} + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_0", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "POSTE", + "events": [ + {"attachments": [], "id": "7a73de91-3c11-49e7-80eb-5c19e0354bf6", "productType": "890", "statusCode": "P000", "statusTimestamp": "2025-11-28T08:28:00Z", "requestTimestamp": "2025-11-28T08:28:00Z"}, + {"attachments": [], "id": "d1c0a47a-e503-4694-8627-1b3f877c7e3e", "productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "requestTimestamp": "2025-11-28T08:28:05.424544300Z", "statusCode": "CON080", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:28:05Z"}, + {"attachments": [], "deliveryFailureCause": "F02", "id": "c72b3c6b-1971-4fe7-8f84-30b6ecb7e30b","productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "requestTimestamp": "2025-11-28T08:28:20.542094Z", "statusCode": "RECAG004", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:28:20Z"} + ], + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "paperStatus": { + }, + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [ + ] + }, + "validationFlow": { + "ocrRequests": [ + ] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_1", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "POSTE", + "events": [ + {"attachments": [{"date": "2025-11-28T08:28:21.077652828Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "TS+04ZWNiqMmXb4nhddcWYXKLoqSZiAjoAS9FAeIsSk=", "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf"}], "createdAt": "2025-11-28T08:28:25.183642513Z", "id": "7216492f-ecd5-41f8-83da-38648d646a59", "iun": "KWMX-KQZM-AUNK-202511-G-1", "productType": "890", "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", "requestTimestamp": "2025-11-28T08:28:15.571747177Z", "statusCode": "CON020", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:28:10Z"}, + {"attachments": [], "id": "e5421093-8258-4edb-9a56-60d83cbd86cd", "productType": "890", "statusCode": "P000", "statusTimestamp": "2025-11-28T08:28:51Z", "requestTimestamp": "2025-11-28T08:28:51Z"}, + {"attachments": [], "id": "9f34ff8f-1727-4062-bec0-1b3d1818bce5", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "requestTimestamp": "2025-11-28T08:28:56.064632Z", "statusCode": "CON080", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:28:56Z"}, + {"attachments": [], "id": "83baa2de-0c7d-440a-9226-705cff1c1e51", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "requestTimestamp": "2025-11-28T08:29:10.195108700Z", "statusCode": "RECAG001A", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:29:10Z"}, + {"attachments": [{"date": "2025-11-28T08:29:09.178707876Z", "documentType": "Copia Conforme AAR", "id": "0", "sha256": "8/GCE6DC5gSEEvIEx7u3I5WMIJ349MfI79oAhqkmhfA=", "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf"}], "id": "97ac3374-225b-4460-90e6-cc4bcd275501", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "requestTimestamp": "2025-11-28T08:29:05.254714346Z", "statusCode": "CON020", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:29:01Z"}, + {"attachments": [{"date": "2025-11-28T08:29:10.195083900Z", "documentType": "23L", "id": "0", "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf"}], "id": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "requestTimestamp": "2025-11-28T08:29:15.614621Z", "statusCode": "RECAG001B", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:29:10Z"}, + {"attachments": [],"id": "be44bcac-cf28-4ad2-8f25-49fa69031b82", "productType": "890", "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", "requestTimestamp": "2025-11-28T08:29:21.405720200Z", "statusCode": "RECAG001C", "statusDescription": "Mock status", "statusTimestamp": "2025-11-28T08:29:10Z"} + ], + "paperStatus": { + "finalDematFound": true, + "finalStatusCode": "RECAG001C", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "validatedEvents": [ + "be44bcac-cf28-4ad2-8f25-49fa69031b82", + "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "83baa2de-0c7d-440a-9226-705cff1c1e51" + ] + }, + "validationConfig": { + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [ + ] + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "attachmentEventId": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "documentType": "23L", + "finalEventId": "be44bcac-cf28-4ad2-8f25-49fa69031b82" + } + ] + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#be44bcac-cf28-4ad2-8f25-49fa69031b82#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID_RETRY}}#be44bcac-cf28-4ad2-8f25-49fa69031b82#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2025-11-28T08:29:10", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_m10_890.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_m10_890.json new file mode 100644 index 000000000..9cba48f8a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_retry_m10_890.json @@ -0,0 +1,657 @@ +{ + "name": "OK_RETRY_M10_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "7a73de91-3c11-49e7-80eb-5c19e0354bf6", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": null, + "statusCode": "P000", + "statusDescription": null, + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:28:00Z", + "statusDateTime": "2025-11-28T08:28:00Z" + } + }, + { + "messageId": "d1c0a47a-e503-4694-8627-1b3f877c7e3e", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "statusCode": "CON080", + "statusDescription": "Mock status", + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:28:05.424544300Z", + "statusDateTime": "2025-11-28T08:28:05Z" + } + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "1234567891011", + "statusCode": "RECAG003A", + "statusDescription": "RECAG003A description", + "attachments": [], + "deliveryFailureCause": "M10", + "clientRequestTimeStamp": "2024-01-01T10:00:03Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "1234567891011", + "statusCode": "RECAG003B", + "statusDescription": "RECAG003B description", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECAG003B-Plico", + "uri": "https://example.com/RECAG003B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ], + "clientRequestTimeStamp": "2024-01-01T10:00:04Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": { + "requestId": "{{REQUEST_ID}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "1234567891011", + "statusCode": "RECAG003C", + "statusDescription": "RECAG003C description", + "attachments": [], + "clientRequestTimeStamp": "2024-01-01T10:00:05Z", + "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 1 + }, + { + "messageId": "7216492f-ecd5-41f8-83da-38648d646a59", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "KWMX-KQZM-AUNK-202511-G-1", + "productType": "890", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "statusCode": "CON020", + "statusDescription": "Mock status", + "attachments": [ + { + "date": "2025-11-28T08:28:21.077652828Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": "TS+04ZWNiqMmXb4nhddcWYXKLoqSZiAjoAS9FAeIsSk=", + "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf" + } + ], + "clientRequestTimeStamp": "2025-11-28T08:28:15.571747177Z", + "statusDateTime": "2025-11-28T08:28:10Z" + } + }, + { + "messageId": "e5421093-8258-4edb-9a56-60d83cbd86cd", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": null, + "statusCode": "P000", + "statusDescription": null, + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:28:51Z", + "statusDateTime": "2025-11-28T08:28:51Z" + } + }, + { + "messageId": "9f34ff8f-1727-4062-bec0-1b3d1818bce5", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "CON080", + "statusDescription": "Mock status", + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:28:56.064632Z", + "statusDateTime": "2025-11-28T08:28:56Z" + } + }, + { + "messageId": "83baa2de-0c7d-440a-9226-705cff1c1e51", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "RECAG001A", + "statusDescription": "Mock status", + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:29:10.195108700Z", + "statusDateTime": "2025-11-28T08:29:10Z" + } + }, + { + "messageId": "97ac3374-225b-4460-90e6-cc4bcd275501", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "CON020", + "statusDescription": "Mock status", + "attachments": [ + { + "date": "2025-11-28T08:29:09.178707876Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": "8/GCE6DC5gSEEvIEx7u3I5WMIJ349MfI79oAhqkmhfA=", + "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf" + } + ], + "clientRequestTimeStamp": "2025-11-28T08:29:05.254714346Z", + "statusDateTime": "2025-11-28T08:29:01Z" + } + }, + { + "messageId": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "RECAG001B", + "statusDescription": "Mock status", + "attachments": [ + { + "date": "2025-11-28T08:29:10.195083900Z", + "documentType": "23L", + "id": "0", + "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf" + } + ], + "clientRequestTimeStamp": "2025-11-28T08:29:15.614621Z", + "statusDateTime": "2025-11-28T08:29:10Z" + } + }, + { + "messageId": "be44bcac-cf28-4ad2-8f25-49fa69031b82", + "analogMail": { + "requestId": "{{REQUEST_ID_RETRY}}", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "RECAG001C", + "statusDescription": "Mock status", + "attachments": [], + "clientRequestTimeStamp": "2025-11-28T08:29:21.405720200Z", + "statusDateTime": "2025-11-28T08:29:10Z" + } + }, + { + "messageId": "SEND_OCR_RESPONSE", + "ocrResponseIdx": 2 + } + ], + "expected": { + "errors": [], + "outputs": [ + { + "trackingId": "{{REQUEST_ID}}", + "clientRequestTimestamp": "2025-11-28T08:28:05.424544300Z", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:28:05Z", + "statusDescription": "890 - CON080 - Mock status", + "statusDetail": "CON080" + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECAG003A", + "deliveryFailureCause": "M10", + "statusDescription": "890 - RECAG003A - RECAG003A description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:03Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECAG003B", + "statusDescription": "890 - RECAG003B - RECAG003B description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:04Z", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECAG003B-Plico", + "uri": "https://example.com/RECAG003B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ] + }, + { + "trackingId": "{{REQUEST_ID}}", + "registeredLetterCode": "1234567891011", + "statusCode": "PROGRESS", + "statusDetail": "RECAG003C", + "deliveryFailureCause": "M10", + "statusDescription": "890 - RECAG003C - RECAG003C description", + "statusDateTime": "2024-01-01T10:00:00Z", + "clientRequestTimestamp": "2024-01-01T10:00:05Z", + "attachments": [] + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attachments": [ + { + "date": "2025-11-28T08:28:21.077652828Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": null, + "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf" + } + ], + "clientRequestTimestamp": "2025-11-28T08:28:15.571747177Z", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:28:10Z", + "statusDescription": "890 - CON020 - Mock status", + "statusDetail": "CON020" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "clientRequestTimestamp": "2025-11-28T08:28:56.064632Z", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:28:56Z", + "statusDescription": "890 - CON080 - Mock status", + "statusDetail": "CON080" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "clientRequestTimestamp": "2025-11-28T08:29:10.195108700Z", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:29:10Z", + "statusDescription": "890 - RECAG001A - Mock status", + "statusDetail": "RECAG001A" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attachments": [ + { + "date": "2025-11-28T08:29:09.178707876Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": null, + "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf" + } + ], + "clientRequestTimestamp": "2025-11-28T08:29:05.254714346Z", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:29:01Z", + "statusDescription": "890 - CON020 - Mock status", + "statusDetail": "CON020" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attachments": [ + { + "date": "2025-11-28T08:29:10.195083900Z", + "documentType": "23L", + "id": "0", + "sha256": null, + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf" + } + ], + "clientRequestTimestamp": "2025-11-28T08:29:15.614621Z", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "PROGRESS", + "statusDateTime": "2025-11-28T08:29:10Z", + "statusDescription": "890 - RECAG001B - Mock status", + "statusDetail": "RECAG001B" + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "clientRequestTimestamp": "2025-11-28T08:29:21.405720200Z", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "statusCode": "OK", + "statusDateTime": "2025-11-28T08:29:10Z", + "statusDescription": "890 - RECAG001C - Mock status", + "statusDetail": "RECAG001C" + } + ], + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_0", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "POSTE", + "events": [ + { + "attachments": [], + "id": "7a73de91-3c11-49e7-80eb-5c19e0354bf6", + "productType": "890", + "statusCode": "P000", + "statusTimestamp": "2025-11-28T08:28:00Z", + "requestTimestamp": "2025-11-28T08:28:00Z" + }, + { + "attachments": [], + "id": "d1c0a47a-e503-4694-8627-1b3f877c7e3e", + "productType": "890", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "requestTimestamp": "2025-11-28T08:28:05.424544300Z", + "statusCode": "CON080", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:28:05Z" + }, + { + "id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "statusCode": "RECAG003A", + "deliveryFailureCause": "M10", + "statusDescription": "RECAG003A description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:03Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "attachments": [] + }, + { + "id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "statusCode": "RECAG003B", + "statusDescription": "RECAG003B description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:04Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "attachments": [ + { + "documentType": "Plico", + "sha256": "sha256", + "id": "id-RECAG003B-Plico", + "uri": "https://example.com/RECAG003B-Plico.pdf", + "date": "2024-01-01T10:00:04Z" + } + ] + }, + { + "id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "statusCode": "RECAG003C", + "statusDescription": "RECAG003C description", + "statusTimestamp": "2024-01-01T10:00:00Z", + "requestTimestamp": "2024-01-01T10:00:05Z", + "registeredLetterCode": "1234567891011", + "iun": "{{RANDOM_IUN}}", + "productType": "890", + "attachments": [] + } + ], + "nextRequestIdPcretry": "{{REQUEST_ID_RETRY}}", + "paperStatus": {}, + "validationConfig": { + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [] + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus": "OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "Plico", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + } + }, + { + "trackingId": "{{REQUEST_ID_RETRY}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "businessState": "DONE", + "pcRetry": "PCRETRY_1", + "productType": "890", + "state": "DONE", + "processingMode": "DRY", + "unifiedDeliveryDriver": "POSTE", + "events": [ + { + "attachments": [ + { + "date": "2025-11-28T08:28:21.077652828Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": "TS+04ZWNiqMmXb4nhddcWYXKLoqSZiAjoAS9FAeIsSk=", + "uri": "safestorage://PN_PRINTED-6a2e2d8dd97c4c59b79e9dd56c609ffd.pdf" + } + ], + "createdAt": "2025-11-28T08:28:25.183642513Z", + "id": "7216492f-ecd5-41f8-83da-38648d646a59", + "iun": "KWMX-KQZM-AUNK-202511-G-1", + "productType": "890", + "registeredLetterCode": "0cb551d382dd46edacf1b946e3e0223a", + "requestTimestamp": "2025-11-28T08:28:15.571747177Z", + "statusCode": "CON020", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:28:10Z" + }, + { + "attachments": [], + "id": "e5421093-8258-4edb-9a56-60d83cbd86cd", + "productType": "890", + "statusCode": "P000", + "statusTimestamp": "2025-11-28T08:28:51Z", + "requestTimestamp": "2025-11-28T08:28:51Z" + }, + { + "attachments": [], + "id": "9f34ff8f-1727-4062-bec0-1b3d1818bce5", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "requestTimestamp": "2025-11-28T08:28:56.064632Z", + "statusCode": "CON080", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:28:56Z" + }, + { + "attachments": [], + "id": "83baa2de-0c7d-440a-9226-705cff1c1e51", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "requestTimestamp": "2025-11-28T08:29:10.195108700Z", + "statusCode": "RECAG001A", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:29:10Z" + }, + { + "attachments": [ + { + "date": "2025-11-28T08:29:09.178707876Z", + "documentType": "Copia Conforme AAR", + "id": "0", + "sha256": "8/GCE6DC5gSEEvIEx7u3I5WMIJ349MfI79oAhqkmhfA=", + "uri": "safestorage://PN_PRINTED-8d9e333346bf4be5b476ac75d83968ad.pdf" + } + ], + "id": "97ac3374-225b-4460-90e6-cc4bcd275501", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "requestTimestamp": "2025-11-28T08:29:05.254714346Z", + "statusCode": "CON020", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:29:01Z" + }, + { + "attachments": [ + { + "date": "2025-11-28T08:29:10.195083900Z", + "documentType": "23L", + "id": "0", + "sha256": "UaMdYj7cAVO6EZTC9ddUBD7pbkG6zdEZ0LaL/3cmphU=", + "uri": "safestorage://PN_EXTERNAL_LEGAL_FACTS-7ab548c1eefb491f8906ad561b9c185e.pdf" + } + ], + "id": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "requestTimestamp": "2025-11-28T08:29:15.614621Z", + "statusCode": "RECAG001B", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:29:10Z" + }, + { + "attachments": [], + "id": "be44bcac-cf28-4ad2-8f25-49fa69031b82", + "productType": "890", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "requestTimestamp": "2025-11-28T08:29:21.405720200Z", + "statusCode": "RECAG001C", + "statusDescription": "Mock status", + "statusTimestamp": "2025-11-28T08:29:10Z" + } + ], + "paperStatus": { + "finalDematFound": true, + "finalStatusCode": "RECAG001C", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "validatedEvents": [ + "be44bcac-cf28-4ad2-8f25-49fa69031b82", + "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "83baa2de-0c7d-440a-9226-705cff1c1e51" + ] + }, + "validationConfig": { + "sendOcrAttachmentsRefinementStock890": [ + "23L" + ], + "requiredAttachmentsRefinementStock890": [ + "23L" + ], + "sendOcrAttachmentsFinalValidation": [ + "Plico", + "AR", + "23L" + ], + "sendOcrAttachmentsFinalValidationStock890": [] + }, + "validationFlow": { + "ocrRequests": [ + { + "responseStatus": "OK", + "attachmentEventId": "f93f029f-053d-4333-ab7e-d5702f3ec7c7", + "documentType": "23L", + "finalEventId": "be44bcac-cf28-4ad2-8f25-49fa69031b82" + } + ] + } + } + ], + "ocrResultPayload": [ + { + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }, + { + "commandId": "{{REQUEST_ID_RETRY}}#be44bcac-cf28-4ad2-8f25-49fa69031b82#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + } + ], + "ocrDataPayload": [ + { + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#Plico", + "commandType": "postal", + "data": { + "documentType": "Plico", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG003C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": "M10", + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }, + { + "commandId": "{{REQUEST_ID_RETRY}}#be44bcac-cf28-4ad2-8f25-49fa69031b82#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2025-11-28T08:29:10", + "registeredLetterCode": "cb59ee05f21145818afc7d03582f84c7", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + } + ], + "sentToOcr": 2 + } +} diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_two_different_final_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_two_different_final_event.json new file mode 100644 index 000000000..5af578c2d --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/ok_two_different_final_event.json @@ -0,0 +1,148 @@ +{ + "name": "OK_TWO_DIFFERENT_FINAL_EVENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T11:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_STATE", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", + "details": { + "cause": "VALUE_AFTER_REFINEMENT", + "message": "Tracking in state", + "additionalDetails": { + "statusCode":"RECAG001C", + "statusTimestamp": "2024-01-01T11:00Z" + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c77", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/fail_890_empty_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/fail_890_empty_deliveryfailurecause.json new file mode 100644 index 000000000..4cf19f768 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/fail_890_empty_deliveryfailurecause.json @@ -0,0 +1,104 @@ +{ + "name": "FAIL_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003A", "statusDescription": "RECAG003A description", "attachments": [],"clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG003C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Missing deliveryFailureCause", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG003A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003A","statusDescription": "890 - RECAG003A - RECAG003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG003B", "statusDescription": "890 - RECAG003B - RECAG003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG003A", "statusDescription": "RECAG003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "validatedEvents": [ + ], + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_bad_event.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_bad_event.json new file mode 100644 index 000000000..e5315e54a --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_bad_event.json @@ -0,0 +1,131 @@ +{ + "name": "OK_BAD_EVENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG002A", "statusDescription": "RECAG002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG002A", "statusDescription": "890 - RECAG002A - RECAG002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", "statusCode": "RECAG002A", "statusDescription": "RECAG002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_empty_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_empty_registeredlettecode.json new file mode 100644 index 000000000..b4aa5980e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_empty_registeredlettecode.json @@ -0,0 +1,107 @@ +{ + "name": "OK_EVENT_NOT_EXPECTED_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Registered letter code is null or empty in one or more events", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG001A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_event_other_product.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_event_other_product.json new file mode 100644 index 000000000..aaf539c37 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_event_other_product.json @@ -0,0 +1,178 @@ +{ + "name": "OK_EVENT_OTHER_PRODUCT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a45", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECRN002A", + "eventIdThrow": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + }, + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "INCONSISTENT_STATE", + "flowThrow": "CHECK_TRACKING_PRODUCT", + "type": "WARNING", + "productType": "890", + "eventThrow": "RECRN002A", + "eventIdThrow": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a45", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Product type mismatch for trackingId", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECRN002A", + "statusTimestamp": "2024-01-01T10:00:00Z" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a44", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a45", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_datetime.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_datetime.json new file mode 100644 index 000000000..db185d094 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_datetime.json @@ -0,0 +1,115 @@ +{ + "name": "OK_INVALID_DATETIME_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG001C" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECAG001B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG001A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T11:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T11:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_deliveryfailurecause.json new file mode 100644 index 000000000..bff1b64c1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_deliveryfailurecause.json @@ -0,0 +1,112 @@ +{ + "name": "OK_NOT_EXPECTED_DELIVERYFAILURECAUSE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003A", "statusDescription": "RECAG003A description", "attachments": [], "deliveryFailureCause":"M02","clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003B", "statusDescription": "RECAG003B description", "deliveryFailureCause":"M03", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG003C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause on events: [M03, M02]", + "additionalDetails": { + "affectedEvents": [ + { + "deliveryFailureCause": "M03", + "statusTimestamp": "2024-01-01T10:00:00Z", + "statusCode": "RECAG003B" + }, + { + "deliveryFailureCause": "M02", + "statusTimestamp": "2024-01-01T10:00:00Z", + "statusCode": "RECAG003A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "deliveryFailureCause":"M02","statusCode": "PROGRESS", "statusDetail": "RECAG003A", "statusDescription": "890 - RECAG003A - RECAG003A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "deliveryFailureCause":"M03", "statusCode": "PROGRESS", "statusDetail": "RECAG003B", "statusDescription": "890 - RECAG003B - RECAG003B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG003A", "deliveryFailureCause":"M02", "statusDescription": "RECAG003A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG003B", "deliveryFailureCause":"M03", "statusDescription": "RECAG003B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECAG003B-Plico", "uri": "https://example.com/RECAG003B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG003C", "statusDescription": "RECAG003C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_registeredlettecode.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_registeredlettecode.json new file mode 100644 index 000000000..7646b88de --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_invalid_registeredlettecode.json @@ -0,0 +1,115 @@ +{ + "name": "OK_INVALID_REGISTEREDLETTERCODE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891012", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "REGISTERED_LETTER_CODE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Registered letter codes do not match in sequence: [1234567891011, 1234567891012, 1234567891011]", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG001C" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG001B" + }, + { + "statusTimestamp":"2024-01-01T10:00:00Z", + "statusCode":"RECAG001A" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891012", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891012", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_attachment.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_attachment.json new file mode 100644 index 000000000..0570c70f1 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_attachment.json @@ -0,0 +1,102 @@ +{ + "name": "OK_NO_ATTACHMENT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z" + } + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Missed required attachments for the sequence validation: [23L]", + "additionalDetails": { + "missingAttachments":["23L"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_eventB.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_eventB.json new file mode 100644 index 000000000..4baed1229 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_no_eventB.json @@ -0,0 +1,79 @@ +{ + "name": "OK_NO_23L_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_not_ordered.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_not_ordered.json new file mode 100644 index 000000000..7d84eeef7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_not_ordered.json @@ -0,0 +1,125 @@ +{ + "name": "OK_NOT_ORDERED_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T10:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_notexpected_deliveryfailurecause.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_notexpected_deliveryfailurecause.json new file mode 100644 index 000000000..7c2093f89 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_notexpected_deliveryfailurecause.json @@ -0,0 +1,107 @@ +{ + "name": "OK_NOT_EXPECTED_DELIVERYFAILURECAUSE_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "deliveryFailureCause":"M02","clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DELIVERY_FAILURE_CAUSE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid deliveryFailureCause: M02", + "additionalDetails": { + "affectedEvents": [ + { + "statusCode": "RECAG001A", + "statusTimestamp": "2024-01-01T10:00:00Z", + "deliveryFailureCause": "M02" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "deliveryFailureCause":"M02","statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "deliveryFailureCause":"M02", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_timestamp_err.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_timestamp_err.json new file mode 100644 index 000000000..7f5b1fd4e --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_timestamp_err.json @@ -0,0 +1,172 @@ +{ + "name": "OK_TIMESTAMPERROR_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a42", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T12:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T11:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c75", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T12:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d63", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T12:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:06Z", "statusDateTime": "2024-01-01T12:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "DATE_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c75", + "details": { + "cause": "VALUES_NOT_MATCHING", + "message": "Invalid business timestamps", + "additionalDetails": { + "affectedEvents": [ + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECAG001C" + }, + { + "statusTimestamp":"2024-01-01T12:00:00Z", + "statusCode":"RECAG001A" + }, + { + "statusTimestamp":"2024-01-01T11:00:00Z", + "statusCode":"RECAG001B" + } + ] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T11:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECAG001C", "statusDescription": "890 - RECAG001C - RECAG001C description", "statusDateTime": "2024-01-01T12:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:06Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "DONE", + "businessState": "DONE", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a42", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T11:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c75", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d63", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T12:00:00Z", "requestTimestamp": "2024-01-01T10:00:06Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "documentType": "23L", + "attachmentEventId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d63" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECAG001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a42", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d63", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "ocrResultPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "version": "v1", + "commandType": "postal", + "data": { + "validationStatus": "OK", + "description": "OK", + "predictedRefinementType": null, + "validationType": "ai" + } + }], + "ocrDataPayload": [{ + "commandId": "{{REQUEST_ID}}#7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76#23L", + "commandType": "postal", + "data": { + "documentType": "23L", + "productType": "890", + "unifiedDeliveryDriver": "Poste", + "details": { + "deliveryDetailCode": "RECAG001C", + "notificationDate": "2024-01-01T12:00:00Z", + "registeredLetterCode": "1234567891011", + "deliveryFailureCause": null, + "attachment": "Uri", + "deliveryAttemptDate": null + } + } + }], + "sentToOcr": 1 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_unespected_demat.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_unespected_demat.json new file mode 100644 index 000000000..3e96cf3c0 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/_890/validation_error/ok_890_unespected_demat.json @@ -0,0 +1,108 @@ +{ + "name": "OK_UNESPECTED_DEMAT_890", + "productType": "890", + "initialTracking": { + "productType": "890", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "POSTE" + }, + "events": [ + { + "messageId": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "CON018", "statusDescription": "CON018 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:02Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG001B-ARCAD", "uri": "https://example.com/RECAG001B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "890", "registeredLetterCode": "1234567891011", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + "expected": { + "errors": [ + { + "trackingId": "{{REQUEST_ID}}", + "errorCategory": "ATTACHMENTS_ERROR", + "flowThrow": "SEQUENCE_VALIDATION", + "type": "ERROR", + "productType": "890", + "eventThrow": "RECAG001C", + "eventIdThrow": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "details": { + "cause": "INVALID_VALUES", + "message": "Event RECAG001B contains invalid attachments: [ARCAD]", + "additionalDetails": { + "invalidAttachments": ["ARCAD"] + } + } + } + ], + "outputs": [ + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "890 - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "890 - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [ { "documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001A", "statusDescription": "890 - RECAG001A - RECAG001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG001B-ARCAD", "uri": "https://example.com/RECAG001B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECAG001B", "statusDescription": "890 - RECAG001B - RECAG001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z" } ] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "POSTE", + "processingMode": "DRY", + "productType": "890", + "state": "KO", + "businessState": "KO", + + "events": [ + {"id": "1f4a7c2d-8b3e-4d1a-9c22-1a6e9b3d5f10", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "2a6d8f3c-7b4e-4a9d-8f33-2b7c1e6a4d21", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id-CON020-7Z", "uri": "https://example.com/CON020-7Z.pdf", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "3b7e9c4a-6d2f-4e1b-9a44-3c8d2e7f5b32", "statusCode": "CON018", "statusDescription": "CON018 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:02Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECAG001A", "statusDescription": "RECAG001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "ARCAD", "sha256": "sha256", "id": "id-RECAG001B-ARCAD", "uri": "https://example.com/RECAG001B-ARCAD.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECAG001B", "statusDescription": "RECAG001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": [{"documentType": "23L", "sha256": "sha256", "id": "id-RECAG001B-23L", "uri": "https://example.com/RECAG001B-23L.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECAG001C", "statusDescription": "RECAG001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "890", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + + ] + }, + "paperStatus": { + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/rework/ok_ar_rework.json b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/rework/ok_ar_rework.json new file mode 100644 index 000000000..d88b25c00 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcase/rework/ok_ar_rework.json @@ -0,0 +1,113 @@ +{ + "name": "FAIL_AR_REWORK", + "productType": "AR", + "initialTracking": { + "productType": "AR", + "pcRetry": "PCRETRY_0", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "unifiedDeliveryDriver": "Poste" + }, + "events": [ + { + "messageId": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON080", "statusDescription": "CON080 description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:00Z", "statusDateTime": "2024-01-01T10:00:00Z"}}, + { + "messageId": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "CON020", "statusDescription": "CON020 description", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:01Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "deliveryFailureCause": "M02", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "RUN_REWORK", + "analogMail": {"requestId": "{{REQUEST_ID}}"} + }, + { + "messageId": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:03Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}], "clientRequestTimeStamp": "2024-01-01T10:00:04Z", "statusDateTime": "2024-01-01T10:00:00Z"} + }, + { + "messageId": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", + "analogMail": {"requestId": "{{REQUEST_ID}}", "iun": "{{RANDOM_IUN}}", "productType": "AR", "registeredLetterCode": "1234567891011", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "attachments": [], "clientRequestTimeStamp": "2024-01-01T10:00:05Z", "statusDateTime": "2024-01-01T10:00:00Z"} + } + ], + + "expected": { + "errors": [], + "outputs": [ + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON080", "statusDescription": "AR - CON080 - CON080 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:00Z", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "CON020", "statusDescription": "AR - CON020 - CON020 description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:01Z", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002A", "statusDescription": "AR - RECRN002A - RECRN002A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "deliveryFailureCause": "M02", "attachments": []}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN002B", "statusDescription": "AR - RECRN002B - RECRN002B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN002C", "statusDescription": "AR - RECRN002C - RECRN002C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "deliveryFailureCause": "M02", "attachments": []}, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001A", "statusDescription": "AR - RECRN001A - RECRN001A description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:03Z", "attachments": [] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "PROGRESS", "statusDetail": "RECRN001B", "statusDescription": "AR - RECRN001B - RECRN001B description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:04Z", "attachments": [ { "documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z" } ] }, + { "trackingId": "{{REQUEST_ID}}", "registeredLetterCode": "1234567891011", "statusCode": "OK", "statusDetail": "RECRN001C", "statusDescription": "AR - RECRN001C - RECRN001C description", "statusDateTime": "2024-01-01T10:00:00Z", "clientRequestTimestamp": "2024-01-01T10:00:05Z", "attachments": [] } + ], + + "trackings": [ + { + "trackingId": "{{REQUEST_ID}}", + "attemptId": "PREPARE_ANALOG_DOMICILE.IUN_{{RANDOM_IUN}}.ATTEMPT_0", + "pcRetry": "PCRETRY_0", + "unifiedDeliveryDriver": "Poste", + "processingMode": "DRY", + "productType": "AR", + "state": "DONE", + "businessState": "DONE", + "events": [ + {"id": "a1b2c3d4-1111-4a2b-8c3d-1e2f3a4b5c61", "statusCode": "CON080", "statusDescription": "CON080 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:00Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "b2c3d4e5-2222-4b3c-9d4e-2f3a4b5c6d72", "statusCode": "CON020", "statusDescription": "CON020 description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:01Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "7Z", "sha256": "sha256", "id": "id", "uri": "uri", "date": "2024-01-01T10:00:01Z"}]}, + {"id": "d4e5f6a7-4444-4d5e-9f6a-4b5c6d7e8f94", "statusCode": "RECRN002A", "statusDescription": "RECRN002A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "deliveryFailureCause": "M02", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05", "statusCode": "RECRN002B", "statusDescription": "RECRN002B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "Plico", "sha256": "sha256", "id": "id-RECRN002B-Plico", "uri": "https://example.com/RECRN002B-Plico.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", "statusCode": "RECRN002C", "statusDescription": "RECRN002C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", "statusCode": "RECRN001A", "statusDescription": "RECRN001A description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:03Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []}, + {"id": "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", "statusCode": "RECRN001B", "statusDescription": "RECRN001B description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:04Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": [{"documentType": "AR", "sha256": "sha256", "id": "id-RECRN001B-AR", "uri": "https://example.com/RECRN001B-AR.pdf", "date": "2024-01-01T10:00:04Z"}]}, + {"id": "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76", "statusCode": "RECRN001C", "statusDescription": "RECRN001C description", "statusTimestamp": "2024-01-01T10:00:00Z", "requestTimestamp": "2024-01-01T10:00:05Z", "registeredLetterCode": "1234567891011", "iun": "{{RANDOM_IUN}}", "productType": "AR", "attachments": []} + ], + + "validationConfig": { + "requiredAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsRefinementStock890": ["23L"], + "sendOcrAttachmentsFinalValidationStock890": [], + "sendOcrAttachmentsFinalValidation": ["Plico", "AR", "23L"], + "strictFinalValidationStock890": false, + "ocrEnabled": "DISABLED" + }, + "validationFlow": { + "ocrRequests": [ + { "responseStatus":"OK", + "finalEventId": "f6a7b8c9-6666-4f7a-9b8c-6d7e8f9a0b16", + "documentType": "Plico", + "attachmentEventId": "e5f6a7b8-5555-4e6f-8a7b-5c6d7e8f9a05" + } + ] + }, + "paperStatus": { + "registeredLetterCode": "1234567891011", + "finalStatusCode": "RECRN001C", + "validatedEvents": [ + "4c8f1a6d-5b3e-4f2a-8d55-4d9e3b7c6a43", + "6e1b3d8a-9c4f-4e7a-8d77-6f2c4b9a1d65", + "7f2c4e9b-1d6a-4a8f-9c88-7a3d5e1b2c76" + ], + "finalDematFound": true + } + } + ], + "sentToOcr": 0 + } +} \ No newline at end of file diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/credentials b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/credentials new file mode 100644 index 000000000..4ab1290a7 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/credentials @@ -0,0 +1,4 @@ +[default] +aws_access_key_id=TEST +aws_secret_access_key=TEST +region=us-east-1 diff --git a/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/init.sh b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/init.sh new file mode 100644 index 000000000..30daedf06 --- /dev/null +++ b/jdk_21_maven/cs/rest/pn-paper-tracker/src/test/resources/testcontainers/init.sh @@ -0,0 +1,82 @@ +echo "### CREATE QUEUES ###" + +queues="pn-ocr_outputs dl-sqs pn-external_channel_to_paper_tracker pn-external_channel_outputs pn-external_channel_to_paper_channel_dryrun pn-external_channel_to_paper_channel" +for qn in $(echo $queues | tr " " "\n"); do + echo creating queue $qn ... + aws --profile default --region us-east-1 --endpoint-url http://localstack:4566 \ + sqs create-queue \ + --attributes '{"DelaySeconds":"2"}' \ + --queue-name $qn + + echo "Queue $qn created successfully" +done + + +awslocal sqs list-queues + +echo "### CREATE TABLES ###" + +aws --profile default --region us-east-1 --endpoint-url=http://localstack:4566 \ + dynamodb create-table \ + --table-name pn-PaperTrackerDryRunOutputs \ + --attribute-definitions \ + AttributeName=trackingId,AttributeType=S \ + AttributeName=created,AttributeType=S \ + --key-schema \ + AttributeName=trackingId,KeyType=HASH \ + AttributeName=created,KeyType=RANGE \ + --provisioned-throughput \ + ReadCapacityUnits=10,WriteCapacityUnits=5 + +aws --profile default --region us-east-1 --endpoint-url=http://localstack:4566 \ + dynamodb create-table \ + --table-name pn-PaperTrackingsErrors \ + --attribute-definitions \ + AttributeName=trackingId,AttributeType=S \ + AttributeName=created,AttributeType=S \ + --key-schema \ + AttributeName=trackingId,KeyType=HASH \ + AttributeName=created,KeyType=RANGE \ + --provisioned-throughput \ + ReadCapacityUnits=10,WriteCapacityUnits=5 + +aws --profile default --region us-east-1 --endpoint-url=http://localstack:4566 \ + dynamodb create-table \ + --table-name pn-PaperTrackings \ + --attribute-definitions \ + AttributeName=trackingId,AttributeType=S \ + AttributeName=ocrRequestId,AttributeType=S \ + AttributeName=attemptId,AttributeType=S \ + AttributeName=pcRetry,AttributeType=S \ + --key-schema \ + AttributeName=trackingId,KeyType=HASH \ + --provisioned-throughput \ + ReadCapacityUnits=10,WriteCapacityUnits=5 \ + --global-secondary-indexes \ + "[ + { + \"IndexName\": \"ocrRequestId-index\", + \"KeySchema\": [{\"AttributeName\":\"ocrRequestId\",\"KeyType\":\"HASH\"}], + \"Projection\":{ + \"ProjectionType\":\"ALL\" + }, + \"ProvisionedThroughput\": { + \"ReadCapacityUnits\": 10, + \"WriteCapacityUnits\": 5 + } + }, + { + \"IndexName\": \"attemptId-pcRetry-index\", + \"KeySchema\": [{\"AttributeName\":\"attemptId\",\"KeyType\":\"HASH\"}, + {\"AttributeName\":\"pcRetry\",\"KeyType\":\"RANGE\"}], + \"Projection\":{ + \"ProjectionType\":\"ALL\" + }, + \"ProvisionedThroughput\": { + \"ReadCapacityUnits\": 10, + \"WriteCapacityUnits\": 5 + } + } + ]" + +echo "Initialization terminated"