--- /Users/james/Downloads/uc_netbanx/uc_netbanx.module	2010-02-20 23:52:10.000000000 +0000
+++ sites/all/modules/uc_netbanx/uc_netbanx.module	2010-04-07 11:43:00.000000000 +0100
@@ -10,7 +10,7 @@
  * Implementation of hook_menu().
  */
 function uc_netbanx_menu() {
-  
+
   $items['cart/netbanx/success'] = array(
     'title' => t('Order complete'),
     'page callback' => 'uc_netbanx_success',
@@ -24,7 +24,7 @@ function uc_netbanx_menu() {
     'access arguments' => array('access content'),
     'type' => MENU_CALLBACK,
   );
-  
+
   $items['cart/netbanx/return/%/%'] = array(
     'title' => t('Order returned - testing'),
     'page callback' => 'uc_netbanx_return',
@@ -40,7 +40,7 @@ function uc_netbanx_menu() {
 /**
  * Implementation of hook_payment_method().
  */
-function uc_netbanx_payment_method() {  
+function uc_netbanx_payment_method() {
   $methods[] = array(
     'id' => 'netbanx',
     'name' => t('netbanx'),
@@ -93,7 +93,7 @@ function uc_payment_method_netbanx($op, 
         'directpay24' => t('DirectPay24'),
         'neteller' => t('NETELLER wallet'),
         'ukash' => t('Ukash'),
-        'paypal' => t('PayPal'), 
+        'paypal' => t('PayPal'),
         'poli' => t('POLI'),
       );
 
@@ -111,7 +111,7 @@ function uc_payment_method_netbanx($op, 
         '#description' => t('The URL your user will be taken to after returning from the netbanx site.'),
         '#default_value' => variable_get('uc_netbanx_return_url', t('/')),
       );
-      
+
       $form['uc_netbanx_currency_factor'] = array(
         '#type' => 'textfield',
         '#title' => t('Minor currency unit multiplier'),
@@ -123,9 +123,9 @@ function uc_payment_method_netbanx($op, 
         '#type' => 'textfield',
         '#title' => t('Secret Key'),
         '#description' => t('Your chosen secret key that will be used to create the checksum for transmitted data.'),
-        '#default_value' => variable_get('uc_netbanx_return_url', t('SECRETKEY')),
+        '#default_value' => variable_get('uc_netbanx_secret_key', t('SECRETKEY')),
       );
-   
+
       return $form;
   }
 }
@@ -136,15 +136,15 @@ function uc_payment_method_netbanx($op, 
  * Inserts netbanx fields into form
  */
 function uc_netbanx_form_alter(&$form, $form_state, $form_id) {
-  
+
   if ($form_id == 'uc_cart_checkout_review_form' && ($order_id = intval($_SESSION['cart_order'])) > 0) {
-  
+
     $order = uc_order_load($order_id);
 
     if ($order->payment_method == 'netbanx') {
-  
+
       $checksum = _nbx_checksum_from_order($order);
-  
+
       $netbanx_fields = array(
         'uc_netbanx_order_id' => $order->order_id,
         'nbx_payment_amount' => $order->order_total * variable_get('uc_netbanx_currency_factor', 100),
@@ -153,7 +153,7 @@ function uc_netbanx_form_alter(&$form, $
         'nbx_checksum' => $checksum,
         'nbx_language' => variable_get('uc_netbanx_language', 'en'),
         'nbx_success_url' => 'http://'. $_SERVER['HTTP_HOST'] . '/cart/netbanx/success',
-        'nbx_failure_url' => 'http://'. $_SERVER['HTTP_HOST'] . '/cart/netbanx/failure',  
+        'nbx_failure_url' => 'http://'. $_SERVER['HTTP_HOST'] . '/cart/netbanx/failure',
         'nbx_return_url' => 'http://'. $_SERVER['HTTP_HOST'] . '/cart/netbanx/return/' . $order->order_id . '/' . $checksum,
         'nbx_email' => $order->primary_email,
         'nbx_cardholder_name' => $order->billing_first_name .' '. $order->billing_last_name,
@@ -161,7 +161,7 @@ function uc_netbanx_form_alter(&$form, $
         'nbx_postcode' => $order->billing_postal_code,
         'nbx_payment_type' => join(',', array_keys(variable_get('uc_netbanx_payment_methods', '')))
       );
-      
+
       foreach ($netbanx_fields as $name => $value) {
         $form[$name] = array(
           '#type' => 'hidden',
@@ -186,22 +186,22 @@ function uc_netbanx_form_alter(&$form, $
  * @author Andrew Larcombe
  */
 function uc_netbanx_success() {
-  
+
   $nbx_status = $_POST['nbx_status'];
   $uc_netbanx_order_id = $_POST['uc_netbanx_order_id'];
   $nbx_netbanx_reference = $_POST['nbx_netbanx_reference'];
   $nbx_payment_amount = $_POST['nbx_payment_amount'];
   $all_post_params = print_r($_POST, 1);
-  
+
   $message = t('Netbanx CGI success callback called with parameters: <pre>!all_post_params</pre>', array('!all_post_params' => $all_post_params));
   watchdog('uc_netbanx', $message);
-  
+
   //NB THE NETBANX DOCS ARE INCORRECT - NBX_STATUS is 'passed'
   if ($nbx_status != 'passed') {
     watchdog('uc_netbanx', t('Success URL called, but nbx_status not set to authorised.'));
     exit();
   }
-  
+
   if (!($order = uc_order_load($uc_netbanx_order_id))) {
     watchdog('uc_netbanx', t('The order !uc_netbanx_order_id could not be found', array('!uc_netbanx_order_id' => $uc_netbanx_order_id)));
     exit();
@@ -220,7 +220,7 @@ function uc_netbanx_success() {
   }
 
   exit();
-  
+
 }
 
 
@@ -231,16 +231,16 @@ function uc_netbanx_success() {
  * @author Andrew Larcombe
  */
 function uc_netbanx_failure() {
-  
+
   $nbx_status = $_POST['nbx_status'];
   $uc_netbanx_order_id = $_POST['uc_netbanx_order_id'];
   $nbx_netbanx_reference = $_POST['nbx_netbanx_reference'];
   $nbx_payment_amount = $_POST['nbx_payment_amount'];
   $all_post_params = print_r($_POST, 1);
-  
+
   $message = t('Netbanx CGI failure callback called with parameters: <pre>!all_post_params</pre>', array('!all_post_params' => $all_post_params));
   watchdog('uc_netbanx', $message);
-  
+
   if (!$order = uc_order_load($uc_netbanx_order_id)) {
     watchdog('uc_netbanx', t('The order !uc_netbanx_order_id could not be found', array('!uc_netbanx_order_id' => $uc_netbanx_order_id)));
     exit();
@@ -251,25 +251,25 @@ function uc_netbanx_failure() {
     case 'declined':
     case 'failure':
       watchdog('uc_netbanx', t('Payment marked as !nbx_status for order !uc_netbanx_order_id', array('!nbx_status' => $nbx_status, '!uc_netbanx_order_id' => $uc_netbanx_order_id)));
-      uc_order_comment_save($order->order_id, 0, t('Payment marked as pending by netbanx.'), 'admin');    
+      uc_order_comment_save($order->order_id, 0, t('Payment marked as pending by netbanx.'), 'admin');
       break;
-    
+
     default:
       watchdog('uc_netbanx', t('Unknown failure status !nbx_status for order !uc_netbanx_order_id', array('!nbx_status' => $nbx_status, '!uc_netbanx_order_id' => $uc_netbanx_order_id)));
-      uc_order_comment_save($order->order_id, 0, t('Payment marked as pending by netbanx.'), 'admin');    
+      uc_order_comment_save($order->order_id, 0, t('Payment marked as pending by netbanx.'), 'admin');
       break;
   }
-  
+
   uc_order_update_status($order->order_id, 'canceled');
-  
+
   exit();
-  
+
 }
 
 /**
  * returns a checksum from an order
  *
- * @param string $order 
+ * @param string $order
  * @return string
  * @author Andrew Larcombe
  */
@@ -286,12 +286,12 @@ function _nbx_checksum_from_order($order
  * @author Andrew Larcombe
  */
 function uc_netbanx_return($order_id, $checksum, $cart_id) {
-  
+
   if (!($order = uc_order_load($order_id))) {
     watchdog('uc_netbanx', t('uc_netbanx_return was called with order_id !order_id - failed to load order', array('!order_id' => $order_id)));
     return drupal_not_found();
   }
-    
+
   if ($checksum != _nbx_checksum_from_order($order)) {
     watchdog('uc_netbanx', t('uc_netbanx_return was called with invalid checksum for order_id !order_id', array('!order_id' => $order_id)));
     return drupal_not_found();
@@ -300,5 +300,5 @@ function uc_netbanx_return($order_id, $c
   uc_cart_empty(uc_cart_get_id());
 
   drupal_goto(variable_get('uc_netbanx_return_url', '/'));
-  
+
 }
