Allow opting countries out of states_required at seed time#6458
Open
shaggybelco wants to merge 1 commit intosolidusio:mainfrom
Open
Allow opting countries out of states_required at seed time#6458shaggybelco wants to merge 1 commit intosolidusio:mainfrom
shaggybelco wants to merge 1 commit intosolidusio:mainfrom
Conversation
Carmen exposes German Bundesländer as subregions, so the default seeder marks Germany's `Spree::Country#states_required` as `true`. PayPal and Braintree do not return state data for German addresses, which then fails Solidus's address validation at checkout. Introduce a `countries_not_requiring_states` preference (default `["DE"]`) and consult it from both the country seeder and the country factory. The `Spree::Country.iso == "DE"` row will be seeded with `states_required = false` going forward, and host applications can extend the list (e.g. `["DE", "ES"]`) without monkey-patching the seeder. Existing seeded databases keep their current values; this only affects new installs and freshly created `Spree::Country` records. Closes solidusio#3803
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Carmen exposes German Bundesländer as subregions, so the default seeder marks Germany's
Spree::Country#states_requiredastrue. PayPal and Braintree do not return state data for German addresses, which then fails Solidus's address validation at checkout.Introduce a
countries_not_requiring_statespreference (default["DE"]) and consult it from both the country seeder and the country factory. TheSpree::Country.iso == "DE"row will be seeded withstates_required = falsegoing forward, and host applications can extend the list (e.g.["DE", "ES"]) without monkey-patching the seeder.Existing seeded databases keep their current values; this only affects new installs and freshly created
Spree::Countryrecords.Closes #3803
Summary
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: