barbarity / CreditCardFormatter

A library for validating and formatting credit cards written in Swift
MIT License
7 stars 2 forks source link

CreditCardFormatter doesn't work correct with test UnionPay card #4

Closed ursasoft closed 4 years ago

ursasoft commented 4 years ago

"6200 0000 0000 0005" is returned as invalid credit card number

barbarity commented 4 years ago

Hi @sebasx,

This is probably my mistake for not updating the README. Please make sure that you're using the correct formatters. China UnionPay isn't included in the default list of formatters.

To add it you can use all formatters like this:


let creditCardFormatter = CreditCardFormatter()
creditCardFormatter.formatters = CreditCardFormatters.all
creditCardFormatter.isValid("6200 0000 0000 0005") // returns true