CyberSource / cybersource-android-sdk

The CyberSource InApp SDK enables developers to simply and securely incorporate mobile payments into their Android applications.
Other
0 stars 2 forks source link

MasterCard checker is outdated #5

Open tsaisean opened 6 years ago

tsaisean commented 6 years ago

The card start with 2221-2720 is not passing current checker. Can consider to update the utils.

private static boolean checkIfMasterCard(int size, String value) {
        int firstChars = Integer.parseInt(value.substring(0, 2));
        int firstCharsRules2017 = Integer.parseInt(value.substring(0, 4));
        if (size == 16
                && ((firstChars >= 51 && firstChars <= 55)
                || (firstCharsRules2017 >= 2221 && firstChars <= 2720))) {
            return true;
        } else {
            return false;
        }
    }