Skip to content

Commit

Permalink
Merged develop into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JonYeb committed Jul 26, 2022
2 parents 2a1e3c7 + 75b6717 commit 8882625
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 21 additions & 1 deletion src/modules/mo/mo_dhl/Api/Standortsuche.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/mo/mo_dhl/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'en' => '<p>Enable features providing Post & Paket Delivery to your OXID shop.</p>' . '<p><a href="https://projects.mediaopt.de/projects/mopt-postp-ua/wiki" target="_blank">Handbook</a></p>',
],
'thumbnail' => 'logo.png',
'version' => '1.6.1',
'version' => '1.6.2',
'author' => '<a href="http://www.mediaopt.de" target="_blank">mediaopt.</a>',
'url' => 'http://www.mediaopt.de',
'email' => '[email protected]',
Expand Down

0 comments on commit 8882625

Please sign in to comment.