Changeset 864

Show
Ignore:
Timestamp:
07/07/08 09:32:12 (2 months ago)
Author:
areski
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/common/lib/epayment/methods/authorizenet.php

    r837 r864  
    66    var $code, $title, $description, $enabled; 
    77    var $authorizeTable; 
    8          
     8 
    99        // class constructor 
    1010    function authorizenet() { 
    1111                global $order; 
    12                  
     12 
    1313                $this->authorizeTable = new Table; 
    1414                $this->code = 'authorizenet'; 
     
    1717                $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_STATUS == 'True') ? true : false); 
    1818                // $this->enabled = true; 
    19                 echo MODULE_PAYMENT_AUTHORIZENET_STATUS; 
     19                // echo MODULE_PAYMENT_AUTHORIZENET_STATUS; 
    2020                $this->sort_order = 0; 
    21                  
     21 
    2222                $this->form_action_url = AUTHORIZE_PAYMENT_URL; 
    2323    } 
     
    2727        //     This code is distributed in the hope that it will be useful, but without any warranty; 
    2828        //     without even the implied warranty of merchantability or fitness for a particular purpose. 
    29          
     29 
    3030        // Main Interfaces: 
    3131        // 
    3232        // function InsertFP ($loginid, $txnkey, $amount, $sequence) - Insert HTML form elements required for SIM 
    33         // function CalculateFP ($loginid, $txnkey, $amount, $sequence, $tstamp) - Returns Fingerprint.  
    34          
     33        // function CalculateFP ($loginid, $txnkey, $amount, $sequence, $tstamp) - Returns Fingerprint. 
     34 
    3535        // compute HMAC-MD5 
    3636        // Uses PHP mhash extension. Pl sure to enable the extension 
     
    3838        //   return (bin2hex (mhash(MHASH_MD5, $data, $key))); 
    3939        //} 
    40          
     40 
    4141        // Thanks is lance from http://www.php.net/manual/en/function.mhash.php 
    4242        //lance_rushing at hot* spamfree *mail dot com 
     
    4646        // 
    4747        //Use this: 
    48          
     48 
    4949        function hmac ($key, $data) 
    5050        { 
     
    5353                // Eliminates the need to install mhash to compute a HMAC 
    5454                // Hacked by Lance Rushing 
    55                  
     55 
    5656                $b = 64; // byte length for md5 
    5757                if (strlen($key) > $b) { 
     
    6363                $k_ipad = $key ^ $ipad ; 
    6464                $k_opad = $key ^ $opad; 
    65                  
     65 
    6666                return md5($k_opad  . pack("H*",md5($k_ipad . $data))); 
    6767        } 
     
    7979                $tstamp = time (); 
    8080                $fingerprint = $this->hmac ($txnkey, $loginid . "^" . $sequence . "^" . $tstamp . "^" . $amount . "^" . $currency); 
    81                  
     81 
    8282                $str = tep_draw_hidden_field('x_fp_sequence', $sequence) . 
    8383                        tep_draw_hidden_field('x_fp_timestamp', $tstamp) . 
    8484                        //tep_draw_hidden_field('x_tran_key', $txnkey) . 
    8585                        tep_draw_hidden_field('x_fp_hash', $fingerprint); 
    86                  
     86 
    8787                return $str; 
    8888        } 
     
    176176        $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&authorizenet_cc_owner=' . urlencode($_POST['authorizenet_cc_owner']) . '&authorizenet_cc_expires_month=' . $_POST['authorizenet_cc_expires_month'] . '&authorizenet_cc_expires_year=' . $_POST['authorizenet_cc_expires_year']; 
    177177                $payment_error_return .= '&amount=' . $_POST['amount'].'&item_name=' . $_POST['item_name'].'&item_number=' . $_POST['item_number']; 
    178                  
     178 
    179179        tep_redirect(tep_href_link("checkout_payment.php", $payment_error_return, 'SSL', true, false)); 
    180180      } 


Google