hi to everyone.
i'm a new user at this forum and a newbie of cs-cart.
i have create a script for payment with a local bank.
the script work correctly, send payment at the bank server and return the result of transition.
When i catch the result of transition, I change the state of order like processed, but I can't clear the cart.
the server of the bank accept two url for the transition positive result (urlok, urlack) and two for the negtive (urlko ,urlnack).
so, urlok and urlko assign the value of a button to return at the site at the end of transition.
urlack and urlnack execute the background operation without force the user to return to the site at the end of operation.
this is a part of my script.
i think ther is an error when i try to refresh the page whith the new url.
Can anyone help me?
<?php/***************************************************************************
-
*
-
(c) 2015 Lorenzo Zanin *
-
*
****************************************************************************/
use Tygh\Session; //ok
use Tygh\Registry;
if (defined(‘PAYMENT_NOTIFICATION’)){
if ($mode == 'notify') {
fn_order_placement_routines('route', $_REQUEST['order_id']);
}
}elseif(!empty($_GET[‘ORDER_ID’])){
require './init_payment.php';
$orderid=substr($_GET['ORDER_ID'], -2,2);
$order_info = fn_get_order_info($orderid, true);
fn_payments_set_company_id($orderid);
$pp_response = array();
$pp_response['order_status'] = 'P';
$pp_response['reason_text']=__('transaction_approved');
$pp_response['transaction_id'] =$_GET['TRANSACTION_ID'];
fn_finish_payment($orderid, $pp_response);
echo "<html><head><meta http-equiv='refresh' content='0; url=" . fn_url("payment_notification.notify?payment=elmama_virtual_pay&order_id=$orderid", $area, 'current', CART_LANGUAGE, $override) ."'></head><body></body></html>";
exit;
}else{
if (!defined('BOOTSTRAP')) { die('Access denied'); }
// info dell'ordine ( sperando che $order_info sia già definita da qualche parte )
// ammontare totale dell'ordine
$totale = str_replace('.', ',', $order_info["total"]);
$numero = rand(0,9999);
// qui c'è l'id dello'ordine va aggiunta una stringa casuale per evitare che la richiesta d'ordine venga eseguita due volte allo stesso modo creo numero random
$order_id='MAMATEST'.$numero."-".$order_info["order_id"];
// id dell'ordine ( mi serve dopo per estrerre i dati degli articoli che ci sono nell'ordine)
$_order_id = ($order_info['repaid']) ? ($order_id . '_' . $order_info['repaid']) : $order_id;
// indirizzo per invio pagamento
if ($processor_data['processor_params']['mode'] == 'test')
{
$payment_url = 'https://www.servizipos.it/GT_EgipsyWeb/CheckOutEGIPSy.jsp';
$totale='0,01';
}else
{
$payment_url = '';
}
$mid=$processor_data['processor_params']['merchant_id'];
$divisa='EUR';
$abi='035XX';
$items='2002^prova^1^0,01^EUR';
$key="E5D49168---------------------B02360B6B";
$mac=strtoupper(md5($mid.$order_id.$totale.$divisa.$abi.$items.$key));
//$urlok= fn_url("payment_notification.process?payment=elmama_virtual_pay&order_id={$order_info['order_id']}", AREA, 'current');
$urlnotify=fn_url("payment_notification.notify?payment=elmama_virtual_pay&order_id={$order_info['order_id']}", AREA, 'current');
$url2= fn_payment_url('current','elmama_virtual_pay.php');
$post_data = array(
'MERCHANT_ID' => $mid,
'ORDER_ID' => $order_id,
'IMPORTO' => $totale,
'DIVISA' => $divisa,
'ABI' => $abi,
'ITEMS' => $items,
'LINGUA' => 'ita',
'URLOK' => 'http://elmama.it/', // da impostare una volta creata una pagina apposita per pagamento andato a buon fine
'URLKO' => 'http://elmama.it/',
'URLACK'=> $url2,
'URLNACK'=>$url2,
'MAC' => $mac
);
//fn_change_order_status($order_info["order_id"], 'O');
fn_create_payment_form($payment_url, $post_data, 'El Mama VirtualPay');
exit;// --> Ci va?
}
?>