diff --git a/Changelog.md b/Changelog.md index 4c932fac..724d2781 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## 1.6.2 +* filter out results not suitable to receive packages + ## 1.6.1 * add weight inputs for articles in custom label form * use article weight over orderarticle weight diff --git a/project.json b/project.json index a469e769..d38f1651 100644 --- a/project.json +++ b/project.json @@ -4,7 +4,7 @@ "pathToModule": "copy_this/modules/mo/mo_dhl", "prefix": "mo_", "suffix": "", - "version": "1.6.1", + "version": "1.6.2", "compatibility": { "minimumVersion": "6.0", "maximumVersion": null, diff --git a/src/modules/mo/mo_dhl/Api/Standortsuche.php b/src/modules/mo/mo_dhl/Api/Standortsuche.php index 2177a3d7..4a9a62c9 100644 --- a/src/modules/mo/mo_dhl/Api/Standortsuche.php +++ b/src/modules/mo/mo_dhl/Api/Standortsuche.php @@ -122,6 +122,25 @@ protected function buildAddressString($address, $postalCode = null, $countryIso2 return $this->sanitizeAddressString(implode('&', $urlOptions)); } + /** + * @param $location + * @return bool + */ + public function locationFilterFunction($location) + { + return $location->location->keyword !== "" && $location->location->keywordId !== ""; + } + + /** + * @param $locations + * @return object + */ + protected function filterUndelivarableLocations($locations) + { + $filteredLocations = array_filter($locations->locations, [$this, "locationFilterFunction"]); + return (object)['locations' => $filteredLocations]; + } + /** * @param Address|string $address * @param string|null $postalCode @@ -136,7 +155,8 @@ public function getParcellocationByAddress($address, $postalCode = null, $countr return new ServiceProviderList([]); } $locations = $this->callApi($addressString); - $oldAPIstandart = $this->convert($locations); + $filteredLocations = $this->filterUndelivarableLocations($locations); + $oldAPIstandart = $this->convert($filteredLocations); return $this->extractServiceProviders($oldAPIstandart); } diff --git a/src/modules/mo/mo_dhl/metadata.php b/src/modules/mo/mo_dhl/metadata.php index e769063d..764f1e8d 100644 --- a/src/modules/mo/mo_dhl/metadata.php +++ b/src/modules/mo/mo_dhl/metadata.php @@ -17,7 +17,7 @@ 'en' => '
Enable features providing Post & Paket Delivery to your OXID shop.
' . '', ], 'thumbnail' => 'logo.png', - 'version' => '1.6.1', + 'version' => '1.6.2', 'author' => 'mediaopt.', 'url' => 'http://www.mediaopt.de', 'email' => 'shopsoftware@deutschepost.de',