Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

House number is not required #23

Closed
lukas-jansen opened this issue Jun 28, 2023 · 3 comments · Fixed by #24
Closed

House number is not required #23

lukas-jansen opened this issue Jun 28, 2023 · 3 comments · Fixed by #24
Assignees
Labels
enhancement New feature or request

Comments

@lukas-jansen
Copy link
Contributor

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.

@villermen villermen self-assigned this Jun 29, 2023
@villermen villermen added the enhancement New feature or request label Jun 29, 2023
@villermen
Copy link
Member

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.

@bleepsandblops
Copy link

bleepsandblops commented Jun 30, 2023

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.

@lukas-jansen
Copy link
Contributor Author

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?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants