Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Update TransactionAddress#state_code validation #141

Merged
merged 1 commit into from
Dec 18, 2017

Conversation

alepore
Copy link
Contributor

@alepore alepore commented Dec 4, 2017

Only validates this field if the country requires states, because this is not always true.

Example:
On an express checkout from the cart button with a german address, the state field is not present on the Paypal form and the payload we receive, because it's not required.
(On Solidus the Germany country has states_required: true, and this is wrong.)

This also uses Address#states_required? for the check instead of checking objects presence, i think this is more correct.

Copy link
Member

@tvdeyen tvdeyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes much more sense. Just a little nit about usage of try

Only validates this field if the country requires states.
Use `Address#states_required?` for this check instead of checking objects
presence.
@alepore alepore force-pushed the update_state_code_validation branch from 4eb1528 to d6b5262 Compare December 5, 2017 08:41
@tvdeyen tvdeyen merged commit 52b5ed9 into solidusio:master Dec 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants