Extract CardAttributes from CardType#119
Extract CardAttributes from CardType#119sshropshire wants to merge 22 commits intonext-major-versionfrom
Conversation
Signed-off-by: Jose Noriega <jonoriega@paypal.com>
…java implementation.
| version '5.4.1-SNAPSHOT' | ||
| ext { | ||
| compileSdkVersion = 30 | ||
| compileSdkVersion = 33 |
There was a problem hiding this comment.
Do we need a changelog for these changes?
| @@ -1,2 +1 @@ | |||
| android.enableJetifier=true | |||
There was a problem hiding this comment.
Same with this one, is a changelog needed?
There was a problem hiding this comment.
Good call! I updated the CHANGELOG with the relevant entries.
| * Character#isDefined(char)} is {@code false}). | ||
| * @see <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn Algorithm (Wikipedia)</a> | ||
| */ | ||
| public static boolean isLuhnValid(String cardNumber) { |
There was a problem hiding this comment.
Since this is all going into a next-major-version branch is it worth explicitly calling out these breaking changes in the changelog? On iOS we have a breaking changes section where we've listed items like this. I realize it's a lot of functions to call out but since there isn't a docstring calling out it could be removed at any time, it may be helpful. Thoughts?
There was a problem hiding this comment.
This is a good callout. I'll add some CHANGELOG notes that it's no longer in the public facing API.
| val result = mutableMapOf<CardType, CardAttributes>() | ||
| for (item in items) { | ||
| result[item.cardType] = item | ||
| } | ||
| return result |
There was a problem hiding this comment.
Take it or leave it comment - if there's a clean/easy way to just create a map literal for knownCardBrandAttributes, might be nice not to need this additional helper function.
There was a problem hiding this comment.
Yeah I agree. It's a compile time vs. runtime tradeoff. I initially went for a when statement but duplicating CardType felt like a code smell so I refactored to creating the map at runtime.
mapOf(
CardType.VISA to CardAttributes(CardType.VISA, "^4\\d*", R.drawable.bt_ic_visa, 16, 16, 3, R.string.bt_cvv, null)
)| ## unreleased | ||
| * Bump `compileSdkVersion` and `targetSdkVersion` to API level 33 | ||
| * Move all classes to `com.braintreepayments.api` package | ||
| * Remove Jetifier now that AndroidX is fully supported |
Summary of changes
CardTypea pure enumCardAttributesto hold metadata about a particular card brandCardParserChecklist
Authors