'Visa', 'MASTERCARD' => 'Mastercard', 'AMEX' => 'American Express', 'DISCOVER' => 'Discover'); // +-- // | THERE IS NO NEED TO EDIT THE CODE BELOW THIS POINT TO // | ACTIVATE THIS INTEGRATION. ONLY EDIT THIS CODE TO MODIFY // | HOW THIS INTEGRATION WORKS. BE SURE YOU KNOW WHAT YOU'RE // | DOING! // +-- // +-- // | Get a few global variables. // +-- $eol = $this->globals('core.eol'); $order = $this->globals('ecom.order_summary'); // +-- // | Create the SIM fingerprint. This requires the use of the // | hash extension to PHP. Make sure your host has enabled // | that extension. // +-- // +-- // | Make sure that the hash extension is loaded. // +-- $extension = 'hash'; $extension_load = $this->load_extension($extension); if ($this->IsError($extension_load)) { $extension = 'mhash'; $extension_load = $this->load_extension($extension); } // End of if statement. if ($this->IsError($extension_load)) { $message = 'The hash and mhash PHP extensions could not be loaded. This '; $message .= 'processing module requires either the hash or mhash PHP '; $message .= 'extensions to be loaded in order to function. This script '; $message .= 'attempted to load these extensions at runtime, however the current '; $message .= 'server configuration did not permit the script to make this '; $message .= 'runtime change. Contact your server administrator and request '; $message .= 'that either the hash or mhahs PHP extensions be loaded at run time.'; print '

' . $this->xhtml_encode($message) . '

' . $eol . $eol; return false; } // End of if statement. // +-- // | Create the SIM fingerprint. // +-- $x_fp_sequence = $order['order']['id']; $x_fp_sequence = preg_replace('/[^\d]/','',$x_fp_sequence); $x_fp_timestamp = $this->globals('core_datetime.epoch'); $x_fp_hash = $order['gateway']['userid'] . '^'; $x_fp_hash .= $x_fp_sequence . '^'; $x_fp_hash .= $x_fp_timestamp . '^'; $x_fp_hash .= $order['order']['ordertotal'] . '^'; if ($extension == 'hash') { $x_fp_hash = @hash_hmac('md5',$x_fp_hash,$order['gateway']['transkey']); } else { $x_fp_hash = @mhash(MHASH_MD5,$x_fp_hash,$order['gateway']['transkey']); $x_fp_hash = @bin2hex($x_fp_hash); } // End of if statement. // +-- // | Create our relay URL. // +-- $url_relay = $this->globals('core.url_ssl') . '/utilities/ecomrelay.php'; // +-- // | Set up the olpform array. // +-- $olpform = array('url' => 'https://secure.authorize.net/gateway/transact.dll', 'button' => 'Submit Payment', 'fields' => array()); // +-- // | Create the HIDDEN fields for the form. // +-- $olpform['fields']['HIDDEN'][] = array('name' => 'x_login', 'value' => $order['gateway']['userid']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_invoice_num', 'value' => $order['order']['id']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_cust_id', 'value' => $this->globals('core_session.sid')); $olpform['fields']['HIDDEN'][] = array('name' => 'x_amount', 'value' => $order['order']['ordertotal']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_first_name', 'value' => $order['order']['fname']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_last_name', 'value' => $order['order']['lname']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_company', 'value' => $order['order']['company']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_address', 'value' => $order['order']['addone'] . ' ' . $order['order']['addtwo']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_city', 'value' => $order['order']['city']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_state', 'value' => $order['order']['stateprov']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_country', 'value' => $order['order']['country']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_zip', 'value' => $order['order']['postalcode']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_phone', 'value' => $order['order']['phone']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_email', 'value' => $order['order']['email']); $olpform['fields']['HIDDEN'][] = array('name' => 'x_method', 'value' => 'CC'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_type', 'value' => 'AUTH_CAPTURE'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_version', 'value' => '3.1'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_relay_response', 'value' => 'TRUE'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_relay_url', 'value' => $url_relay); $olpform['fields']['HIDDEN'][] = array('name' => 'x_receipt_link_method', 'value' => 'POST'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_email_customer', 'value' => 'FALSE'); $olpform['fields']['HIDDEN'][] = array('name' => 'x_fp_hash', 'value' => $x_fp_hash); $olpform['fields']['HIDDEN'][] = array('name' => 'x_fp_sequence', 'value' => $x_fp_sequence); $olpform['fields']['HIDDEN'][] = array('name' => 'x_fp_timestamp', 'value' => $x_fp_timestamp); // +-- // | Create the DISPLAY fields for the form. // +-- $olpform['fields']['DISPLAY'][] = array('type' => 'SELECTCUSTOM', 'params' => array('name' => 'x_card_type', 'required' => 1, 'display' => 'Card Type', 'desc' => 'Select the type of credit card you wish to use.', 'options' => $accepted_cards)); $olpform['fields']['DISPLAY'][] = array('type' => 'TEXTCUSTOM', 'params' => array('name' => 'x_card_num', 'required' => 1, 'display' => 'Card Number', 'desc' => 'Enter your credit card number.')); $olpform['fields']['DISPLAY'][] = array('type' => 'TEXTCUSTOM', 'params' => array('name' => 'x_card_code', 'required' => 0, 'display' => 'Card Verification Number', 'desc' => 'Enter your card verification number. Some cards do not contain verification numbers. Use the image presented below to locate your verification number.')); $olpform['fields']['DISPLAY'][] = array('type' => 'EXPCOMBO', 'params' => array('name' => 'x_exp_date', 'required' => 1, 'display' => 'Card Expiration Date', 'desc' => 'Select your card expiration date from the list.', 'mformat' => 'MM', 'yformat' => 'YY', 'sepchar' => '/')); // +-- // | Set a global variable to display the card verification // | number image. // +-- $this->globals('ecom.olp_showimg_cvv2',1); // +-- // | Globalize the $olpform array and return. // +-- $this->globals('ecom.olpform',$olpform); ?>