-
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
Add ability to set card number and validate it #671
Conversation
/** | ||
* Checks whether the current card number is valid | ||
*/ | ||
public boolean validateCardNumber() { |
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.
Appears to be unused, is that intentional? Does it need to be a public method?
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.
It is intentional. We are adding the ability for our users to call this. I think there's cases where they will want to just add the number and cases when they will want to add it validate it so we allow them to do both.
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.
Should we add a test for this method then?
* | ||
* @param cardNumber card number to be set | ||
*/ | ||
public void setCardNumber(String cardNumber) { |
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 you add tests for the various types of card numbers (e.g. cards with spaces, cards without?)
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.
Added them. Though, TBH, I don't think adding tests here do adds that much safety. More test is better than fewer and this doesn't feel like a fragile test so I'm in the it can't hurt camp.
This is a one line wrapper file that exists to expose existing functionality to users on the SDK. That existing functionality is already tested
stripe-android/stripe/src/test/java/com/stripe/android/view/CardMultilineWidgetTest.java
Line 115 in 6670d21
public void getCard_whenInputIsValidVisaWithZip_returnsCardObjectWithLoggingToken() { |
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.
Also one more nit, might be good practice to annotate new methods we add (@NonNull
in this case)
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.
didn't mean to approve
In response to:
#508