-
Notifications
You must be signed in to change notification settings - Fork 662
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
Support 3 digit AMEX CVC input. #548
Conversation
71fac7c
to
228d68e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
It would be optimal if we could look into simplifying the expressions though.
if (StripeTextUtils.isBlank(cvcValue) || cvcValue.length() != requiredLength) { | ||
String cvcValue = mCvcNumberEditText.getText().toString().trim(); | ||
int cvcLength = cvcValue.length(); | ||
if (!(cvcLength == Card.CVC_LENGTH_COMMON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we simplify this expression at all? I'm worried it'll be confusing down the line with all the nesting and the parts
One idea is we can either pull it into two functions
isCommonCSVLength() || isValidAmexCVC()
boolean cvcIsValid = ViewUtils.isCvcMaximalLength( | ||
mCardBrand, mCvcEditText.getText().toString()); | ||
int cvcLength = mCvcEditText.getText().toString().trim().length(); | ||
boolean cvcIsValid = cvcLength == Card.CVC_LENGTH_COMMON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we simplify this at all? This looks confusing and I'm concern it will be hard to maintain.
One option is to pull this into a self documenting helper function and to write some tests for it because then we will be able to know what the expression is expected to resolve to
https://jira.corp.stripe.com/browse/ANDROID-220