commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (VALIDATOR-247) Move CreditCardValidator to routines package and refactor
Date Sat, 03 Nov 2007 02:29:50 GMT

    [ https://issues.apache.org/jira/browse/VALIDATOR-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12539772
] 

niallp edited comment on VALIDATOR-247 at 11/2/07 7:29 PM:
--------------------------------------------------------------------

As you mention I was thinking that the new routines version could use the new "generic" code
validator for individual cards and perhaps ditch the CreditCardType interface altogether.
 New cards types can simply be implemented by creating a new CodeValidator instance with an
appropriate regular expression rather than having to define a new CreditCardType implementation.

The main (IMO) advantage though is that if someone wanted to allow separators (spaces or dashes)
they can define a regular expression with the separators as a "non-capturing group" which
means they get "stripped" out before the check digit validation is done - and the valdiator
can return a uniform card number without separators.

Attaching an option for consideration.

      was (Author: niallp):
    As you mention I was thinking that the new routines version could use the new "generic"
code validator for individual cards and perhaps ditch the CreditCardType interface altogether.
 New cards types can simply be implemented by creating a new CodeValidator instance with an
appropriate regular expression rather than having to define a new CreditCardType implementation.

The main (IMO) advantage though is that if someone wanted to allow separators (spaces or dashes)
they can define a regular expression with the separators as a "non-capturing group" which
means they get "stripped" out before the check digit validation is done - and the valdiator
can return a uniform card number without validators.

Attaching an option for consideration.
  
> Move CreditCardValidator to routines package and refactor
> ---------------------------------------------------------
>
>                 Key: VALIDATOR-247
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-247
>             Project: Commons Validator
>          Issue Type: Task
>          Components: Routines
>            Reporter: Ben Speakmon
>            Assignee: Ben Speakmon
>             Fix For: 1.4
>
>         Attachments: CreditCardValidator.java
>
>
> Having copied CreditCardValidator to routines, it now needs to be refactored to use CodeValidator/LuhnCheckDigit/etc.
It might also make sense to break CreditCardType out into a separate 1.4-style typesafe enum
so it can be easily converted to a real enum for Validator 2.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message