Jump to content
Sign in to follow this  
Dennis Thompson

having NOCHEX trouble sending correct order totals

Recommended Posts

Hi... I am using a pretty old snapshot of osC(TEP) but I have been modding it up here and there over the years (yup, it's a version from 2002!) and it works a TREAT. Although heavily customised, nothing from the actual functions, classes or modules have been tampered with. I recently switched from WorldPay to NOCHEX for my payment handling and just found an error with this contribution (the only one that actually works until reaching the NOCHEX server):

 

http://www.oscommerce.com/community/contri...l/search,nochex

 

the order totals that go to the NOCHEX server always report as only ?7 (my delivery charge) rather than including the order total, delivery charge and tax (VAT) all together!

 

Here is the code for nochex.php from my catalog/includes/modules/payment

<?php

/*
 $Id: nochex.php,v 1.24 2001/12/28 15:17:18 dgw_ Exp $

 The Exchange Project - Community Made Shopping!
 http://www.theexchangeproject.org
 modified by Garry Blackmore gazonice@yahoo.com
 from Paypal to Nochex.
 Thanks to Mark Keith Evans for assistance.

 Copyright (c) 2000,2001 The Exchange Project

 Released under the GNU General Public License
*/

 class nochex {
   var $code, $title, $description, $enabled;

// class constructor
   function nochex() {
     $this->code = 'nochex';
     $this->title = MODULE_PAYMENT_NOCHEX_TEXT_TITLE;
     $this->description = MODULE_PAYMENT_NOCHEX_TEXT_DESCRIPTION;
     $this->enabled = MODULE_PAYMENT_NOCHEX_STATUS;
   }

// class methods
   function javascript_validation() {
     return false;
   }

   function selection() {
     return false;
   }

   function pre_confirmation_check() {
     return false;
   }

   function confirmation() {
  global $checkout_form_action;

     $checkout_form_action = 'https://www.nochex.com/nochex.dll/checkout';
   }

   function process_button() {
     global $HTTP_POST_VARS, $customer_id, $total_cost, $total_tax, $currencies, $shipping_cost;

     $nochex_return = 'payment=' . $HTTP_POST_VARS['payment'] . '&shipping_selected=' . $shipping_selected . '&shipping_cost=' . $shipping_cost . '&shipping_method=' . urlencode($shipping_method);
     $nochex_cancel_return = 'payment=' . $HTTP_POST_VARS['payment'] . '&shipping_selected=' . $shipping_selected;

     $process_button_string = tep_draw_hidden_field('cmd', '_xclick') .
                              tep_draw_hidden_field('email', MODULE_PAYMENT_NOCHEX_ID) .
                              tep_draw_hidden_field('amount', number_format(($total_cost + $total_tax + $shipping_cost) * $currencies->currencies['GBP']['value'], 2)) .
                              tep_draw_hidden_field('ordernumber', $customer_id . '-' . date('Ymdhis')) .
                              tep_draw_hidden_field('returnurl', tep_href_link(FILENAME_CHECKOUT_PROCESS, $nochex_return, 'SSL')) .
                              tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, $nochex_cancel_return, 'SSL'));

     return $process_button_string;
   }

   function before_process() {
     return false;
   }

   function after_process() {
  return false;
   }

   function output_error() {
     return false;
   }

   function check() {
     $check = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOCHEX_STATUS'");
     $check = tep_db_num_rows($check);

     return $check;
   }

   function install() {
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Allow nochex', 'MODULE_PAYMENT_NOCHEX_STATUS', '1', 'Do you want to accept nochex payments?', '6', '3', now())");
     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('nochex ID', 'MODULE_PAYMENT_NOCHEX_ID', 'you@yourbuisness.com', 'Your business ID at nochex.  Usually the email address you signed up with.  You can create a free nochex account at http://www.nochex.com.', '6', '4', now())");
   }

   function remove() {
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOCHEX_STATUS'");
     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_NOCHEX_ID'");
   }

   function keys() {
     $keys = array('MODULE_PAYMENT_NOCHEX_STATUS', 'MODULE_PAYMENT_NOCHEX_ID');

     return $keys;
   }
 }
?>

 

this is the line I have been trying o tamper with to get the right results but anything I try either makes no difference or just changes the amount forwarded to NOCHEX's servers to ?0.00:

 

                               tep_draw_hidden_field('amount', number_format(($total_cost + $total_tax + $shipping_cost) * $currencies->currencies['GBP']['value'], 2)) .

 

any help any one?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×