You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2017/02/05 16:34:47 UTC

svn commit: r1781780 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java

Author: sebb
Date: Sun Feb  5 16:34:46 2017
New Revision: 1781780

URL: http://svn.apache.org/viewvc?rev=1781780&view=rev
Log:
Document the number ranges

Modified:
    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java?rev=1781780&r1=1781779&r2=1781780&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java (original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java Sun Feb  5 16:34:46 2017
@@ -121,19 +121,38 @@ public class CreditCardValidator impleme
      */
     private static final CheckDigit LUHN_VALIDATOR = LuhnCheckDigit.LUHN_CHECK_DIGIT;
 
-    /** American Express (Amex) Card Validator */
+    /**
+     * American Express (Amex) Card Validator
+     * 34xxxx (15)
+     * 37xxxx (15)
+     */
     public static final CodeValidator AMEX_VALIDATOR = new CodeValidator("^(3[47]\\d{13})$", LUHN_VALIDATOR);
 
-    /** Diners Card Validator */
+    /**
+     * Diners Card Validator
+     * 300xxx - 305xxx (14)
+     * 3095xx (14)
+     * 36xxxx (14)
+     * 38xxxx (14)
+     * 39xxxx (14)
+     */
     public static final CodeValidator DINERS_VALIDATOR = new CodeValidator("^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$", LUHN_VALIDATOR);
 
-    /** Discover Card regular expressions */
+    /**
+     * Discover Card regular expressions
+     * 6011xx (16)
+     * 644xxx - 65xxxx (16)
+     */
     private static final RegexValidator DISCOVER_REGEX = new RegexValidator(new String[] {"^(6011\\d{12})$", "^(64[4-9]\\d{13})$", "^(65\\d{14})$"});
 
     /** Discover Card Validator */
     public static final CodeValidator DISCOVER_VALIDATOR = new CodeValidator(DISCOVER_REGEX, LUHN_VALIDATOR);
 
-    /** Mastercard regular expressions */
+    /**
+     * Mastercard regular expressions
+     * 2221xx - 2720xx (16)
+     * 51xxx - 55xxx (16)
+     */
     private static final RegexValidator MASTERCARD_REGEX = new RegexValidator(
         new String[] {
             "^(5[1-5]\\d{14})$",  // 51 - 55 (pre Oct 2016)
@@ -156,10 +175,14 @@ public class CreditCardValidator impleme
     @Deprecated
     public static final CodeValidator MASTERCARD_VALIDATOR_PRE_OCT2016 = new CodeValidator("^(5[1-5]\\d{14})$", LUHN_VALIDATOR);
 
-    /** Visa Card Validator */
+    /**
+     * Visa Card Validator
+     * 4xxxxx (13 or 16)
+     */
     public static final CodeValidator VISA_VALIDATOR = new CodeValidator("^(4)(\\d{12}|\\d{15})$", LUHN_VALIDATOR);
 
-    /** VPay (Visa) Card Validator 
+    /** VPay (Visa) Card Validator
+     * 4xxxxx (13-19) 
      * @since 1.5.0
      */
     public static final CodeValidator VPAY_VALIDATOR = new CodeValidator("^(4)(\\d{12,18})$", LUHN_VALIDATOR);



Re: svn commit: r1781780 - /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java

Posted by Benedikt Ritter <br...@apache.org>.
Hello Sebb,

> Am 05.02.2017 um 17:34 schrieb sebb@apache.org:
> 
> Author: sebb
> Date: Sun Feb  5 16:34:46 2017
> New Revision: 1781780
> 
> URL: http://svn.apache.org/viewvc?rev=1781780&view=rev
> Log:
> Document the number ranges
> 
> Modified:
>    commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
> 
> Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java
> URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java?rev=1781780&r1=1781779&r2=1781780&view=diff
> ==============================================================================
> --- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java (original)
> +++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/CreditCardValidator.java Sun Feb  5 16:34:46 2017
> @@ -121,19 +121,38 @@ public class CreditCardValidator impleme
>      */
>     private static final CheckDigit LUHN_VALIDATOR = LuhnCheckDigit.LUHN_CHECK_DIGIT;
> 
> -    /** American Express (Amex) Card Validator */
> +    /**
> +     * American Express (Amex) Card Validator
> +     * 34xxxx (15)
> +     * 37xxxx (15)

Have you checked how this looks in the rendered JavaDoc? Maybe we should wrap this into <ol> ?

Regards,
Benedikt

> +     */
>     public static final CodeValidator AMEX_VALIDATOR = new CodeValidator("^(3[47]\\d{13})$", LUHN_VALIDATOR);
> 
> -    /** Diners Card Validator */
> +    /**
> +     * Diners Card Validator
> +     * 300xxx - 305xxx (14)
> +     * 3095xx (14)
> +     * 36xxxx (14)
> +     * 38xxxx (14)
> +     * 39xxxx (14)
> +     */
>     public static final CodeValidator DINERS_VALIDATOR = new CodeValidator("^(30[0-5]\\d{11}|3095\\d{10}|36\\d{12}|3[8-9]\\d{12})$", LUHN_VALIDATOR);
> 
> -    /** Discover Card regular expressions */
> +    /**
> +     * Discover Card regular expressions
> +     * 6011xx (16)
> +     * 644xxx - 65xxxx (16)
> +     */
>     private static final RegexValidator DISCOVER_REGEX = new RegexValidator(new String[] {"^(6011\\d{12})$", "^(64[4-9]\\d{13})$", "^(65\\d{14})$"});
> 
>     /** Discover Card Validator */
>     public static final CodeValidator DISCOVER_VALIDATOR = new CodeValidator(DISCOVER_REGEX, LUHN_VALIDATOR);
> 
> -    /** Mastercard regular expressions */
> +    /**
> +     * Mastercard regular expressions
> +     * 2221xx - 2720xx (16)
> +     * 51xxx - 55xxx (16)
> +     */
>     private static final RegexValidator MASTERCARD_REGEX = new RegexValidator(
>         new String[] {
>             "^(5[1-5]\\d{14})$",  // 51 - 55 (pre Oct 2016)
> @@ -156,10 +175,14 @@ public class CreditCardValidator impleme
>     @Deprecated
>     public static final CodeValidator MASTERCARD_VALIDATOR_PRE_OCT2016 = new CodeValidator("^(5[1-5]\\d{14})$", LUHN_VALIDATOR);
> 
> -    /** Visa Card Validator */
> +    /**
> +     * Visa Card Validator
> +     * 4xxxxx (13 or 16)
> +     */
>     public static final CodeValidator VISA_VALIDATOR = new CodeValidator("^(4)(\\d{12}|\\d{15})$", LUHN_VALIDATOR);
> 
> -    /** VPay (Visa) Card Validator 
> +    /** VPay (Visa) Card Validator
> +     * 4xxxxx (13-19) 
>      * @since 1.5.0
>      */
>     public static final CodeValidator VPAY_VALIDATOR = new CodeValidator("^(4)(\\d{12,18})$", LUHN_VALIDATOR);
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org