From 78318aa1404574fc93c89a250c6079e295e90317 Mon Sep 17 00:00:00 2001 From: Joeri van Veen Date: Fri, 17 Feb 2023 21:13:39 +0100 Subject: [PATCH] fix: use correct insurance format (#445) --- Dockerfile | 22 ------------------- src/Model/Consignment/AbstractConsignment.php | 5 +++++ .../Consignment/DHLForYouConsignment.php | 18 ++++++++++++++- .../Consignment/DHLForYouConsignmentTest.php | 6 ++--- 4 files changed, 25 insertions(+), 26 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index ba585ad0..00000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -ARG PHP_VERSION=7.2 - -### -# Test -### -FROM ghcr.io/myparcelnl/php-xd:${PHP_VERSION} AS test - -COPY composer.json phpunit.xml ./ -COPY test/ ./test/ -COPY src/ ./src/ - -RUN composer install --dev - -CMD ["vendor/bin/phpunit", "--coverage-clover", "coverage.xml"] - - -### -# Dev -### -FROM ghcr.io/myparcelnl/php-xd:${PHP_VERSION} AS dev - -CMD ["sleep", "infinity"] diff --git a/src/Model/Consignment/AbstractConsignment.php b/src/Model/Consignment/AbstractConsignment.php index fd8f4c14..0e008a99 100755 --- a/src/Model/Consignment/AbstractConsignment.php +++ b/src/Model/Consignment/AbstractConsignment.php @@ -41,6 +41,9 @@ abstract class AbstractConsignment public const SHIPMENT_OPTION_RETURN = 'return'; public const SHIPMENT_OPTION_SAME_DAY_DELIVERY = 'same_day_delivery'; public const SHIPMENT_OPTION_SIGNATURE = 'signature'; + /** + * @deprecated since jan 2023 extra_assurance is no longer supported + */ public const SHIPMENT_OPTION_EXTRA_ASSURANCE = 'extra_assurance'; public const EXTRA_OPTION_DELIVERY_DATE = 'delivery_date'; @@ -1536,6 +1539,7 @@ public function hasHideSender(): ?bool * @param bool $extraAssurance * @codeCoverageIgnore * @return $this + * @deprecated since 2023 */ public function setExtraAssurance(bool $extraAssurance): self { @@ -1546,6 +1550,7 @@ public function setExtraAssurance(bool $extraAssurance): self /** * @return null|bool + * @deprecated since 2023 */ public function hasExtraAssurance(): ?bool { diff --git a/src/Model/Consignment/DHLForYouConsignment.php b/src/Model/Consignment/DHLForYouConsignment.php index 76805dc9..1eca898b 100644 --- a/src/Model/Consignment/DHLForYouConsignment.php +++ b/src/Model/Consignment/DHLForYouConsignment.php @@ -49,7 +49,7 @@ public function getAllowedShipmentOptions(): array return [ self::SHIPMENT_OPTION_AGE_CHECK, self::SHIPMENT_OPTION_HIDE_SENDER, - self::SHIPMENT_OPTION_EXTRA_ASSURANCE, + self::SHIPMENT_OPTION_INSURANCE, self::SHIPMENT_OPTION_ONLY_RECIPIENT, self::SHIPMENT_OPTION_SIGNATURE, self::SHIPMENT_OPTION_SAME_DAY_DELIVERY, @@ -63,4 +63,20 @@ public function getLocalCountryCode(): string { return self::CC_NL; } + + /** + * @return int[] + */ + protected function getLocalInsurancePossibilities(): array + { + return [ + 500, + 1000, + 1500, + 2000, + 2500, + 3000, + ]; + } + } diff --git a/test/Model/Consignment/DHLForYouConsignmentTest.php b/test/Model/Consignment/DHLForYouConsignmentTest.php index 6c30a1f7..e3e11c8c 100644 --- a/test/Model/Consignment/DHLForYouConsignmentTest.php +++ b/test/Model/Consignment/DHLForYouConsignmentTest.php @@ -24,10 +24,10 @@ public function provideDHLForYouConsignmentsData(): array self::HIDE_SENDER => true, self::SAME_DAY_DELIVERY => true, ], - 'Extra assurance' => [ - self::EXTRA_ASSURANCE => true, + 'Insurance' => [ + self::INSURANCE => 500, self::SAME_DAY_DELIVERY => true, - self::expected(self::INSURANCE) => 0, + self::expected(self::INSURANCE) => 500, ], 'Return' => [ self::RETURN => true,