Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default secure trading problem, help needed

    we have used zencart for over 1 year for our website with secure trading with version 1.2.

    we have alway used 3 diffrent currency, zencart passed over the currency to securetrading useing there module which carried over the currency type and the amount.

    however we decided to upgrade to verision 1.3 and now the when the amount is passed over to secure trading it converts amount back to the defalt currency "if somone was paying $12 in version 1.2 it would come to payment page as $12 now it comes to payment page as £8"

    woundered if anyone eles as had this problem and fixed it i may be missing somthing simple normaly the case with me.

    Thanks in advances

  2. #2
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: secure trading problem, help needed

    more info on the problem,

    this is where i think the problem is.

    this is off the securetrading payment module page.

    there is one big diffrence in the data that is passed over.

    v 1.2

    zen_draw_hidden_field('inputamount', number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

    v 1.3

    zen_draw_hidden_field('inputamount', round($order->info['total'],2)).

    this looks to me as being very importent.

    i have tryed exchanging the lines of code and also just adding the currency part of the code.

    the only effect this as had is to pass an amount uncoverted to the payment moduel

    i.e with that change now when somone buys something for $12 they would come to payment page and it would be £12.

  3. #3
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: secure trading problem, help needed

    I haven't researched the module. But based on what you reported above, I suspect that you also need to send the currency code (not just 'inputamount'); otherwise it's just assuming a default.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: secure trading problem, help needed

    mmm, i think this may be the line of code that does that the problem may be here then.

    zen_draw_hidden_field('currency', $currency) .

    i will post up the fullsection to allow everyone to get a better feel.

    $process_button_string = zen_draw_hidden_field('cmd', 'click') .
    zen_draw_hidden_field('merchant', 'xxxxxxxx') .
    zen_draw_hidden_field('merchant', 'xxxxxxxx') .
    zen_draw_hidden_field('merchantemail', 'xxxxxxxxxxxx') .//the email address you want the notifications of transactions sent to.
    zen_draw_hidden_field('orderref', $order_id) .
    zen_draw_hidden_field('currency', $currency) .
    zen_draw_hidden_field('customerid', $customer_id) .
    zen_draw_hidden_field('inputamount', round($order->info['total'],2)).
    zen_draw_hidden_field('name', $order->billing['firstname'].' '.$order- >billing['lastname']) .
    zen_draw_hidden_field('address', $order->billing['street_address'] . ', ' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address
    zen_draw_hidden_field('zenid',zen_session_id()) .
    zen_draw_hidden_field('town', $order->billing['city']) .
    zen_draw_hidden_field('county',$order->billing['state']) .
    zen_draw_hidden_field('country',$order->billing['country']['title']) .
    zen_draw_hidden_field('postcode', $order->billing['postcode']).
    zen_draw_hidden_field('telephone',$order->customer['telephone']) .
    zen_draw_hidden_field('email', $order->customer['email_address']) .
    zen_draw_hidden_field('customeremail', '1') .
    zen_draw_hidden_field('callbackurl','1') .
    zen_draw_hidden_field('cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
    ;

  5. #5
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: secure trading problem, help needed

    Assuming $currency is correct (vs $my_currency which you mentioned earlier), these should be fine:
    Code:
    zen_draw_hidden_field('currency', $currency) .
    zen_draw_hidden_field('inputamount', round($order->info['total'],2)).
    That simply submits the $currency value (which one would assume has been set a few lines earlier to be the value of either the currency code associated with $_SESSION['currency'] or the $order->info['currency'] .. whether GBP or USD etc, and submits the order amount which is based on the value of the order in the currency in which the customer placed the order.

    You might try changing $currency to $order->info['currency'] instead ?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: secure trading problem, help needed

    we have big progress on this thank wish i had asked here sooner.

    for people who have this problem you need to add the line of code

    $currency = $_SESSION['currency'];

    for

    zen_draw_hidden_field('currency', $currency) .

    to work

    however i am not out the woods yet although it is taking currency over i now can't get it to stop it from converting it.

    so if somone order $12 they get to payment page and it comes up as $8 dollers i think the problem is in this line of code.

    zen_draw_hidden_field('inputamount', round($order->info['total'],2)) .



    thanks again this so proves a when you have a problem outside input can make it very easy solultion

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: secure trading problem, help needed

    Is something resetting the value of $order->info['total'] elsewhere in the code ?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: secure trading problem, help needed

    PHP Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // 
    // Modified from $Id: securetrading.php,2006/05/24 $
    // by Gavin Roberts
      
    class securetrading {
        var 
    $code$title$description$enabled;
    // class constructor
        
    function securetrading() {
          global 
    $order;
          
    $this->code 'securetrading';
          
    $this->title Securetrading ;
          
    $this->description PAYMENT_PAGES;
          
    $this->sort_order MODULE_PAYMENT_SECURETRADING_SORT_ORDER;
          
    $this->enabled = ((MODULE_PAYMENT_SECURETRADING_STATUS == 'True') ? true false);
          if ((int)
    MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID 1) {
            
    $this->order_status MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID;
          }
          if (
    is_object($order)) $this->update_status();
          
    $this->form_action_url 'https://securetrading.net/authorize/form.cgi';
        }
    // class methods
        
    function update_status() {
          global 
    $db$order;
          if ( (
    $this->enabled == true) && ((int)MODULE_PAYMENT_SECURETRADING_ZONE 0) ) {
            
    $check_flag false;
            
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = 'UK' and zone_country_id = 'United Kingdom' order by zone_id");
            while (!
    $check->EOF) {
              if (
    $check->fields['zone_id'] < 1) {
                
    $check_flag true;
                break;
              } elseif (
    $check->fields['zone_id'] == $order->billing['zone_id']) {
                
    $check_flag true;
                break;
              }
              
    $check->fieldsMoveNext();
            }
            if (
    $check_flag == false) {
              
    $this->enabled false;
            }
          }
        }
        function 
    javascript_validation() {
          return 
    false;
        }
        function 
    selection() {
          return array(
    'id' => $this->code,
                       
    'module' => $this->title);
        }
        function 
    pre_confirmation_check() {
          return 
    false;
        }
        function 
    confirmation() {
          return 
    false;
        }
        function 
    process_button() {
          global 
    $order$currencies$customer_id;
       
    /*
       $last_order_id = $db->Execute("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
       $new_order_id = $last_order_id->fields['orders_id'];
       $new_order_id = $new_order_id++;
    */  
          
    $currency $_SESSION['currency'];
          
    $process_button_string zen_draw_hidden_field('cmd''click') .
        
    zen_draw_hidden_field('merchant''xxxxxxxxx') .
           
    zen_draw_hidden_field('merchant''xxxxxx') .
              
    zen_draw_hidden_field('merchantemail''xxxxxxxxxx) .//the email address you want the notifications of transactions sent to.
                                   zen_draw_hidden_field('
    currency', $currency) .
        zen_draw_hidden_field('
    orderref', $order_id) .
                                   zen_draw_hidden_field('
    customerid', $customer_id) .
                                 zen_draw_hidden_field('
    inputamount', round($order->info['total'],2)) .
                                   zen_draw_hidden_field('
    name', $order->billing['firstname'].' '.$order->billing['lastname']) .
                                   zen_draw_hidden_field('
    address', $order->billing['street_address'] . '' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address                    
         zen_draw_hidden_field('
    zenid',zen_session_id()) .
                                  zen_draw_hidden_field('
    town', $order->billing['city']) .
                                  zen_draw_hidden_field('
    county',$order->billing['state']) .
                                  zen_draw_hidden_field('
    country',$order->billing['country']['title']) .
                                  zen_draw_hidden_field('
    postcode', $order->billing['postcode']).
                                  zen_draw_hidden_field('
    telephone',$order->customer['telephone']) .
                                  zen_draw_hidden_field('
    email', $order->customer['email_address']) .
             zen_draw_hidden_field('
    customeremail', '1') .
                                  zen_draw_hidden_field('
    callbackurl','1') .
                                  zen_draw_hidden_field('
    cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
                                   ;
          return $process_button_string;
        }
        function before_process() {
          return false;
        }
        function after_process() {
          return false;
        }
        function output_error() {
          return false;
        }
        function check() {
        global $db;
          if (!isset($this->_check)) {
            $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '
    MODULE_PAYMENT_SECURETRADING_STATUS'");
            $this->_check = $check_query->RecordCount();
          }
          return $this->_check;
        }
        function install() {
        global $db;
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('
    Enable SecureTrading Module', 'MODULE_PAYMENT_SECURETRADING_STATUS', 'True', 'Do you want to accept SecureTrading payments?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), 'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderdate_addedvalues ('SecureTrading Account Email''MODULE_PAYMENT_SECURETRADING_ID''[email protected]''The e-mail address to use for the SecureTrading service''6''4'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderdate_addedvalues ('Sort order of display.''MODULE_PAYMENT_SECURETRADING_SORT_ORDER''0''Sort order of display. Lowest is displayed first.''6''0'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderuse_functionset_functiondate_addedvalues ('Payment Zone''MODULE_PAYMENT_SECURETRADING_ZONE''0''If a zone is selected, only enable this payment method for that zone.''6''2''zen_get_zone_class_title''zen_cfg_pull_down_zone_classes('now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderset_functionuse_functiondate_addedvalues ('Set Order Status''MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID''0''Set the status of orders made with this payment module to this value''6''0''zen_cfg_pull_down_order_statuses(''zen_get_order_status_name'now())");
        }
        function remove() {
        global 
    $db;
          
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("''", $this->keys()) . "')");
        }
        function keys() {
          return array('MODULE_PAYMENT_SECURETRADING_STATUS', 'MODULE_PAYMENT_SECURETRADING_ID', 'MODULE_PAYMENT_SECURETRADING_ZONE', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER');
        }
      }
    ?>
    I can't find that anywhere this is the code for the full page but i will keep looking thanks again

  9. #9
    Join Date
    Mar 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: secure trading problem, help needed

    thanks you very much for yoou help with this couldn't have done it without you.

    everything as i can see is working correctly now if anyone eles is haveing the same problem i have posted the full page of code below

    Thanks again

    PHP Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // 
    // Modified from $Id: securetrading.php,2006/05/24 $
    // by Gavin Roberts

      
    class securetrading {
        var 
    $code$title$description$enabled;

    // class constructor
        
    function securetrading() {
          global 
    $order;

          
    $this->code 'securetrading';
          
    $this->title Securetrading    ;
          
    $this->description PAYMENT_PAGES;
          
    $this->sort_order MODULE_PAYMENT_SECURETRADING_SORT_ORDER;
          
    $this->enabled = ((MODULE_PAYMENT_SECURETRADING_STATUS == 'True') ? true false);

          if ((int)
    MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID 1) {
            
    $this->order_status MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID;
          }

          if (
    is_object($order)) $this->update_status();

          
    $this->form_action_url 'https://securetrading.net/authorize/form.cgi';
        }

    // class methods
        
    function update_status() {
          global 
    $db$order;

          if ( (
    $this->enabled == true) && ((int)MODULE_PAYMENT_SECURETRADING_ZONE 0) ) {
            
    $check_flag false;
            
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = 'UK' and zone_country_id = 'United Kingdom' order by zone_id");
            while (!
    $check->EOF) {
              if (
    $check->fields['zone_id'] < 1) {
                
    $check_flag true;
                break;
              } elseif (
    $check->fields['zone_id'] == $order->billing['zone_id']) {
                
    $check_flag true;
                break;
              }
              
    $check->fieldsMoveNext();
            }

            if (
    $check_flag == false) {
              
    $this->enabled false;
            }
          }
        }

        function 
    javascript_validation() {
          return 
    false;
        }

        function 
    selection() {
          return array(
    'id' => $this->code,
                       
    'module' => $this->title);
        }

        function 
    pre_confirmation_check() {
          return 
    false;
        }

        function 
    confirmation() {
          return 
    false;
        }

        function 
    process_button() {
          global 
    $order$currencies$customer_id;
          
    /*
          $last_order_id = $db->Execute("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
          $new_order_id = $last_order_id->fields['orders_id'];
          $new_order_id = $new_order_id++;
    */  

                          
    $currency $_SESSION['currency'];

          
    $process_button_string zen_draw_hidden_field('cmd''click') .
                     
    zen_draw_hidden_field('merchant''xxxxxxxx') .
                    
    zen_draw_hidden_field('merchant''xxxxxxx) .
                    zen_draw_hidden_field('
    merchantemail', 'xxxxxxxxxx') .//the email address you want the notifications of transactions sent to.
                                       zen_draw_hidden_field('
    currency', $currency) .
                    zen_draw_hidden_field('
    orderref', $order_id) .
                                       zen_draw_hidden_field('
    customerid', $customer_id) .
                                     zen_draw_hidden_field('
    inputamount', number_format(($order->info['total']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . //zen_draw_hidden_field('inputamount', round($order->info['total'],2)) .
                                       zen_draw_hidden_field('
    name', $order->billing['firstname'].' '.$order->billing['lastname']) .
                                       zen_draw_hidden_field('
    address', $order->billing['street_address'] . '' .$order->customer['suburb']) .//you can remove the suburb statement if you only want to show first line of address                    
                    zen_draw_hidden_field('
    zenid',zen_session_id()) .
                                      zen_draw_hidden_field('
    town', $order->billing['city']) .
                                      zen_draw_hidden_field('
    county',$order->billing['state']) .
                                      zen_draw_hidden_field('
    country',$order->billing['country']['title']) .
                                      zen_draw_hidden_field('
    postcode', $order->billing['postcode']).
                                      zen_draw_hidden_field('
    telephone',$order->customer['telephone']) .
                                      zen_draw_hidden_field('
    email', $order->customer['email_address']) .
                    zen_draw_hidden_field('
    customeremail', '1') .
                                      zen_draw_hidden_field('
    callbackurl','1') .
                                      zen_draw_hidden_field('
    cancelurl', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'))
                                   ;

          return $process_button_string;
        }

        function before_process() {
          return false;
        }

        function after_process() {
          return false;
        }

        function output_error() {
          return false;
        }

        function check() {
        global $db;
          if (!isset($this->_check)) {
            $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = '
    MODULE_PAYMENT_SECURETRADING_STATUS'");
            $this->_check = $check_query->RecordCount();
          }
          return $this->_check;
        }

        function install() {
        global $db;
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('
    Enable SecureTrading Module', 'MODULE_PAYMENT_SECURETRADING_STATUS', 'True', 'Do you want to accept SecureTrading payments?', '6', '3', 'zen_cfg_select_option(array(\'True\', \'False\'), 'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderdate_addedvalues ('SecureTrading Account Email''MODULE_PAYMENT_SECURETRADING_ID''[email protected]''The e-mail address to use for the SecureTrading service''6''4'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderdate_addedvalues ('Sort order of display.''MODULE_PAYMENT_SECURETRADING_SORT_ORDER''0''Sort order of display. Lowest is displayed first.''6''0'now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderuse_functionset_functiondate_addedvalues ('Payment Zone''MODULE_PAYMENT_SECURETRADING_ZONE''0''If a zone is selected, only enable this payment method for that zone.''6''2''zen_get_zone_class_title''zen_cfg_pull_down_zone_classes('now())");
          
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_titleconfiguration_keyconfiguration_valueconfiguration_descriptionconfiguration_group_idsort_orderset_functionuse_functiondate_addedvalues ('Set Order Status''MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID''0''Set the status of orders made with this payment module to this value''6''0''zen_cfg_pull_down_order_statuses(''zen_get_order_status_name'now())");
        }

        function remove() {
        global 
    $db;
          
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("''", $this->keys()) . "')");
        }

        function keys() {
          return array('MODULE_PAYMENT_SECURETRADING_STATUS', 'MODULE_PAYMENT_SECURETRADING_ID', 'MODULE_PAYMENT_SECURETRADING_ZONE', 'MODULE_PAYMENT_SECURETRADING_ORDER_STATUS_ID', 'MODULE_PAYMENT_SECURETRADING_SORT_ORDER');
        }
      }
    ?>

 

 

Similar Threads

  1. secure trading mod problem
    By Nick1973 in forum Addon Payment Modules
    Replies: 1
    Last Post: 25 May 2012, 02:47 PM
  2. Secure Trading customising
    By JaminT in forum Addon Payment Modules
    Replies: 6
    Last Post: 11 Jul 2011, 06:25 PM
  3. Secure Trading Call Back
    By leenug in forum Addon Payment Modules
    Replies: 2
    Last Post: 23 Mar 2010, 12:14 PM
  4. Secure Trading Module
    By pickledshark in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 14 Aug 2006, 07:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR