From fbf8800883d8a40da45233d5dc807809ce1b8aa8 Mon Sep 17 00:00:00 2001 From: marija Date: Mon, 20 Dec 2021 16:47:21 +0100 Subject: [PATCH 1/4] Fixed EditServiceController CS-2768 --- .../Resources/js/EditServiceController.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/BusinessLogic/Resources/js/EditServiceController.js b/src/BusinessLogic/Resources/js/EditServiceController.js index cfc5f22b..b8ab0788 100644 --- a/src/BusinessLogic/Resources/js/EditServiceController.js +++ b/src/BusinessLogic/Resources/js/EditServiceController.js @@ -328,16 +328,20 @@ if (!window.Packlink) { } for (let systemId in pricePolicyControllers) { - let fieldName = pricePolicyControllers[systemId].getExcludedFieldForValidation(); - if (fieldName !== null) { - excludedElementNames.push(fieldName); + if (pricePolicyControllers.hasOwnProperty(systemId)) { + let fieldName = pricePolicyControllers[systemId].getExcludedFieldForValidation(); + if (fieldName !== null) { + excludedElementNames.push(fieldName); + } } } if (validationService.validateForm(form, excludedElementNames) && validateMiconfiguredPolicies()) { let pricingPolicies = []; for (let systemId in pricePolicyControllers) { - pricingPolicies = pricingPolicies.concat(pricePolicyControllers[systemId].getSystemPricingPolicies()); + if (pricePolicyControllers.hasOwnProperty(systemId)) { + pricingPolicies = pricingPolicies.concat(pricePolicyControllers[systemId].getSystemPricingPolicies()); + } } serviceModel.activated = true; From 9ffa887aaffc1b64ad50d8a03b66bb3e4da53af2 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 27 Dec 2021 10:06:08 +0100 Subject: [PATCH 2/4] Add drop-off flag to configuration service PLCRSET229-7 --- src/BusinessLogic/Configuration.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/BusinessLogic/Configuration.php b/src/BusinessLogic/Configuration.php index 600bb5b1..df223c04 100644 --- a/src/BusinessLogic/Configuration.php +++ b/src/BusinessLogic/Configuration.php @@ -53,6 +53,16 @@ public function setMaxTaskAge($maxAge) $this->saveConfigValue('maxTaskAge', $maxAge); } + /** + * Determines whether the drop-off shipping services are system supported. + * + * @return bool + */ + public function dropOffShippingServicesSupported() + { + return true; + } + /** * Returns web-hook callback URL for current system. * From 77764e2f81274ae44dcb3e732fa0a2c8a061d5d7 Mon Sep 17 00:00:00 2001 From: Tamara Date: Mon, 27 Dec 2021 10:07:04 +0100 Subject: [PATCH 3/4] Update getting shipping services with drop-off flag PLCRSET229-8 --- src/BusinessLogic/Http/Proxy.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/BusinessLogic/Http/Proxy.php b/src/BusinessLogic/Http/Proxy.php index 77188b6c..01ea99d0 100644 --- a/src/BusinessLogic/Http/Proxy.php +++ b/src/BusinessLogic/Http/Proxy.php @@ -301,6 +301,10 @@ public function getShippingServicesDeliveryDetails(ShippingServiceSearch $params $shippingDetails = ShippingServiceDetails::fromBatch($body); + if (!$this->configService->dropOffShippingServicesSupported()) { + return $this->getShippingServicesDeliveryDetailsWithoutDropOffServices($shippingDetails, $params); + } + foreach ($shippingDetails as $shippingDetail) { $shippingDetail->departureCountry = $params->fromCountry; $shippingDetail->destinationCountry = $params->toCountry; @@ -440,6 +444,29 @@ public function sendAnalytics($eventName) } } + /** + * @param $shippingDetails + * @param $params + * @return array + */ + protected function getShippingServicesDeliveryDetailsWithoutDropOffServices($shippingDetails, $params) + { + $newShippingDetails = array(); + + foreach ($shippingDetails as $shippingDetail) { + if ($shippingDetail->destinationDropOff) { + continue; + } else { + $shippingDetail->departureCountry = $params->fromCountry; + $shippingDetail->destinationCountry = $params->toCountry; + $shippingDetail->national = $params->toCountry === $params->fromCountry; + $newShippingDetails[] = $shippingDetail; + } + } + + return $newShippingDetails; + } + /** * Calls shipments endpoint and handles response. Any shipment endpoint can return 404 so this call handles that. * From 5d4c03fc854435974c9aa1116677a82ac5292767 Mon Sep 17 00:00:00 2001 From: Risto Date: Mon, 31 Jan 2022 12:51:29 +0100 Subject: [PATCH 4/4] Release version 3.3.5 ISSUE: PLCRSET229-24 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de8c05c7..491bde42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). +## [3.3.5](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.4...v3.3.5) - 2021-01-31 +### Added +- Added a new configuration flag that specifies whether a given integration supports drop-off carriers or not. The default will be `true` and only integrations that do not support drop-off carriers should set this flag to `false`. +### Changed +- Fixed a frontend issue when adding/editing a shipping service on the module configuration page. + ## [3.3.4](https://github.com/packlink-dev/ecommerce_module_core/compare/v3.3.3...v3.3.4) - 2021-11-30 ### Changed - Updated the mechanism for fetching controller URLs on the frontend views.