problem with checksum being passed to netbanx.

netbanx formating
Sha1(nbx_payment_amount . nbx_currency_code . nbx_merchant_reference)

Netbankx say it had a decimal in it but I can see ('uc_netbanx_currency_factor', 100),
maybe an ubercart issue but I don't know.

Comments

alarcombe’s picture

Hi there,

What sort of error are you receiving? Something as fundamental as checksum configuration shouldn't be broken... :-/

MarcusOaten’s picture

Netbanx say the checksum is in error because the nbx_payment_amount has a decimal in it, I am wondering if this is being caused by the VAT add 20% caculation before this module gets passed that value.

The following errors have occurred:

* Authorisation Denied (135)

MarcusOaten’s picture

even with the tax and vat modules off there is still a 135 error,

MarcusOaten’s picture

netbanx say that the nbx_payment_amount needs to be an integrer without any decimal value, even .0

something like this has been suggested to remove all minor functions.
pseudo code.
sub str (variable amount,0,strpos(amount, ".'));

MarcusOaten’s picture

$form['uc_netbanx_currency_factor'] = array(
'#type' => 'textfield',
'#title' => t('Minor currency unit multiplier'),
'#description' => t('Netbanx uses integer minor currency units, Ubercart uses decimal major currency units. This is the the multiplication factor to use to convert between them (usually 100).'),
'#default_value' => variable_get('uc_netbanx_currency_factor', 100),

could this be applied somewhere here.
sub str (variable amount,0,strpos(amount, ".'));

MarcusOaten’s picture

edited 'nbx_payment_amount' => round($order->order_total * variable_get('uc_netbanx_currency_factor', 100)),
this has resolved the decimal major unit.

MarcusOaten’s picture

I have changed-
$checksum = _nbx_checksum_from_order($order);

With these lines of code

$amount = round($order->order_total *
variable_get('uc_netbanx_currency_factor', 100)) ;
$currency = "GBP";
$reference =$order->order_id;
$key = "SECRET KEY IN HERE... ";

$checksum = sha1($amount . $currency . $reference . $key);

This works but now the return is resolving to. The requested page could not be found. back at the merchant site.
with URL:
http://www.itdoesthejob.com/cart/netbanx/return/71/73bb4a3f87cc50d2b5cc6...

alarcombe’s picture

What's in the watchdog log? If it returns with an invalid order id or if the checksum returned by netbanx doesn't validate then you'll receive a 404 error.

MarcusOaten’s picture

Now working with following changes-
round order->order_total
and order_total->order_id

'nbx_payment_amount' => round($order->order_total * variable_get('uc_netbanx_currency_factor', 100)),

return sha1(($order->order_total * variable_get('uc_netbanx_currency_factor', 100)) . 'GBP' . ($order->order_id) . variable_get('uc_netbanx_secret_key', 'SECRETKEY'));

}

MarcusOaten’s picture

Status: Active » Needs review
StatusFileSize
new1.22 KB

Here is my diff patch file.

MarcusOaten’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev
MarcusOaten’s picture

Assigned: MarcusOaten » Unassigned
StatusFileSize
new1.22 KB
MarcusOaten’s picture

+++ /Users/marcus/Downloads/uc_netbanx 3/uc_netbanx.module
@@ -147,7 +147,7 @@
+        'nbx_payment_amount' => $order->order_total * variable_get('uc_netbanx_currency_factor', 100),

@@ -275,7 +275,8 @@
+  return sha1(($order->order_total * variable_get('uc_netbanx_currency_factor', 100)) . 'GBP' . ($order_total->order_id) . variable_get('uc_netbanx_secret_key', 'SECRETKEY'));

This is how you fix tax issue

alarcombe’s picture

Version: 6.x-1.x-dev » 6.x-1.0
Status: Needs review » Closed (fixed)

Thanks! Patched in new release 6.x-1.0