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

Add state code field #34

Merged
merged 2 commits into from
Sep 6, 2021
Merged

Add state code field #34

merged 2 commits into from
Sep 6, 2021

Conversation

sqr
Copy link
Contributor

@sqr sqr commented Sep 5, 2021

This PR adds a field state code which is necessary when capturing orders in the US.

Before this change, trying to use OrderCapture with country_code="us" would throw an error due to the missing stateCode.

After this change, the user can pass the state code along with the zip code, for example:

api.OrderCapture(zip_code="02215", state_code="MA")

The state code validator takes into account that all state codes should have two letters. state_code string is not case sensitive.

If no state code is specified, an empty string is passed, which does not affect non-US country codes.

It has been tested with US state codes, I am not aware if there are other countries for which IKEA requires state codes.

Closes #33

@vrslev
Copy link
Owner

vrslev commented Sep 6, 2021

Hello! Can you check "Allow edits from maintainers"? I want to do some changes.

- state_code default is None
- more clear validation
- don't add state_code to payload when it is None
@vrslev vrslev merged commit 1b9de6e into vrslev:main Sep 6, 2021
vrslev added a commit that referenced this pull request Sep 6, 2021
- token reuse warning (closes #35)
- `state_code` notice in OrderCapture (#34)
@vrslev vrslev mentioned this pull request Sep 6, 2021
vrslev added a commit that referenced this pull request Sep 6, 2021
- token reuse warning (closes #35)
- `state_code` notice in OrderCapture (#34)
@sqr sqr deleted the bug/33_add_state_code branch September 6, 2021 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KeyError: 'details' when using US zip codes
2 participants