sharish / CreditCardView

Apache License 2.0
968 stars 246 forks source link

Added support for AMEX cards (15 digits, CVV on the front) #40

Closed dcchristopher closed 7 years ago

dcchristopher commented 7 years ago

Short of a rewrite to abstract some of the credit card type-specific variations, the changes I have implemented in this PR add support for AMEX cards. The highlights are: 15 digits, different grouping of the digits, the CVV is on the front (thus, don't flip the card). I also made some miscellaneous fixes that in some cases would cause fatal exceptions or unwanted degradation in the support of the AMEX cards (such as switching back to 3-digit CVV).

There are still many things I changed in my local repo that I did not include with this PR, such as the card color and chip layout being changed even after the card type has been identified. I would want to keep the Amex card green and not have it change color yet again. There are other chicken and egg issues with the code, such as setting the max CVV length when the underlying view object is still null. Again, a rewrite is in order. One has to separate the model logic from the UI.

Anyway, I hope this helps some folks out there who are wanting a better visualization of the AmEx cards.