Index: add_to_cart.php =================================================================== --- add_to_cart.php (revision 13557) +++ add_to_cart.php (working copy) @@ -1,20 +0,0 @@ -Init(); - -$application->Redirect('in-commerce/checkout/shop_cart', array('pass'=>'p,ord', 'ord_event' => 'OnAddToCart', 'p_id' => $application->GetVar('product'))); \ No newline at end of file Index: gw_notify.php =================================================================== --- gw_notify.php (revision 13557) +++ gw_notify.php (working copy) @@ -10,32 +10,34 @@ * and will be prosecuted to the maximum extent possible under the law * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - - define('FULL_PATH', realpath(dirname(__FILE__).'/..')); define('GW_NOTIFY', 1); - define('REL_PATH', 'in-commerce'); - include_once(FULL_PATH.'/core/kernel/startup.php'); - + define('REL_PATH', 'modules/in-commerce'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../..')); + include_once(FULL_PATH . '/core/kernel/startup.php'); + $application =& kApplication::Instance(); $application->Init(); - /*$fh = fopen(WRITEABLE . '/gw.log', 'a'); + /* + // for debugging payment gateway notifications, don't remove + $fh = fopen(WRITEABLE . '/gw.log', 'a'); fwrite ($fh, "\n\n".date('d/m/y h:i:s').":\n"); foreach ($_REQUEST as $key => $val) { fwrite($fh, "\n"); } - fclose($fh);*/ - + fclose($fh); + */ + $db =& $application->GetADODBConnection(); $application->setUnitOption('ord','AutoLoad',false); $order =& $application->recallObject('ord'); - + $order_id = $application->GetVar('order_id'); if ($order_id) { $order->Load($order_id); } - + $gw_data = $order->getGatewayData($application->GetVar('payment_type_id')); $application->registerClass( $gw_data['ClassName'], GW_CLASS_PATH.'/'.$gw_data['ClassFile'] ); $gateway_object =& $application->recallObject( $gw_data['ClassName'] ); Index: units/gateways/gw_classes/atosorigin.php =================================================================== --- units/gateways/gw_classes/atosorigin.php (revision 13557) +++ units/gateways/gw_classes/atosorigin.php (working copy) @@ -63,10 +63,10 @@ $params['normal_return_url'] = $this->Application->HREF($tag_params['return_template'],'',Array('pass'=>'m')); $params['cancel_return_url'] = $this->Application->HREF($tag_params['cancel_template'],'',Array('pass'=>'m')); - $params['automatic_response_url'] = $this->Application->BaseURL('/in-commerce/units/gateways/gw_classes/notify_scripts').'atosorigin_notify.php'; + $params['automatic_response_url'] = $this->getNotificationUrl('units/gateways/gw_classes/notify_scripts/atosorigin_notify.php'); $txt_amount = sprintf("%.2f", $item_data['TotalAmount']); - + $params['amount'] = str_replace( Array('.', ','), '', $txt_amount); $params['caddie'] = $this->Application->GetSID() . ',' . MD5($item_data['OrderId']); $params['order_id'] = $item_data['OrderId']; Index: units/gateways/gw_classes/google_checkout.php =================================================================== --- units/gateways/gw_classes/google_checkout.php (revision 13557) +++ units/gateways/gw_classes/google_checkout.php (working copy) @@ -108,7 +108,7 @@ } $use_ssl = substr($this->gwParams['submit_url'], 0, 8) == 'https://' ? true : null; - $shipping_url = $this->Application->BaseURL('/in-commerce/units/gateways/gw_classes/notify_scripts', $use_ssl).'google_checkout_shippings.php'; + $shipping_url = $this->getNotificationUrl('units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php', $use_ssl); $shipping_xml = ' '.$shipping_xml.' Index: units/gateways/gw_classes/gw_base.php =================================================================== --- units/gateways/gw_classes/gw_base.php (revision 13557) +++ units/gateways/gw_classes/gw_base.php (working copy) @@ -258,4 +258,13 @@ return array(); } + function getNotificationUrl($script = 'gw_notify.php', $use_ssl = null) + { + // custom path can be: units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php' + + $ret = MODULES_PATH . '/in-commerce/' . $script; + $ret = preg_replace('/^' . preg_quote(FULL_PATH . '/', '/') . '/', $this->Application->BaseURL('', $use_ssl), $ret); + + return str_replace(DIRECTORY_SEPARATOR, '/', $ret); + } } \ No newline at end of file Index: units/gateways/gw_classes/ideal_nl.php =================================================================== --- units/gateways/gw_classes/ideal_nl.php (revision 13557) +++ units/gateways/gw_classes/ideal_nl.php (working copy) @@ -77,13 +77,12 @@ $fields['a'] = 'fetch'; $fields['partnerid'] = $gw_params['partner_id']; $txt_amount = sprintf("%.2f", $item_data['TotalAmount']); - $fields['amount'] = str_replace( Array('.', ','), '', $txt_amount); + $fields['amount'] = str_replace( Array('.', ','), '', $txt_amount); $fields['bank_id'] = $this->Application->GetVar('ideal_nl_bank_id'); $fields['description'] = 'Invoice #'.$item_data['OrderNumber']; + $fields['returnurl'] = $this->getNotificationUrl() . '?order_id='.$item_data['OrderId']; + $fields['reporturl'] = $this->getNotificationUrl() . '?mode=report&order_id='.$item_data['OrderId']; - $fields['returnurl'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?order_id='.$item_data['OrderId']; - $fields['reporturl'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?mode=report&order_id='.$item_data['OrderId']; - $transaction_xml = curl_post($gw_params['request_url'], $fields, null, 'GET'); $parser =& $this->Application->recallObject('kXMLHelper'); Index: units/gateways/gw_classes/multicards.php =================================================================== --- units/gateways/gw_classes/multicards.php (revision 13557) +++ units/gateways/gw_classes/multicards.php (working copy) @@ -65,7 +65,7 @@ // $ret['cancel_return'] = $this->Application->HREF($tag_params['cancel_template'],'',Array('pass'=>'m')); // $ret['return'] = $this->Application->HREF($tag_params['return_template'],'',Array('pass'=>'m')); -// $ret['notify_url'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; +// $ret['notify_url'] = $this->getNotificationUrl() . '?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; // $ret['cmd'] = '_xclick'; // act as "Buy Now" PayPal button $ret['no_note'] = 1; // customer is not prompted for notes Index: units/gateways/gw_classes/notify_scripts/atosorigin_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/atosorigin_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/atosorigin_notify.php (working copy) @@ -11,10 +11,10 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); - include_once(FULL_PATH.'/core/kernel/startup.php'); + include_once(FULL_PATH . '/core/kernel/startup.php'); $application =& kApplication::Instance(); $application->Init(); @@ -26,4 +26,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kAtosOriginGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/google_checkout_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/google_checkout_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/google_checkout_notify.php (working copy) @@ -11,8 +11,8 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); include_once(FULL_PATH.'/core/kernel/startup.php'); Index: units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php =================================================================== --- units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/google_checkout_shippings.php (working copy) @@ -11,10 +11,10 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); - include_once(FULL_PATH.'/core/kernel/startup.php'); + include_once(FULL_PATH . '/core/kernel/startup.php'); $application =& kApplication::Instance(); $application->Init(); Index: units/gateways/gw_classes/notify_scripts/multicards_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/multicards_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/multicards_notify.php (working copy) @@ -11,13 +11,11 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); - if (!file_exists(FULL_PATH.'/core/kernel/application.php')) { //way to dectect new ver - define('APPLICATION_CLASS', 'MyApplication'); - } + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); + define('ADMIN', 1); - include_once(FULL_PATH.'/core/kernel/startup.php'); + include_once(FULL_PATH . '/core/kernel/startup.php'); $application =& kApplication::Instance(); $application->Init(); @@ -29,4 +27,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kMultiCardsGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/paybox_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/paybox_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/paybox_notify.php (working copy) @@ -11,11 +11,9 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); - if (!file_exists(FULL_PATH.'/core/kernel/application.php')) { //way to dectect new ver - define('APPLICATION_CLASS', 'MyApplication'); - } + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); + define('ADMIN', 1); include_once(FULL_PATH.'/core/kernel/startup.php'); @@ -29,4 +27,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kPayboxGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/sella_error.php =================================================================== --- units/gateways/gw_classes/notify_scripts/sella_error.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/sella_error.php (working copy) @@ -11,8 +11,8 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); include_once(FULL_PATH.'/core/kernel/startup.php'); @@ -28,4 +28,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kSellaGuestPayGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/sella_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/sella_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/sella_notify.php (working copy) @@ -11,8 +11,8 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); include_once(FULL_PATH.'/core/kernel/startup.php'); @@ -26,4 +26,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kSellaGuestPayGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/sella_ok.php =================================================================== --- units/gateways/gw_classes/notify_scripts/sella_ok.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/sella_ok.php (working copy) @@ -11,10 +11,10 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); - include_once(FULL_PATH.'/core/kernel/startup.php'); + include_once(FULL_PATH . '/core/kernel/startup.php'); $application =& kApplication::Instance(); $application->Init(); @@ -28,4 +28,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kSellaGuestPayGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/notify_scripts/verisign_pflink_notify.php =================================================================== --- units/gateways/gw_classes/notify_scripts/verisign_pflink_notify.php (revision 13557) +++ units/gateways/gw_classes/notify_scripts/verisign_pflink_notify.php (working copy) @@ -11,10 +11,10 @@ * See http://www.in-portal.org/commercial-license for copyright notices and details. */ - define('FULL_PATH', realpath(dirname(__FILE__).'/../../../../../')); - define('REL_PATH', 'in-commerce/units/gateways/gw_classes/notify_scripts'); + define('FULL_PATH', realpath(dirname(__FILE__) . '/../../../../../..')); + define('REL_PATH', 'modules/in-commerce/units/gateways/gw_classes/notify_scripts'); define('ADMIN', 1); - include_once(FULL_PATH.'/core/kernel/startup.php'); + include_once(FULL_PATH . '/core/kernel/startup.php'); $application =& kApplication::Instance(); $application->Init(); @@ -26,4 +26,4 @@ ON g.GatewayId = pt.GatewayId WHERE g.ClassName = '.$application->Conn->qstr('kVerisignPfLinkGW'))); - include(FULL_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file + include(MODULES_PATH.'/in-commerce/gw_notify.php'); \ No newline at end of file Index: units/gateways/gw_classes/paypal.php =================================================================== --- units/gateways/gw_classes/paypal.php (revision 13557) +++ units/gateways/gw_classes/paypal.php (working copy) @@ -85,7 +85,8 @@ /* @var $cs_helper kCountryStatesHelper */ $ret['country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); - $ret['notify_url'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; + $ret['notify_url'] = $this->getNotificationUrl() . '?sid=' . $this->Application->GetSID() . '&admin=1&order_id=' . $item_data['OrderId']; + $ret['cmd'] = '_xclick'; // act as "Buy Now" PayPal button return $ret; } @@ -149,7 +150,7 @@ /* @var $cs_helper kCountryStatesHelper */ $ret['country'] = $cs_helper->getCountryIso( $item_data['BillingCountry'] ); - $ret['notify_url'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId'].'&payment_type_id='.$tag_params['payment_type_id']; + $ret['notify_url'] = $this->getNotificationUrl() . '?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId'].'&payment_type_id='.$tag_params['payment_type_id']; $ret['cmd'] = '_xclick-subscriptions'; // act as "Buy Now" PayPal button $real_ret = array(); Index: units/gateways/gw_classes/worldpay.php =================================================================== --- units/gateways/gw_classes/worldpay.php (revision 13557) +++ units/gateways/gw_classes/worldpay.php (working copy) @@ -86,8 +86,8 @@ $return_params = Array ('pass' => 'm', 'sid' => $this->Application->GetSID(), 'admin' => 1); $ret['MC_return_page'] = $this->Application->HREF($tag_params['return_template'], '', $return_params); $ret['MC_cancel_return_page'] = $this->Application->HREF($tag_params['cancel_template'], '', $return_params); + $ret['MC_callback'] = $this->getNotificationUrl() . '?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; - $ret['MC_callback'] = $this->Application->BaseURL('/in-commerce').'gw_notify.php?sid='.$this->Application->GetSID().'&admin=1&order_id='.$item_data['OrderId']; return $ret; }