Originally Posted by
p1drobert2
Thank you LAT9 for your answer.
I don't have a proper PHP file viewer but notepad indicates line 444 should be inside the code shown on the bottom of this post. Now, so far, I've been updating the file to fix errors caused by going from php5.6 to PHP7.
So far I changed
function nab_transact_hpp(
to
function __construct(
and
global $$order_totals[$i]['code'];
to
global ${$order_totals[$i]['code']};
which fixed warnings and errors, thanks to the help of users above. Since this module worked in zencart versions 1.5.6, using PHP5.6 I'm assuming there's either something in zencart 1.5.7 or changes in php7 that is causing this following sections of code to misbehave now. I've recently had a new geotrust SSL certificate installed on my web site but since the NAB servers has processed the payment and returned to my site I'm assuming its not a SSL issue.
Unfortunately I have no real PHP knowledge. Can anyone quickly glance through the following code and see why the error is occurring, in particular why a string should now be getting written to a variable that only accepts integers? More importantly how I should rewrite it to fix it.
/**
* This function is called after the order has been created
*
* @param int $order_id
*/
function after_order_create($order_id) {
global $order, $amount_paid;
$customer_ip = $_SESSION['customer_ip'];
//Write the payment specific values to the order history
if ($_SERVER['REMOTE_ADDR'] != $customer_ip || empty($customer_ip)){
$order_status = $order->info['order_status'];
$payment_status = 'NOT PAID/PARTIALLY PAID';
//If the full amount has been paid update the order status
//otherwise leave the status as it is
if (round((float)$order->info['total'],2) == round((float)$amount_paid, 2)) {
if (MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID > 0) {
$order_status = MODULE_PAYMENT_NAB_TRANSACT_HPP_ORDER_STATUS_ID;
}
$payment_status = 'PAID IN FULL';
}
$sql_data_array = array(
'orders_id' => $order_id,
'orders_status_id' => $order_status,
'date_added' => 'now()',
'customer_notified' => 0,
'comments' =>
'***'.MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_HEADING.'***'.chr(10).
MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_STATUS.': '.$payment_status.' ('.strtoupper($this->in_test_mode() ? MODULE_PAYMENT_NAB_TRANSACT_CONST_TEST : MODULE_PAYMENT_NAB_TRANSACT_CONST_LIVE).' PAYMENT)'.chr(10).
MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_AMOUNT.': '.$amount_paid.chr(10).
MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_CARD.': '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_CARD_TYPE]).chr(10).
MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_TXN_REF.'#: '.$_SESSION['nt_hpp_payment_reference'].':'.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_REF_NUM]).chr(10).
MODULE_PAYMENT_NAB_TRANSACT_HPP_PAY_INFO_BANK_REF.'#: '.urldecode($_GET[MODULE_PAYMENT_NAB_TRANSACT_QS_PARAM_NAME_BANK_REF]).chr(10)
);
zen_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
//unregister the session variables
unset($_SESSION['nt_hpp_payment_reference']);
unset($_SESSION['customer_ip']);
} else {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . MODULE_PAYMENT_NAB_TRANSACT_ERR_UNAUTH_CHECKOUT_CALL, 'NONSSL'));
}
return true;
}
function after_process() {
global $insert_id, $db;
}
Bookmarks