strangename Posted January 29, 2007 Share Posted January 29, 2007 I am in a bit of a fix and am looking for any help. I am trying to install Realex on to a site and am having a problem. The payment process goes fine until checkout_confirmation.php where only part of the screen is produced...the bottom part with the button to confirm the order is correct does not show (it works fine with other modules). I have spoken to Realex who have said to send them what data I am sending so they can see if it is hitting their server. What is the best way to produce an output that I can send to them? I have included the Realex module (they wrote it but can't help!!) below for reference. Thanks for any help in advance, no matter how small - John <?php /* $ */ class realex { var $code, $title, $description, $enabled; var $oid; // class constructor function realex() { global $order; $this->code = 'realex'; $this->title = MODULE_PAYMENT_REALEX_TEXT_TITLE; $this->description = MODULE_PAYMENT_REALEX_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_REALEX_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_REALEX_STATUS == 'True') ? true : false); if ((int)MODULE_PAYMENT_REALEX_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_REALEX_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); $this->form_action_url = 'https://epage.payandshop.com/epage.cgi'; } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_REALEX_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_REALEX_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->billing['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } function javascript_validation() { return false; } function selection() { return array('id' => $this->code, 'module' => $this->title); } function pre_confirmation_check() { return false; } function confirmation() { return false; } function process_button() { global $osC_Session, $order, $currencies; if (MODULE_PAYMENT_REALEX_CURRENCY == 'Selected Currency') { $my_currency = $osC_Session->value('currency'); } else { $my_currency = substr(MODULE_PAYMENT_REALEX_CURRENCY, 5); } if (!in_array($my_currency, array('CHF', 'EUR', 'GBP', 'JPY', 'USD', 'SEK', 'HKD'))) { $my_currency = 'USD'; } //Replace these with the values you receive from Realex Payments $merchantid = MODULE_PAYMENT_REALEX_ID; $secret = MODULE_PAYMENT_REALEX_SECRET; //The code below is used to create the timestamp format required by Realex Payments $timestamp = strftime("%Y%m%d%H%M%S"); mt_srand((double)microtime()*1000000); /* orderid: Timestamp - randvalue */ $orderid = $timestamp . "-" . mt_rand(1, 999); $curr = $my_currency; $amount = number_format($order->info['total'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)) * 100; /*md5 crypt*/ $tmp = "$timestamp.$merchantid.$orderid.$amount.$curr"; $md5hash = md5($tmp); $tmp = "$md5hash.$secret"; $md5hash = md5($tmp); $process_button_string = tep_draw_hidden_field('MERCHANT_ID', MODULE_PAYMENT_REALEX_ID) . tep_draw_hidden_field('osCsid', session_id()) . tep_draw_hidden_field('ORDER_ID', $orderid) . tep_draw_hidden_field('AMOUNT', $amount) . tep_draw_hidden_field('CURRENCY', $curr) . tep_draw_hidden_field('TIMESTAMP', $timestamp) . tep_draw_hidden_field('AUTO_SETTLE_FLAG', 1) . tep_draw_hidden_field('RETURN_TSS', 1) . tep_draw_hidden_field('BILLING_CODE', $order->billing['postcode']) . tep_draw_hidden_field('BILLING_CO', $order->billing['country']['iso_code_2']) . tep_draw_hidden_field('MD5HASH', $md5hash). tep_draw_hidden_field('COMMENT', urldecode($order->billing['firstname']) . ' ' . urldecode($order->billing['lastname']) . (strlen($order->billing['company'])>0?' ' . urldecode($order->billing['company']):'') ) . tep_draw_hidden_field('PROD_ID', STORE_NAME); return $process_button_string; } function before_process() { global $HTTP_POST_VARS; $error = false; $merchantid = MODULE_PAYMENT_REALEX_ID; $secret = MODULE_PAYMENT_REALEX_SECRET; $timestamp = $HTTP_POST_VARS['TIMESTAMP']; $result = $HTTP_POST_VARS['RESULT']; $orderid = $HTTP_POST_VARS['ORDER_ID']; $message = $HTTP_POST_VARS['MESSAGE']; $authcode = $HTTP_POST_VARS['AUTHCODE']; $pasref = $HTTP_POST_VARS['PASREF']; $md5hash_post = $HTTP_POST_VARS['MD5HASH']; $tmp = "$timestamp.$merchantid.$orderid.$result.$message.$pasref.$authcode"; $md5hash_new = md5($tmp); $tmp = "$md5hash_new.$secret"; $md5hash_new = md5($tmp); //Check to see if hashes match or not if ($md5hash_new != $md5hash_post) { $payment_error_return = 'payment_error=' . $this->code . '&error=' . TEXT_REALEX_HASH_ERROR; tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } if ($result !='00') { $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($message); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false)); } return false; } function after_process() { return false; } function get_error() { if (PHP_VERSION < 4.1) { global $_GET; } $error = array('title' => REALEX_ERROR_TITLE, 'error' => ((isset($_GET['error'])) ? stripslashes(urldecode($_GET['error'])) : IPAYMENT_ERROR_MESSAGE)); return $error; } function output_error() { return false; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_REALEX_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Realex Module', 'MODULE_PAYMENT_REALEX_STATUS', 'True', 'Do you want to accept Realex payments?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant ID', 'MODULE_PAYMENT_REALEX_ID', 'MerchantID', 'The merchant ID provided by realex', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shared Secret', 'MODULE_PAYMENT_REALEX_SECRET', 'Secret', 'The Shared Secret provided by realex', '6', '4', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_REALEX_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '6', 'tep_cfg_select_option(array(\'Selected Currency\',\'Only USD\',\'Only CHF\',\'Only EUR\',\'Only GBP\',\'Only JPY\', \'Only HKD\', \'Only SEK\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_REALEX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_REALEX_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_REALEX_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_PAYMENT_REALEX_STATUS', 'MODULE_PAYMENT_REALEX_ID','MODULE_PAYMENT_REALEX_SECRET', 'MODULE_PAYMENT_REALEX_CURRENCY', 'MODULE_PAYMENT_REALEX_ZONE', 'MODULE_PAYMENT_REALEX_ORDER_STATUS_ID', 'MODULE_PAYMENT_REALEX_SORT_ORDER'); } } ?> Quote Link to comment Share on other sites More sharing options...
strangename Posted January 29, 2007 Author Share Posted January 29, 2007 I keep forgetting I can't edit these posts. ***Update*** What I need to know is where is the best place to place an "echo $data" statement? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.