Changeset 864
- Timestamp:
- 07/07/08 09:32:12 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/common/lib/epayment/methods/authorizenet.php
r837 r864 6 6 var $code, $title, $description, $enabled; 7 7 var $authorizeTable; 8 8 9 9 // class constructor 10 10 function authorizenet() { 11 11 global $order; 12 12 13 13 $this->authorizeTable = new Table; 14 14 $this->code = 'authorizenet'; … … 17 17 $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_STATUS == 'True') ? true : false); 18 18 // $this->enabled = true; 19 echo MODULE_PAYMENT_AUTHORIZENET_STATUS;19 // echo MODULE_PAYMENT_AUTHORIZENET_STATUS; 20 20 $this->sort_order = 0; 21 21 22 22 $this->form_action_url = AUTHORIZE_PAYMENT_URL; 23 23 } … … 27 27 // This code is distributed in the hope that it will be useful, but without any warranty; 28 28 // without even the implied warranty of merchantability or fitness for a particular purpose. 29 29 30 30 // Main Interfaces: 31 31 // 32 32 // 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 35 35 // compute HMAC-MD5 36 36 // Uses PHP mhash extension. Pl sure to enable the extension … … 38 38 // return (bin2hex (mhash(MHASH_MD5, $data, $key))); 39 39 //} 40 40 41 41 // Thanks is lance from http://www.php.net/manual/en/function.mhash.php 42 42 //lance_rushing at hot* spamfree *mail dot com … … 46 46 // 47 47 //Use this: 48 48 49 49 function hmac ($key, $data) 50 50 { … … 53 53 // Eliminates the need to install mhash to compute a HMAC 54 54 // Hacked by Lance Rushing 55 55 56 56 $b = 64; // byte length for md5 57 57 if (strlen($key) > $b) { … … 63 63 $k_ipad = $key ^ $ipad ; 64 64 $k_opad = $key ^ $opad; 65 65 66 66 return md5($k_opad . pack("H*",md5($k_ipad . $data))); 67 67 } … … 79 79 $tstamp = time (); 80 80 $fingerprint = $this->hmac ($txnkey, $loginid . "^" . $sequence . "^" . $tstamp . "^" . $amount . "^" . $currency); 81 81 82 82 $str = tep_draw_hidden_field('x_fp_sequence', $sequence) . 83 83 tep_draw_hidden_field('x_fp_timestamp', $tstamp) . 84 84 //tep_draw_hidden_field('x_tran_key', $txnkey) . 85 85 tep_draw_hidden_field('x_fp_hash', $fingerprint); 86 86 87 87 return $str; 88 88 } … … 176 176 $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']; 177 177 $payment_error_return .= '&amount=' . $_POST['amount'].'&item_name=' . $_POST['item_name'].'&item_number=' . $_POST['item_number']; 178 178 179 179 tep_redirect(tep_href_link("checkout_payment.php", $payment_error_return, 'SSL', true, false)); 180 180 }
