Source for file Offline.php
Documentation is available at Offline.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Joe Stump <joe@joestump.net> |
// +----------------------------------------------------------------------+
// $Id: Offline.php,v 1.4 2004/03/22 20:35:58 ieure Exp $
require_once('Validate/CreditCard.php');
* Payment_Process_offline
* An offline driver that allows you to do offline validation of credit card
* via the Validate_CreditCard package. This package is intended for those
* who wish to someday use a payment gateway, but at this time are not currently
* @author Joe Stump <joe@joestump.net>
* @package Payment_Process
* Set to true after the credit card has been processed
* @author Joe Stump <joe@joestump.net>
* The response after the credit card has been processed
* @author Joe Stump <joe@joestump.net>
* Payment_Process_offline
* Constructor - currently does nothing
* @author Joe Stump <joe@joestump.net>
* Processes the given credit card. Returns PEAR_Error when an error has
* occurred or it will return a valid Payment_Process_Result on success.
* @author Joe Stump <joe@joestump.net>
$card['number'] = $this->cardNumber;
$card['month'] = $this->expMonth;
$card['year'] = $this->expYear;
$card['type'] = VALIDATE_CREDITCARD_TYPE_VS;
case PROCESS_TYPE_MASTERCARD:
$card['type'] = VALIDATE_CREDITCARD_TYPE_MC;
$card['type'] = VALIDATE_CREDITCARD_TYPE_AX;
case PROCESS_TYPE_DISCOVER:
$card['type'] = VALIDATE_CREDITCARD_TYPE_DS;
return $check = true; // Nothing to process - it's a check
$this->_result = Validate_CreditCard ::card ($card);
$this->_processed = true;
$code = PROCESS_RESULT_APPROVED;
$message = 'Valid Credit Card';
$code = PROCESS_RESULT_DECLINED;
// Run extra checks to get a better error message
if(Validate_CreditCard ::number ($card['number'])) {
$message = 'Card number is invalid';
} elseif (Validate_CreditCard ::expiryDate ($card['month'],$card['year'])) {
$message = 'Invalid expriation date';
} elseif (Validate_CreditCard ::expiryDate ($card['number'],$card['type'])) {
$message = 'Card number does not match specified type';
if($code == PROCESS_RESULT_DECLINED ) {
return PEAR ::raiseError ($message,$code);
* Return status or PEAR_Error when it has not been processed yet.
* @author Joe Stump <joe@joestump.net>
return PEAR ::raiseError ('The transaction has not been processed yet.', PROCESS_ERROR_INCOMPLETE );
Documentation generated on Mon, 11 Mar 2019 13:51:27 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|