Permalink
Browse files

Add parameter to load payment pages through an iframe

  • Loading branch information...
haraldpdl committed Jun 25, 2010
1 parent 254d757 commit b28e91418f1748b72c1b0c4202e8cedc7c60f88f
@@ -0,0 +1,104 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2010 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ chdir('../../../../');
+ require('includes/application_top.php');
+
+// if the customer is not logged on, redirect them to the login page
+ if (!tep_session_is_registered('customer_id')) {
+ $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));
+ tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
+ }
+
+// if there is nothing in the customers cart, redirect them to the shopping cart page
+ if ($cart->count_contents() < 1) {
+ tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
+ }
+
+// avoid hack attempts during the checkout procedure by checking the internal cartID
+ if (isset($cart->cartID) && tep_session_is_registered('cartID')) {
+ if ($cart->cartID != $cartID) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
+ }
+ }
+
+// if no shipping method has been selected, redirect the customer to the shipping method selection page
+ if (!tep_session_is_registered('shipping')) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
+ }
+
+ if (!tep_session_is_registered('payment') || (substr($payment, 0, 12) != 'moneybookers')) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
+ }
+
+// load the selected payment module
+ require(DIR_WS_CLASSES . 'payment.php');
+ $payment_modules = new payment($payment);
+
+ require(DIR_WS_CLASSES . 'order.php');
+ $order = new order;
+
+ $payment_modules->update_status();
+
+ if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));
+ }
+
+ if (is_array($payment_modules->modules)) {
+ $payment_modules->pre_confirmation_check();
+ }
+
+// load the selected shipping module
+ require(DIR_WS_CLASSES . 'shipping.php');
+ $shipping_modules = new shipping($shipping);
+
+ require(DIR_WS_CLASSES . 'order_total.php');
+ $order_total_modules = new order_total;
+ $order_total_modules->process();
+
+// Stock Check
+ $any_out_of_stock = false;
+ if (STOCK_CHECK == 'true') {
+ for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
+ if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) {
+ $any_out_of_stock = true;
+ }
+ }
+ // Out of Stock
+ if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) {
+ tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
+ }
+ }
+
+ require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_CONFIRMATION);
+
+ $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
+ $breadcrumb->add(NAVBAR_TITLE_2);
+
+ $iframe_url = 'https://www.moneybookers.com/app/payment.pl?sid=' . $HTTP_POST_VARS['sid'];
+
+ require(DIR_WS_INCLUDES . 'template_top.php');
+?>
+ <table border="0" width="100%" cellspacing="0" cellpadding="0">
+ <tr>
+ <td>
+ <iframe src="<?php echo $iframe_url; ?>" width="100%" height="600" frameborder="0">
+ <p>Your browser does not support iframes.</p>
+ </iframe>
+ </td>
+ </tr>
+ </table>
+
+<?php
+ require(DIR_WS_INCLUDES . 'template_bottom.php');
+ require(DIR_WS_INCLUDES . 'application_bottom.php');
+?>
@@ -19,6 +19,7 @@
define('MODULE_PAYMENT_MONEYBOOKERS_TEXT_PUBLIC_TITLE', 'Moneybookers (including Credit and Debit Cards)');
define('MODULE_PAYMENT_MONEYBOOKERS_TEXT_DESCRIPTION', '<img src="images/icon_popup.gif" border="0">&nbsp;<a href="http://www.moneybookers.com/partners/oscommerce" target="_blank" style="text-decoration: underline; font-weight: bold;">Visit Moneybookers Website</a>' . $moneybookers_ping_button);
define('MODULE_PAYMENT_MONEYBOOKERS_RETURN_TEXT', 'Continue and return to ' . STORE_NAME);
+ define('MODULE_PAYMENT_MONEYBOOKERS_LANGUAGE_CODE', 'EN');
define('MB_ACTIVATION_TITLE', 'Moneybookers Account Activation');
define('MB_ACTIVATION_ACCOUNT_TITLE', 'Verify Account');
@@ -36,7 +36,11 @@ function moneybookers() {
if (is_object($order)) $this->update_status();
- $this->form_action_url = 'https://www.moneybookers.com/app/payment.pl';
+ if (defined('MODULE_PAYMENT_MONEYBOOKERS_IFRAME') && (MODULE_PAYMENT_MONEYBOOKERS_IFRAME == 'True')) {
+ $this->form_action_url = tep_href_link('ext/modules/payment/moneybookers/checkout.php', '', 'SSL');
+ } else {
+ $this->form_action_url = 'https://www.moneybookers.com/app/payment.pl';
+ }
}
// class methods
@@ -286,8 +290,7 @@ function confirmation() {
'cancel_url' => tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'),
'cancel_url_target' => 1,
'status_url' => tep_href_link('ext/modules/payment/moneybookers/callback.php', '', 'SSL', false, false),
- 'language' => 'EN',
- 'logo_url' => MODULE_PAYMENT_MONEYBOOKERS_STORE_IMAGE,
+ 'language' => MODULE_PAYMENT_MONEYBOOKERS_LANGUAGE_CODE,
'prepare_only' => '1',
'pay_from_email' => $order->customer['email_address'],
'first_name' => $order->billing['firstname'],
@@ -304,6 +307,10 @@ function confirmation() {
'osc_custid' => $customer_id,
'referring_platform' => 'osCommerce|' . $this->signature);
+ if (MODULE_PAYMENT_MONEYBOOKERS_IFRAME == 'False') {
+ $parameters['logo_url'] = MODULE_PAYMENT_MONEYBOOKERS_STORE_IMAGE;
+ }
+
if (tep_not_null(MODULE_PAYMENT_MONEYBOOKERS_DEBUG_EMAIL)) {
$parameters['status_url2'] = MODULE_PAYMENT_MONEYBOOKERS_DEBUG_EMAIL;
}
@@ -605,6 +612,7 @@ function install() {
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_MONEYBOOKERS_MERCHANT_ID', '" . (isset($HTTP_GET_VARS['custid']) ? $HTTP_GET_VARS['custid'] : '') . "', 'The Moneybookers merchant ID assigned to the seller e-mail address', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Word', 'MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD', '', 'The secret word to verify transactions with', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Store Logo Image', 'MODULE_PAYMENT_MONEYBOOKERS_STORE_IMAGE', '" . tep_catalog_href_link('images/store_logo.png', '', 'SSL') . "', 'The URL of the store logo image to display on the gateway transaction page. This must be served through HTTPS otherwise it will not be shown.', '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 ('iFrame Presentation', 'MODULE_PAYMENT_MONEYBOOKERS_IFRAME', 'True', 'Show the Moneybookers payment pages through an iFrame?', '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 ('Debug E-Mail Address', 'MODULE_PAYMENT_MONEYBOOKERS_DEBUG_EMAIL', '', 'All parameters of an invalid transaction will be sent to this email address.', '6', '0', 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_MONEYBOOKERS_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_MONEYBOOKERS_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())");
@@ -621,7 +629,7 @@ function remove() {
}
function keys() {
- return array('MODULE_PAYMENT_MONEYBOOKERS_STATUS', 'MODULE_PAYMENT_MONEYBOOKERS_PAY_TO', 'MODULE_PAYMENT_MONEYBOOKERS_MERCHANT_ID', 'MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD', 'MODULE_PAYMENT_MONEYBOOKERS_STORE_IMAGE', 'MODULE_PAYMENT_MONEYBOOKERS_DEBUG_EMAIL', 'MODULE_PAYMENT_MONEYBOOKERS_ZONE', 'MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_TRANSACTIONS_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_SORT_ORDER', 'MODULE_PAYMENT_MONEYBOOKERS_CURL');
+ return array('MODULE_PAYMENT_MONEYBOOKERS_STATUS', 'MODULE_PAYMENT_MONEYBOOKERS_PAY_TO', 'MODULE_PAYMENT_MONEYBOOKERS_MERCHANT_ID', 'MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD', 'MODULE_PAYMENT_MONEYBOOKERS_STORE_IMAGE', 'MODULE_PAYMENT_MONEYBOOKERS_IFRAME', 'MODULE_PAYMENT_MONEYBOOKERS_DEBUG_EMAIL', 'MODULE_PAYMENT_MONEYBOOKERS_ZONE', 'MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_TRANSACTIONS_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID', 'MODULE_PAYMENT_MONEYBOOKERS_SORT_ORDER', 'MODULE_PAYMENT_MONEYBOOKERS_CURL');
}
// format prices without currency formatting

0 comments on commit b28e914

Please sign in to comment.