Thursday, 10 March 2016

Find all uniq stripe keys for identity


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
}
view raw keys.rb hosted with ❤ by GitHub

No comments:

Post a Comment