[TEP-COMMIT] CVS: catalog/catalog/includes/modules/payment secpay.php,1.35,1.36
cvs-OfajU3CKLf1/[email protected] Sun, 14 Mar 2004 23:37:46 +0100 (CET)
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /pack/cvsroots/oscommerce/catalog/catalog/includes/modules/payment
In directory sunsite.dk:/tmp/cvs-serv543/includes/modules/payment
Modified Files:
secpay.php
Log Message:
Update secpay module to use hash checking instead of reverse lookup. Also add the functionality for the customer to return to the store by clicking a back button on the secpay site
Index: secpay.php
===================================================================
RCS file: /pack/cvsroots/oscommerce/catalog/catalog/includes/modules/payment/secpay.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- secpay.php 2004/02/16 08:27:28 1.35
+++ secpay.php 2004/03/14 21:52:51 1.36
@@ -119,8 +119,9 @@
tep_draw_hidden_field('ship_country', $order->delivery['country']['title']) .
tep_draw_hidden_field('currency', $sec_currency) .
tep_draw_hidden_field('callback', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL', false) . ';' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL', false)) .
+ tep_draw_hidden_field('backcallback', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', false)) .
tep_draw_hidden_field($osC_Session->name, $osC_Session->id) .
- tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_post=true,cb_flds=' . $osC_Session->name);
+ tep_draw_hidden_field('options', 'test_status=' . $test_status . ',dups=false,cb_flds=' . $osC_Session->name);
return $process_button_string;
}
@@ -129,22 +130,16 @@
global $osC_Session;
if (PHP_VERSION < 4.1) {
- global $_POST;
+ global $_GET;
}
- if ($_POST['valid'] == 'true') {
- if (MODULE_PAYMENT_SECPAY_ENHANCED_CHECK == 'true') {
- if ($remote_host = getenv('REMOTE_HOST')) {
- if ($remote_host != 'secpay.com') {
- $remote_host = gethostbyaddr($remote_host);
- }
- if ($remote_host != 'secpay.com') {
- tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $osC_Session->name . '=' . $_POST[$osC_Session->name] . '&payment_error=' . $this->code, 'SSL', false, false));
- }
- }
+ if ($_GET['valid'] == 'true') {
+ list($REQUEST_URI) = split("hash=", $_SERVER['REQUEST_URI']);
+ if ($_GET['hash'] != MD5($REQUEST_URI . MODULE_PAYMENT_SECPAY_DIGEST_KEY)) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $osC_Session->name . '=' . $_GET[$osC_Session->name] . '&payment_error=' . $this->code, 'SSL', false, false));
}
} else {
- tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $osC_Session->name . '=' . $_POST[$osC_Session->name] . '&payment_error=' . $this->code, 'SSL', false, false));
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $osC_Session->name . '=' . $_GET[$osC_Session->name] . '&payment_error=' . $this->code, 'SSL', false, false));
}
}
@@ -183,7 +178,7 @@
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_SECPAY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', 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_SECPAY_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())");
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_SECPAY_ORDER_STATUS_ID', '0', 'Set the status of 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, date_added) values ('Use enhanced checking', 'MODULE_PAYMENT_SECPAY_ENHANCED_CHECK', 'true', 'Use enhanced checking to ensure payment response is coming from secpay.com? Note: Some hosts disallow reverse lookups causing sucessful payments to fail. If this happens set this option to false.', '6', '8', '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 ('Digest Key', 'MODULE_PAYMENT_SECPAY_DIGEST_KEY', 'secpay', 'Key to use for the digest functionality', '6', '8', now())");
}
function remove() {
@@ -191,7 +186,7 @@
}
function keys() {
- return array('MODULE_PAYMENT_SECPAY_STATUS', 'MODULE_PAYMENT_SECPAY_MERCHANT_ID', 'MODULE_PAYMENT_SECPAY_CURRENCY', 'MODULE_PAYMENT_SECPAY_TEST_STATUS', 'MODULE_PAYMENT_SECPAY_ZONE', 'MODULE_PAYMENT_SECPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECPAY_SORT_ORDER', 'MODULE_PAYMENT_SECPAY_ENHANCED_CHECK');
+ return array('MODULE_PAYMENT_SECPAY_STATUS', 'MODULE_PAYMENT_SECPAY_MERCHANT_ID', 'MODULE_PAYMENT_SECPAY_CURRENCY', 'MODULE_PAYMENT_SECPAY_TEST_STATUS', 'MODULE_PAYMENT_SECPAY_ZONE', 'MODULE_PAYMENT_SECPAY_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECPAY_SORT_ORDER', 'MODULE_PAYMENT_SECPAY_DIGEST_KEY');
}
}
?>
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click