New Payment Gateway

Dear Admin,



My Bank Has private gateway, i used the following code on Cs-cart professional,




```php

/***************************************************************************
* *
* Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
if ( !defined('AREA') ) { die('Access denied'); }
if (defined('PAYMENT_NOTIFICATION')) {
$payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $_REQUEST['order_id']);
$processor_data = fn_get_payment_method_data($payment_id);
switch ($_REQUEST['vpc_TxnResponseCode']) {
case '0':
$pp_response['order_status'] = 'P';
break;
case 'C':
$pp_response['order_status'] = 'C';
break;
case '7':
$pp_response['order_status'] = 'F';
break;
default:
$pp_response['order_status'] = 'D';
break;
}
$pp_response['reason_text'] = $_REQUEST['vpc_Message'];
$pp_response['transaction_id'] = $_REQUEST['vpc_TransactionNo'];
if (fn_check_payment_script('zienthbank.php', $_REQUEST['order_id'])) {
fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
fn_order_placement_routines($_REQUEST['order_id']);
}
exit;
} else {
$current_location = Registry::get('config.current_location');
$total = $order_info['total'] * 100;
$post['vpc_Version'] = '1';
$post['vpc_Command'] = 'pay';
$post['vpc_MerchTxnRef'] = $order_id;
$post['vpc_AccessCode'] = $processor_data['params']['accesscode'];
$post['vpc_Merchant'] = $processor_data['params']['merchant'];
$post['vpc_OrderInfo'] = $order_id;
$post['vpc_Amount'] = $total;
$post['vpc_Locale'] = "en_EN";
$post['vpc_ReturnURL'] = "$current_location/$index_script?dispatch=payment_notification.finish&payment=zienthbank&order_id=$order_id";
ksort($post);
$md5hash = $processor_data['params']['securehashsecret'];
foreach ($post as $k => $v) {
$md5hash .= $v;
}
$post['vpc_SecureHash'] = strtoupper(md5($md5hash));
// https://migs.mastercard.com.au/vpcpay
echo <<


EOT;
foreach ($post as $name => $value) {
echo "\n";
}
$msg = fn_get_lang_var('text_cc_processor_connection');
$msg = str_replace('[processor]', 'migs.mastercard.com.au', $msg);
echo <<
{$msg}



EOT;
}
exit;
?>

```





I moved to new Cs-cart 4.2.x and this payment gateway stopped working, I added (use Tygh\Registry; ) to the code as i'm using


$current_location = Registry::get('config.current_location');


in my code, the code become as following :


```php

/***************************************************************************
* *
* Copyright (c) 2004 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;

if ( !defined('AREA') ) { die('Access denied'); }
if (defined('PAYMENT_NOTIFICATION')) {
$payment_id = db_get_field("SELECT payment_id FROM ?:orders WHERE order_id = ?i", $_REQUEST['order_id']);
$processor_data = fn_get_payment_method_data($payment_id);
switch ($_REQUEST['vpc_TxnResponseCode']) {
case '0':
$pp_response['order_status'] = 'P';
break;
case 'C':
$pp_response['order_status'] = 'C';
break;
case '7':
$pp_response['order_status'] = 'F';
break;
default:
$pp_response['order_status'] = 'D';
break;
}
$pp_response['reason_text'] = $_REQUEST['vpc_Message'];
$pp_response['transaction_id'] = $_REQUEST['vpc_TransactionNo'];
if (fn_check_payment_script('zienthbank.php', $_REQUEST['order_id'])) {
fn_finish_payment($_REQUEST['order_id'], $pp_response, false);
fn_order_placement_routines($_REQUEST['order_id']);
}
exit;
} else {
$current_location = Registry::get('config.current_location');
$total = $order_info['total'] * 100;
$post['vpc_Version'] = '1';
$post['vpc_Command'] = 'pay';
$post['vpc_MerchTxnRef'] = $order_id;
$post['vpc_AccessCode'] = $processor_data['params']['accesscode'];
$post['vpc_Merchant'] = $processor_data['params']['merchant'];
$post['vpc_OrderInfo'] = $order_id;
$post['vpc_Amount'] = $total;
$post['vpc_Locale'] = "en_EN";
$post['vpc_ReturnURL'] = "$current_location/$index_script?dispatch=payment_notification.finish&payment=zienthbank&order_id=$order_id";
ksort($post);
$md5hash = $processor_data['params']['securehashsecret'];
foreach ($post as $k => $v) {
$md5hash .= $v;
}
$post['vpc_SecureHash'] = strtoupper(md5($md5hash));
// https://migs.mastercard.com.au/vpcpay
echo <<


EOT;
foreach ($post as $name => $value) {
echo "\n";
}
$msg = fn_get_lang_var('text_cc_processor_connection');
$msg = str_replace('[processor]', 'migs.mastercard.com.au', $msg);
echo <<
{$msg}



EOT;
}
exit;
?>

```



After this modification the payment gateway didn't work and i Hope that i can get more information why it's not working on cs-cart 4.x.x



Thank you

The 'params' index is now 'processor_params' in V4 (one of the more useless and annoying changes).

Thank you so much for sharing this helpful information



is working now.



Can you please share with me the changing log so i can know what changed ?

There is another error with the response when we return the customer to the site is giving an Blank page



do you know why ?

Review your PHP error_log and/or any response you can see from an AJAX request in your browsers debugger (Firebug, Chrome Debugger, etc.)

Try to replace:



fn_order_placement_routines($_REQUEST['order_id']);




with



fn_order_placement_routines('route', $_REQUEST['order_id']);

Thank you so much.

[quote name='eComLabs' timestamp='1419239378' post='200533'] Try to replace: fn_order_placement_routines($_REQUEST['order_id']); with fn_order_placement_routines('route', $_REQUEST['order_id']); [/quote]



thanks you it works i did't notice to this.

[quote name='Fouani-Nig' timestamp='1419250544' post='200580']

Thank you so much.

[/quote]



You are welcome!