Ignore:
Timestamp:
Feb 20, 2014 3:03:59 AM (10 years ago)
Author:
anonymous
Message:

Completed integrating /branches/eli_branch into /trunk. Changes include:

  • Removed closing ?> from end of files
  • Upgrade old-style contructor methods to use construct() instead.
  • Class properties and methods defined as public, private, static or protected
  • Ensure code runs under E_ALL with only mysql_* deprecated warnings
  • Search for the '@' symbol anywhere it might be used to supress runtime errors, then replace with proper error recovery.
  • Run the php cli -l option to check files for syntax errors.
  • Bring tests up-to-date with latest version and methods of PHPUnit
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/lib/AuthorizeNet.inc.php

    r396 r468  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3131 * @date 2004-04-06
    3232 */
    33  
     33
    3434// Example usage
    3535// require_once 'codebase/lib/AuthorizeNet.inc.php';
     
    6161class AuthorizeNet {
    6262
    63     var $post_url = ''; // The URL to post data to.
    64     var $_results = array();
    65     var $_params = array();
    66     var $_default_params = array(
     63    public $post_url = ''; // The URL to post data to.
     64    private $_results = array();
     65    private $_params = array();
     66    private $_default_params = array(
    6767        'x_version'         => '3.1',
    6868        'x_relay_response'  => 'FALSE',
     
    8080
    8181    // Array of response names. Used in the results array.
    82     var $_result_fields = Array(
     82    private $_result_fields = Array(
    8383        'x_response_code',
    8484        'x_response_subcode',
     
    129129     * @param optional array $_params  A hash containing parameters.
    130130     */
    131     function AuthorizeNet($params = array())
     131    public function __construct($params = array())
    132132    {
    133133        $app =& App::getInstance();
     
    143143        $this->_params = $this->_default_params;
    144144        $this->setParam($params);
    145        
     145
    146146        $this->setParam(array('md5_hash_salt' => $app->getParam('signing_key')));
    147147    }
     
    153153     * @param  array    $params     Array of parameters (key => val pairs).
    154154     */
    155     function setParam($params)
     155    public function setParam($params)
    156156    {
    157157        $app =& App::getInstance();
    158    
     158
    159159        if (isset($params) && is_array($params)) {
    160160            // Merge new parameters with old overriding only those passed.
     
    172172     * @return mixed               Configured parameter value.
    173173     */
    174     function getParam($param)
     174    public function getParam($param)
    175175    {
    176176        $app =& App::getInstance();
    177    
     177
    178178        if (isset($this->_params[$param])) {
    179179            return $this->_params[$param];
     
    192192     * @return mixed      False or x_response_code: false = error, 1 = accepted, 2 = declined, 3 = error
    193193     */
    194     function process()
     194    public function process()
    195195    {
    196196        $app =& App::getInstance();
    197    
     197
    198198        if (empty($this->_params['x_login'])) {
    199199            $this->_results['x_response_reason_text'] = _("Transaction gateway temporarily not available. Please try again later.");
     
    245245     * @return array             Returns the results array.
    246246     */
    247     function getResult($key=null)
     247    public function getResult($key=null)
    248248    {
    249249        if (isset($key)) {
     
    265265     * @return bool             True if the hash is valid, false otherwise.
    266266     */
    267     function validMD5Hash()
     267    public function validMD5Hash()
    268268    {
    269269        return (
     
    282282     * @access public
    283283     */
    284     function reset()
     284    public function reset()
    285285    {
    286286        $this->_results = Array();
     
    297297     * @return integer      Transaction result code.
    298298     */
    299     function _processResult($result)
     299    private function _processResult($result)
    300300    {
    301301        $this->_results = Array();
     
    315315    }
    316316}
    317 ?>
Note: See TracChangeset for help on using the changeset viewer.