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

CardInputWidget.CardValidCallback will consider the postal code in validation. #4202

Merged
merged 3 commits into from
Sep 21, 2021

Conversation

michelleb-stripe
Copy link
Contributor

Summary

With this change the CardValidCallback for CardInputWidget will only report isValid = true if CardNumber, CVC, and ExpiryDate are valid, and if either postalCodeRequired or usZipCodeRequired is true and the postalCodeEnabled (aka visible) isValid will only be true if it passes postal code validation.

The cardParams when queried will change focus to any invalid fields. This is as it is currently designed. If not wanting focus to change to invalid fields cardParams, paymentMethodCreateParams, and paymentMethodCard should only be called when CardValidCallback returns true (which will not be correctly reported). The comments in the code have been updated to reflect this.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@@ -197,7 +200,7 @@ class CardInputWidget @JvmOverloads constructor(

/**
* A [PaymentMethodCreateParams] representing the card details and postal code if all fields
* are valid; otherwise `null`
* are valid; otherwise `null`. If a field is invalid focus will shift to the invalid field
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: missing a . here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants