Validate/CreditCard.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Validate  
Version
$Id$  

\Zend_Validate_CreditCard

Package: Zend_Validate
Parent(s)
\Zend_Validate_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstantstring  ALL = 'All'
Detected CCI list
ALL
string

>VConstant  AMERICAN_EXPRESS = 'American_Express'
>VConstant  UNIONPAY = 'Unionpay'
>VConstant  DINERS_CLUB = 'Diners_Club'
>VConstant  DINERS_CLUB_US = 'Diners_Club_US'
>VConstant  DISCOVER = 'Discover'
>VConstant  JCB = 'JCB'
>VConstant  LASER = 'Laser'
>VConstant  MAESTRO = 'Maestro'
>VConstant  MASTERCARD = 'Mastercard'
>VConstant  SOLO = 'Solo'
>VConstant  VISA = 'Visa'
>VConstant  CHECKSUM = 'creditcardChecksum'
>VConstant  CONTENT = 'creditcardContent'
>VConstant  INVALID = 'creditcardInvalid'
>VConstant  LENGTH = 'creditcardLength'
>VConstant  PREFIX = 'creditcardPrefix'
>VConstant  SERVICE = 'creditcardService'
>VConstant  SERVICEFAILURE = 'creditcardServiceFailure'

Properties

>VPropertyprotectedarray $_cardLength = array(self::AMERICAN_EXPRESS => array(15), self::DINERS_CLUB => array(14), self::DINERS_CLUB_US => array(16), self::DISCOVER => array(16), self::JCB => array(16), self::LASER => array(16, 17, 18, 19), self::MAESTRO => array(12, 13, 14, 15, 16, 17, 18, 19), self::MASTERCARD => array(16), self::SOLO => array(16, 18, 19), self::UNIONPAY => array(16, 17, 18, 19), self::VISA => array(16))
List of allowed CCV lengths
Default valuearray(self::AMERICAN_EXPRESS => array(15), self::DINERS_CLUB => array(14), self::DINERS_CLUB_US => array(16), self::DISCOVER => array(16), self::JCB => array(16), self::LASER => array(16, 17, 18, 19), self::MAESTRO => array(12, 13, 14, 15, 16, 17, 18, 19), self::MASTERCARD => array(16), self::SOLO => array(16, 18, 19), self::UNIONPAY => array(16, 17, 18, 19), self::VISA => array(16))Details
Type
array
>VPropertyprotectedarray $_cardType = array(self::AMERICAN_EXPRESS => array('34', '37'), self::DINERS_CLUB => array('300', '301', '302', '303', '304', '305', '36'), self::DINERS_CLUB_US => array('54', '55'), self::DISCOVER => array('6011', '622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925', '644', '645', '646', '647', '648', '649', '65'), self::JCB => array('3528', '3529', '353', '354', '355', '356', '357', '358'), self::LASER => array('6304', '6706', '6771', '6709'), self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6763'), self::MASTERCARD => array('51', '52', '53', '54', '55'), self::SOLO => array('6334', '6767'), self::UNIONPAY => array('622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925'), self::VISA => array('4'))
List of accepted CCV provider tags
Default valuearray(self::AMERICAN_EXPRESS => array('34', '37'), self::DINERS_CLUB => array('300', '301', '302', '303', '304', '305', '36'), self::DINERS_CLUB_US => array('54', '55'), self::DISCOVER => array('6011', '622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925', '644', '645', '646', '647', '648', '649', '65'), self::JCB => array('3528', '3529', '353', '354', '355', '356', '357', '358'), self::LASER => array('6304', '6706', '6771', '6709'), self::MAESTRO => array('5018', '5020', '5038', '6304', '6759', '6761', '6763'), self::MASTERCARD => array('51', '52', '53', '54', '55'), self::SOLO => array('6334', '6767'), self::UNIONPAY => array('622126', '622127', '622128', '622129', '62213', '62214', '62215', '62216', '62217', '62218', '62219', '6222', '6223', '6224', '6225', '6226', '6227', '6228', '62290', '62291', '622920', '622921', '622922', '622923', '622924', '622925'), self::VISA => array('4'))Details
Type
array
>VPropertyprotectedarray $_messageTemplates = array(self::CHECKSUM => "'%value%' seems to contain an invalid checksum", self::CONTENT => "'%value%' must contain only digits", self::INVALID => "Invalid type given. String expected", self::LENGTH => "'%value%' contains an invalid amount of digits", self::PREFIX => "'%value%' is not from an allowed institute", self::SERVICE => "'%value%' seems to be an invalid creditcard number", self::SERVICEFAILURE => "An exception has been raised while validating '%value%'")
Validation failure message template definitions
Default valuearray(self::CHECKSUM => "'%value%' seems to contain an invalid checksum", self::CONTENT => "'%value%' must contain only digits", self::INVALID => "Invalid type given. String expected", self::LENGTH => "'%value%' contains an invalid amount of digits", self::PREFIX => "'%value%' is not from an allowed institute", self::SERVICE => "'%value%' seems to be an invalid creditcard number", self::SERVICEFAILURE => "An exception has been raised while validating '%value%'")Details
Type
array
>VPropertyprotectedcallback $_service
Service callback for additional validation
Details
Type
callback
>VPropertyprotectedarray $_type = array()
CCIs which are accepted by validation
Default valuearray()Details
Type
array

Methods

methodpublic__construct( $options = array()) : void

Constructor

Parameters
NameTypeDescription
$options
methodpublicaddType(string | array $type) : \Zend_Validate_CreditCard

Adds a CCI to be accepted by validation

Parameters
NameTypeDescription
$typestring | array

Type to allow for validation

Returns
TypeDescription
\Zend_Validate_CreditCardProvides a fluid interface
methodpublicgetService() : callback

Returns the actual set service

Returns
TypeDescription
callback
methodpublicgetType() : array

Returns a list of accepted CCIs

Returns
TypeDescription
array
methodpublicisValid(string $value) : boolean

Defined by Zend_Validate_Interface

Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum)
Parameters
NameTypeDescription
$valuestring
Returns
TypeDescription
boolean
methodpublicsetService(\unknown_type $service) : void

Sets a new callback for service validation

Parameters
NameTypeDescription
$service\unknown_type
methodpublicsetType(string | array $type) : \Zend_Validate_CreditCard

Sets CCIs which are accepted by validation

Parameters
NameTypeDescription
$typestring | array

Type to allow for validation

Returns
TypeDescription
\Zend_Validate_CreditCardProvides a fluid interface
Documentation was generated by phpDocumentor 2.2.0 .