diff --git a/Packetery/Checkout/Controller/Config/ShippingRatesConfig.php b/Packetery/Checkout/Controller/Config/ShippingRatesConfig.php index 549750a..fac646e 100644 --- a/Packetery/Checkout/Controller/Config/ShippingRatesConfig.php +++ b/Packetery/Checkout/Controller/Config/ShippingRatesConfig.php @@ -147,6 +147,9 @@ public function execute() { $shippingRates = $postData['rates']; foreach ($shippingRates as $shippingRate) { + if (!$this->validateShippingRate($shippingRate)) { + continue; + } $ratesConfig[$shippingRate['rateCode']] = $this->getRateConfig($shippingRate['countryId'], $shippingRate['carrierCode'], $shippingRate['methodCode']); } @@ -158,4 +161,11 @@ public function execute() { return $this->resultJsonFactory->create()->setData($response); } + + private function validateShippingRate(array $shippingRate): bool + { + return !empty($shippingRate['countryId']) && + !empty($shippingRate['carrierCode']) && + !empty($shippingRate['methodCode']); + } } diff --git a/Packetery/Checkout/Model/Pricing/Service.php b/Packetery/Checkout/Model/Pricing/Service.php index 242bceb..f48f6ae 100644 --- a/Packetery/Checkout/Model/Pricing/Service.php +++ b/Packetery/Checkout/Model/Pricing/Service.php @@ -129,6 +129,10 @@ protected function resolvePrice(RateRequest $request, AbstractConfig $config, Pr return 0; } + if ($request->getFreeShipping()) { + return 0; + } + $weightRules = $this->getWeightRulesByPricingRule($pricingRule); return $this->resolveWeightedPrice($weightRules, $weightTotal, $config->getMaxWeight()); } diff --git a/Packetery/Checkout/Ui/Component/CarrierCountry/Form/Modifier.php b/Packetery/Checkout/Ui/Component/CarrierCountry/Form/Modifier.php index 52ca498..f9dd1a0 100644 --- a/Packetery/Checkout/Ui/Component/CarrierCountry/Form/Modifier.php +++ b/Packetery/Checkout/Ui/Component/CarrierCountry/Form/Modifier.php @@ -31,6 +31,12 @@ class Modifier implements ModifierInterface /** @var \Packetery\Checkout\Model\FeatureFlag\Manager */ private $featureFlagManager; + /** @var \Packetery\Checkout\Model\ResourceModel\Carrier\CollectionFactory */ + private $carrierCollectionFactory; + + /** @var Carrier\Imp\Packetery\Carrier */ + private $packeteryCarrier; + /** * Modifier constructor. * diff --git a/Packetery/Checkout/composer.json b/Packetery/Checkout/composer.json index 550e0e1..a39a4cb 100755 --- a/Packetery/Checkout/composer.json +++ b/Packetery/Checkout/composer.json @@ -3,6 +3,7 @@ "description": "module Packetery for Magento 2", "type": "magento2-module", "license": "AFL-3.0", + "version": "2.3.1", "authors": [ { "name": "Packeta Innovations", @@ -18,13 +19,5 @@ "psr-4": { "Packetery\\Checkout\\": "" } - }, - "extra": { - "map": [ - [ - "*", - "Packetery/Checkout" - ] - ] } }