You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/06/06 19:35:36 UTC

DO NOT REPLY [Bug 20557] New: - Improved CreditCard validation and minor refactoring

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20557>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20557

Improved CreditCard validation and minor refactoring

           Summary: Improved CreditCard validation and minor refactoring
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Validator
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ummmmm22@yahoo.com


We've been doing Credit Card number validation for several years, so we had our
own utility methods, around which we wrapped a Struts validator.

I have since discovered that such a validator already exists in Struts/Commons.
 I looked at the source and that validator does everything ours does except
allow you to specify which Credit Card brands are valid for your particular
application.  This would be a nice feature to add to both the Struts and Commons
validator classes.  (Our validator uses a comma-delimited list of
single-character codes in validation.xml to indicate which card types are to be
allowed.  e.g. V,M for Visa,Mastercard)

Also, while looking at the
org.apache.commons.validator.GenericValidator.validateCreditCardPrefixCheck()
method, I noticed that the series of "if" statements could be converted to "else
if" statements for greater efficiency.  (Or the second set could be changed to
simply return early.)

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