RE: [PEAR-DEV] Mod 10 for Payment package?
| From: | Stefan Neufeind | Date: | Tue, 16 Sep 2003 16:03:55 +0000 |
| Subject: | RE: [PEAR-DEV] Mod 10 for Payment package? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-21580@lists.php.net to get a copy of this message | ||
On 16 Sep 2003 at 10:52, Joe Stump wrote:
> > Please note that there is also a check for Validate::creditCard().
> > Maybe this is a bit to simplistic and could be further improved if
> > you're about to implement a larger / better algorithm?
>
> It appears that mod 10 is already included, however, the creditCard
> function does not do the following:
>
> 1.) Check type specific validation (ie. Discover/Novus starts with
> 6011) 2.) Expiration checking (ie. $month > 1 && $month < 12) for
> month/year
>
> The function also does not return a PEAR_Error class, which isn't
> huge, but when processing CC cards it's good to pinpoint the exact
> error (ie. Bad number or bad expiration?).
>
> I do agree that the proposed changes be placed in the Validate package
> - Possibly as Validate_CC?
I think Validate_Finance_Creditcard would be the appropriate name
conforming to the current naming. Would you say that your creditcard-
implementation is a successor of the current Validate::creditcard()?
If yes, maybe we could arrange that Validate_Finance_Creditcard is a
large class that does all the checks and returns meaningful errors
whereas Validate::creditcard() could become a "wrapper" that simply
returns true / false (as it does now).
For error-handling please have a look at what Pierre agreed this to
be in Validate_Finance_IBAN (in CVS; using raiseError). I guess
that's a convenient way for your implementation also, right?
Stefan