Webador / sendcloud

Provides a PHP client to interact with the SendCloud API in an object-oriented way.
MIT License
16 stars 15 forks source link

Support for 'to_post_number' parcel parameter #15

Closed ahegyes closed 3 years ago

ahegyes commented 3 years ago

Hello!

I was wondering if you might be willing to include support for the 'to_post_number' parameter of the parcel creation endpoint (https://docs.sendcloud.sc/api/v2/shipping/#create-a-parcel)? It's needed for creating DHL Parcel Service Point deliveries in Germany (maybe in other places too).

This would have to be handled similarly to the 'to_service_point' parameter.

Thank you!

villermen commented 3 years ago

Thanks for creating an issue for this @ahegyes!

There is no mention about the format of this field. In the Netherlands we usually handle PO boxes by just using "Postbus #" as the street address and number and fill in the other details as usual.

How does this fit in with the other fields? Is this just a value you can optionally add on top of the other information?

ahegyes commented 3 years ago

I have this image from SendCloud's post box selection in Germany:

postnummer

Basically, it's required to enter a so-called Postnummer (PO number?) that you get from DHL. As far as I know, it's always just a numeric string of length 9 but I guess that could vary. It's passed on as an extra parameter to DHL and the recipient will need to know this number in order to get their package (they also first need to register with DHL to get the number to begin with).

For myself, I actually went ahead and added a string parameter to try it out and it worked as expected on SendCloud's end. Basically I edited the function 'createParcel' in Client.php to accept a parameter ?string servicePointNumber and down the line I handled it the same as 'to_service_point' (except that it's a string, not an int).

villermen commented 3 years ago

Hey @ahegyes. Sorry for not getting back on this sooner, but v3.10.0 which just released supports an additional $postNumber argument in Client::createParcel().

ahegyes commented 3 years ago

Awesome, thank you very much!