DivideBV / Postnl

Library to connect to PostNL's SOAP service called CIF
GNU General Public License v2.0
31 stars 40 forks source link

Bug: new API GetNearestLocationsRequest #64

Closed 11mb closed 5 years ago

11mb commented 5 years ago

Expected Behavior

When calling Postnl::getNearestLocations I Expect a response with dropoff locations.

Current Behavior

When executed, the response is an error:

"Parameter 'Location.OpeningTime' may not be null."

Steps to Reproduce

// Codesnippet from Postnl::getNearestLocations with sample data
$message = new ComplexTypes\Message;
$location = new ComplexTypes\Location('4330AB', 'false', '15-10-2018');
$request = new ComplexTypes\GetNearestLocationsRequest($message, $location, 'NL');

Workaround

It looks like PostNL doesnt like the empty key OpeningTime. A Quick workaround is to disable line 24 in BaseLocation:

/**
 * @var string
 */
//protected $OpeningTime = null;

Version v2.0.0-beta1

CrazyHenk44 commented 5 years ago

I can confirm this function is broken:

$locations = $client->getNearestLocations($zip, false, null, $country);

Results in errors:

I tried to set it manually, but the same error.

ameenross commented 5 years ago

This is the same for the confirming webservice. They essentially changed the behaviour of the new endpoints, instead of just different authentication. I've already gotten an acknowledgement from PostNL in this regard.

CrazyHenk44 commented 5 years ago

Maybe, but getNearestLocations($zip, false, null, $country) sets AllowSundaySorting to false (2nd argument). So the error might indicate there is something broken in the library as well.

ameenross commented 5 years ago

It should be a string "true"/"false". According to the WSDL, the value is simply a string.

ameenross commented 5 years ago

However, looks like the OpeningTime error can't be solved, like #63

11mb commented 5 years ago

Isn't it possible to add the variables dynamicly to the class?

ameenross commented 5 years ago

It would mean adding class annotation like @property string $openingTime and removing the properties. Not necessarily a big deal, but PostNL violates their WSDL so it's a won't fix.

Besides, I have no clue for how many properties I would need to do that

This has already cost us a lot of time.

11mb commented 5 years ago

Do you have contact about this issue with PostNL? Is there something I can support you with?

ameenross commented 5 years ago

They acknowledged the issue and apparently they're working on it. I hope to hear news next week.

ameenross commented 5 years ago

They made a new release last monday. This should be resolved. Can you test?

CrazyHenk44 commented 5 years ago

I can confirm it is fixed.

ameenross commented 5 years ago

Great. Thanks for confirming

11mb commented 5 years ago

Yes it is working indeed. Thanks for your effort @ameenross!