diff --git a/app/api/config/autoload/global.php b/app/api/config/autoload/global.php index 92a7a57dd3..35bb4720d0 100644 --- a/app/api/config/autoload/global.php +++ b/app/api/config/autoload/global.php @@ -90,7 +90,8 @@ 'nr' => [ 'max_schema_errors' => 10, //maximum number of xml schema problems to return (prevents massive error messages) 'compliance_episode' => [ - 'xmlNs' => 'https://webgate.ec.testa.eu/erru/1.0', + 'xmlNs' => 'https://webgate.ec.testa.eu/move-hub/erru/', + 'erruVersion' => "3.4", ], ] ]; diff --git a/app/api/module/Api/config/module.config.php b/app/api/module/Api/config/module.config.php index 90ac791df9..2eed230b7e 100644 --- a/app/api/module/Api/config/module.config.php +++ b/app/api/module/Api/config/module.config.php @@ -1157,7 +1157,7 @@ __DIR__ . '/../data/ebsr/xsd/TransXChange_schema_2.5/TransXChange_registration.xsd', 'http://naptan.dft.gov.uk/transxchange/publisher/schema/3.1.2/TransXChangePublisherService.xsd' => __DIR__ . '/../data/ebsr/xsd/TransXChange_schema_2.4/TransXChangePublisherService_2_4.xsd', - 'https://webgate.ec.testa.eu/erru/1.0' => __DIR__ . '/../data/nr/xsd/ERRU2MS_Infringement_Req.xsd' + 'https://webgate.ec.testa.eu/move-hub/erru/3.4' => __DIR__ . '/../data/nr/xsd/NotifyCheckResult_Request.xsd' ], 'validators' => [ 'invokables' => [ diff --git a/app/api/module/Api/data/nr/complianceEpisodeTemplate.xml b/app/api/module/Api/data/nr/complianceEpisodeTemplate.xml deleted file mode 100644 index d7e2e916b3..0000000000 --- a/app/api/module/Api/data/nr/complianceEpisodeTemplate.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/api/module/Api/data/nr/complianceEpisodeTemplateNoNs.xml b/app/api/module/Api/data/nr/complianceEpisodeTemplateNoNs.xml deleted file mode 100644 index 8fe8fbc967..0000000000 --- a/app/api/module/Api/data/nr/complianceEpisodeTemplateNoNs.xml +++ /dev/null @@ -1,24 +0,0 @@ - - -
- - - -
- - - - - - - - - - - - - - - - -
\ No newline at end of file diff --git a/app/api/module/Api/data/nr/compliancePenaltiesTemplate.xml b/app/api/module/Api/data/nr/compliancePenaltiesTemplate.xml deleted file mode 100644 index 6fb4a4bc6c..0000000000 --- a/app/api/module/Api/data/nr/compliancePenaltiesTemplate.xml +++ /dev/null @@ -1,13 +0,0 @@ - -
- - - -
- - - - - - -
\ No newline at end of file diff --git a/app/api/module/Api/data/nr/notifyCheckResponseTemplate.xml b/app/api/module/Api/data/nr/notifyCheckResponseTemplate.xml new file mode 100644 index 0000000000..783e47f823 --- /dev/null +++ b/app/api/module/Api/data/nr/notifyCheckResponseTemplate.xml @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + diff --git a/app/api/module/Api/data/nr/notifyCheckResultTemplate.xml b/app/api/module/Api/data/nr/notifyCheckResultTemplate.xml new file mode 100644 index 0000000000..0b2408758f --- /dev/null +++ b/app/api/module/Api/data/nr/notifyCheckResultTemplate.xml @@ -0,0 +1,35 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Request.xsd b/app/api/module/Api/data/nr/xsd/CheckGoodRepute_Request.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Request.xsd rename to app/api/module/Api/data/nr/xsd/CheckGoodRepute_Request.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Response.xsd b/app/api/module/Api/data/nr/xsd/CheckGoodRepute_Response.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Response.xsd rename to app/api/module/Api/data/nr/xsd/CheckGoodRepute_Response.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Types.xsd b/app/api/module/Api/data/nr/xsd/CheckGoodRepute_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckGoodRepute_Types.xsd rename to app/api/module/Api/data/nr/xsd/CheckGoodRepute_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Request.xsd b/app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Request.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Request.xsd rename to app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Request.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Response.xsd b/app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Response.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Response.xsd rename to app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Response.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Types.xsd b/app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/CheckTransportUndertakingData_Types.xsd rename to app/api/module/Api/data/nr/xsd/CheckTransportUndertakingData_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/ComplianceEpisode-v1-0.xsd b/app/api/module/Api/data/nr/xsd/ComplianceEpisode-v1-0.xsd deleted file mode 100644 index 93da35d078..0000000000 --- a/app/api/module/Api/data/nr/xsd/ComplianceEpisode-v1-0.xsd +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - This is the Notification Number from TB_COMPLIANCE_SERIOUS_INFRINGEMENT - - - - - - - - - This may become another type based on conversations with Steve Hunter - -e.g. short - - - - - This may become another type (or string) in line with the actual date format passed by INR - - - - - This may become another type (or string) in line with the actual date format passed by INR - - - - - - - - - - - - - - - - True/False or enumeration? - - - - - - - - - - - - - - - - - Is there an enumeration of values we can restrict this to? - - - - - - - - - - Is this an enumeration (e.g. 1 day, 1 week or a number? - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/CompliancePenalties-v1-0.xsd b/app/api/module/Api/data/nr/xsd/CompliancePenalties-v1-0.xsd deleted file mode 100644 index d34fab3488..0000000000 --- a/app/api/module/Api/data/nr/xsd/CompliancePenalties-v1-0.xsd +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - This is the Notification Number from TB_COMPLIANCE_SERIOUS_INFRINGEMENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - Is this an enumeration? - - - - - - - - - - - - - Optional? - - - - - Will be created from the SQL DATETIME values in the following format YYYY-MM-DD HH:MM:SS - - - - - Optional? -Will be created from the SQL DATETIME values in the following format YYYY-MM-DD HH:MM:SS - - - - - Optional? - - - - - Optional? - - - - - - - - - - - What is this? - -Assumption that this is a string - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Req.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Req.xsd deleted file mode 100755 index ec63c35702..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Req.xsd +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Res.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Res.xsd deleted file mode 100755 index 7be165f59c..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2MS_CheckGoodRepute_Res.xsd +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Ack.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Ack.xsd deleted file mode 100755 index ff534650d7..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Ack.xsd +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Req.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Req.xsd deleted file mode 100755 index e77b9c38c3..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Req.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Res.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Res.xsd deleted file mode 100755 index 5fa9c0ee36..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2MS_Infringement_Res.xsd +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU2MS_Invalid_Message.xsd b/app/api/module/Api/data/nr/xsd/ERRU2MS_Invalid_Message.xsd deleted file mode 100755 index b31f1b8a06..0000000000 Binary files a/app/api/module/Api/data/nr/xsd/ERRU2MS_Invalid_Message.xsd and /dev/null differ diff --git a/app/api/module/Api/data/nr/xsd/ERRU2SYS_Statistics_Ack.xsd b/app/api/module/Api/data/nr/xsd/ERRU2SYS_Statistics_Ack.xsd deleted file mode 100755 index 97e78d7a73..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU2SYS_Statistics_Ack.xsd +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU_CheckGoodRepute_Types.xsd b/app/api/module/Api/data/nr/xsd/ERRU_CheckGoodRepute_Types.xsd deleted file mode 100755 index d575fb13f0..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU_CheckGoodRepute_Types.xsd +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU_Global_Types.xsd b/app/api/module/Api/data/nr/xsd/ERRU_Global_Types.xsd deleted file mode 100755 index 850380e88b..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU_Global_Types.xsd +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU_Infringement_Types.xsd b/app/api/module/Api/data/nr/xsd/ERRU_Infringement_Types.xsd deleted file mode 100755 index a5685208ed..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU_Infringement_Types.xsd +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/ERRU_Statistics_Types.xsd b/app/api/module/Api/data/nr/xsd/ERRU_Statistics_Types.xsd deleted file mode 100755 index 8c907b7635..0000000000 --- a/app/api/module/Api/data/nr/xsd/ERRU_Statistics_Types.xsd +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/3.4/ErrorNotification.xsd b/app/api/module/Api/data/nr/xsd/ErrorNotification.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/ErrorNotification.xsd rename to app/api/module/Api/data/nr/xsd/ErrorNotification.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/ErrorNotification_Types.xsd b/app/api/module/Api/data/nr/xsd/ErrorNotification_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/ErrorNotification_Types.xsd rename to app/api/module/Api/data/nr/xsd/ErrorNotification_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/Global_Types.xsd b/app/api/module/Api/data/nr/xsd/Global_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/Global_Types.xsd rename to app/api/module/Api/data/nr/xsd/Global_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Req.xsd b/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Req.xsd deleted file mode 100755 index c531a0795d..0000000000 --- a/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Req.xsd +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Res.xsd b/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Res.xsd deleted file mode 100755 index b594532290..0000000000 --- a/app/api/module/Api/data/nr/xsd/MS2ERRU_CheckGoodRepute_Res.xsd +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Ack.xsd b/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Ack.xsd deleted file mode 100755 index 499a1919ad..0000000000 --- a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Ack.xsd +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Req.xsd b/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Req.xsd deleted file mode 100755 index 0d9ba0d255..0000000000 --- a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Req.xsd +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Res.xsd b/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Res.xsd deleted file mode 100755 index f65fff9078..0000000000 --- a/app/api/module/Api/data/nr/xsd/MS2ERRU_Infringement_Res.xsd +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Acknowledgement.xsd b/app/api/module/Api/data/nr/xsd/NotifyCheckResult_Acknowledgement.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Acknowledgement.xsd rename to app/api/module/Api/data/nr/xsd/NotifyCheckResult_Acknowledgement.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Request.xsd b/app/api/module/Api/data/nr/xsd/NotifyCheckResult_Request.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Request.xsd rename to app/api/module/Api/data/nr/xsd/NotifyCheckResult_Request.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Response.xsd b/app/api/module/Api/data/nr/xsd/NotifyCheckResult_Response.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Response.xsd rename to app/api/module/Api/data/nr/xsd/NotifyCheckResult_Response.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Types.xsd b/app/api/module/Api/data/nr/xsd/NotifyCheckResult_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyCheckResult_Types.xsd rename to app/api/module/Api/data/nr/xsd/NotifyCheckResult_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Acknowledgement.xsd b/app/api/module/Api/data/nr/xsd/NotifyUnfitness_Acknowledgement.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Acknowledgement.xsd rename to app/api/module/Api/data/nr/xsd/NotifyUnfitness_Acknowledgement.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Request.xsd b/app/api/module/Api/data/nr/xsd/NotifyUnfitness_Request.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Request.xsd rename to app/api/module/Api/data/nr/xsd/NotifyUnfitness_Request.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Types.xsd b/app/api/module/Api/data/nr/xsd/NotifyUnfitness_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/NotifyUnfitness_Types.xsd rename to app/api/module/Api/data/nr/xsd/NotifyUnfitness_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Request.xsd b/app/api/module/Api/data/nr/xsd/RoadSideInspection_Request.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Request.xsd rename to app/api/module/Api/data/nr/xsd/RoadSideInspection_Request.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Response.xsd b/app/api/module/Api/data/nr/xsd/RoadSideInspection_Response.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Response.xsd rename to app/api/module/Api/data/nr/xsd/RoadSideInspection_Response.xsd diff --git a/app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Types.xsd b/app/api/module/Api/data/nr/xsd/RoadSideInspection_Types.xsd similarity index 100% rename from app/api/module/Api/data/nr/xsd/3.4/RoadSideInspection_Types.xsd rename to app/api/module/Api/data/nr/xsd/RoadSideInspection_Types.xsd diff --git a/app/api/module/Api/data/nr/xsd/SYS2ERRU_Statistics_Data.xsd b/app/api/module/Api/data/nr/xsd/SYS2ERRU_Statistics_Data.xsd deleted file mode 100755 index 1b5ffe951d..0000000000 --- a/app/api/module/Api/data/nr/xsd/SYS2ERRU_Statistics_Data.xsd +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/api/module/Api/data/nr/xsd/nysiis.svc.wsdl b/app/api/module/Api/data/nr/xsd/nysiis.svc.wsdl deleted file mode 100755 index 72c5a5de4d..0000000000 --- a/app/api/module/Api/data/nr/xsd/nysiis.svc.wsdl +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd0.xsd b/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd0.xsd deleted file mode 100755 index 48b1997e2f..0000000000 --- a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd0.xsd +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd1.xsd b/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd1.xsd deleted file mode 100755 index 37bb6f6bb1..0000000000 --- a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd1.xsd +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd2.xsd b/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd2.xsd deleted file mode 100755 index 47bd572c8c..0000000000 --- a/app/api/module/Api/data/nr/xsd/nysiis.svc.xsd2.xsd +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/api/module/Api/data/nr/xsd/xml.xsd b/app/api/module/Api/data/nr/xsd/xml.xsd deleted file mode 100644 index aea7d0db0a..0000000000 --- a/app/api/module/Api/data/nr/xsd/xml.xsd +++ /dev/null @@ -1,287 +0,0 @@ - - - - - - -
-

About the XML namespace

- -
-

- This schema document describes the XML namespace, in a form - suitable for import by other schema documents. -

-

- See - http://www.w3.org/XML/1998/namespace.html and - - http://www.w3.org/TR/REC-xml for information - about this namespace. -

-

- Note that local names in this namespace are intended to be - defined only by the World Wide Web Consortium or its subgroups. - The names currently defined in this namespace are listed below. - They should not be used with conflicting semantics by any Working - Group, specification, or document instance. -

-

- See further below in this document for more information about how to refer to this schema document from your own - XSD schema documents and about the - namespace-versioning policy governing this schema document. -

-
-
-
-
- - - - -
- -

lang (as an attribute name)

-

- denotes an attribute whose value - is a language code for the natural language of the content of - any element; its value is inherited. This name is reserved - by virtue of its definition in the XML specification.

- -
-
-

Notes

-

- Attempting to install the relevant ISO 2- and 3-letter - codes as the enumerated possible values is probably never - going to be a realistic possibility. -

-

- See BCP 47 at - http://www.rfc-editor.org/rfc/bcp/bcp47.txt - and the IANA language subtag registry at - - http://www.iana.org/assignments/language-subtag-registry - for further information. -

-

- The union allows for the 'un-declaration' of xml:lang with - the empty string. -

-
-
-
- - - - - - - - - -
- - - - -
- -

space (as an attribute name)

-

- denotes an attribute whose - value is a keyword indicating what whitespace processing - discipline is intended for the content of the element; its - value is inherited. This name is reserved by virtue of its - definition in the XML specification.

- -
-
-
- - - - - - -
- - - -
- -

base (as an attribute name)

-

- denotes an attribute whose value - provides a URI to be used as the base for interpreting any - relative URIs in the scope of the element on which it - appears; its value is inherited. This name is reserved - by virtue of its definition in the XML Base specification.

- -

- See http://www.w3.org/TR/xmlbase/ - for information about this attribute. -

-
-
-
-
- - - - -
- -

id (as an attribute name)

-

- denotes an attribute whose value - should be interpreted as if declared to be of type ID. - This name is reserved by virtue of its definition in the - xml:id specification.

- -

- See http://www.w3.org/TR/xml-id/ - for information about this attribute. -

-
-
-
-
- - - - - - - - - - -
- -

Father (in any context at all)

- -
-

- denotes Jon Bosak, the chair of - the original XML Working Group. This name is reserved by - the following decision of the W3C XML Plenary and - XML Coordination groups: -

-
-

- In appreciation for his vision, leadership and - dedication the W3C XML Plenary on this 10th day of - February, 2000, reserves for Jon Bosak in perpetuity - the XML name "xml:Father". -

-
-
-
-
-
- - - -
-

About this schema document

- -
-

- This schema defines attributes and an attribute group suitable - for use by schemas wishing to allow xml:base, - xml:lang, xml:space or - xml:id attributes on elements they define. -

-

- To enable this, such a schema must import this schema for - the XML namespace, e.g. as follows: -

-
-          <schema . . .>
-           . . .
-           <import namespace="http://www.w3.org/XML/1998/namespace"
-                      schemaLocation="http://www.w3.org/2001/xml.xsd"/>
-     
-

- or -

-
-           <import namespace="http://www.w3.org/XML/1998/namespace"
-                      schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
-     
-

- Subsequently, qualified reference to any of the attributes or the - group defined below will have the desired effect, e.g. -

-
-          <type . . .>
-           . . .
-           <attributeGroup ref="xml:specialAttrs"/>
-     
-

- will define a type which will schema-validate an instance element - with any of those attributes. -

-
-
-
-
- - - -
-

Versioning policy for this schema document

-
-

- In keeping with the XML Schema WG's standard versioning - policy, this schema document will persist at - - http://www.w3.org/2009/01/xml.xsd. -

-

- At the date of issue it can also be found at - - http://www.w3.org/2001/xml.xsd. -

-

- The schema document at that URI may however change in the future, - in order to remain compatible with the latest version of XML - Schema itself, or with the XML namespace itself. In other words, - if the XML Schema or XML namespaces change, the version of this - document at - http://www.w3.org/2001/xml.xsd - - will change accordingly; the version at - - http://www.w3.org/2009/01/xml.xsd - - will not change. -

-

- Previous dated (and unchanging) versions of this schema - document are at: -

- -
-
-
-
- -
- diff --git a/app/api/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisode.php b/app/api/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisode.php index 4ff76fcc93..4c40731e90 100644 --- a/app/api/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisode.php +++ b/app/api/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisode.php @@ -1,9 +1,5 @@ - */ final class ComplianceEpisode extends AbstractCommandHandler implements TransactionedInterface, UploaderAwareInterface { use UploaderAwareTrait; @@ -173,7 +165,7 @@ public function handleCommand(CommandInterface $command) $parsedXmlData = $this->xmlMapping->mapData($xmlDomDocument); //extract the data we need from the dom document, on failure return a result object containing the errors - if (!$erruData = $this->validateInput('complianceEpisode', $parsedXmlData, [])) { + if (!$erruData = $this->validateInput('complianceEpisode', $parsedXmlData)) { return $this->result; } @@ -185,10 +177,13 @@ public function handleCommand(CommandInterface $command) //generate a case object $case = $this->generateCase($erruData, $this->requestDocument); + $checkDate = new \DateTime($erruData['checkDate']); + $checkDate->setTime(0, 0); + //there can be more than one serious infringement per request foreach ($erruData['si'] as $si) { //format/validate si data, on failure return a result object containing the errors - if (!$si = $this->validateInput('seriousInfringement', $si, [])) { + if (!$si = $this->validateInput('seriousInfringement', $si)) { return $this->result; } @@ -202,7 +197,7 @@ public function handleCommand(CommandInterface $command) return $this->result; } - $case->getSeriousInfringements()->add($this->getSi($case, $si)); + $case->getSeriousInfringements()->add($this->getSi($case, $si, $checkDate)); } $this->getRepo()->save($case); @@ -219,19 +214,11 @@ public function handleCommand(CommandInterface $command) return $this->result; } - /** - * Gets a serious infringement entity - * - * @param CaseEntity $case case entity - * @param array $si array of serious infringement information - * - * @return SiEntity - */ - private function getSi(CaseEntity $case, array $si) + private function getSi(CaseEntity $case, array $si, \DateTime $checkDate): SiEntity { $siEntity = new SiEntity( $case, - $si['checkDate'], + $checkDate, $si['infringementDate'], $this->getRepo('SiCategory')->fetchById(SiCategoryEntity::ERRU_DEFAULT_CATEGORY), $this->siCategoryType[$si['siCategoryType']] @@ -243,15 +230,7 @@ private function getSi(CaseEntity $case, array $si) return $siEntity; } - /** - * Returns an array collection of imposed errus - * - * @param SiEntity $si serious infringement entity - * @param array $imposedErrus array of imposed errus - * - * @return ArrayCollection - */ - private function getImposedErruCollection(SiEntity $si, $imposedErrus) + private function getImposedErruCollection(SiEntity $si, array $imposedErrus): ArrayCollection { $imposedErruCollection = new ArrayCollection(); @@ -262,7 +241,8 @@ private function getImposedErruCollection(SiEntity $si, $imposedErrus) $this->imposedPen['executed'][$imposedErru['executed']], $imposedErru['startDate'], $imposedErru['endDate'], - $imposedErru['finalDecisionDate'] + $imposedErru['finalDecisionDate'], + $imposedErru['penaltyImposedIdentifier'] ); $imposedErruCollection->add($imposedEntity); @@ -271,35 +251,26 @@ private function getImposedErruCollection(SiEntity $si, $imposedErrus) return $imposedErruCollection; } - /** - * Returns an array collection of requested errus - * - * @param SiEntity $si serious infringement entity - * @param array $requestedErrus array of requested errus - * - * @return ArrayCollection - */ - private function getRequestedErruCollection(SiEntity $si, $requestedErrus) + private function getRequestedErruCollection(SiEntity $si, array $requestedErrus): ArrayCollection { $requestedErruCollection = new ArrayCollection(); foreach ($requestedErrus as $requestedErru) { $penalty = $this->requestedPen['siPenaltyRequestedType'][$requestedErru['siPenaltyRequestedType']]; - $requestedErruCollection->add(new PenaltyRequestedEntity($si, $penalty, $requestedErru['duration'])); + $requestedErruCollection->add( + new PenaltyRequestedEntity( + $si, + $penalty, + $requestedErru['duration'], + $requestedErru['penaltyRequestedIdentifier'] + ) + ); } return $requestedErruCollection; } - /** - * Builds the case entity - * - * @param array $erruData array of erru data - * @param Document $requestDocument request document entity - * - * @return CaseEntity - */ - private function generateCase(array $erruData, Document $requestDocument) + private function generateCase(array $erruData, Document $requestDocument): CaseEntity { $case = new CaseEntity( new \DateTime(), @@ -318,7 +289,8 @@ private function generateCase(array $erruData, Document $requestDocument) $requestDocument, $erruData['originatingAuthority'], $erruData['transportUndertakingName'], - $erruData['vrm'] + $erruData['vrm'], + $erruData['communityLicenceNumber'], ); $case->setErruRequest($erruRequest); @@ -326,30 +298,22 @@ private function generateCase(array $erruData, Document $requestDocument) return $case; } - /** - * Builds the ErruRequest entity - * - * @param CaseEntity $case case entity - * @param Document $requestDocument request document entity - * @param string $originatingAuthority originating authority - * @param string $transportUndertakingName transport undertaking name - * @param string $vrm vrm - * - * @return ErruRequestEntity - * @throws \Dvsa\Olcs\Api\Domain\Exception\RuntimeException - */ private function getErruRequest( CaseEntity $case, Document $requestDocument, - $originatingAuthority, - $transportUndertakingName, - $vrm - ) { + string $originatingAuthority, + string $transportUndertakingName, + string $vrm, + string $communityLicenceNumber + ): ErruRequestEntity { return new ErruRequestEntity( $case, $this->getRepo()->getRefdataReference(ErruRequestEntity::DEFAULT_CASE_TYPE), $this->commonData['memberState'], $requestDocument, + $this->getRepo()->getRefdataReference(CommunityLic::STATUS_ACTIVE), + $communityLicenceNumber, + $this->commonData['totAuthVehicles'], $originatingAuthority, $transportUndertakingName, $vrm, @@ -358,12 +322,7 @@ private function getErruRequest( ); } - /** - * Gets a list of case categories - * - * @return ArrayCollection - */ - private function getCaseCategories() + private function getCaseCategories(): ArrayCollection { return new ArrayCollection([$this->getRepo()->getRefdataReference(CaseEntity::ERRU_DEFAULT_CASE_CATEGORY)]); } @@ -371,12 +330,8 @@ private function getCaseCategories() /** * Gets doctrine category type data for each serious infringement, if we've already retrieved the data previously, * we don't do so again - * - * @param int $categoryType category type id - * - * @return void */ - private function addDoctrineCategoryTypeData($categoryType) + private function addDoctrineCategoryTypeData(int $categoryType): void { if (!isset($this->siCategoryType[$categoryType])) { try { @@ -392,13 +347,8 @@ private function addDoctrineCategoryTypeData($categoryType) /** * Gets doctrine penalty data for each serious infringement, if we've already retrieved the data previously, * we don't do so again - * - * @param array $imposedErruData imposed erru data - * @param array $requestedErruData requested erru data - * - * @return void */ - private function addDoctrinePenaltyData(array $imposedErruData, array $requestedErruData) + private function addDoctrinePenaltyData(array $imposedErruData, array $requestedErruData): void { /** * @var SiPenaltyRequestedTypeRepo $imposedRepo @@ -454,7 +404,7 @@ private function addDoctrinePenaltyData(array $imposedErruData, array $requested * @throws Exception * @return array */ - private function getCommonData(array $erruData) + private function getCommonData(array $erruData): array|false { /** * @var ErruRequestRepo $erruRequestRepo @@ -488,9 +438,10 @@ private function getCommonData(array $erruData) $this->commonData = [ 'licence' => $licence, + 'totAuthVehicles' => $licence->getTotAuthVehicles(), 'memberState' => $memberState, 'notificationNumber' => $erruData['notificationNumber'], - 'workflowId' => $erruData['workflowId'] + 'workflowId' => $erruData['workflowId'], ]; return $this->commonData; @@ -504,7 +455,7 @@ private function getCommonData(array $erruData) * * @return bool */ - private function handleErrors($input, $errors) + private function handleErrors($input, array $errors): false { $this->errors = $errors; $this->result->setFlag('hasErrors', true); @@ -546,14 +497,7 @@ private function validateInput($filter, mixed $value, $context = []) return $this->$inputFilter->getValue(); } - /** - * Creates a task - * - * @param CaseEntity $case case entity - * - * @return CreateTaskCmd - */ - private function createTaskCmd($case) + private function createTaskCmd(CaseEntity $case): CreateTaskCmd { $data = [ 'category' => CategoryEntity::CATEGORY_COMPLIANCE, @@ -569,15 +513,9 @@ private function createTaskCmd($case) } /** - * Updates the document record with case and licence ids - * - * @param DocumentEntity $document document entity - * @param CaseEntity $case case entity - * @param Licence $licence licence entity - * - * @return UpdateDocLinksCmd + * Command to update the document record with case and licence ids */ - private function createUpdateDocLinksCmd(DocumentEntity $document, CaseEntity $case, LicenceEntity $licence) + private function createUpdateDocLinksCmd(DocumentEntity $document, CaseEntity $case, LicenceEntity $licence): UpdateDocLinksCmd { $data = [ 'id' => $document->getId(), @@ -590,22 +528,16 @@ private function createUpdateDocLinksCmd(DocumentEntity $document, CaseEntity $c /** * Returns a queue command to send the error email - * - * @param int $id the erru request failure id - * - * @return CreateQueueCmd */ - private function createErrorEmailCmd($id) + private function createErrorEmailCmd(int $id): CreateQueueCmd { return $this->emailQueue(SendErrorEmailCmd::class, ['id' => $id], $id); } /** * Returns the current list of errors - * - * @return array */ - public function getErrors() + public function getErrors(): array { return $this->errors; } diff --git a/app/api/module/Api/src/Domain/CommandHandler/Email/SendErruErrors.php b/app/api/module/Api/src/Domain/CommandHandler/Email/SendErruErrors.php index 12e8783025..a9cafe4776 100644 --- a/app/api/module/Api/src/Domain/CommandHandler/Email/SendErruErrors.php +++ b/app/api/module/Api/src/Domain/CommandHandler/Email/SendErruErrors.php @@ -108,7 +108,6 @@ private function getTemplateVars(DocumentEntity $document, array $input, array $ $originatingAuthority = ($input['originatingAuthority'] ?? self::MISSING_INPUT); $sentAt = self::MISSING_INPUT; - $notificationDate = self::MISSING_INPUT; if (isset($input['sentAt'])) { //providing we have a date, we know the format is OK as it has been enforced by the XML schema @@ -116,18 +115,11 @@ private function getTemplateVars(DocumentEntity $document, array $input, array $ $sentAt = $sentDateTime->format(self::BODY_DATE_FORMAT); } - if (isset($input['notificationDateTime'])) { - //providing we have a date, we know the format is OK as it has been enforced by the XML schema - $notificationDateTime = new \DateTime($input['notificationDateTime']); - $notificationDate = $notificationDateTime->format(self::BODY_DATE_FORMAT); - } - return [ 'sentAt' => $sentAt, 'notificationNumber' => $notificationNumber, 'memberState' => $memberStateCode, 'originatingAuthority' => $originatingAuthority, - 'notificationDateTime' => $notificationDate, 'errorMessages' => $errors, 'filename' => $filename ]; diff --git a/app/api/module/Api/src/Entity/Si/AbstractErruRequest.php b/app/api/module/Api/src/Entity/Si/AbstractErruRequest.php index d22b7b5c0a..536219b958 100644 --- a/app/api/module/Api/src/Entity/Si/AbstractErruRequest.php +++ b/app/api/module/Api/src/Entity/Si/AbstractErruRequest.php @@ -3,6 +3,7 @@ namespace Dvsa\Olcs\Api\Entity\Si; use Dvsa\Olcs\Api\Domain\QueryHandler\BundleSerializableInterface; +use Dvsa\Olcs\Api\Entity\System\RefData; use JsonSerializable; use Dvsa\Olcs\Api\Entity\Traits\BundleSerializableTrait; use Dvsa\Olcs\Api\Entity\Traits\ProcessDateTrait; @@ -106,7 +107,7 @@ abstract class AbstractErruRequest implements BundleSerializableInterface, JsonS /** * Msi type * - * @var \Dvsa\Olcs\Api\Entity\System\RefData + * @var RefData * * @ORM\ManyToOne(targetEntity="Dvsa\Olcs\Api\Entity\System\RefData", fetch="LAZY") * @ORM\JoinColumn(name="msi_type", referencedColumnName="id", nullable=false) @@ -215,6 +216,34 @@ abstract class AbstractErruRequest implements BundleSerializableInterface, JsonS */ protected $workflowId; + /** + * Community licence number + * + * @var string + * + * @ORM\Column(type="string", name="community_licence_number", length=32, nullable=false, options={"default": "unknown"})) + */ + protected $communityLicenceNumber; + + /** + * Community licence status (nullable due to legacy data) + * + * @var RefData + * + * @ORM\ManyToOne(targetEntity="Dvsa\Olcs\Api\Entity\System\RefData", fetch="LAZY") + * @ORM\JoinColumn(name="community_licence_status", referencedColumnName="id", nullable=true) + */ + protected $communityLicenceStatus; + + /** + * Number of vehicles authorised on the licence + * + * @var int + * + * @ORM\Column(type="smallint", name="tot_auth_vehicles", nullable=false, options={"default": 0}) + */ + protected $totAuthVehicles; + /** * Set the case * @@ -338,7 +367,7 @@ public function getMemberStateCode() /** * Set the msi type * - * @param \Dvsa\Olcs\Api\Entity\System\RefData $msiType entity being set as the value + * @param RefData $msiType entity being set as the value * * @return ErruRequest */ @@ -352,7 +381,7 @@ public function setMsiType($msiType) /** * Get the msi type * - * @return \Dvsa\Olcs\Api\Entity\System\RefData + * @return RefData */ public function getMsiType() { @@ -605,4 +634,37 @@ public function getWorkflowId() { return $this->workflowId; } + + public function getCommunityLicenceNumber(): ?string + { + return $this->communityLicenceNumber; + } + + public function setCommunityLicenceNumber(string $communityLicenceNumber): ErruRequest + { + $this->communityLicenceNumber = $communityLicenceNumber; + return $this; + } + + public function getCommunityLicenceStatus(): ?RefData + { + return $this->communityLicenceStatus; + } + + public function setCommunityLicenceStatus(RefData $communityLicenceStatus): ErruRequest + { + $this->communityLicenceStatus = $communityLicenceStatus; + return $this; + } + + public function getTotAuthVehicles(): int|string + { + return $this->totAuthVehicles; + } + + public function setTotAuthVehicles(int|string $totAuthVehicles): ErruRequest + { + $this->totAuthVehicles = $totAuthVehicles; + return $this; + } } diff --git a/app/api/module/Api/src/Entity/Si/AbstractSiPenalty.php b/app/api/module/Api/src/Entity/Si/AbstractSiPenalty.php index ceb3e203de..54a32598ee 100644 --- a/app/api/module/Api/src/Entity/Si/AbstractSiPenalty.php +++ b/app/api/module/Api/src/Entity/Si/AbstractSiPenalty.php @@ -6,7 +6,7 @@ use JsonSerializable; use Dvsa\Olcs\Api\Entity\Traits\BundleSerializableTrait; use Dvsa\Olcs\Api\Entity\Traits\ProcessDateTrait; -use Dvsa\Olcs\Api\Entity\Traits\ClearPropertiesTrait; +use Dvsa\Olcs\Api\Entity\Traits\ClearPropertiesWithCollectionsTrait; use Dvsa\Olcs\Api\Entity\Traits\CreatedOnTrait; use Dvsa\Olcs\Api\Entity\Traits\ModifiedOnTrait; use Dvsa\Olcs\Api\Entity\Traits\SoftDeletableTrait; @@ -35,7 +35,7 @@ abstract class AbstractSiPenalty implements BundleSerializableInterface, JsonSer { use BundleSerializableTrait; use ProcessDateTrait; - use ClearPropertiesTrait; + use ClearPropertiesWithCollectionsTrait; use CreatedOnTrait; use ModifiedOnTrait; use SoftDeletableTrait; @@ -91,6 +91,16 @@ abstract class AbstractSiPenalty implements BundleSerializableInterface, JsonSer */ protected $lastModifiedBy; + /** + * The corresponding penalty that was requested (nullable for now due to existing data) + * + * @var \Dvsa\Olcs\Api\Entity\Si\SiPenaltyErruRequested + * + * @ORM\ManyToOne(targetEntity="Dvsa\Olcs\Api\Entity\Si\SiPenaltyErruRequested", fetch="LAZY", inversedBy="appliedPenalties") + * @ORM\JoinColumn(name="si_penalty_erru_requested_id", referencedColumnName="id", nullable=true) + */ + protected $erruPenaltyRequested; + /** * Olbs key * @@ -406,6 +416,18 @@ public function getStartDate($asDateTime = false) return $this->startDate; } + public function setErruPenaltyRequested($erruPenaltyRequested) + { + $this->erruPenaltyRequested = $erruPenaltyRequested; + + return $this; + } + + public function getErruPenaltyRequested() + { + return $this->erruPenaltyRequested; + } + /** * Set the version * diff --git a/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruImposed.php b/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruImposed.php index 84a2ac190c..767615bebc 100644 --- a/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruImposed.php +++ b/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruImposed.php @@ -103,6 +103,15 @@ abstract class AbstractSiPenaltyErruImposed implements BundleSerializableInterfa */ protected $lastModifiedBy; + /** + * Penalty imposed identifier (nullable for now due to existing data, doesn't need to be going forward) + * + * @var int + * + * @ORM\Column(type="integer", name="penalty_imposed_identifier", nullable=true) + */ + protected $penaltyImposedIdentifier; + /** * Olbs key * @@ -337,6 +346,18 @@ public function getOlbsKey() return $this->olbsKey; } + public function setPenaltyImposedIdentifier($penaltyImposedIdentifier) + { + $this->penaltyImposedIdentifier = $penaltyImposedIdentifier; + + return $this; + } + + public function getPenaltyImposedIdentifier() + { + return $this->penaltyImposedIdentifier; + } + /** * Set the serious infringement * diff --git a/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruRequested.php b/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruRequested.php index 6aed4a529a..5df598ad63 100644 --- a/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruRequested.php +++ b/app/api/module/Api/src/Entity/Si/AbstractSiPenaltyErruRequested.php @@ -84,6 +84,15 @@ abstract class AbstractSiPenaltyErruRequested implements BundleSerializableInter */ protected $lastModifiedBy; + /** + * Penalty requested identifier (nullable only due to pre existing data)) + * + * @var int + * + * @ORM\Column(type="integer", name="penalty_requested_identifier", nullable=true) + */ + protected $penaltyRequestedIdentifier; + /** * Olbs key * @@ -117,6 +126,19 @@ abstract class AbstractSiPenaltyErruRequested implements BundleSerializableInter */ protected $siPenaltyRequestedType; + /** + * Penalties that have been applied + * + * @var \Doctrine\Common\Collections\ArrayCollection + * + * @ORM\OneToMany( + * targetEntity="Dvsa\Olcs\Api\Entity\Si\SiPenalty", + * mappedBy="erruPenaltyRequested", + * cascade={"persist"} + * ) + */ + protected $appliedPenalties; + /** * Version * @@ -247,6 +269,30 @@ public function getOlbsKey() return $this->olbsKey; } + public function setPenaltyRequestedIdentifier($penaltyRequestedIdentifier) + { + $this->penaltyRequestedIdentifier = $penaltyRequestedIdentifier; + + return $this; + } + + public function getPenaltyRequestedIdentifier() + { + return $this->penaltyRequestedIdentifier; + } + + public function getAppliedPenalties() + { + return $this->appliedPenalties; + } + + public function setAppliedPenalties($appliedPenalties) + { + $this->appliedPenalties = $appliedPenalties; + + return $this; + } + /** * Set the serious infringement * diff --git a/app/api/module/Api/src/Entity/Si/ErruRequest.php b/app/api/module/Api/src/Entity/Si/ErruRequest.php index 859c311857..4b217f86fa 100644 --- a/app/api/module/Api/src/Entity/Si/ErruRequest.php +++ b/app/api/module/Api/src/Entity/Si/ErruRequest.php @@ -48,6 +48,9 @@ public function __construct( RefData $msiType, CountryEntity $memberStateCode, DocumentEntity $requestDocument, + RefData $communityLicenceStatus, + string $communityLicenceNumber, + $totAuthVehicles, $originatingAuthority, $transportUndertakingName, $vrm, @@ -58,6 +61,9 @@ public function __construct( $this->msiType = $msiType; $this->memberStateCode = $memberStateCode; $this->requestDocument = $requestDocument; + $this->communityLicenceStatus = $communityLicenceStatus; + $this->communityLicenceNumber = $communityLicenceNumber; + $this->totAuthVehicles = $totAuthVehicles; $this->originatingAuthority = $originatingAuthority; $this->transportUndertakingName = $transportUndertakingName; $this->vrm = $vrm; diff --git a/app/api/module/Api/src/Entity/Si/SiPenaltyErruImposed.php b/app/api/module/Api/src/Entity/Si/SiPenaltyErruImposed.php index 70898b76af..d36b037f1c 100644 --- a/app/api/module/Api/src/Entity/Si/SiPenaltyErruImposed.php +++ b/app/api/module/Api/src/Entity/Si/SiPenaltyErruImposed.php @@ -27,7 +27,8 @@ public function __construct( RefData $executed, \DateTime $startDate, \DateTime $endDate, - \DateTime $finalDecisionDate + \DateTime $finalDecisionDate, + int $penaltyImposedIdentifier ) { $this->seriousInfringement = $seriousInfringement; $this->siPenaltyImposedType = $siPenaltyImposedType; @@ -35,5 +36,6 @@ public function __construct( $this->startDate = $startDate; $this->endDate = $endDate; $this->finalDecisionDate = $finalDecisionDate; + $this->penaltyImposedIdentifier = $penaltyImposedIdentifier; } } diff --git a/app/api/module/Api/src/Entity/Si/SiPenaltyErruRequested.php b/app/api/module/Api/src/Entity/Si/SiPenaltyErruRequested.php index f787a3da9f..1305f15be2 100644 --- a/app/api/module/Api/src/Entity/Si/SiPenaltyErruRequested.php +++ b/app/api/module/Api/src/Entity/Si/SiPenaltyErruRequested.php @@ -22,10 +22,12 @@ class SiPenaltyErruRequested extends AbstractSiPenaltyErruRequested public function __construct( SeriousInfringement $seriousInfringement, SiPenaltyRequestedType $siPenaltyRequestedType, - $duration + int $duration, + int $penaltyRequestedIdentifier ) { $this->seriousInfringement = $seriousInfringement; $this->siPenaltyRequestedType = $siPenaltyRequestedType; $this->duration = $duration; + $this->penaltyRequestedIdentifier = $penaltyRequestedIdentifier; } } diff --git a/app/api/module/Api/src/Service/Nr/Filter/Format/SiDates.php b/app/api/module/Api/src/Service/Nr/Filter/Format/SiDates.php index d62fec0487..7c4d07ae75 100644 --- a/app/api/module/Api/src/Service/Nr/Filter/Format/SiDates.php +++ b/app/api/module/Api/src/Service/Nr/Filter/Format/SiDates.php @@ -29,7 +29,6 @@ public function filter($value) $value['imposedErrus'][$key]['finalDecisionDate'] = $this->createDate($dates['finalDecisionDate']); } - $value['checkDate'] = $this->createDate($value['checkDate']); $value['infringementDate'] = $this->createDate($value['infringementDate']); return $value; diff --git a/app/api/module/Api/src/Service/Nr/Filter/LicenceNumber.php b/app/api/module/Api/src/Service/Nr/Filter/LicenceNumber.php index 5124a6c33d..639bda31e5 100644 --- a/app/api/module/Api/src/Service/Nr/Filter/LicenceNumber.php +++ b/app/api/module/Api/src/Service/Nr/Filter/LicenceNumber.php @@ -22,7 +22,7 @@ class LicenceNumber extends AbstractFilter */ public function filter($value) { - //licence number defaults to the the initial value + //licence number defaults to the initial value $value['licenceNumber'] = $value['communityLicenceNumber']; //see if we can split into three parts, as per a community licence number diff --git a/app/api/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactory.php b/app/api/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactory.php index 0ea4cac1f0..ea9cbdda93 100644 --- a/app/api/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactory.php +++ b/app/api/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactory.php @@ -17,6 +17,7 @@ class XmlStructureInputFactory implements FactoryInterface public const MAX_SCHEMA_MSG = 'No config specified for max_schema_errors'; public const XML_VALID_EXCLUDE_MSG = 'No config specified for xml messages to exclude'; public const XML_NS_MSG = 'No config specified for xml ns'; + public const XML_VERSION_MSG = 'No config specified for erru version'; /** * invoke method @@ -40,13 +41,19 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o if (!isset($config['xml_valid_message_exclude'])) { throw new \RuntimeException(self::XML_VALID_EXCLUDE_MSG); } + if (!isset($config['nr']['compliance_episode']['erruVersion'])) { + throw new \RuntimeException(self::XML_NS_MSG); + } + + $xsd = $config['nr']['compliance_episode']['xmlNs'] . $config['nr']['compliance_episode']['erruVersion']; + $service = new Input('xml_structure'); $filterChain = $service->getFilterChain(); $filterChain->attach($container->get('FilterManager')->get(ParseXmlString::class)); $validatorChain = $service->getValidatorChain(); /** @var Xsd $xsdValidator */ $xsdValidator = $container->get('ValidatorManager')->get(Xsd::class); - $xsdValidator->setXsd($config['nr']['compliance_episode']['xmlNs']); + $xsdValidator->setXsd($xsd); $xsdValidator->setMaxErrors($config['nr']['max_schema_errors']); $xsdValidator->setXmlMessageExclude($config['xml_valid_message_exclude']); $validatorChain->attach($xsdValidator); diff --git a/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXml.php b/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXml.php index 2e58ff8b58..ebec89088c 100644 --- a/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXml.php +++ b/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXml.php @@ -8,11 +8,6 @@ use Olcs\XmlTools\Xml\Specification\RecursionAttribute; use Olcs\XmlTools\Xml\Specification\RecursionValue; -/** - * Class ComplianceEpisodeXml - * @package Dvsa\Olcs\Api\Service\Nr\Mapping - * @author Ian Lindsay - */ class ComplianceEpisodeXml { protected $nsPrefix; @@ -43,14 +38,7 @@ public function mapData(\DOMDocument $domDocument) return $this->mapXmlFile->filter($domDocument); } - /** - * calculate the ns prefix - * - * @param \DOMDocument $domDocument dom document - * - * @return string|null - */ - private function calculateNsPrefix(\DOMDocument $domDocument) + private function calculateNsPrefix(\DOMDocument $domDocument): ?string { $nsPrefix = $domDocument->documentElement->lookupPrefix($this->xmlNs); $this->nsPrefix = ($nsPrefix !== null ? $nsPrefix . ':' : null); @@ -60,10 +48,8 @@ private function calculateNsPrefix(\DOMDocument $domDocument) /** * Gets information to create the serious infringement - * - * @return array */ - protected function getSeriousInfringement() + protected function getSeriousInfringement(): array { return [ $this->nsPrefix . 'Header' => [ @@ -74,13 +60,23 @@ protected function getSeriousInfringement() $this->nsPrefix . 'Body' => [ new NodeAttribute('notificationNumber', 'businessCaseId'), new NodeAttribute('originatingAuthority', 'originatingAuthority'), - new NodeAttribute('notificationDateTime', 'notificationDateTime'), new Recursion( $this->nsPrefix . 'TransportUndertaking', [ new NodeAttribute('communityLicenceNumber', 'communityLicenceNumber'), - new NodeAttribute('vrm', 'vehicleRegNumber'), - new NodeAttribute('transportUndertakingName', 'name'), + new NodeAttribute('transportUndertakingName', 'transportUndertakingName'), + new Recursion( + $this->nsPrefix . 'Vehicle', + [ + new NodeAttribute('vrm', 'vehicleRegistrationNumber') + ] + ), + new Recursion( + $this->nsPrefix . 'CheckSummary', + [ + new NodeAttribute('checkDate', 'dateOfCheck') + ] + ), $this->getSi() ] ) @@ -88,19 +84,23 @@ protected function getSeriousInfringement() ]; } - /** - * Gets Si information - * - * @return RecursionValue - */ - protected function getSi() + private function getSi(): RecursionValue { $spec = [ new NodeAttribute(['infringementDate'], 'dateOfInfringement'), new NodeAttribute(['siCategoryType'], 'infringementType'), - new NodeAttribute(['checkDate'], 'dateOfCheck'), - $this->getPenaltiesImposed(), - $this->getPenaltiesRequested() + new Recursion( + $this->nsPrefix . 'PenaltiesImposed', + [ + $this->getPenaltiesImposed(), + ], + ), + new Recursion( + $this->nsPrefix . 'PenaltiesRequested', + [ + $this->getPenaltiesRequested(), + ], + ), ]; return new RecursionValue( @@ -109,14 +109,10 @@ protected function getSi() ); } - /** - * Gets imposed penalty data - * - * @return RecursionValue - */ - protected function getPenaltiesImposed() + private function getPenaltiesImposed(): RecursionValue { $spec = [ + new NodeAttribute('penaltyImposedIdentifier', 'penaltyImposedIdentifier'), new NodeAttribute('finalDecisionDate', 'finalDecisionDate'), new NodeAttribute('siPenaltyImposedType', 'penaltyTypeImposed'), new NodeAttribute('startDate', 'startDate'), @@ -130,14 +126,10 @@ protected function getPenaltiesImposed() ); } - /** - * Gets requested penalty data - * - * @return RecursionValue - */ - protected function getPenaltiesRequested() + private function getPenaltiesRequested(): RecursionValue { $spec = [ + new NodeAttribute('penaltyRequestedIdentifier', 'penaltyRequestedIdentifier'), new NodeAttribute('siPenaltyRequestedType', 'penaltyTypeRequested'), new NodeAttribute('duration', 'duration'), ]; diff --git a/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactory.php b/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactory.php index 23a76688e4..74ab93f035 100644 --- a/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactory.php +++ b/app/api/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactory.php @@ -27,9 +27,17 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o { $config = $container->get('config'); if (!isset($config['nr']['compliance_episode']['xmlNs'])) { - throw new \RuntimeException('Missing INR service config'); + throw new \RuntimeException('Missing xmlNs for INR config'); } + + if (!isset($config['nr']['compliance_episode']['erruVersion'])) { + throw new \RuntimeException('Missing erruVersion for INR config'); + } + + $ns = $config['nr']['compliance_episode']['xmlNs']; + $erruVersion = $config['nr']['compliance_episode']['erruVersion']; + $mapXmlFile = $container->get('FilterManager')->get(MapXmlFile::class); - return new ComplianceEpisodeXml($mapXmlFile, $config['nr']['compliance_episode']['xmlNs']); + return new ComplianceEpisodeXml($mapXmlFile, $ns . $erruVersion); } } diff --git a/app/api/module/Api/src/Service/Nr/MsiResponse.php b/app/api/module/Api/src/Service/Nr/MsiResponse.php index 3987058b65..f364d827e9 100644 --- a/app/api/module/Api/src/Service/Nr/MsiResponse.php +++ b/app/api/module/Api/src/Service/Nr/MsiResponse.php @@ -11,11 +11,6 @@ use Dvsa\Olcs\Api\Domain\Exception\ForbiddenException; use Olcs\XmlTools\Xml\XmlNodeBuilder; -/** - * Class MsiResponse - * @package Dvsa\Olcs\Api\Service\Nr - * @author Ian Lindsay - */ class MsiResponse { public const AUTHORITY_TRU = 'Transport Regulation Unit'; @@ -24,7 +19,9 @@ class MsiResponse /** * @var string $responseDateTime */ - private $responseDateTime; + private string $responseDateTime = ''; + + private string $timeoutDateTime = ''; /** * @var String @@ -43,42 +40,35 @@ class MsiResponse * * @return MsiResponse */ - public function __construct(private readonly XmlNodeBuilder $xmlBuilder) + public function __construct(private readonly XmlNodeBuilder $xmlBuilder, private readonly string $erruVersion) { } - /** - * Gets xml node builder - * - * @return XmlNodeBuilder - */ - public function getXmlBuilder() + public function getXmlBuilder(): XmlNodeBuilder { return $this->xmlBuilder; } - /** - * Gets the response date and time - * - * @return mixed - */ - public function getResponseDateTime() + public function getResponseDateTime(): string { return $this->responseDateTime; } - /** - * Sets the response date and time - * - * @param string $responseDateTime response date and time - * - * @return void - */ - public function setResponseDateTime($responseDateTime) + public function setResponseDateTime(string $responseDateTime): void { $this->responseDateTime = $responseDateTime; } + public function setTimeoutDateTime(string $timeoutDateTime): void + { + $this->timeoutDateTime = $timeoutDateTime; + } + + public function getTimeoutDateTime(): string + { + return $this->timeoutDateTime; + } + /** * Gets the technical id * @@ -126,12 +116,9 @@ public function setAuthority($authority) /** * Creates the Msi response, returns xml string * - * @param CasesEntity $case the case - * - * @return string * @throws ForbiddenException */ - public function create(CasesEntity $case) + public function create(CasesEntity $case): string { if (!$case->canSendMsiResponse()) { throw new ForbiddenException('Unable to send Msi Response'); @@ -139,7 +126,8 @@ public function create(CasesEntity $case) $this->setTechnicalId($this->generateGuid()); $dateTime = new DateTimeExtended(); - $this->setResponseDateTime($dateTime->format(\DateTime::ISO8601)); + $this->setResponseDateTime($dateTime->format(\DateTime::ATOM)); + $this->setTimeoutDateTime($dateTime->add(new \DateInterval('PT10S'))->format(\DateTime::ATOM)); if ($case->getLicence() === null) { $this->setAuthority(self::AUTHORITY_TRU); @@ -160,12 +148,8 @@ public function create(CasesEntity $case) /** * Fetches array of header information for the XML - * - * @param ErruRequestEntity $erruRequest erru request - * - * @return array */ - private function getHeader(ErruRequestEntity $erruRequest) + private function getHeader(ErruRequestEntity $erruRequest): array { //if member state was GB, we need to make this UK $memberStateCode = $erruRequest->getMemberStateCode()->getId(); @@ -174,52 +158,54 @@ private function getHeader(ErruRequestEntity $erruRequest) return [ 'name' => 'Header', 'attributes' => [ + 'version' => $this->erruVersion, 'technicalId' => $this->getTechnicalId(), 'workflowId' => $erruRequest->getWorkflowId(), 'sentAt' => $this->getResponseDateTime(), - 'from' => 'UK' + 'timeoutValue' => $this->timeoutDateTime, + 'from' => 'UK', + 'to' => $filteredMemberStateCode ], - 'nodes' => [ - 0 => [ - 'name' => 'To', - 'nodes' => [ - 0 => [ - 'name' => 'MemberState', - 'attributes' => [ - 'code' => $filteredMemberStateCode - ] - ] - ] - ] - ] ]; } /** * Fetches array of information for the xml body - * - * @param CasesEntity $cases case entity - * @param ErruRequestEntity $erruRequest erru request entity - * - * @return array */ - private function getBody(CasesEntity $cases, ErruRequestEntity $erruRequest) + private function getBody(CasesEntity $cases, ErruRequestEntity $erruRequest): array { return [ 'name' => 'Body', 'attributes' => [ 'businessCaseId' => $erruRequest->getNotificationNumber(), 'originatingAuthority' => $erruRequest->getOriginatingAuthority(), - 'licensingAuthority' => $this->getAuthority(), - 'responseDateTime' => $this->getResponseDateTime() + 'respondingAuthority' => $this->getAuthority(), + 'statusCode' => 'OK', ], 'nodes' => [ 0 => [ 'name' => 'TransportUndertaking', 'attributes' => [ - 'name' => $erruRequest->getTransportUndertakingName() + 'transportUndertakingName' => $erruRequest->getTransportUndertakingName(), + 'communityLicenceNumber' => $erruRequest->getCommunityLicenceNumber(), + 'communityLicenceStatus' => $erruRequest->getCommunityLicenceStatus()->getDescription(), + 'numberOfVehicles' => $erruRequest->getTotAuthVehicles(), ], - 'nodes' => $this->formatPenalties($cases->getSeriousInfringements()) + 'nodes' => [ + 0 => [ + 'name' => 'TransportUndertakingAddress', + 'attributes' => [ + 'address' => 'address', + 'postcode' => 'postcode', + 'city' => 'city', + 'country' => 'UK', + ], + ], + ], + ], + 1 => [ + 'name'=> 'PenaltiesImposed', + 'nodes' => $this->formatPenalties($cases->getSeriousInfringements()), ] ] ]; @@ -227,12 +213,8 @@ private function getBody(CasesEntity $cases, ErruRequestEntity $erruRequest) /** * Formats penalty information into something usable by xml node builder - * - * @param CollectionInterface $seriousInfringements collection of serious infringements - * - * @return array */ - private function formatPenalties(CollectionInterface $seriousInfringements) + private function formatPenalties(CollectionInterface $seriousInfringements): array { $formattedPenalties = []; @@ -249,10 +231,10 @@ private function formatPenalties(CollectionInterface $seriousInfringements) $newPenalty['penaltyTypeImposed'] = $penalty->getSiPenaltyType()->getId(); if ($penalty->getImposed() === 'N') { - $newPenalty['isImposed'] = 'No'; + $newPenalty['isImposed'] = 'false'; $newPenalty['reasonNotImposed'] = $penalty->getReasonNotImposed(); } else { - $newPenalty['isImposed'] = 'Yes'; + $newPenalty['isImposed'] = 'true'; } $startDate = $penalty->getStartDate(); @@ -276,12 +258,7 @@ private function formatPenalties(CollectionInterface $seriousInfringements) return $formattedPenalties; } - /** - * Generate a GUID - * - * @return string - */ - private function generateGuid() + private function generateGuid(): string { // com_create_guid is unavailable on our environments return sprintf( diff --git a/app/api/module/Api/src/Service/Nr/MsiResponseFactory.php b/app/api/module/Api/src/Service/Nr/MsiResponseFactory.php index 1d71f2f421..7d2f48101b 100644 --- a/app/api/module/Api/src/Service/Nr/MsiResponseFactory.php +++ b/app/api/module/Api/src/Service/Nr/MsiResponseFactory.php @@ -6,13 +6,10 @@ use Laminas\ServiceManager\Factory\FactoryInterface; use Psr\Container\ContainerInterface; -/** - * Class MsiResponseFactory - * @package Dvsa\Olcs\Api\Service\Nr - */ class MsiResponseFactory implements FactoryInterface { public const XML_NS_MSG = 'No config specified for xml ns'; + public const XML_VERSION_MSG = 'No config specified for erru version'; /** * invoke method @@ -30,7 +27,15 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o if (!isset($config['nr']['compliance_episode']['xmlNs'])) { throw new \RuntimeException(self::XML_NS_MSG); } - $xmlBuilder = new XmlNodeBuilder('MS2ERRU_Infringement_Res', $config['nr']['compliance_episode']['xmlNs'], []); - return new MsiResponse($xmlBuilder); + + if (!isset($config['nr']['compliance_episode']['erruVersion'])) { + throw new \RuntimeException(self::XML_VERSION_MSG); + } + + $ns = $config['nr']['compliance_episode']['xmlNs']; + $erruVersion = $config['nr']['compliance_episode']['erruVersion']; + + $xmlBuilder = new XmlNodeBuilder('NotifyCheckResult_Response', $ns . $erruVersion, []); + return new MsiResponse($xmlBuilder, $erruVersion); } } diff --git a/app/api/module/Email/view/email/cy_GB/html/erru-failure.phtml b/app/api/module/Email/view/email/cy_GB/html/erru-failure.phtml index 701c52d2fd..f8a7f72d5c 100644 --- a/app/api/module/Email/view/email/cy_GB/html/erru-failure.phtml +++ b/app/api/module/Email/view/email/cy_GB/html/erru-failure.phtml @@ -9,7 +9,6 @@ Wedi'i anfon am: escapeHtml($this->sentAt); ?>
Oddi wrth MS: escapeHtml($this->memberState); ?>
Awdurdod Gwreiddiol: escapeHtml($this->originatingAuthority); ?>
- Dyddiad/amser cydnabod: escapeHtml($this->notificationDateTime); ?>

Nesgeseuon gwall: @@ -20,4 +19,4 @@

-

(Gweler y ffeil gysylltiedig: escapeHtml($this->filename); ?>)

\ No newline at end of file +

(Gweler y ffeil gysylltiedig: escapeHtml($this->filename); ?>)

diff --git a/app/api/module/Email/view/email/cy_GB/plain/erru-failure.phtml b/app/api/module/Email/view/email/cy_GB/plain/erru-failure.phtml index e3245fed27..57a107a379 100644 --- a/app/api/module/Email/view/email/cy_GB/plain/erru-failure.phtml +++ b/app/api/module/Email/view/email/cy_GB/plain/erru-failure.phtml @@ -8,14 +8,13 @@ ID achos busnes: notificationNumber; ?> Wedi'i anfon am: sentAt; ?> Oddi wrth MS: memberState; ?> Awdurdod Gwreiddiol: originatingAuthority; ?> -Dyddiad/amser cydnabod: notificationDateTime; ?> Nesgeseuon gwall: -errorMessages as $message) { - echo '*' . $message. "\n"; -} +errorMessages as $message) { + echo '*' . $message. "\n"; +} ?> -(Gweler y ffeil gysylltiedig: filename; ?>) \ No newline at end of file +(Gweler y ffeil gysylltiedig: filename; ?>) diff --git a/app/api/module/Email/view/email/en_GB/html/erru-failure.phtml b/app/api/module/Email/view/email/en_GB/html/erru-failure.phtml index 58609a7f96..416b89f255 100644 --- a/app/api/module/Email/view/email/en_GB/html/erru-failure.phtml +++ b/app/api/module/Email/view/email/en_GB/html/erru-failure.phtml @@ -11,7 +11,6 @@ Business case id: escapeHtml($this->notificationNumber); ?>
escapeHtml($this->sentAt); ?>
From MS: escapeHtml($this->memberState); ?>
Originating authority: escapeHtml($this->originatingAuthority); ?>
-Acknowledgement date/time: escapeHtml($this->notificationDateTime); ?>

Error messages: @@ -22,4 +21,4 @@ Acknowledgement date/time: escapeHtml($this->notificationDateT

-

(See attached file: escapeHtml($this->filename); ?>)

\ No newline at end of file +

(See attached file: escapeHtml($this->filename); ?>)

diff --git a/app/api/module/Email/view/email/en_GB/plain/erru-failure.phtml b/app/api/module/Email/view/email/en_GB/plain/erru-failure.phtml index e6de0ff245..b78fc9bd15 100644 --- a/app/api/module/Email/view/email/en_GB/plain/erru-failure.phtml +++ b/app/api/module/Email/view/email/en_GB/plain/erru-failure.phtml @@ -8,7 +8,6 @@ Business case id: escapeHtml($this->notificationNumber); ?> Sent at: escapeHtml($this->sentAt); ?> From MS: escapeHtml($this->memberState); ?> Originating authority: escapeHtml($this->originatingAuthority); ?> -Acknowledgement date/time: escapeHtml($this->notificationDateTime); ?> Error messages: @@ -17,4 +16,4 @@ Error messages: echo '*' . $message . "\n"; } ?> -(See attached file: escapeHtml($this->filename); ?>) \ No newline at end of file +(See attached file: escapeHtml($this->filename); ?>) diff --git a/app/api/test/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisodeTest.php b/app/api/test/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisodeTest.php index 8862ec344d..f7771e4f4a 100644 --- a/app/api/test/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisodeTest.php +++ b/app/api/test/module/Api/src/Domain/CommandHandler/Cases/Si/ComplianceEpisodeTest.php @@ -1,8 +1,11 @@ - */ class ComplianceEpisodeTest extends AbstractCommandHandlerTestCase { public function setUp(): void @@ -77,6 +75,7 @@ protected function initReferences() CasesEntity::LICENCE_CASE_TYPE, ErruRequestEntity::DEFAULT_CASE_TYPE, CasesEntity::ERRU_DEFAULT_CASE_CATEGORY, + CommunityLic::STATUS_ACTIVE, 'pen_erru_imposed_executed_yes' ]; @@ -112,6 +111,9 @@ public function testHandleCommand() $vrm = 'ABC123'; $transportUndertakingName = 'transport undertaking'; $memberStateCode = 'PL'; + $checkDate = '2015-12-24'; + $communityLicenceNumber = 'UKGB/OB1234567/00001'; + $totAuthVehicles = 10; //imposed erru $siPenaltyImposedType = 102; @@ -122,6 +124,7 @@ public function testHandleCommand() $executedRefData = 'pen_erru_imposed_executed_yes'; $imposedErru = [ + 'penaltyImposedIdentifier' => 1111, 'finalDecisionDate' => $finalDecisionDate, 'siPenaltyImposedType' => $siPenaltyImposedType, 'startDate' => $startDate, @@ -130,6 +133,7 @@ public function testHandleCommand() ]; $filteredImposedErru = [ + 'penaltyImposedIdentifier' => 1111, 'finalDecisionDate' => new \DateTime($finalDecisionDate . ' 00:00:00'), 'siPenaltyImposedType' => $siPenaltyImposedType, 'startDate' => new \DateTime($startDate . ' 00:00:00'), @@ -142,19 +146,18 @@ public function testHandleCommand() $duration = 12; $requestedErru = [ + 'penaltyRequestedIdentifier' => 2222, 'siPenaltyRequestedType' => $siPenaltyRequestedType, 'duration' => $duration ]; //serious infringement $infringementDate = '2015-12-25'; - $checkDate = '2015-12-24'; $siCategoryType = 101; $si = [ 'infringementDate' => $infringementDate, 'siCategoryType' => $siCategoryType, - 'checkDate' => $checkDate, 'imposedErrus' => [ 0 => $imposedErru ], @@ -166,7 +169,6 @@ public function testHandleCommand() $filteredSi = [ 'infringementDate' => new \DateTime($infringementDate . ' 00:00:00'), 'siCategoryType' => $siCategoryType, - 'checkDate' => new \DateTime($checkDate . ' 00:00:00'), 'imposedErrus' => [ 0 => $filteredImposedErru ], @@ -183,7 +185,9 @@ public function testHandleCommand() 'notificationNumber' => $notificationNumber, 'originatingAuthority' => $originatingAuthority, 'licenceNumber' => $licenceNumber, + 'communityLicenceNumber' => $communityLicenceNumber, 'vrm' => $vrm, + 'checkDate' => $checkDate, 'transportUndertakingName' => $transportUndertakingName, 'si' => [ 0 => $si @@ -195,60 +199,54 @@ public function testHandleCommand() $licenceEntity = m::mock(LicenceEntity::class); $licenceEntity->shouldReceive('getId')->times(2)->andReturn($licenceId); + $licenceEntity->expects('getTotAuthVehicles')->withNoArgs()->andReturn($totAuthVehicles); $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) ->andReturn($licenceEntity); $countryEntity = m::mock(CountryEntity::class); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andReturn($countryEntity); $siCategoryTypeEntity = m::mock(SiCategoryTypeEntity::class); $this->repoMap['SiCategoryType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siCategoryType) ->andReturn($siCategoryTypeEntity); $siCategoryEntity = m::mock(SiCategoryEntity::class); $this->repoMap['SiCategory'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with(SiCategoryEntity::ERRU_DEFAULT_CATEGORY) ->andReturn($siCategoryEntity); $siPenaltyImposedTypeEntity = m::mock(SiPenaltyImposedTypeEntity::class); $this->repoMap['SiPenaltyImposedType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siPenaltyImposedType) ->andReturn($siPenaltyImposedTypeEntity); $siPenaltyRequestedTypeEntity = m::mock(SiPenaltyRequestedTypeEntity::class); $this->repoMap['SiPenaltyRequestedType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siPenaltyRequestedType) ->andReturn($siPenaltyRequestedTypeEntity); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(false); - $this->repoMap['Cases']->shouldReceive('save')->once()->with(m::type(CasesEntity::class)); + $this->repoMap['Cases']->expects('save')->with(m::type(CasesEntity::class)); $taskResult = new Result(); $taskResult->addId('task', 88); @@ -293,8 +291,11 @@ public function testErrorsForDoctrinePenaltyAndCategoryData() $this->fetchDocumentAndXml($command, $xmlString, $documentId); $licenceNumber = 'OB1234567'; + $communityLicenceNumber = 'UKGB/OB1234567/00001'; + $totAuthVehicles = 10; $workflowId = '0ffefb6b-6344-4a60-9a53-4381c32f98d9'; $siCategoryType = 101; + $checkDate = '2015-12-24'; //imposed erru $siPenaltyImposedType = 102; @@ -329,20 +330,17 @@ public function testErrorsForDoctrinePenaltyAndCategoryData() $this->validSiInput($si, $filteredSi); $this->repoMap['SiCategoryType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siCategoryType) ->andThrow(NotFoundException::class); $this->repoMap['SiPenaltyImposedType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siPenaltyImposedType) ->andThrow(NotFoundException::class); $this->repoMap['SiPenaltyRequestedType'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($siPenaltyRequestedType) ->andThrow(NotFoundException::class); @@ -350,6 +348,8 @@ public function testErrorsForDoctrinePenaltyAndCategoryData() $erruData = [ 'licenceNumber' => $licenceNumber, + 'communityLicenceNumber' => $communityLicenceNumber, + 'checkDate' => $checkDate, 'workflowId' => $workflowId, 'memberStateCode' => $memberStateCode, 'originatingAuthority' => 'originating authority', @@ -364,22 +364,22 @@ public function testErrorsForDoctrinePenaltyAndCategoryData() $this->validInitialInput($xmlString, $xmlData, $erruData, new \DOMDocument()); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(false); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andReturn(m::mock(CountryEntity::class)); + $licence = m::mock(LicenceEntity::class); + $licence->expects('getTotAuthVehicles')->withNoArgs()->andReturn($totAuthVehicles); + $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) - ->andReturn(m::mock(LicenceEntity::class)); + ->andReturn($licence); $this->handleErrors(); @@ -426,20 +426,17 @@ public function testErrorsForMissingLicenceData() $licenceError = 'licence not found error'; $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) ->andThrow(NotFoundException::class, $licenceError); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andReturn(m::mock(CountryEntity::class)); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(false); @@ -481,20 +478,17 @@ public function testErrorsForMissingMemberState() $this->validInitialInput($xmlString, $xmlData, $erruData, new \DOMDocument()); $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) ->andReturn(m::mock(LicenceEntity::class)); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andThrow(NotFoundException::class); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(false); @@ -537,20 +531,17 @@ public function testErrorsForExistingErruRequest() $this->validInitialInput($xmlString, $xmlData, $erruData, new \DOMDocument()); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(true); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andReturn(m::mock(CountryEntity::class)); $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) ->andReturn(m::mock(LicenceEntity::class)); @@ -580,13 +571,18 @@ public function testErrorsForSeriousInfringementInputFailure() $this->fetchDocumentAndXml($command, $xmlString, $documentId); $licenceNumber = 'OB1234567'; + $communityLicenceNumber = 'UKGB/OB1234567/00001'; + $totAuthVehicles = 10; $workflowId = '0ffefb6b-6344-4a60-9a53-4381c32f98d9'; + $checkDate = '2015-12-24'; $si = ['si']; $xmlData = ['array of pre-filtered xml data']; $erruData = [ 'licenceNumber' => $licenceNumber, + 'communityLicenceNumber' => $communityLicenceNumber, + 'checkDate' => $checkDate, 'workflowId' => $workflowId, 'memberStateCode' => $memberStateCode, 'originatingAuthority' => 'originating authority', @@ -601,32 +597,30 @@ public function testErrorsForSeriousInfringementInputFailure() $this->validInitialInput($xmlString, $xmlData, $erruData, new \DOMDocument()); $this->repoMap['ErruRequest'] - ->shouldReceive('existsByWorkflowId') - ->once() + ->expects('existsByWorkflowId') ->with($workflowId) ->andReturn(false); $this->repoMap['Country'] - ->shouldReceive('fetchById') - ->once() + ->expects('fetchById') ->with($memberStateCode) ->andReturn(m::mock(CountryEntity::class)); + $licence = m::mock(LicenceEntity::class); + $licence->expects('getTotAuthVehicles')->withNoArgs()->andReturn($totAuthVehicles); + $this->repoMap['Licence'] - ->shouldReceive('fetchByLicNoWithoutAdditionalData') - ->once() + ->expects('fetchByLicNoWithoutAdditionalData') ->with($licenceNumber) - ->andReturn(m::mock(LicenceEntity::class)); + ->andReturn($licence); $this->mockedSmServices['SeriousInfringementInput'] - ->shouldReceive('setValue') - ->once() + ->expects('setValue') ->with($si) ->andReturnSelf(); $this->mockedSmServices['SeriousInfringementInput'] - ->shouldReceive('isValid') - ->once() + ->expects('isValid') ->with([]) ->andReturn(false); @@ -634,7 +628,6 @@ public function testErrorsForSeriousInfringementInputFailure() $this->mockedSmServices['SeriousInfringementInput'] ->shouldReceive('getMessages') - ->once() ->andReturn($inputFilterErrors); $this->handleErrors(); @@ -658,22 +651,19 @@ public function testErrorsForXmlInputFailure() $this->fetchDocumentAndXml($command, $xmlString, $documentId); $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('setValue') + ->expects('setValue') ->with($xmlString) - ->once() ->andReturnSelf(); $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('isValid') + ->expects('isValid') ->with([]) - ->once() ->andReturn(false); $inputFilterErrors = ['message 1', 'message2']; $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('getMessages') - ->once() + ->expects('getMessages') ->andReturn($inputFilterErrors); $this->handleErrors(); @@ -704,22 +694,19 @@ public function testErrorsForComplianceEpisodeInputFailure() $this->mapXmlFile($xmlData, $xmlDomDocument); $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('setValue') - ->once() + ->expects('setValue') ->with($xmlData) ->andReturnSelf(); $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('isValid') - ->once() + ->expects('isValid') ->with([]) ->andReturn(false); $inputFilterErrors = ['message 1', 'message2']; $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('getMessages') - ->once() + ->expects('getMessages') ->andReturn($inputFilterErrors); $this->handleErrors(); @@ -739,8 +726,7 @@ private function handleErrors() $erruFailureId = 12345; $this->repoMap['ErruRequestFailure'] - ->shouldReceive('save') - ->once() + ->expects('save') ->with(m::type(ErruRequestFailure::class)) ->andReturnUsing( function (ErruRequestFailure $erruRequestFailure) use (&$savedErruRequestFailure) { @@ -771,16 +757,14 @@ private function fetchDocumentAndXml($command, $xmlString, $documentId, $documen $documentEntity->shouldReceive('getId')->times($documentIdTimes)->andReturn($documentId); $this->repoMap['Document'] - ->shouldReceive('fetchUsingId') - ->once() + ->expects('fetchUsingId') ->with($command)->andReturn($documentEntity); $xmlFile = m::mock(File::class); $xmlFile->shouldReceive('getContent')->once()->andReturn($xmlString); $this->mockedSmServices['FileUploader'] - ->shouldReceive('download') - ->once() + ->expects('download') ->with($docIdentifier) ->andReturn($xmlFile); } @@ -806,20 +790,17 @@ private function validInitialInput($xmlString, $xmlData, $erruData, $xmlDomDocum private function validXml($xmlString, $xmlDomDocument) { $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('setValue') - ->once() + ->expects('setValue') ->with($xmlString) ->andReturnSelf(); $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('isValid') - ->once() + ->expects('isValid') ->with([]) ->andReturn(true); $this->mockedSmServices['ComplianceXmlStructure'] - ->shouldReceive('getValue') - ->once() + ->expects('getValue') ->andReturn($xmlDomDocument); } @@ -832,20 +813,17 @@ private function validXml($xmlString, $xmlDomDocument) private function validComplianceEpisodeInput($erruData, $xmlData) { $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('setValue') - ->once() + ->expects('setValue') ->with($xmlData) ->andReturnSelf(); $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('isValid') - ->once() + ->expects('isValid') ->with([]) ->andReturn(true); $this->mockedSmServices['ComplianceEpisodeInput'] - ->shouldReceive('getValue') - ->once() + ->expects('getValue') ->andReturn($erruData); } @@ -856,20 +834,17 @@ private function validComplianceEpisodeInput($erruData, $xmlData) private function validSiInput($si, $filteredSi) { $this->mockedSmServices['SeriousInfringementInput'] - ->shouldReceive('setValue') - ->once() + ->expects('setValue') ->with($si) ->andReturnSelf(); $this->mockedSmServices['SeriousInfringementInput'] - ->shouldReceive('isValid') - ->once() + ->expects('isValid') ->with([]) ->andReturn(true); $this->mockedSmServices['SeriousInfringementInput'] - ->shouldReceive('getValue') - ->once() + ->expects('getValue') ->andReturn($filteredSi); } diff --git a/app/api/test/module/Api/src/Domain/CommandHandler/Email/SendErruErrorsTest.php b/app/api/test/module/Api/src/Domain/CommandHandler/Email/SendErruErrorsTest.php index ac450dbda3..0746d42e5e 100644 --- a/app/api/test/module/Api/src/Domain/CommandHandler/Email/SendErruErrorsTest.php +++ b/app/api/test/module/Api/src/Domain/CommandHandler/Email/SendErruErrorsTest.php @@ -56,21 +56,16 @@ public function testHandleCommand() $documentId = 5678; $sentAt = '2014-02-20T16:22:09Z'; - $notificationDate = '2014-02-20T16:20:12Z'; $sentDateTime = new \DateTime($sentAt); $formattedSentAt = $sentDateTime->format(SendErruErrors::BODY_DATE_FORMAT); $subjectSentAt = $sentDateTime->format(SendErruErrors::SUBJECT_DATE_FORMAT); - $notificationDateTime = new \DateTime($notificationDate); - $formattedNotificationDate = $notificationDateTime->format(SendErruErrors::BODY_DATE_FORMAT); - $inputData = [ 'notificationNumber' => $notificationNumber, 'memberStateCode' => $memberStateCode, 'originatingAuthority' => $originatingAuthority, 'sentAt' => $sentAt, - 'notificationDateTime' => $notificationDate ]; $inputJson = Json::encode($inputData); @@ -103,7 +98,6 @@ public function testHandleCommand() 'notificationNumber' => $notificationNumber, 'memberState' => $memberStateCode, 'originatingAuthority' => $originatingAuthority, - 'notificationDateTime' => $formattedNotificationDate, 'errorMessages' => $errors, 'filename' => $filename ], @@ -165,7 +159,6 @@ public function testHandleCommandWithNoInputData() 'notificationNumber' => SendErruErrors::MISSING_INPUT, 'memberState' => SendErruErrors::MISSING_INPUT, 'originatingAuthority' => SendErruErrors::MISSING_INPUT, - 'notificationDateTime' => SendErruErrors::MISSING_INPUT, 'errorMessages' => $errors, 'filename' => $filename ], diff --git a/app/api/test/module/Api/src/Entity/Si/ErruRequestEntityTest.php b/app/api/test/module/Api/src/Entity/Si/ErruRequestEntityTest.php index 1014497544..4f03655446 100644 --- a/app/api/test/module/Api/src/Entity/Si/ErruRequestEntityTest.php +++ b/app/api/test/module/Api/src/Entity/Si/ErruRequestEntityTest.php @@ -39,12 +39,18 @@ public function testCreate() $vrm = 'vrm'; $notificationNumber = '0ffefb6b-6344-4a60-9a53-4381c32f98d9'; $workflowId = '20776dc3-5fe7-42d5-b554-09ad12fa25c4'; + $communityLicenceStatus = m::mock(RefData::class); + $communityLicenceNumber = 'UKGB/OB1234567/00000'; + $totAuthVehicles = 10; $entity = new Entity( $case, $msiType, $memberStateCode, $requestDocument, + $communityLicenceStatus, + $communityLicenceNumber, + $totAuthVehicles, $originatingAuthority, $transportUndertakingName, $vrm, @@ -61,6 +67,9 @@ public function testCreate() $this->assertEquals($vrm, $entity->getVrm()); $this->assertEquals($notificationNumber, $entity->getNotificationNumber()); $this->assertEquals($workflowId, $entity->getWorkflowId()); + $this->assertEquals($totAuthVehicles, $entity->getTotAuthVehicles()); + $this->assertEquals($communityLicenceStatus, $entity->getCommunityLicenceStatus()); + $this->assertEquals($communityLicenceNumber, $entity->getCommunityLicenceNumber()); } /** diff --git a/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruImposedEntityTest.php b/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruImposedEntityTest.php index 72727d2903..6a2b3717ea 100644 --- a/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruImposedEntityTest.php +++ b/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruImposedEntityTest.php @@ -1,5 +1,7 @@ assertEquals($siPenaltyImposedType, $entity->getSiPenaltyImposedType()); $this->assertEquals($executed, $entity->getExecuted()); $this->assertEquals($startDate, $entity->getStartDate()); $this->assertEquals($endDate, $entity->getEndDate()); $this->assertEquals($finalDecisionDate, $entity->getFinalDecisionDate()); + $this->assertEquals($penaltyImposedIdentifier, $entity->getPenaltyImposedIdentifier()); } } diff --git a/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruRequestedEntityTest.php b/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruRequestedEntityTest.php index 5b7b68a2b1..1d7cae23bc 100644 --- a/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruRequestedEntityTest.php +++ b/app/api/test/module/Api/src/Entity/Si/SiPenaltyErruRequestedEntityTest.php @@ -1,5 +1,7 @@ assertEquals($si, $entity->getSeriousInfringement()); $this->assertEquals($siPenaltyRequestedType, $entity->getSiPenaltyRequestedType()); $this->assertEquals($duration, $entity->getDuration()); + $this->assertEquals($penaltyRequestedIdentifier, $entity->getPenaltyRequestedIdentifier()); } } diff --git a/app/api/test/module/Api/src/Service/Nr/Filter/Format/SiDatesTest.php b/app/api/test/module/Api/src/Service/Nr/Filter/Format/SiDatesTest.php index a016d9d51d..59ec58b117 100644 --- a/app/api/test/module/Api/src/Service/Nr/Filter/Format/SiDatesTest.php +++ b/app/api/test/module/Api/src/Service/Nr/Filter/Format/SiDatesTest.php @@ -1,33 +1,25 @@ '2015-12-23', 'infringementDate' => '2015-12-24', 'imposedErrus' => [0 => $inputPenaltyDates] ]; $expectedOutput = [ - 'checkDate' => new \DateTime('2015-12-23 00:00:00'), 'infringementDate' => new \DateTime('2015-12-24 00:00:00'), 'imposedErrus' => [0 => $expectedPenaltyDates] ]; @@ -39,7 +31,7 @@ public function testFilter($inputPenaltyDates, $expectedPenaltyDates) /** * data provider for testFilterProvider */ - public function filterProvider() + public function filterProvider(): array { return [ [ diff --git a/app/api/test/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactoryTest.php b/app/api/test/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactoryTest.php index 1e21f8baa9..281edfcb16 100644 --- a/app/api/test/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactoryTest.php +++ b/app/api/test/module/Api/src/Service/Nr/InputFilter/XmlStructureInputFactoryTest.php @@ -18,12 +18,14 @@ public function testInvoke(): void { $xmlExclude = ['strings']; $maxSchemaErrors = 10; - $xmlNs = 'https://webgate.ec.testa.eu/erru/1.0'; + $xmlNs = 'https://webgate.ec.testa.eu/move-hub/erru/'; + $erruVersion = '3.1'; $config = [ 'nr' => [ 'compliance_episode' => [ - 'xmlNs' => $xmlNs + 'xmlNs' => $xmlNs, + 'erruVersion' => $erruVersion, ], 'max_schema_errors' => $maxSchemaErrors ], @@ -31,7 +33,7 @@ public function testInvoke(): void ]; $mockXsdValidator = m::mock(\Laminas\Validator\AbstractValidator::class); - $mockXsdValidator->shouldReceive('setXsd')->once()->with($xmlNs); + $mockXsdValidator->shouldReceive('setXsd')->once()->with($xmlNs . $erruVersion); $mockXsdValidator->shouldReceive('setMaxErrors')->once()->with($maxSchemaErrors); $mockXsdValidator->shouldReceive('setXmlMessageExclude')->once()->with($xmlExclude); diff --git a/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactoryTest.php b/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactoryTest.php index 536d9cc5d8..7a320c6620 100644 --- a/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactoryTest.php +++ b/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlFactoryTest.php @@ -1,5 +1,7 @@ [ 'compliance_episode' => [ - 'xmlNs' => 'xml ns info' + 'xmlNs' => 'xml ns info', + 'erruVersion' => "3.1", ] ] ]; @@ -35,10 +38,10 @@ public function testInvoke() $this->assertInstanceOf(ComplianceEpisodeXml::class, $service); } - public function testInvokeMissingConfig() + public function testInvokeMissingConfig(): void { $this->expectException(\RuntimeException::class); - $this->expectExceptionMessage('Missing INR service config'); + $this->expectExceptionMessage('Missing xmlNs for INR config'); $mockSl = m::mock(ContainerInterface::class); $mockSl->shouldReceive('get')->with('config')->andReturn([]); diff --git a/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlTest.php b/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlTest.php index 8fdb1b93ce..2996cc5d71 100644 --- a/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlTest.php +++ b/app/api/test/module/Api/src/Service/Nr/Mapping/ComplianceEpisodeXmlTest.php @@ -1,30 +1,26 @@ load($path); - $sut = new ComplianceEpisodeXml(new MapXmlFile(), 'https://webgate.ec.testa.eu/erru/1.0'); + $sut = new ComplianceEpisodeXml(new MapXmlFile(), 'https://webgate.ec.testa.eu/move-hub/erru/3.4'); $expected = [ 'workflowId' => '20776dc3-5fe7-42d5-b554-09ad12fa25c4', @@ -33,25 +29,26 @@ public function testXmlMapping($template) 'notificationNumber' => '0ffefb6b-6344-4a60-9a53-4381c32f98d9', 'originatingAuthority' => 'Driver & Vehicle Agency', 'communityLicenceNumber' => 'UKGB/OB1234567/00000', - 'vrm' => 'aBc123', 'transportUndertakingName' => 'TEST USER (SELF SERVICE)(12345)', - 'notificationDateTime' => '2014-02-20T16:20:12Z', + 'vrm' => 'aBc123', + 'checkDate' => '2014-02-20', 'si' => [ 0 => [ 'infringementDate' => '2014-02-20', - 'siCategoryType' => 101, - 'checkDate' => '2014-02-20', + 'siCategoryType' => '101', 'imposedErrus' => [ 0 => [ + 'penaltyImposedIdentifier' => '1', 'finalDecisionDate' => '2014-02-20', - 'siPenaltyImposedType' => 101, + 'siPenaltyImposedType' => '101', 'startDate' => '2014-03-14', 'endDate' => '2014-09-17', 'executed' => 'Yes', ], 1 => [ + 'penaltyImposedIdentifier' => '2', 'finalDecisionDate' => '2014-06-25', - 'siPenaltyImposedType' => 102, + 'siPenaltyImposedType' => '102', 'startDate' => '', 'endDate' => '', 'executed' => 'No', @@ -59,30 +56,33 @@ public function testXmlMapping($template) ], 'requestedErrus' => [ 0 => [ - 'siPenaltyRequestedType' => 301, - 'duration' => 12 + 'penaltyRequestedIdentifier' => '1', + 'siPenaltyRequestedType' => '301', + 'duration' => '12' ], 1 => [ - 'siPenaltyRequestedType' => 302, - 'duration' => 30 + 'penaltyRequestedIdentifier' => '2', + 'siPenaltyRequestedType' => '302', + 'duration' => '30' ] ] ], 1 => [ 'infringementDate' => '2014-03-21', 'siCategoryType' => '201', - 'checkDate' => '2014-03-21', 'imposedErrus' => [ 0 => [ + 'penaltyImposedIdentifier' => '3', 'finalDecisionDate' => '2014-03-21', - 'siPenaltyImposedType' => 202, + 'siPenaltyImposedType' => '202', 'startDate' => '2014-04-15', 'endDate' => '2014-10-18', 'executed' => 'No', ], 1 => [ + 'penaltyImposedIdentifier' => '4', 'finalDecisionDate' => '2014-07-26', - 'siPenaltyImposedType' => 203, + 'siPenaltyImposedType' => '203', 'startDate' => '', 'endDate' => '', 'executed' => 'Yes', @@ -90,12 +90,14 @@ public function testXmlMapping($template) ], 'requestedErrus' => [ 0 => [ - 'siPenaltyRequestedType' => 305, - 'duration' => 18 + 'penaltyRequestedIdentifier' => '3', + 'siPenaltyRequestedType' => '305', + 'duration' => '18' ], 1 => [ - 'siPenaltyRequestedType' => 306, - 'duration' => 24 + 'penaltyRequestedIdentifier' => '4', + 'siPenaltyRequestedType' => '306', + 'duration' => '24' ] ] ] @@ -107,14 +109,11 @@ public function testXmlMapping($template) /** * data provider for testXmlMapping - * - * @return array */ - public function dpTemplate() + public function dpTemplate(): array { return [ - ['complianceEpisodeTemplate.xml'], - ['complianceEpisodeTemplateNoNs.xml'] + ['notifyCheckResultTemplate.xml'], ]; } } diff --git a/app/api/test/module/Api/src/Service/Nr/MsiResponseFactoryTest.php b/app/api/test/module/Api/src/Service/Nr/MsiResponseFactoryTest.php index 312560a54b..766a0e4e02 100644 --- a/app/api/test/module/Api/src/Service/Nr/MsiResponseFactoryTest.php +++ b/app/api/test/module/Api/src/Service/Nr/MsiResponseFactoryTest.php @@ -1,5 +1,7 @@ - */ class MsiResponseFactoryTest extends TestCase { - public function testInvoke() + public function testInvoke(): void { $config = [ 'nr' => [ 'compliance_episode' => [ - 'xmlNs' => 'xml ns' + 'xmlNs' => 'xml ns', + 'erruVersion' => "3.4", ], ], ]; @@ -36,7 +34,7 @@ public function testInvoke() $this->assertInstanceOf(XmlNodeBuilder::class, $service->getXmlBuilder()); } - public function testInvokeMissingConfig() + public function testInvokeMissingConfig(): void { $this->expectException(\RuntimeException::class); $this->expectExceptionMessage('No config specified for xml ns'); diff --git a/app/api/test/module/Api/src/Service/Nr/MsiResponseTest.php b/app/api/test/module/Api/src/Service/Nr/MsiResponseTest.php index 757c4a1329..1ad6c94ff2 100644 --- a/app/api/test/module/Api/src/Service/Nr/MsiResponseTest.php +++ b/app/api/test/module/Api/src/Service/Nr/MsiResponseTest.php @@ -1,10 +1,13 @@ - */ class MsiResponseTest extends MockeryTestCase { - public function testCreateThrowsException() + public function testCreateThrowsException(): void { - $this->expectException(\Dvsa\Olcs\Api\Domain\Exception\ForbiddenException::class); + $this->expectException(ForbiddenException::class); $cases = m::mock(CasesEntity::class); - $cases->shouldReceive('canSendMsiResponse')->once()->andReturn(false); + $cases->expects('canSendMsiResponse')->withNoArgs()->andReturnFalse(); - $sut = new MsiResponse(m::mock(XmlNodeBuilder::class)); + $sut = new MsiResponse(m::mock(XmlNodeBuilder::class), "3.4"); $sut->create($cases); } /** - * Tests create - * - * @param $licence - * @param $authority - * @param $memberStateCode - * @param $filteredMemberStateCode - * * @dataProvider createDataProvider */ - public function testCreate($licence, $authority, $memberStateCode, $filteredMemberStateCode) + public function testCreate(?string $licence, string $authority, string $memberStateCode, string $filteredMemberStateCode): void { $siPenaltyTypeId1 = 101; $siPenaltyTypeId2 = 102; @@ -53,19 +44,23 @@ public function testCreate($licence, $authority, $memberStateCode, $filteredMemb $startDate = '2015-01-31'; $endDate = '2015-05-16'; $workflowId = "FB4F5CE2-4D38-4AB8-8185-03947C939393"; + $communityLicenceNumber = 'GBUK/OB1234567/00001'; + $totAuthVehicles = 10; + $communityLicenceStatus = 'Active'; + $schemaVersion = '3.4'; $penalty1 = m::mock(SiPenaltyEntity::class)->makePartial(); - $penalty1->shouldReceive('getSiPenaltyType->getId')->once()->andReturn($siPenaltyTypeId1); - $penalty1->shouldReceive('getStartDate')->once()->andReturn(null); - $penalty1->shouldReceive('getEndDate')->once()->andReturn(null); - $penalty1->shouldReceive('getImposed')->once()->andReturn('N'); - $penalty1->shouldReceive('getReasonNotImposed')->once()->andReturn($reasonNotImposed); + $penalty1->expects('getSiPenaltyType->getId')->withNoArgs()->andReturn($siPenaltyTypeId1); + $penalty1->expects('getStartDate')->withNoArgs()->andReturnNull(); + $penalty1->expects('getEndDate')->withNoArgs()->andReturnNull(); + $penalty1->expects('getImposed')->withNoArgs()->andReturn('N'); + $penalty1->expects('getReasonNotImposed')->withNoArgs()->andReturn($reasonNotImposed); $penalty2 = m::mock(SiPenaltyEntity::class); $penalty2->shouldReceive('getSiPenaltyType->getId')->once()->andReturn($siPenaltyTypeId2); - $penalty2->shouldReceive('getStartDate')->once()->andReturn($startDate); - $penalty2->shouldReceive('getEndDate')->once()->andReturn($endDate); - $penalty2->shouldReceive('getImposed')->once()->andReturn('Y'); + $penalty2->expects('getStartDate')->withNoArgs()->andReturn($startDate); + $penalty2->expects('getEndDate')->withNoArgs()->andReturn($endDate); + $penalty2->expects('getImposed')->withNoArgs()->andReturn('Y'); $penalty2->shouldReceive('getReasonNotImposed')->never(); $appliedPenalties = new PersistentCollection( @@ -75,51 +70,44 @@ public function testCreate($licence, $authority, $memberStateCode, $filteredMemb ); $seriousInfringement = m::mock(SiEntity::class); - $seriousInfringement->shouldReceive('getAppliedPenalties')->once()->andReturn($appliedPenalties); + $seriousInfringement->expects('getAppliedPenalties')->withNoArgs()->andReturn($appliedPenalties); $seriousInfringements = new ArrayCollection([$seriousInfringement]); $erruRequest = m::mock(ErruRequestEntity::class); - $erruRequest->shouldReceive('getNotificationNumber')->once()->andReturn($notificationNumber); - $erruRequest->shouldReceive('getWorkflowId')->once()->andReturn($workflowId); - $erruRequest->shouldReceive('getMemberStateCode->getId')->once()->andReturn($memberStateCode); - $erruRequest->shouldReceive('getTransportUndertakingName')->once()->andReturn($erruTransportUndertaking); - $erruRequest->shouldReceive('getOriginatingAuthority')->once()->andReturn($erruOriginatingAuthority); + $erruRequest->expects('getNotificationNumber')->withNoArgs()->andReturn($notificationNumber); + $erruRequest->expects('getWorkflowId')->withNoArgs()->andReturn($workflowId); + $erruRequest->expects('getMemberStateCode->getId')->withNoArgs()->andReturn($memberStateCode); + $erruRequest->expects('getTransportUndertakingName')->withNoArgs()->andReturn($erruTransportUndertaking); + $erruRequest->expects('getOriginatingAuthority')->withNoArgs()->andReturn($erruOriginatingAuthority); + $erruRequest->expects('getCommunityLicenceNumber')->withNoArgs()->andReturn($communityLicenceNumber); + $erruRequest->expects('getTotAuthVehicles')->withNoArgs()->andReturn($totAuthVehicles); + $erruRequest->expects('getCommunityLicenceStatus->getDescription')->withNoArgs()->andReturn($communityLicenceStatus); $cases = m::mock(CasesEntity::class); - $cases->shouldReceive('canSendMsiResponse')->once()->andReturn(true); - $cases->shouldReceive('getSeriousInfringements')->once()->andReturn($seriousInfringements); - $cases->shouldReceive('getLicence')->once()->andReturn($licence); - $cases->shouldReceive('getErruRequest')->once()->andReturn($erruRequest); + $cases->expects('canSendMsiResponse')->withNoArgs()->andReturnTrue(); + $cases->expects('getSeriousInfringements')->withNoArgs()->andReturn($seriousInfringements); + $cases->expects('getLicence')->withNoArgs()->andReturn($licence); + $cases->expects('getErruRequest')->withNoArgs()->andReturn($erruRequest); $expectedXmlResponse = 'xml'; $xmlNodeBuilder = m::mock(XmlNodeBuilder::class)->makePartial(); - $xmlNodeBuilder->shouldReceive('buildTemplate')->once()->andReturn($expectedXmlResponse); + $xmlNodeBuilder->expects('buildTemplate')->withNoArgs()->andReturn($expectedXmlResponse); - $sut = new MsiResponse($xmlNodeBuilder); + $sut = new MsiResponse($xmlNodeBuilder, $schemaVersion); $actualXmlResponse = $sut->create($cases); $header = [ 'name' => 'Header', 'attributes' => [ + 'version' => $schemaVersion, 'technicalId' => $sut->getTechnicalId(), 'workflowId' => $workflowId, 'sentAt' => $sut->getResponseDateTime(), - 'from' => 'UK' + 'timeoutValue' => $sut->getTimeoutDateTime(), + 'from' => 'UK', + 'to' => $filteredMemberStateCode ], - 'nodes' => [ - 0 => [ - 'name' => 'To', - 'nodes' => [ - 0 => [ - 'name' => 'MemberState', - 'attributes' => [ - 'code' => $filteredMemberStateCode - ] - ] - ] - ] - ] ]; $body = [ @@ -127,23 +115,40 @@ public function testCreate($licence, $authority, $memberStateCode, $filteredMemb 'attributes' => [ 'businessCaseId' => $notificationNumber, 'originatingAuthority' => $erruOriginatingAuthority, - 'licensingAuthority' => $authority, - 'responseDateTime' => $sut->getResponseDateTime() + 'respondingAuthority' => $authority, + 'statusCode' => 'OK', ], 'nodes' => [ 0 => [ 'name' => 'TransportUndertaking', 'attributes' => [ - 'name' => $erruTransportUndertaking + 'transportUndertakingName' => $erruTransportUndertaking, + 'communityLicenceNumber' => $communityLicenceNumber, + 'communityLicenceStatus' => $communityLicenceStatus, + 'numberOfVehicles' => $totAuthVehicles, ], + 'nodes' => [ + 0 => [ + 'name' => 'TransportUndertakingAddress', + 'attributes' => [ + 'address' => 'address', + 'postcode' => 'postcode', + 'city' => 'city', + 'country' => 'UK', + ], + ], + ], + ], + 1 => [ + 'name' => 'PenaltiesImposed', 'nodes' => [ 0 => [ 'name' => 'PenaltyImposed', 'attributes' => [ 'authorityImposingPenalty' => $authority, 'penaltyTypeImposed' => $siPenaltyTypeId1, - 'isImposed' => 'No', - 'reasonNotImposed' => $reasonNotImposed + 'isImposed' => 'false', + 'reasonNotImposed' => $reasonNotImposed, ] ], 1 => [ @@ -151,14 +156,14 @@ public function testCreate($licence, $authority, $memberStateCode, $filteredMemb 'attributes' => [ 'authorityImposingPenalty' => $authority, 'penaltyTypeImposed' => $siPenaltyTypeId2, - 'isImposed' => 'Yes', + 'isImposed' => 'true', 'startDate' => $startDate, - 'endDate' => $endDate - ] - ] - ] - ] - ] + 'endDate' => $endDate, + ], + ], + ], + ], + ], ]; $expectedXmlData = [ @@ -175,7 +180,7 @@ public function testCreate($licence, $authority, $memberStateCode, $filteredMemb * * @return array */ - public function createDataProvider() + public function createDataProvider(): array { return [ [null, MsiResponse::AUTHORITY_TRU, 'GB', 'UK'],