Files
discourse-subscriptions/assets/javascripts/discourse/components/subscribe-us-state-select.js
T
Mark Reeves 803bba7938 FEATURE: Capture cardholder address fields for Stripe customer (#161)
- Adds the following fields to the subscription payment form:
  - Cardholder Name
  - Country
  - Postal Code
  - Address Line 1
  - City
  - State or Province
- Stripe recommends Cardholder Name & Country for verification; Cardholder Name, Country, and State/Province for US/Canada selections are required fields
- All fields are passed to Stripe for verification on submit
- Fields are also captured on the customer record in Stripe, under Billing Details
2023-05-05 13:20:35 -04:00

89 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import ComboBoxComponent from "select-kit/components/combo-box";
import { computed } from "@ember/object";
import I18n from "I18n";
export default ComboBoxComponent.extend({
pluginApiIdentifiers: ["subscribe-us-state-select"],
classNames: ["subscribe-address-state-select"],
nameProperty: "name",
valueProperty: "value",
selectKitOptions: {
filterable: true,
allowAny: false,
translatedNone: I18n.t(
"discourse_subscriptions.subscribe.cardholder_address.state"
),
},
content: computed(function () {
return [
["AL", "Alabama"],
["AK", "Alaska"],
["AZ", "Arizona"],
["AR", "Arkansas"],
["CA", "California"],
["CO", "Colorado"],
["CT", "Connecticut"],
["DE", "Delaware"],
["US", "District"],
["FL", "Florida"],
["GA", "Georgia"],
["HI", "Hawaii"],
["ID", "Idaho"],
["IL", "Illinois"],
["IN", "Indiana"],
["IA", "Iowa"],
["KS", "Kansas"],
["KY", "Kentucky"],
["LA", "Louisiana"],
["ME", "Maine"],
["MD", "Maryland"],
["MA", "Massachusetts"],
["MI", "Michigan"],
["MN", "Minnesota"],
["MS", "Mississippi"],
["MO", "Missouri"],
["MT", "Montana"],
["NE", "Nebraska"],
["NV", "Nevada"],
["NH", "New Hampshire"],
["NJ", "New Jersey"],
["NM", "New Mexico"],
["NY", "New York"],
["NC", "North Carolina"],
["ND", "North Dakota"],
["OH", "Ohio"],
["OK", "Oklahoma"],
["OR", "Oregon"],
["PA", "Pennsylvania"],
["RI", "Rhode"],
["SC", "South"],
["SD", "South"],
["TN", "Tennessee"],
["TX", "Texas"],
["UT", "Utah"],
["VT", "Vermont"],
["VA", "Virginia"],
["WA", "Washington"],
["WV", "West"],
["WI", "Wisconsin"],
["WY", "Wyoming"],
["AS", "American Samoa"],
["GU", "Guam"],
["MP", "Northern Mariana Islands"],
["PR", "Puerto Rico"],
["VI", "U.S. Virgin Islands"],
["UM", "U.S. Minor Outlying Islands"],
["MH", "Marshall Islands"],
["FM", "Micronesia"],
["PW", "Palau"],
["AA", "U.S. Armed Forces Americas"],
["AE", "U.S. Armed Forces Europe"],
["AP", "U.S. Armed Forces Pacific"],
].map((arr) => {
return { value: arr[0], name: arr[1] };
});
}),
});