Last active
March 10, 2016 17:50
-
-
Save msroot/2e77fa7b4515211720ca to your computer and use it in GitHub Desktop.
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
| master_keys = [] | |
| ["US", | |
| "CA", | |
| "AU", | |
| "DK", | |
| "NO", | |
| "SE", | |
| "FI", | |
| "JP", | |
| "AT", | |
| "BE", | |
| "DE", | |
| "ES", | |
| "FR", | |
| "GB", | |
| "IE", | |
| "IT", | |
| "LU", | |
| "NL"].map do |e| | |
| c = Stripe::CountrySpec.retrieve(e) | |
| c = c[:verification_fields] | |
| keys = [] | |
| keys<< c[:individual][:minimum] | |
| keys<< c[:individual][:additional] | |
| keys<< c[:company][:minimum] | |
| keys<< c[:company][:additional] | |
| master_keys << keys.flatten.uniq.map { |e| e.split(".")[0] }.uniq | |
| end | |
| puts master_keys.flatten.uniq | |
| # [137] pry(main)> puts master_keys.flatten.uniq | |
| # external_account | |
| # legal_entity | |
| # tos_acceptance | |
| # In your params: | |
| # white_listed_keys = ["legal_entity.", "tos_acceptance.", "additional_owners"] | |
| white_listed_keys = master_keys.flatten.uniq | |
| entities = entities.keep_if { |key, _| | |
| key.to_s.start_with? *white_listed_keys | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment