Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update postal code logic #1479

Merged
merged 18 commits into from
Feb 12, 2020
Merged

Update postal code logic #1479

merged 18 commits into from
Feb 12, 2020

Conversation

davidme-stripe
Copy link
Contributor

@davidme-stripe davidme-stripe commented Jan 23, 2020

Summary

  • Request postal codes by default in most situations. This is not a breaking change to our public API, though it may cause trouble if folks are messing with our internals.
  • When STPBillingAddressFieldsZip is selected, STPAddCardViewController will now embed the postal code collection into the STPPaymentCardTextField instead of splitting it out into a separate row.
  • Postal codes will now be validated for non-US markets. We're assuming that they're always uppercase, and include only alphanumeric characters, dashes, and spaces. These rules will also apply in the US, as we can't be 100% sure that a US region user will have a US ZIP code. Shipping/Billing address entry forms will still validate and enforce US-style ZIP codes for US addresses.
  • All countries will use the NumbersAndPunctuation keyboard.
  • STPBillingAddressFieldsZip has been deprecated in favor of STPBillingAddressFieldsPostalCode, which is identical. I'm not sure whether this is worth the churn, but it didn't seem appropriate to use "ZIP" now that it's the default option globally.

Motivation

We're now recommending that all users in the US collect postal codes.

Testing

  • On a device, switching between a few regions and exercising different STPBillingAddressFields settings.
  • I've also added a new set of end-to-end tests using a French device in Belize, covering both the "different language" and "doesn't use postal codes" case.

@davidme-stripe davidme-stripe changed the title WIP: Update postal code logic Update postal code logic Jan 23, 2020
Copy link
Contributor

@csabol-stripe csabol-stripe left a comment

Choose a reason for hiding this comment

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

yay UI tests!

Looks good with a couple questions inline

We should probably add some text to MIGRATING.md describing how the default behavior has changed and why you probably don't want to revert the change but here's how you would if you really want to

Stripe/NSCharacterSet+Stripe.m Show resolved Hide resolved
Stripe/STPAddCardViewController.m Show resolved Hide resolved
Stripe/STPAddressFieldTableViewCell.m Show resolved Hide resolved
@davidme-stripe davidme-stripe merged commit 0c27170 into master Feb 12, 2020
@davidme-stripe davidme-stripe deleted the davidme/update-zip-logic branch February 12, 2020 21:29
yuki-stripe pushed a commit that referenced this pull request Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants