Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2012
    Posts
    2
    Plugin Contributions
    0

    customer issue Discount Values appear twice

    Hi ,

    I have a discount coupon which contains the value of 5%. The problem is if a customer order a product with the discount code in front end it shows correct value but when passing final values to Payment gateway it sends "double deducted" values

    -------------------------------------------------------------
    for ex : product1 $200
    discount 5% $ 10
    ------------------------------
    $190

    but in Payment gateway it appears as $180
    ==============================================

    Some one please help me

  2. #2
    Join Date
    May 2011
    Location
    DELHI,INDIA
    Posts
    43
    Plugin Contributions
    1

    Default Re: Discount Values appear twice

    I am getting the same problem Hi while using the ebs payment module the Discount is debited twice, suppose there is a discount of 5% on a product of value 100 then after discount the amount is 95, but while paying through ebs it comes to 90.25.
    I have attached the ebs module file.

    <?php

    /*

    Zencart

    Copyright (c) 2003 Zencart



    Released under the GNU General Public License

    */
    /**
    * RC4 stream cipher routines implementation
    *
    * in PHP4 based on code written by Damien Miller <[email protected]>
    *
    * Usage:
    * $key = "pear";
    * $message = "PEAR rulez!";
    *
    * $rc4 = new Crypt_RC4;
    * $rc4->key($key);
    * echo "Original message: $message <br>\n";
    * $rc4->crypt($message);
    * echo "Encrypted message: $message <br>\n";
    * $rc4->decrypt($message);
    * echo "Decrypted message: $message <br>\n";
    *
    * @version $Revision: 1.6 $
    * @access public
    * @package Crypt
    * @author Dave Mertens <[email protected]>
    */
    class Crypt_RC4 {

    /**
    * Real programmers...
    * @var array
    */
    var $s= array();
    /**
    * Real programmers...
    * @var array
    */
    var $i= 0;
    /**
    * Real programmers...
    * @var array
    */
    var $j= 0;

    /**
    * Key holder
    * @var string
    */
    var $_key;

    /**
    * Constructor
    * Pass encryption key to key()
    *
    * @see key()
    * @param string key - Key which will be used for encryption
    * @return void
    * @access public
    */
    function Crypt_RC4($key = null) {
    if ($key != null) {
    $this->setKey($key);
    }
    }

    function setKey($key) {
    if (strlen($key) > 0)
    $this->_key = $key;
    }

    /**
    * Assign encryption key to class
    *
    * @param string key - Key which will be used for encryption
    * @return void
    * @access public
    */
    function key(&$key) {
    $len= strlen($key);
    for ($this->i = 0; $this->i < 256; $this->i++) {
    $this->s[$this->i] = $this->i;
    }

    $this->j = 0;
    for ($this->i = 0; $this->i < 256; $this->i++) {
    $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
    $t = $this->s[$this->i];
    $this->s[$this->i] = $this->s[$this->j];
    $this->s[$this->j] = $t;
    }
    $this->i = $this->j = 0;
    }

    /**
    * Encrypt function
    *
    * @param string paramstr - string that will encrypted
    * @return void
    * @access public
    */
    function crypt(&$paramstr) {

    //Init key for every call, Bugfix 22316
    $this->key($this->_key);

    $len= strlen($paramstr);
    for ($c= 0; $c < $len; $c++) {
    $this->i = ($this->i + 1) % 256;
    $this->j = ($this->j + $this->s[$this->i]) % 256;
    $t = $this->s[$this->i];
    $this->s[$this->i] = $this->s[$this->j];
    $this->s[$this->j] = $t;

    $t = ($this->s[$this->i] + $this->s[$this->j]) % 256;

    $paramstr[$c] = chr(ord($paramstr[$c]) ^ $this->s[$t]);
    }
    }

    /**
    * Decrypt function
    *
    * @param string paramstr - string that will decrypted
    * @return void
    * @access public
    */
    function decrypt(&$paramstr) {
    //Decrypt is exactly the same as encrypting the string. Reuse (en)crypt code
    $this->crypt($paramstr);
    }


    } //end of RC4 class

    // Please make sure you insert your merchant id in the OSC admin area

    class ebs2_5 {

    var $code, $title, $description, $enabled;



    // class constructor

    function ebs2_5() {

    global $order;

    $this->code = 'ebs2_5';

    $this->title = MODULE_PAYMENT_EBS_TEXT_TITLE;

    $this->description = MODULE_PAYMENT_EBS_TEXT_DESCRIPTION;

    $this->sort_order = MODULE_PAYMENT_EBS_SORT_ORDER;

    $this->enabled = ((MODULE_PAYMENT_EBS_STATUS == 'True') ? true : false);

    $this->form_action_url = 'https://secure.ebs.in/pg/ma/sale/pay/';

    }



    function update_status() {
    /* Check whether the zones/geo_zones is valid */
    global $order;
    if (((int) MODULE_PAYMENT_EBS_VALID_ZONE > 0)) {
    $checkFlag = false;
    global $db;
    $sql = "select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_EBS_VALID_ZONE . "' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id";
    $result = $db->Execute($sql);
    if($result) while(!$result->EOF) {
    if ($result->fields['zone_id'] < 1) {
    $checkFlag = true;
    break;
    }
    elseif ($result->fields['zone_id'] == $order->delivery['zone_id']) {
    $checkFlag = true;
    break;
    }
    // Move Next
    }

    /* Set whether this should be valid or not */
    if ($checkFlag == false) {
    $this->enabled = false;
    }
    }
    }




    // class methods


    function javascript_validation() {

    return '';
    }



    function selection() {

    global $order;



    for ($i=1; $i < 13; $i++) {

    $expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));

    }



    $today = getdate();

    for ($i=$today['year']; $i < $today['year']+10; $i++) {

    $expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));

    }



    $selection = array('id' => $this->code,

    'module' => $this->title,

    'fields' => array(array('title' => MODULE_PAYMENT_EBS_TEXT_CREDIT_CARD_OWNER_FIRST_NAME,

    'field' => zen_draw_input_field('ebs_cc_owner_firstname', $order->billing['firstname'])),

    array('title' => MODULE_PAYMENT_EBS_TEXT_CREDIT_CARD_OWNER_LAST_NAME,

    'field' => zen_draw_input_field('ebs_cc_owner_lastname', $order->billing['lastname']))));


    return $selection;

    }



    function pre_confirmation_check() {

    return false;
    }



    function confirmation() {

    $confirmation = array ('title' => $this->description);
    return $confirmation;

    }



    function process_button() {

    global $order,$order_total_modules,$currencies;

    $temp=mysql_query("select value from zen_currencies where code='INR'")or die(mysql_error());

    $currency_value=mysql_fetch_array($temp);
    $products_ordered = '';
    for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
    $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
    }
    $products_ordered .= "\n";
    $order_totals = $order_total_modules->process();
    for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
    $products_ordered .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
    }

    $amount = $order->info['total'];
    $ref_no = date('YmdHis');

    $return_url = zen_href_link(FILENAME_CHECKOUT_PROCESS, 'DR=${DR}', 'SSL');


    $hash = MODULE_PAYMENT_EBS_SECRET_KEY."|".MODULE_PAYMENT_EBS_ACCOUNTID."|". $amount."|".$ref_no."|".html_entity_decode($return_url)."|".MODULE_PAYMENT_EBS_T ESTMODE;


    $secure_hash = md5($hash);








    $process_button_string = zen_draw_hidden_field('account_id', MODULE_PAYMENT_EBS_ACCOUNTID) .



    zen_draw_hidden_field('amount', $amount).

    zen_draw_hidden_field('description','Order ID'. $order->info['orders_id']).

    zen_draw_hidden_field('reference_no',$ref_no) .

    zen_draw_hidden_field('name', $order->customer['firstname'] . ' ' . $order->customer['lastname']) .

    zen_draw_hidden_field('address', $order->customer['street_address']) .

    zen_draw_hidden_field('city', $order->customer['city']) .

    zen_draw_hidden_field('state', $order->customer['state']) .

    zen_draw_hidden_field('postal_code', $order->customer['postcode']) .

    zen_draw_hidden_field('country', $order->customer['country']['iso_code_3']) .

    zen_draw_hidden_field('email', $order->customer['email_address']) .

    zen_draw_hidden_field('phone', $order->customer['telephone']) .

    zen_draw_hidden_field('ship_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']) .

    zen_draw_hidden_field('ship_address', $order->delivery['street_address']) .

    zen_draw_hidden_field('ship_city', $order->delivery['city']) .

    zen_draw_hidden_field('ship_state', $order->delivery['state']) .

    zen_draw_hidden_field('ship_postal_code', $order->delivery['postcode']) .

    zen_draw_hidden_field('ship_country', $order->delivery['country']['iso_code_3']) .

    zen_draw_hidden_field('ship_phone', $order->delivery['telephone']) .

    zen_draw_hidden_field('mode', MODULE_PAYMENT_EBS_TESTMODE) .

    zen_draw_hidden_field('secure_hash', $secure_hash) .


    zen_draw_hidden_field('return_url',$return_url);

    return $process_button_string;

    }



    function before_process() {

    $QueryString = base64_decode($_GET['DR']);

    $secret_key = MODULE_PAYMENT_EBS_SECRET_KEY;
    $rc4 = new Crypt_RC4($secret_key);
    $rc4->decrypt($QueryString);
    $QueryString=explode('&',$QueryString);
    $response = array();
    foreach($QueryString as $param){
    $param = split('=',$param);
    $response[$param[0]] = $param[1];
    }
    if (!isset($response['ResponseCode']) || !is_numeric($response['ResponseCode']) || $response['ResponseCode'] != '0') {

    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_EBS_TEXT_ERROR_MESSAGE), 'SSL', true, false));

    }

    }



    function after_process() {

    return false;

    }



    function get_error() {



    $error = array('title' => MODULE_PAYMENT_EBS_TEXT_ERROR,

    'error' => stripslashes(urldecode($_GET['error'])));

    return $error;

    }



    function check() {

    global $db;

    if (!isset($this->_check)) {

    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_EBS_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 EBS Payment Module', 'MODULE_PAYMENT_EBS_STATUS', 'True', 'Do you want to accept EBS payments?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");

    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant User ID', 'MODULE_PAYMENT_EBS_ACCOUNTID', '5', 'Your Merchant Account ID of EBS', '5087', '0', now())");

    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret key', 'MODULE_PAYMENT_EBS_SECRET_KEY', '18157', 'Your secret key of EBS', '6', '0', now())");

    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Test Mode', 'MODULE_PAYMENT_EBS_TESTMODE', 'TEST', 'Test mode used for the EBS', '6', '0', 'zen_cfg_select_option(array(\'TEST\', \'LIVE\'), ', now())");

    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display', 'MODULE_PAYMENT_EBS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '2', now())");

    }



    function remove() {

    global $db;

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

    }



    function keys() {

    return array('MODULE_PAYMENT_EBS_STATUS', 'MODULE_PAYMENT_EBS_ACCOUNTID', 'MODULE_PAYMENT_EBS_SECRET_KEY', 'MODULE_PAYMENT_EBS_TESTMODE');

    }

    }

    ?>
    Friends please have a look ...and suggest some remedy

  3. #3
    Join Date
    Apr 2012
    Location
    beijing
    Posts
    258
    Plugin Contributions
    1

    Default Re: Discount Values appear twice

    I think it would be much faster to ask the owner of "ebs payment module",you use their payment ,they would charge,and will solve the problem
    focus on the open source for online shoping website.
    my site: best shop 24h.com

 

 

Similar Threads

  1. v139h Discount Values appear twice
    By srinidelite in forum Basic Configuration
    Replies: 1
    Last Post: 2 Nov 2012, 08:48 AM
  2. validation messages appear twice (image attached)
    By fadi21 in forum Customization from the Admin
    Replies: 3
    Last Post: 2 Aug 2010, 08:03 PM
  3. Header & Footer both appear twice
    By dhblewis in forum General Questions
    Replies: 2
    Last Post: 12 Jun 2010, 05:37 PM
  4. Index Listing Items Appear Twice after upgrading
    By ptoly in forum Upgrading from 1.3.x to 1.3.9
    Replies: 11
    Last Post: 14 Jun 2009, 02:01 AM
  5. product appear twice in the same category
    By mipavluk in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 2 Apr 2009, 02:12 AM

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