From 129bd6870fedabe4a9973adde434aa13c6e5a1e4 Mon Sep 17 00:00:00 2001 From: Florian Riecker- de Vries <93703843+FlorianSDV@users.noreply.github.com> Date: Thu, 1 Aug 2024 10:31:53 +0200 Subject: [PATCH] feat: update insurance settings (#856) --- .../Source/AbstractInsurancePossibilities.php | 41 --- .../Source/CarrierInsurancePossibilities.php | 90 +++++ Model/Source/DefaultOptions.php | 109 +++--- Model/Source/PostNLInsurancePossibilities.php | 15 - Setup/UpgradeData.php | 199 +++++++++++ etc/adminhtml/system.xml | 324 +++++------------- etc/config.xml | 68 ++-- etc/di.xml | 90 ++++- 8 files changed, 521 insertions(+), 415 deletions(-) delete mode 100755 Model/Source/AbstractInsurancePossibilities.php create mode 100755 Model/Source/CarrierInsurancePossibilities.php delete mode 100755 Model/Source/PostNLInsurancePossibilities.php diff --git a/Model/Source/AbstractInsurancePossibilities.php b/Model/Source/AbstractInsurancePossibilities.php deleted file mode 100755 index 9af6c8e8..00000000 --- a/Model/Source/AbstractInsurancePossibilities.php +++ /dev/null @@ -1,41 +0,0 @@ - $key, - 'label' => $value, - ]; - }, $this->toArray(), array_keys($this->toArray())); - } - - /** - * @return array - */ - public function toArray(): array - { - return array_reduce($this->getInsurancePossibilitiesArray(), static function ($array, $insuranceValue) { - $array[$insuranceValue] = $insuranceValue; - - return $array; - }, []); - } - - /** - * @return array - */ - abstract protected function getInsurancePossibilitiesArray(): array; -} diff --git a/Model/Source/CarrierInsurancePossibilities.php b/Model/Source/CarrierInsurancePossibilities.php new file mode 100755 index 00000000..11b4e0a2 --- /dev/null +++ b/Model/Source/CarrierInsurancePossibilities.php @@ -0,0 +1,90 @@ +type = $type; + $this->carrier = ConsignmentFactory::createByCarrierName($carrierName); + } + + /** + * @return array + * @throws Exception + */ + public function toOptionArray(): array + { + return array_map(static function ($value, $key) { + return [ + 'value' => $key, + 'label' => $value, + ]; + }, $this->toArray(), array_keys($this->toArray())); + } + + /** + * @return array + * @throws Exception + */ + public function toArray(): array + { + $cc = $this->getCc(); + + return array_reduce($this->getInsurancePossibilitiesArray($cc), static function ($array, $insuranceValue) { + $array[$insuranceValue] = $insuranceValue; + + return $array; + }, [0]); + } + + /** + * @throws Exception + */ + protected function getInsurancePossibilitiesArray(?string $cc = null): array + { + return $this->carrier->getInsurancePossibilities($cc); + } + + /** + * @return string|null + */ + private function getCc(): ?string + { + $cc = null; + if ($this->type === 'local') { + $cc = $this->carrier->getLocalCountryCode(); + } + + if ($this->type === AbstractConsignment::CC_BE) { + $cc = AbstractConsignment::CC_BE; + } + + if ($this->type === CountryCodes::ZONE_EU) { + $cc = CountryCodes::ZONE_EU; + } + + if ($this->type === CountryCodes::ZONE_ROW) { + $cc = CountryCodes::ZONE_ROW; + } + + return $cc; + } +} diff --git a/Model/Source/DefaultOptions.php b/Model/Source/DefaultOptions.php index b7b8d800..71349428 100755 --- a/Model/Source/DefaultOptions.php +++ b/Model/Source/DefaultOptions.php @@ -19,6 +19,7 @@ use MyParcelNL\Magento\Helper\Checkout; use MyParcelNL\Magento\Helper\Data; use MyParcelNL\Magento\Model\Sales\Repository\PackageRepository; +use MyParcelNL\Sdk\src\Factory\ConsignmentFactory; use MyParcelNL\Sdk\src\Factory\DeliveryOptionsAdapterFactory; use MyParcelNL\Sdk\src\Model\Carrier\AbstractCarrier; use MyParcelNL\Sdk\src\Model\Carrier\CarrierFactory; @@ -29,14 +30,27 @@ class DefaultOptions { // Maximum characters length of company name. private const COMPANY_NAME_MAX_LENGTH = 50; + /** @deprecated */ private const INSURANCE_BELGIUM = 'insurance_belgium_custom'; - private const INSURANCE_BELGIUM_AMOUNT = 500; + /** @deprecated */ private const INSURANCE_EU_AMOUNT_50 = 'insurance_eu_50'; + /** @deprecated */ private const INSURANCE_EU_AMOUNT_500 = 'insurance_eu_500'; + /** @deprecated */ private const INSURANCE_AMOUNT_100 = 'insurance_100'; + /** @deprecated */ private const INSURANCE_AMOUNT_250 = 'insurance_250'; + /** @deprecated */ private const INSURANCE_AMOUNT_500 = 'insurance_500'; + /** @deprecated */ private const INSURANCE_AMOUNT_CUSTOM = 'insurance_custom'; + + private const INSURANCE_FROM_PRICE = 'insurance_from_price'; + private const INSURANCE_LOCAL_AMOUNT = 'insurance_local_amount'; + private const INSURANCE_BELGIUM_AMOUNT = 'insurance_belgium_amount'; + private const INSURANCE_EU_AMOUNT = 'insurance_eu_amount'; + private const INSURANCE_ROW_AMOUNT = 'insurance_row_amount'; + private const INSURANCE_PERCENTAGE = 'insurance_percentage'; public const DEFAULT_OPTION_VALUE = 'default'; /** @@ -96,18 +110,7 @@ public function hasDefault(string $option, string $carrier): bool return true; } - $total = self::$order->getGrandTotal(); - $settings = self::$helper->getStandardConfig($carrier, 'default_options'); - $activeKey = "{$option}_active"; - - if (! isset($settings[$activeKey])) { - return false; - } - - $priceKey = "{$option}_from_price"; - - return '1' === $settings[$activeKey] - && (! ($settings[$priceKey] ?? false) || $total > (int) $settings[$priceKey]); + return false; } /** @@ -173,9 +176,10 @@ public function hasDefaultOptionsWithoutPrice(string $carrier, string $option): /** * Get default value of insurance based on order grand total * - * @param string $carrier + * @param string $carrier * * @return int + * @throws \Exception */ public function getDefaultInsurance(string $carrier): int { @@ -183,74 +187,51 @@ public function getDefaultInsurance(string $carrier): int $shippingCountry = $shippingAddress ? $shippingAddress->getCountryId() : AbstractConsignment::CC_NL; if (AbstractConsignment::CC_NL === $shippingCountry) { - return $this->getDefaultLocalInsurance($carrier); + return $this->getInsurance($carrier, self::INSURANCE_LOCAL_AMOUNT, $shippingCountry); } if (AbstractConsignment::CC_BE === $shippingCountry) { - return $this->getDefaultBeInsurance($carrier); - } - - return $this->getDefaultEuInsurance($carrier); - } - - /** - * @param string $carrier - * - * @return int - */ - private function getDefaultEuInsurance(string $carrier): int - { - if ($this->hasDefault(self::INSURANCE_EU_AMOUNT_500, $carrier)) { - return 500; + return $this->getInsurance($carrier, self::INSURANCE_BELGIUM_AMOUNT, $shippingCountry); } - if ($this->hasDefault(self::INSURANCE_EU_AMOUNT_50, $carrier)) { - return 50; - } - - return 0; - } - - /** - * @param string $carrier - * - * @return int - */ - private function getDefaultBeInsurance(string $carrier): int - { - if ($this->hasDefault(self::INSURANCE_BELGIUM, $carrier)) { - return self::$helper->getConfigValue(Data::CARRIERS_XML_PATH_MAP[$carrier] . 'default_options/insurance_belgium_custom_amount'); + if (in_array($shippingCountry, AbstractConsignment::EURO_COUNTRIES)) { + return $this->getInsurance($carrier, self::INSURANCE_EU_AMOUNT, $shippingCountry); } - return $this->hasDefault(self::INSURANCE_BELGIUM, $carrier) ? self::$helper->getConfigValue( - Data::CARRIERS_XML_PATH_MAP[$carrier] . 'default_options/insurance_belgium_custom_amount' - ) : 0; + return $this->getInsurance($carrier, self::INSURANCE_ROW_AMOUNT, $shippingCountry); } /** - * @param string $carrier - * - * @return int + * @throws Exception */ - private function getDefaultLocalInsurance(string $carrier): int + private function getInsurance(string $carrierName, string $priceKey, string $shippingCountry): int { - if ($this->hasDefault(self::INSURANCE_AMOUNT_CUSTOM, $carrier)) { - return self::$helper->getConfigValue(Data::CARRIERS_XML_PATH_MAP[$carrier] . 'default_options/insurance_custom_amount'); + $total = self::$order->getGrandTotal(); + $settings = self::$helper->getStandardConfig($carrierName, 'default_options'); + $totalAfterPercentage = $total * (($settings[self::INSURANCE_PERCENTAGE] ?? 0) / 100); + + if (! isset($settings[$priceKey]) + || $settings[$priceKey] === 0 + || $totalAfterPercentage < $settings[self::INSURANCE_FROM_PRICE]) { + return 0; } - if ($this->hasDefault(self::INSURANCE_AMOUNT_500, $carrier)) { - return 500; - } + $carrier = ConsignmentFactory::createByCarrierName($carrierName); + $insuranceTiers = $carrier->getInsurancePossibilities($shippingCountry); + sort($insuranceTiers); - if ($this->hasDefault(self::INSURANCE_AMOUNT_250, $carrier)) { - return 250; - } + $insurance = 0; + foreach ($insuranceTiers as $insuranceTier) { + $totalPriceFallsIntoTier = $totalAfterPercentage <= $insuranceTier; + $atMaxInsuranceTier = $insuranceTier >= $settings[$priceKey]; - if ($this->hasDefault(self::INSURANCE_AMOUNT_100, $carrier)) { - return 100; + if ($totalPriceFallsIntoTier || $atMaxInsuranceTier) { + $insurance = $insuranceTier; + break; + } } - return 0; + return $insurance; } /** diff --git a/Model/Source/PostNLInsurancePossibilities.php b/Model/Source/PostNLInsurancePossibilities.php deleted file mode 100755 index fa44e142..00000000 --- a/Model/Source/PostNLInsurancePossibilities.php +++ /dev/null @@ -1,15 +0,0 @@ -getVersion(), '4.16.0', '<')) { + $scope = 'default'; + $scopeId = 0; + + $oldPathNames = [ + 'insurance_belgium_active', + 'insurance_100_active', + 'insurance_250_active', + 'insurance_500_active', + 'insurance_custom_active', + 'insurance_belgium_custom_active', + 'insurance_eu_50_active', + 'insurance_eu_500_active', + 'insurance_100_from_price', + 'insurance_250_from_price', + 'insurance_500_from_price', + 'insurance_custom_amount', + 'insurance_custom_from_price', + 'insurance_belgium_custom_amount', + 'insurance_belgium_custom_from_price', + 'insurance_eu_50_from_price', + 'insurance_eu_500_from_price', + ]; + + $postnl = [ + 'carrierName' => 'postnl', + 'basePath' => 'myparcelnl_magento_postnl_settings/default_options/', + 'newPaths' => [ + 'insurance_local_amount', + 'insurance_belgium_amount', + 'insurance_eu_amount', + 'insurance_row_amount', + ], + ]; + + $dhlForYou = [ + 'carrierName' => 'dhlforyou', + 'basePath' => 'myparcelnl_magento_dhlforyou_settings/default_options/', + 'newPaths' => [ + 'insurance_local_amount', + 'insurance_belgium_amount', + ], + ]; + + $dhlParcelConnect = [ + 'carrierName' => 'dhlparcelconnect', + 'basePath' => 'myparcelnl_magento_dhlparcelconnect_settings/default_options/', + 'newPaths' => [ + 'insurance_eu_amount', + 'insurance_row_amount', + ], + ]; + + $dhlEuroPlus = [ + 'carrierName' => 'dhleuroplus', + 'basePath' => 'myparcelnl_magento_dhleuroplus_settings/default_options/', + 'newPaths' => [ + 'insurance_local_amount', + 'insurance_belgium_amount', + 'insurance_eu_amount', + 'insurance_row_amount', + ], + ]; + + $carriers = [$postnl, $dhlForYou, $dhlParcelConnect, $dhlEuroPlus]; + + $getFromPriceFunction = static function ($path, $rows) { + foreach ($rows as $row) { + if ($row['path'] === $path) { + $insuranceFromPriceArray[] = $row['value']; + break; + } + } + + return $insuranceFromPriceArray; + }; + + $getCustomAmountFunction = static function ($rows, $path) { + $insuranceCustomAmount = 0; + foreach ($rows as $row) { + if ($row['path'] === $path) { + $insuranceCustomAmount = $row['value']; + break; + } + } + + return $insuranceCustomAmount; + }; + + $compareAmountWithTiers = static function ($insuranceAmount, $insuranceTiers) { + if ($insuranceAmount === 0) { + return 0; + } + sort($insuranceTiers); + $amountOfTiers = count($insuranceTiers); + for ($i = 0; $i < $amountOfTiers; $i++) { + // Check if the insurance falls into the tier + if ($insuranceAmount <= $insuranceTiers[$i]) { + $insuranceAmount = $insuranceTiers[$i]; + break; + } + // If the insurance is even larger than the largest tier we use the largest tier instead. + if ($i === $amountOfTiers - 1) { + $insuranceAmount = $insuranceTiers[$i]; + } + } + + return $insuranceAmount; + }; + + foreach ($carriers as $carrier) { + $carrierConsignment = ConsignmentFactory::createByCarrierName($carrier['carrierName']); + $insuranceFromPriceArray = []; + $basePath = $carrier['basePath']; + + $updates = [ + $basePath . 'insurance_percentage' => 100, + ]; + + $carrierPaths = []; + foreach ($oldPathNames as $oldPathName) { + $carrierPaths[] = $carrier['basePath'] . $oldPathName; + } + $rows = $connection->fetchAll($connection->select()->from($table, ['config_id', 'path', 'value'])->where('path IN (?)', $carrierPaths)); + + foreach ($carrier['newPaths'] as $type) { + if ($type === 'insurance_local_amount') { + $insuranceLocalAmount = 0; + foreach ($rows as $row) { + if ($row['path'] === $basePath . 'insurance_100_active' && $row['value'] === '1') { + $insuranceLocalAmount = 100; + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_100_from_price', $rows); + } + if ($row['path'] === $basePath . 'insurance_250_active' && $row['value'] === '1') { + $insuranceLocalAmount = 250; + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_250_from_price', $rows); + } + if ($row['path'] === $basePath . 'insurance_500_active' && $row['value'] === '1') { + $insuranceLocalAmount = 500; + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_500_from_price', $rows); + } + if ($row['path'] === $basePath . 'insurance_custom_active' && $row['value'] === '1') { + $insuranceLocalAmount = $getCustomAmountFunction($rows, $basePath . 'insurance_custom_amount'); + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_custom_from_price', $rows); + } + } + $insuranceTiersLocal = $carrierConsignment->getInsurancePossibilities(CountryCodes::CC_NL); + $insuranceLocalAmount = $compareAmountWithTiers($insuranceLocalAmount, $insuranceTiersLocal); + $updates[$basePath . 'insurance_local_amount'] = $insuranceLocalAmount; + } + + if ($type === 'insurance_belgium_amount') { + $insuranceBelgiumAmount = 0; + foreach ($rows as $row) { + if ($row['path'] === $basePath . 'insurance_belgium_custom_active' && $row['value'] === '1') { + $insuranceBelgiumAmount = $getCustomAmountFunction($rows, $basePath . 'insurance_belgium_custom_amount'); + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_belgium_custom_from_price', $rows); + } + } + $insuranceTiersBe = $carrierConsignment->getInsurancePossibilities(CountryCodes::CC_BE); + $insuranceBelgiumAmount = $compareAmountWithTiers($insuranceBelgiumAmount, $insuranceTiersBe); + $updates[$basePath . 'insurance_belgium_amount'] = $insuranceBelgiumAmount; + } + + if ($type === 'insurance_eu_amount') { + $insuranceEuAmount = 0; + foreach ($rows as $row) { + if ($row['path'] === $basePath . 'insurance_eu_50_active' && $row['value'] === '1') { + $insuranceEuAmount = 50; + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_eu_50_from_price', $rows); + } + if ($row['path'] === $basePath . 'insurance_eu_500_active' && $row['value'] === '1') { + $insuranceEuAmount = 500; + $insuranceFromPriceArray[] = $getFromPriceFunction($basePath . 'insurance_eu_500_from_price', $rows); + } + } + + $insuranceTiersEu = $carrierConsignment->getInsurancePossibilities(CountryCodes::ZONE_EU); + $insuranceEuAmount = $compareAmountWithTiers($insuranceEuAmount, $insuranceTiersEu); + $updates[$basePath . 'insurance_eu_amount'] = $insuranceEuAmount; + } + if ($type === 'insurance_row_amount') { + $updates[$basePath . 'insurance_row_amount'] = 0; + } + } + + // The lowest from price out of all will become the from price. + sort($insuranceFromPriceArray); + $updates[$basePath . 'insurance_from_price'] = $insuranceFromPriceArray[0] ?? 0; + + foreach ($updates as $path => $value) { + $connection->delete($table, ['path = ?' => $path, 'scope = ?' => $scope, 'scope_id = ?' => $scopeId]); + $connection->insert($table, ['path' => $path, 'value' => $value, 'scope' => $scope, 'scope_id' => $scopeId]); + } + } + } + $setup->endSetup(); } } diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index fc371260..433d09f4 100755 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -364,105 +364,35 @@ Magento\Config\Model\Config\Source\Yesno The age check is intended for parcel shipments for which the recipient must show 18+ by means of a proof of identity. With this shipping option Signature on receipt and Home address only are included. The age 18+ is further excluded from the delivery options morning and evening delivery. - - - Magento\Config\Model\Config\Source\Yesno - - - + + validate-number validate-zero-or-greater - 'Insurance € 100' operates above a certain order total amount. Only for dutch shipments. - - 1 - + The minimum amount from when insurance is active. - - - Magento\Config\Model\Config\Source\Yesno + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\Postnl\Local + This setting applies to domestic shipments only - - - validate-number validate-zero-or-greater - 'Insurance € 250' operates above a certain order total amount. Only for Dutch shipments, shipments outside of the EU are insured up to € 200 by default. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 500' operates above a certain order total amount. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - MyParcelNL\Magento\Model\Source\PostNLInsurancePossibilities - A custom insurance price within a range of possibilities. - - 1 - - - - - validate-number validate-zero-or-greater - 'Insurance custom' operates above a certain custom order total amount. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - MyParcelNL\Magento\Model\Source\PostNLInsurancePossibilities + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\Postnl\Belgium A custom be insurance price within a range of possibilities. - - 1 - - - - validate-number validate-zero-or-greater - 'Insurance be custom' operates above a certain custom order total amount. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance EU € 50' operates above a certain order total amount. - - 1 - + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\Postnl\EU + A custom eu insurance price within a range of possibilities. - - - Magento\Config\Model\Config\Source\Yesno + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\Postnl\ROW + A custom row insurance price within a range of possibilities. - - - validate-number validate-zero-or-greater - 'Insurance EU € 500' operates above a certain order total amount. - - 1 - + + + validate-number validate-number-range number-range-0-100 + Use percentage of total order amount for insurance. After the calculation, the next available price scale is selected. @@ -766,61 +696,25 @@ Magento\Config\Model\Config\Source\Yesno Activating the 'hide sender' option will remove the name and address of the sender from the label - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 100' operates above a certain order total amount. Only for dutch shipments. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - + + validate-number validate-zero-or-greater - 'Insurance € 250' operates above a certain order total amount. Only for Dutch shipments, shipments outside of the EU are insured up to € 200 by default. - - 1 - + The minimum amount from when insurance is active. - - - Magento\Config\Model\Config\Source\Yesno + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLForYou\Local + This setting applies to domestic shipments only - - - validate-number validate-zero-or-greater - 'Insurance € 500' operates above a certain order total amount. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - MyParcelNL\Magento\Model\Source\PostNLInsurancePossibilities - A custom insurance price within a range of possibilities. - - 1 - + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLForYou\Belgium + A custom be insurance price within a range of possibilities. - - - validate-number validate-zero-or-greater - 'Insurance custom' operates above a certain custom order total amount. - - 1 - + + + validate-number validate-number-range number-range-0-100 + Use percentage of total order amount for insurance. After the calculation, the next available price scale is selected. @@ -962,61 +856,35 @@ Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually. These settings will activate based on the order total amount. - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 100' operates above a certain order total amount. Only for dutch shipments. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - + + validate-number validate-zero-or-greater - 'Insurance € 250' operates above a certain order total amount. Only for Dutch shipments, shipments outside of the EU are insured up to € 200 by default. - - 1 - + The minimum amount from when insurance is active. - - - Magento\Config\Model\Config\Source\Yesno + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLEuroPlus\Local + This setting applies to domestic shipments only - - - validate-number validate-zero-or-greater - 'Insurance € 500' operates above a certain order total amount. - - 1 - + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLEuroPlus\Belgium + A custom be insurance price within a range of possibilities. - - - Magento\Config\Model\Config\Source\Yesno + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLEuroPlus\EU + A custom eu insurance price within a range of possibilities. - - - MyParcelNL\Magento\Model\Source\PostNLInsurancePossibilities - A custom insurance price within a range of possibilities. - - 1 - + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLEuroPlus\ROW + A custom row insurance price within a range of possibilities. - - - validate-number validate-zero-or-greater - 'Insurance custom' operates above a certain custom order total amount. - - 1 - + + + validate-number validate-number-range number-range-0-100 + Use percentage of total order amount for insurance. After the calculation, the next available price scale is selected. @@ -1122,61 +990,25 @@ Fill in your preferences for a shipment. These settings will only apply for the mass actions in the order grid. When creating a single shipment, these settings can be changed manually. These settings will activate based on the order total amount. - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 100' operates above a certain order total amount. Only for dutch shipments. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 250' operates above a certain order total amount. Only for Dutch shipments, shipments outside of the EU are insured up to € 200 by default. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - validate-number validate-zero-or-greater - 'Insurance € 500' operates above a certain order total amount. - - 1 - - - - - Magento\Config\Model\Config\Source\Yesno - - - - MyParcelNL\Magento\Model\Source\PostNLInsurancePossibilities - A custom insurance price within a range of possibilities. - - 1 - - - - + + validate-number validate-zero-or-greater - 'Insurance custom' operates above a certain custom order total amount. - - 1 - + The minimum amount from when insurance is active. + + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLParcelConnect\EU + A custom eu insurance price within a range of possibilities. + + + + MyParcelNL\Magento\Model\Source\CarrierInsurancePossibilities\DHLParcelConnect\ROW + A custom row insurance price within a range of possibilities. + + + + validate-number validate-number-range number-range-0-100 + Use percentage of total order amount for insurance. After the calculation, the next available price scale is selected. diff --git a/etc/config.xml b/etc/config.xml index d959ae4a..fdcaf32d 100755 --- a/etc/config.xml +++ b/etc/config.xml @@ -48,6 +48,12 @@ + 0 + 0 + 0 + 0 + 0 + 0 0 1 0 @@ -57,18 +63,6 @@ No 1 0 - 0 - 1 - 0 - 1 - 0 - 1 - 0 - 1000 - 1 - 0 - 0 - 1 14 @@ -121,18 +115,10 @@ 0 1 0 - 0 - 1 - 0 - 1 - 0 - 1 - 0 - 1000 - 1 - 0 - 0 - 1 + 0 + 0 + 0 + 0 14 @@ -164,18 +150,12 @@ - 0 - 1 - 0 - 1 - 0 - 1 - 0 - 1000 - 1 - 0 - 0 - 1 + 0 + 0 + 0 + 0 + 0 + 0 14 @@ -192,18 +172,10 @@ - 0 - 1 - 0 - 1 - 0 - 1 - 0 - 1000 - 1 - 0 - 0 - 1 + 0 + 0 + 0 + 0 14 diff --git a/etc/di.xml b/etc/di.xml index 976ec1e6..90ce5dfa 100755 --- a/etc/di.xml +++ b/etc/di.xml @@ -41,5 +41,93 @@ - + + + + + + postnl + local + + + + + + postnl + BE + + + + + + postnl + EU + + + + + + postnl + ROW + + + + + + + dhlforyou + local + + + + + + dhlforyou + BE + + + + + + + dhleuroplus + local + + + + + + dhleuroplus + BE + + + + + + dhleuroplus + EU + + + + + + dhleuroplus + ROW + + + + + + + dhlparcelconnect + EU + + + + + + dhlparcelconnect + ROW + +