From 58ae608f163943f52e591315a11ac41d9a318bce Mon Sep 17 00:00:00 2001
From: Jochem Gravendeel <119667571+GravendeelJochem@users.noreply.github.com>
Date: Thu, 7 Nov 2024 12:16:16 +0100
Subject: [PATCH] feat: allow dhlforyou pickup locations (#316)

INT-694
---
 config/platform/myparcel.php                  |  1 +
 .../schema/myparcel/order/dhlforyou/base.json |  2 +-
 .../order/dhlforyou/nl_package_small.json     | 25 +++++++++++++++++++
 config/validation/myparcel/order.php          |  5 ++++
 .../DhlForYouShipmentOptionsCalculator.php    |  1 +
 ...fier_with_data_set_default_carrier__1.json |  2 +-
 ...with_data_set_subscription_carrier__1.json |  2 +-
 ...carriers_from_name_with_(myparcel)__1.json |  2 +-
 ...__it_gets_carriers_with_(myparcel)__1.json |  2 +-
 ..._for_each_platform_with_(myparcel)__1.json |  2 +-
 10 files changed, 38 insertions(+), 6 deletions(-)
 create mode 100644 config/schema/myparcel/order/dhlforyou/nl_package_small.json

diff --git a/config/platform/myparcel.php b/config/platform/myparcel.php
index 3f30acba7..a7ef00f82 100644
--- a/config/platform/myparcel.php
+++ b/config/platform/myparcel.php
@@ -111,6 +111,7 @@
                 'packageTypes'    => [
                     DeliveryOptions::PACKAGE_TYPE_PACKAGE_NAME,
                     DeliveryOptions::PACKAGE_TYPE_MAILBOX_NAME,
+                    DeliveryOptions::PACKAGE_TYPE_PACKAGE_SMALL_NAME
                 ],
                 'deliveryTypes'   => [
                     DeliveryOptions::DELIVERY_TYPE_STANDARD_NAME,
diff --git a/config/schema/myparcel/order/dhlforyou/base.json b/config/schema/myparcel/order/dhlforyou/base.json
index 874012015..e810728b7 100644
--- a/config/schema/myparcel/order/dhlforyou/base.json
+++ b/config/schema/myparcel/order/dhlforyou/base.json
@@ -15,7 +15,7 @@
           "enum": ["standard", "pickup", null]
         },
         "packageType": {
-          "enum": ["letter", "mailbox", "package", null]
+          "enum": ["letter", "mailbox", "package", "package_small", null]
         },
         "shipmentOptions": {
           "properties": {
diff --git a/config/schema/myparcel/order/dhlforyou/nl_package_small.json b/config/schema/myparcel/order/dhlforyou/nl_package_small.json
new file mode 100644
index 000000000..3903dfa58
--- /dev/null
+++ b/config/schema/myparcel/order/dhlforyou/nl_package_small.json
@@ -0,0 +1,25 @@
+{
+  "description": "order/dhlforyou/nl_package_small",
+  "properties": {
+    "deliveryOptions": {
+      "properties": {
+        "deliveryType": {
+          "enum": ["standard", "pickup", null]
+        },
+        "shipmentOptions": {
+          "properties": {
+            "ageCheck": {
+              "enum": [0, 1]
+            },
+            "onlyRecipient": {
+              "enum": [0, 1]
+            },
+            "signature": {
+              "enum": [0, 1]
+            }
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/config/validation/myparcel/order.php b/config/validation/myparcel/order.php
index 87d9437f9..2cec5143c 100644
--- a/config/validation/myparcel/order.php
+++ b/config/validation/myparcel/order.php
@@ -179,6 +179,11 @@
                             'name'   => DeliveryOptions::PACKAGE_TYPE_LETTER_NAME,
                             'schema' => 'order/dhlforyou/letter',
                         ],
+                        [
+                            'id'     => DeliveryOptions::PACKAGE_TYPE_PACKAGE_SMALL_ID,
+                            'name'   => DeliveryOptions::PACKAGE_TYPE_PACKAGE_SMALL_NAME,
+                            'schema' => 'order/dhlforyou/nl_package_small',
+                        ],
                     ],
                 ],
                 [
diff --git a/src/App/Order/Calculator/DhlForYou/DhlForYouShipmentOptionsCalculator.php b/src/App/Order/Calculator/DhlForYou/DhlForYouShipmentOptionsCalculator.php
index 2af962f65..3c57d4451 100644
--- a/src/App/Order/Calculator/DhlForYou/DhlForYouShipmentOptionsCalculator.php
+++ b/src/App/Order/Calculator/DhlForYou/DhlForYouShipmentOptionsCalculator.php
@@ -65,5 +65,6 @@ private function calculateOptionsForCountry(): void
         $this->order->deliveryOptions->shipmentOptions->ageCheck        = TriStateService::DISABLED;
         $this->order->deliveryOptions->shipmentOptions->onlyRecipient   = TriStateService::DISABLED;
         $this->order->deliveryOptions->shipmentOptions->sameDayDelivery = TriStateService::DISABLED;
+        $this->order->deliveryOptions->shipmentOptions->tracked         = TriStateService::DISABLED;
     }
 }
diff --git a/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_default_carrier__1.json b/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_default_carrier__1.json
index c3df6cbe0..d46a9f7d8 100644
--- a/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_default_carrier__1.json
+++ b/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_default_carrier__1.json
@@ -13,7 +13,7 @@
     "features": {
       "labelDescriptionLength": 45
     },
-    "packageTypes": ["package", "mailbox"],
+    "packageTypes": ["package", "mailbox", "package_small"],
     "shipmentOptions": {
       "ageCheck": true,
       "largeFormat": false,
diff --git a/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_subscription_carrier__1.json b/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_subscription_carrier__1.json
index 3baf3080b..3ab0ea5fa 100644
--- a/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_subscription_carrier__1.json
+++ b/tests/__snapshots__/CarrierTest__it_instantiates_carrier_from_external_identifier_with_data_set_subscription_carrier__1.json
@@ -14,7 +14,7 @@
     "features": {
       "labelDescriptionLength": 45
     },
-    "packageTypes": ["package", "mailbox"],
+    "packageTypes": ["package", "mailbox", "package_small"],
     "shipmentOptions": {
       "ageCheck": true,
       "largeFormat": false,
diff --git a/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json b/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json
index c52a21ce8..465abe5b6 100644
--- a/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json
+++ b/tests/__snapshots__/CarrierTest__it_instantiates_carriers_from_name_with_(myparcel)__1.json
@@ -106,7 +106,7 @@
       "features": {
         "labelDescriptionLength": 45
       },
-      "packageTypes": ["package", "mailbox"],
+      "packageTypes": ["package", "mailbox", "package_small"],
       "shipmentOptions": {
         "ageCheck": true,
         "largeFormat": false,
diff --git a/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json b/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json
index c52a21ce8..465abe5b6 100644
--- a/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json
+++ b/tests/__snapshots__/PlatformManagerTest__it_gets_carriers_with_(myparcel)__1.json
@@ -106,7 +106,7 @@
       "features": {
         "labelDescriptionLength": 45
       },
-      "packageTypes": ["package", "mailbox"],
+      "packageTypes": ["package", "mailbox", "package_small"],
       "shipmentOptions": {
         "ageCheck": true,
         "largeFormat": false,
diff --git a/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json b/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json
index 4133356e7..1132c0d14 100644
--- a/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json
+++ b/tests/__snapshots__/PlatformManagerTest__it_retrieves_config_for_each_platform_with_(myparcel)__1.json
@@ -52,7 +52,7 @@
     {
       "name": "dhlforyou",
       "capabilities": {
-        "packageTypes": ["package", "mailbox"],
+        "packageTypes": ["package", "mailbox", "package_small"],
         "deliveryTypes": ["standard", "pickup"],
         "shipmentOptions": {
           "ageCheck": true,