Ignore:
Timestamp:
Jun 3, 2006 7:47:48 PM (18 years ago)
Author:
scdev
Message:

Q - Merged branches/2.0singleton into trunk. Completed updating classes to use singleton methods. Implemented tests. Fixed some bugs. Changed some interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/AuthorizeNet.inc.php

    r42 r136  
    11<?php
     2/**
     3 * AuthorizeNet.inc.php
     4 * code by strangecode :: www.strangecode.com :: this document contains copyrighted information
     5 *
     6 * The AuthorizeNet class provides an abstract interface for communicating
     7 * with authorize.net's AIM interface. Supports Auth.Net v3.1
     8 *
     9 * @author  Quinn Comendant <quinn@strangecode.com>
     10 * @version 1.0
     11 * @date 2004-04-06
     12 */
     13 
    214// Example usage
    315// require_once 'codebase/lib/AuthorizeNet.inc.php';
     
    1426//     'x_Exp_Date' => '042008',
    1527//     'x_Invoice_Num' => '100',
    16 //     'x_Address' => '10 rue LevouvŽ',
     28//     'x_Address' => '10 rue Levouvé',
    1729//     'x_City' => 'SomeCity',
    1830//     'x_State' => 'CA',
     
    2739// }
    2840
    29 /**
    30  * The AuthorizeNet class provides an abstract interface for communicating
    31  * with authorize.net's AIM interface. Supports Auth.Net v3.1
    32  *
    33  * @author  Quinn Comendant <quinn@strangecode.com>
    34  * @version 1.0
    35  * @date 2004-04-06
    36  */
    37 
    38 require_once dirname(__FILE__) . '/Utilities.inc.php';
    39 
    40 class AuthorizeNet
    41 {
     41class AuthorizeNet {
     42
    4243    var $post_url = ''; // The URL to post data to.
    4344    var $md5_hash_value = ','; // A custom value for the response delimination character.
     
    132133    function setParam($params)
    133134    {
     135        $app =& App::getInstance();
     136   
    134137        if (isset($params) && is_array($params)) {
    135138            // Merge new parameters with old overriding only those passed.
    136139            $this->_params = array_merge($this->_params, $params);
    137140        } else {
    138             App::logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
     141            $app->logMsg(sprintf('Parameters are not an array: %s', $params), LOG_ERR, __FILE__, __LINE__);
    139142        }
    140143    }
     
    149152    function getParam($param)
    150153    {
     154        $app =& App::getInstance();
     155   
    151156        if (isset($this->_params[$param])) {
    152157            return $this->_params[$param];
    153158        } else {
    154             App::logMsg(sprintf('Parameter is not set: %s', $param), LOG_DEBUG, __FILE__, __LINE__);
     159            $app->logMsg(sprintf('Parameter is not set: %s', $param), LOG_NOTICE, __FILE__, __LINE__);
    155160            return null;
    156161        }
     
    167172    function process()
    168173    {
     174        $app =& App::getInstance();
     175   
    169176        if (empty($this->_params['x_login'])) {
    170177            $this->_results['x_response_reason_text'] = _("Transaction gateway temporarily not available. Please try again later.");
    171             App::logMsg(sprintf('x_login not specified.', null), LOG_ERROR, __FILE__, __LINE__);
     178            $app->logMsg(sprintf('x_login not specified.', null), LOG_ERROR, __FILE__, __LINE__);
    172179            return false;
    173180        }
    174181        if (empty($this->_params['x_card_num'])) {
    175182            $this->_results['x_response_reason_text'] = _("Transaction gateway temporarily not available. Please try again later.");
    176             App::logMsg(sprintf('x_card_num not specified.', null), LOG_ERROR, __FILE__, __LINE__);
     183            $app->logMsg(sprintf('x_card_num not specified.', null), LOG_ERROR, __FILE__, __LINE__);
    177184            return false;
    178185        }
Note: See TracChangeset for help on using the changeset viewer.