jimbeeer Posted September 20, 2006 Posted September 20, 2006 My client has decided, on the 11th hour, to offer postage insurance, i've installed the Shipping Insurance module no problem and it comes up correctly on screen, but i haven't a clue on how to pass the insurance value onto the payment module page. I'm using Westpac Web Advantage, i realise it's not a heavily used module but at a glance i can see the code isn't that difficult, i just haven't a clue how to pass the insurance value to the webadvantage page. Westpac (the payment module company) are suggesting i'm just not sumitting this input as part of my $process_button_string. Any help would be greatly appreciated as i doubt i can do this on my own Below is the code for webadvantage.php: <?php /* $Id: WEBADVANTAGE.php,v 1.39 2003/01/29 19:57:15 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class webadvantage { var $code, $title, $description, $enabled, $test_mode; // class constructor function webadvantage() { global $order; $this->code = 'webadvantage'; $this->title = MODULE_PAYMENT_WEBADVANTAGE_TEXT_TITLE; $this->description = MODULE_PAYMENT_WEBADVANTAGE_TEXT_DESCRIPTION; $this->sort_order = MODULE_PAYMENT_WEBADVANTAGE_SORT_ORDER; $this->enabled = ((MODULE_PAYMENT_WEBADVANTAGE_STATUS == 'True') ? true : false); $this->test_mode = ((MODULE_PAYMENT_WEBADVANTAGE_TEST_MODE == 'True') ? true : false); if ((int)MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID > 0) { $this->order_status = MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID; } if (is_object($order)) $this->update_status(); if($this->test_mode === true) { $this->form_action_url = 'https://verifytransact.webadvantage.com.au/host/cgi-bin/test_payment.pl'; } else { $this->form_action_url = 'https://transact.webadvantage.com.au/host/cgi-bin/make_payment.pl'; } } // class methods function update_status() { global $order; if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_WEBADVANTAGE_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_WEBADVANTAGE_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 $order, $currencies, $currency; $tax_rate = 0; $process_button_string = tep_draw_hidden_field('vendor_name', MODULE_PAYMENT_WEBADVANTAGE_MERCHANT_ID) . tep_draw_hidden_field('payment_alert', MODULE_PAYMENT_WEBADVANTAGE_MERCHANT_EMAIL) . tep_draw_hidden_field('print_zero_qty', 'false'); foreach($order->products as $key => $value) { // Modified: 2005-12-13 // Author : Ben Balbo <[email protected]> // // The previous version didn't cater for carts that contain a mix of GST and GST-exempt products. // // Products that are subject to GST are added as before. GST-exempt products have their name suffixed // with a * and a flag telling the Web Advantage system that it's GST-exempt // // It still doesn't, nor ever did, support the case where different tax percentages apply to different // products if($value['tax']>0) { $process_button_string .= tep_draw_hidden_field($value['name'], $value['qty'].','.$value['final_price']); $tax_rate = $value['tax']; } else { $process_button_string .= tep_draw_hidden_field($value['name'] . ' *', $value['qty'].','.$value['final_price']); $process_button_string .= tep_draw_hidden_field('gst_exempt_fields', $value['name'] . ' *'); } } if($tax_rate > 0) { $process_button_string .= tep_draw_hidden_field('gst_rate', $tax_rate); $process_button_string .= tep_draw_hidden_field('gst_added', 'false'); $process_button_string .= tep_draw_hidden_field('gst_exempt_fields', 'Shipping Method: '.$order->info['shipping_method'] . ' *'); } $process_button_string .= tep_draw_hidden_field('Shipping Method: '.$order->info['shipping_method'] . ' *', '1,'.$order->info['shipping_cost']); $process_button_string .= tep_draw_hidden_field('receipt_address', $order->customer['email_address']); $process_button_string .= tep_draw_hidden_field('return_link_text', 'Finish payment&return to main site.'); $process_button_string .= tep_draw_hidden_field('return_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS,'bank_reference=&payment_number=&remote_ip=')); // $process_button_string .= tep_draw_hidden_field('reply_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS,'bank_reference=&payment_number=&remote_ip=')); return $process_button_string; } function before_process() { global $order; if(MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID >0) { $order->info['order_status'] = MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID; } } function after_process() { global $order, $insert_id; if(MODULE_PAYMENT_WEBADVANTAGE_ORDER_STATUS_ID >0) { tep_db_query("UPDATE ".TABLE_ORDERS." SET orders_status='".MODULE_PAYMENT_WEBADVANTAGE_ORDER_STATUS_ID."', webadvantage_payment_number='".mysql_escape_string($_GET['payment_number'])."', webadvantage_bank_reference='".mysql_escape_string($_GET['bank_reference'])."', webadvantage_remote_ip='".mysql_escape_string($_GET['remote_ip'])."' WHERE orders_id='".$insert_id."'"); if(isset($_GET['bank_reference'])) { tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" .$insert_id . "', '" . MODULE_PAYMENT_WEBADVANTAGE_ORDER_STATUS_ID . "', now(), '0', '***WebAdvantage Payment Data*** Payment#: ".$_GET['payment_number']." Bank Reference#: ".$_GET['bank_reference']." Remote Ip: ".$_GET['remote_ip']."')"); } return false; } } 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_WEBADVANTAGE_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Preparing [WebAdvantage]' limit 1"); if (tep_db_num_rows($check_query) < 1) { $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS); $status = tep_db_fetch_array($status_query); $status_id = $status['status_id']+1; $languages = tep_get_languages(); foreach ($languages as $lang) { tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [WebAdvantage]')"); } } else { $check = tep_db_fetch_array($check_query); $status_id = $check['orders_status_id']; } $check_query = tep_db_query("select orders_status_id from " . TABLE_ORDERS_STATUS . " where orders_status_name = 'Payment confirmed [WebAdvantage]' limit 1"); if (tep_db_num_rows($check_query) < 1) { $status_query = tep_db_query("select max(orders_status_id) as status_id from " . TABLE_ORDERS_STATUS); $status = tep_db_fetch_array($status_query); $payed_status_id = $status['status_id']+1; $languages = tep_get_languages(); foreach ($languages as $lang) { tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $payed_status_id . "', '" . $lang['id'] . "', 'Payment confirmed [WebAdvantage]')"); } } else { $check = tep_db_fetch_array($check_query); $payed_status_id = $check['orders_status_id']; } $check_instalation_order_query = tep_db_query("SELECT * FROM orders LIMIT 1"); $check_instalation_order_array = tep_db_fetch_array($check_instalation_order_query); if($check_instalation_order_array['ideal_ec'] != -1 && !isset($check_instalation_order_array['webadvantage_bank_reference'])) { tep_db_query("ALTER TABLE `orders` ADD COLUMN `webadvantage_payment_number` VARCHAR( 50 ) NOT NULL DEFAULT -1"); tep_db_query("ALTER TABLE `orders` ADD COLUMN `webadvantage_bank_reference` VARCHAR( 50 ) NOT NULL DEFAULT -1"); tep_db_query("ALTER TABLE `orders` ADD COLUMN `webadvantage_remote_ip` VARCHAR( 50 ) NOT NULL DEFAULT -1"); } 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 WebAdvantage Module', 'MODULE_PAYMENT_WEBADVANTAGE_STATUS', 'True', 'Do you want to accept payments through Webadvantage gateway?', '6', '1', '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, set_function, date_added) values ('Test Mode', 'MODULE_PAYMENT_WEBADVANTAGE_TEST_MODE','False', 'Run in TEST MODE?', '6', '2', '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_WEBADVANTAGE_MERCHANT_ID', '', 'WebAdvantage Merchant ID', '6', '3', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('E-Mail Address', 'MODULE_PAYMENT_WEBADVANTAGE_MERCHANT_EMAIL', '[email protected]', 'The e-mail address where to receive customers invoice copy', '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, use_function, date_added) values ('Set Preparing Order Status', 'MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID', '" . $status_id . "', 'Set the status of prepared orders made with this payment module to this value', '6', '7', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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 Processed Order Status', 'MODULE_PAYMENT_WEBADVANTAGE_ORDER_STATUS_ID', '".$payed_status_id."', 'Set the status of orders made with this payment module to this value', '6', '8', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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_WEBADVANTAGE_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_WEBADVANTAGE_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); tep_db_query("DELETE FROM ". TABLE_ORDERS_STATUS ." WHERE orders_status_name='Payment confirmed [WebAdvantage]' OR orders_status_name='Preparing [WebAdvantage]'"); } function keys() { return array('MODULE_PAYMENT_WEBADVANTAGE_STATUS', 'MODULE_PAYMENT_WEBADVANTAGE_MERCHANT_ID', 'MODULE_PAYMENT_WEBADVANTAGE_MERCHANT_EMAIL', 'MODULE_PAYMENT_WEBADVANTAGE_ZONE', 'MODULE_PAYMENT_WEBADVANTAGE_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_WEBADVANTAGE_TEST_MODE', 'MODULE_PAYMENT_WEBADVANTAGE_ORDER_STATUS_ID', 'MODULE_PAYMENT_WEBADVANTAGE_SORT_ORDER'); } } ?> Quote
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.