Commons Validator
  1. Commons Validator
  2. VALIDATOR-39

[validator] CreditValidator does not handle Visa correctly

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      When using 5817550003933609 as card number the check will fail. This number is
      a valid Visa number, as used for Visa Carte Blue in France.

      Solution:
      change the Visa inner class to:

      private class Visa implements CreditCardType {
      private static final String PREFIX = "4,5,";
      public boolean matches(String card)

      { String prefix2 = card.substring(0, 1) + ","; return ((PREFIX.indexOf(prefix2) != -1) && (card.length() == 13 || card.length() == 16)); }

      }

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Leo Moot
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development