View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

{zone-data:component-name}
Zend_Validate_CreditCard
{zone-data}

{zone-data:proposer-list}
[~thomas]
{zone-data}

{zone-data:liaison}
TBD
{zone-data}

{zone-data:revision}
1.0 - 14 June 2009: Initial Draft.
{zone-data}

{zone-data:overview}
Zend_Validate_CreditCard is a rewrite of Zend_Validate_Ccnum and adds functionality.
{zone-data}

{zone-data:references}
* [Wikipedia - Credit Cards|http://en.wikipedia.org/wiki/Credit_card]
* [Wikipedia - Bank Card number|http://en.wikipedia.org/wiki/Bank_card_number]
{zone-data}

{zone-data:requirements}
* This component *will* check if credit cards are valid
* This component *will* allow to check against a online service for more security and redundancy
* This component *will not* add this services but only the interface for them
* This component *will* validate against all known credit card institutes
{zone-data}

{zone-data:dependencies}
* Zend_Validate_Exception
* Zend_Validate_Abstract
{zone-data}

{zone-data:operation}
The component is a rewrite of the actual available Zend_Validate_Ccnum validator. The actual available validator should be renamed to Zend_Validate_CreditCard for usability. The old class would be a wrapper for the new class but with a notice for depreciation.

This component is able to check against 16 different credit card institutes. The actual component will be used as "generic" validator when no credit card institute is given.

Additionally this component will add a interface which allows to use external service classes for the validation of a credit card. Some credit card institutes provide a online API for this case. But many of them are payed-services and not available for free.
This component will also work offline and allows therefor several levels of validation.
Level 1.) Generic - as with the actual component - very unsecure
Level 2.) Institute specific - offline test specific to each institute - more secure
Level 3.) Online - needs a online connection and a service class - most available security
{zone-data}

{zone-data:milestones}
* Milestone 1: \[DONE\] Proposal finished
* Milestone 2: \[DONE\] Proposal accepted
* Milestone 3: \[DONE\] Coding finished
* Milestone 4: \[DONE\] Unit tests finished
* Milestone 5: \[DONE\] Documentation finished
* Milestone 6: \[DONE\] Component moved to core
{zone-data}

{zone-data:class-list}
* Zend_Validate_CreditCard
* Zend_Validate_CreditCard_Interface
{zone-data}

{zone-data:use-cases}
||UC-01||
Level 1 - works like actual component
{code}
$validate = new Zend_Validate_CreditCard();
$validate->isValid('1234567890123456');
{code}

||UC-02||
Level 2 - validation for one credit card institute
{code}
$validate = new Zend_Validate_CreditCard(Zend_Validate_CreditCard::AMERICAN_EXPRESS);
$validate->isValid('1234567890123456');
{code}

||UC-03||
Level 3 - using a online check
Note that the number is also checked with level2 which means that when Level2 failes, the online check is not processed
{code}
$validate = new Zend_Validate_CreditCard(Zend_Validate_CreditCard::AMERICAN_EXPRESS);
$checker = new My_Service_MyApiConnector();
$validate->setOnlineCheck($checker);
$validate->isValid('1234567890123456');
{code}
{zone-data}

{zone-data:skeletons}
{code}
interface Zend_Validate_CreditCard_Interface {
public function isValid($value);
}

class Zend_Validate_CreditCard {
const AMERICAN_EXPRESS = 'Amex';
const VISA = 'Visa';
const MAESTRO = 'Maestro';
const JCB = 'Jcb';
... several others

public function __construct($options = 'Generic');
public function setOnlineCheck($class);
public function getOnlineCheck();
public function isValid($value);
}
{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>