diff --git a/src/LocationClient.php b/src/LocationClient.php index 80069a9..96aaeac 100644 --- a/src/LocationClient.php +++ b/src/LocationClient.php @@ -58,4 +58,13 @@ public function getLocation(ComplexTypes\GetLocationRequest $getLocations) { return $this->__soapCall('GetLocation', [$getLocations]); } + + /** + * @param ComplexTypes\GetNearestLocationsRequest $getLocationsInArea + * @return ComplexTypes\GetLocationsResult + */ + public function getLocationsInArea(ComplexTypes\GetLocationsInAreaRequest $getLocationsInArea) + { + return $this->__soapCall('GetLocationsInArea', [$getLocationsInArea]); + } } diff --git a/src/Postnl.php b/src/Postnl.php index 27c08a9..e72f57e 100644 --- a/src/Postnl.php +++ b/src/Postnl.php @@ -417,6 +417,40 @@ public function getNearestLocation( $request = new ComplexTypes\GetNearestLocationsRequest($message, $location, $countryCode); return $this->call('LocationClient', __FUNCTION__, $request); } + + /** + * @param ComplexTypes\Coordinate $coordinatesNorthWest + * @param ComplexTypes\Coordinate $coordinatesSouthEast + * @param string $allowSundaySorting + * @param null|string $deliveryDate + * @param array $deliveryOptions + * @param array $options + * @param string $countryCode + * @return ComplexTypes\GetNearestLocationsResponse + */ + public function getLocationsInArea( + ComplexTypes\Coordinate $coordinatesNorthWest, + ComplexTypes\Coordinate $coordinatesSouthEast, + $allowSundaySorting = 'false', + $deliveryDate = null, + $deliveryOptions = null, + $options = ['Daytime'], + $countryCode = 'NL' + ) { + $message = new ComplexTypes\Message; + + $deliveryDate = $deliveryDate ?: (new \DateTime('next monday'))->format('d-m-Y'); + $locationArea = ComplexTypes\LocationArea::create() + ->setAllowSundaySorting($allowSundaySorting) + ->setDeliveryDate($deliveryDate) + ->setDeliveryOptions($deliveryOptions) + ->setOptions($options) + ->setCoordinatesNorthWest($coordinatesNorthWest) + ->setCoordinatesSouthEast($coordinatesSouthEast); + + $request = new ComplexTypes\GetLocationsInAreaRequest($countryCode, $locationArea, $message); + return $this->call('LocationClient', __FUNCTION__, $request); + } /** * @param string $postalCode