Closed lukas-jansen closed 1 year ago
Ooh that's new information to me. Thanks for sharing @lukas-jansen! Right now in my use case I'm splitting the address before sending it off to Sendcloud, so requiring just an address would be easier too.
I'll play around with this soon™ to see if I can make this happen without causing BC breaks. Otherwise bumping a major version for this shouldn't be too much of an issue either.
I'm using this library in the context of this plugin https://github.com/white-nl/commerce-sendcloud and I believe house_number is required for some destinations, for example Switzerland.
Did a bit more testing, looks like sending null
as house_number still throws an error.
When sending an empty string the house number will be extracted from the address (street
) itself. When the street doesn't contains a house number or it can't extract it for a reason it will throw the error house_number: "This field cannot be blank."
It will also work when you don't sent the house_number
argument at all. But then it should be ignored here
@villermen so no actual real change must be done, except maybe defaulting it to an empty string so you could skip it if you use named arguments?.
https://api.sendcloud.dev/docs/sendcloud-public-api/parcels/operations/create-a-parcel#request-body
https://github.com/JouwWeb/sendcloud/blob/master/src/Model/Address.php#L28
As sendcloud has an automatic extraction system in place to get the house number from the address you provide, is not required to sent the house number separately and you can combine it inside the address field.