Finish Payment For Offline Payment Method

Hello,



I’m converting a payment method from cscart 3.x to 4.x. Its a offline payment method that generates a code to pay at the ATM machines or home banking.



I got it (almost) all working but after the client clicks the final checkout button the order doesnt shows in the backoffice as “Open”.



There is something missing in the fn_order_placement_routines or the fn_finish_payment i really dont know what it is. i’ve searched other payment gateways and the forum with no luck.



Any help or hint would be much apreciated. I feel like i’m so close.


<br />
use Tygh\Http;<br />
use Tygh\Registry;<br />
if (!defined('BOOTSTRAP')) { die('Access denied'); }<br />
if (defined('PAYMENT_NOTIFICATION')) {<br />
<br />
$order_id = $_REQUEST['order_id'];  <br />
$pp_response = array(); <br />
    fn_order_placement_routines($order_id, true, AREA);<br />
fn_finish_payment($order_id,$pp_response,true); <br />
      <br />
}else{ <br />
<br />
$entidade=$processor_data['processor_params']['entidade'];<br />
$subentidade=$processor_data['processor_params']['subentidade'];<br />
$order_total=$order_info['total'];<br />
$current_location = Registry::get('config.current_location'); <br />
$link_script = $current_location . "/app/payments/multibanco/ifmb.php";<br />
$url_return = fn_url("payment_notification.success?payment=multibanco&order_id=$order_id", AREA, 'current'); <br />
<br />
echo <<<EOT<br />
<html><br />
<body onload="document.process.submit();"><br />
<body><br />
<form method="POST" action="{$link_script}" name="process"><br />
<input type="hidden" name="ENTIDADE" value="{$entidade}" /><br />
<input type="hidden" name="SUBENTIDADE" value="{$subentidade}" /><br />
<input type="hidden" name="ID" value="{$order_id}" /><br />
<input type="hidden" name="VALOR" value="{$order_total}" /><br />
<input type="hidden" name="RETURN" value="{$url_return}" /><br />
</form><br />
<br />
</body><br />
</html><br />
<br />
EOT;<br />
<br />
}

I got it, for future reference, here it it the bit of code to process the order as “OPEN” when the custumer finishes the checkout.



You then need to change the order status manualy in the back office.



For CS-cart 4.x



use Tygh\Http;
use Tygh\Registry;

if (!defined('BOOTSTRAP')) { die('Access denied'); }

$StaTus_message = "";
$pp_response['customer_email'] = $_REQUEST['billing_cust_email'];
$pp_response['client_id'] = $_REQUEST['billing_cust_name'];
$pp_response['order_status'] = 'O';
$pp_response['reason_text'] = $StaTus_message;
fn_finish_payment($_REQUEST['Order_Id'], $pp_response);
fn_change_order_status($_REQUEST['Order_Id'], $pp_response['order_status']);

then do the rest. in my case was a sendmail to custumer.