From d986a5a8a45dca7b784e7b7b75f4d8825b0e79b5 Mon Sep 17 00:00:00 2001 From: Jonathan Yeboah Date: Mon, 11 Jul 2022 14:16:33 +0200 Subject: [PATCH 1/3] #32076 * Added filter function to remove unsupported locations --- src/modules/mo/mo_dhl/Api/Standortsuche.php | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/modules/mo/mo_dhl/Api/Standortsuche.php b/src/modules/mo/mo_dhl/Api/Standortsuche.php index 20c728d4..33388972 100644 --- a/src/modules/mo/mo_dhl/Api/Standortsuche.php +++ b/src/modules/mo/mo_dhl/Api/Standortsuche.php @@ -118,6 +118,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 @@ -132,7 +151,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); } From db3806c2589e88d0f356bd8cdf243e3840ea9ce2 Mon Sep 17 00:00:00 2001 From: Jonathan Yeboah Date: Mon, 25 Jul 2022 08:41:09 +0200 Subject: [PATCH 2/3] Changelog.md --- Changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changelog.md b/Changelog.md index 4c932fac..35dd52b1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## next version +* 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 From 75b6717336904592cbcce5827ca513d51afdd1d8 Mon Sep 17 00:00:00 2001 From: Jonathan Yeboah Date: Tue, 26 Jul 2022 08:51:12 +0200 Subject: [PATCH 3/3] create new version 1.6.2 --- Changelog.md | 2 +- project.json | 2 +- src/modules/mo/mo_dhl/metadata.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 35dd52b1..724d2781 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,6 @@ # Changelog -## next version +## 1.6.2 * filter out results not suitable to receive packages ## 1.6.1 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/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.

' . '

Handbook

', ], 'thumbnail' => 'logo.png', - 'version' => '1.6.1', + 'version' => '1.6.2', 'author' => 'mediaopt.', 'url' => 'http://www.mediaopt.de', 'email' => 'shopsoftware@deutschepost.de',