Forums / Built-in Shipping and Payment Modules / Payment problem- credit card payment successful but orders cann't be create

Payment problem- credit card payment successful but orders cann't be create

Locked

Views: 2,439

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
14 Aug 2007, 1:34 PM
#1
kevinlee avatar

kevinlee

New Zenner

Join Date:
Apr 2007
Posts:
14
Plugin Contributions:
0

Payment problem- credit card payment successful but orders cann't be create

Payment - credit card payment successful but orders cann't be create.

I use the zencart 1.30, My creadit card peyment mod modify from stratapay .
when i pay in the gateways.and return to my site,there is not order be create !
i think is the receiving parameters code return form gateways must be some wrong!

Mark:I set the return url in my payment gateways is:wwww.mydomian.com.index.php?main_page=checkout_success

and the gateway will return the parameters to my kick url successful"Result=OK"or "Result=NG"

just like"wwww.mydomian.com.index.php?main_page=checkout_success&Result=OK"

Pls help me check it!and make sure if it is right?
tks for anyone who can help me

<?php

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

// class constructor

    function stratapay() {
      $this->code = 'stratapay';
      $this->title = MODULE_PAYMENT_STRATAPAY_TEXT_TITLE;
      $this->description = MODULE_PAYMENT_STRATAPAY_TEXT_DESCRIPTION;
      $this->enabled = ((MODULE_PAYMENT_STRATAPAY_STATUS == 'True') ? true : false);

      $this->form_action_url = 'https://www.mygateways.com';
    }

// class methods

    function javascript_validation() {
      return false;
    }

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

    function pre_confirmation_check() {
      return false;

    }

    function confirmation() {  
      return array('title' => MODULE_PAYMENT_STRATAPAY_TEXT_DESCRIPTION);
    }

    function process_button() {
      global $HTTP_POST_VARS, $order, $currencies, $currency;
        $process_button_string =
        zen_draw_hidden_field('SiteId', '0000000') .
        zen_draw_hidden_field('SitePass', '0000000') .    
        //zen_draw_hidden_field('CustomerId', $order->customer['firstname'] . ' ' . $order->customer['lastname']).//ok 
        //zen_draw_hidden_field('zip', $order->customer['postcode']) .
        //zen_draw_hidden_field('tel', $order->customer['telephone']) .
        //zen_draw_hidden_field('mail', $order->customer['email_address']) .
        zen_draw_hidden_field('Amount', urlencode(round($order->info[total],2)));
        return $process_button_string;
      }

     function before_process() {
      global $HTTP_POST_VARS, $order;
    
        if (isset($HTTP_POST_VARS['Result'])) {
             if( $HTTP_POST_VARS['Result']  == 'OK')
           {
           return true;
           } else {
            zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL', true, false));
           }
           } else {
           // There is an error. The response should always be available.
           zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message= Response is missing', 'SSL', true, false));
         }

} 

    function after_process() {    
    return false;
    }


    function get_error() {
      global $HTTP_POST_VARS;

      if (isset($HTTP_POST_VARS['response']) && (strlen($HTTP_POST_VARS['response']) > 0)) {
        $error = stripslashes(urldecode($HTTP_POST_VARS['response']));
      } else {
        $error = MODULE_PAYMENT_STRATAPAY_TEXT_ERROR_MESSAGE;
      }

      return array('title' => MODULE_PAYMENT_STRATAPAY_TEXT_ERROR,
                   'error' => $error);
    }

    function check() {
    global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_STRATAPAY_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 ('Allow StrataPay Payments', 'MODULE_PAYMENT_STRATAPAY_STATUS', 'False', 'Do you want to accept StrataPay payments?', '6', '1', '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 ('StrataPay Number', 'MODULE_PAYMENT_STRATAPAY_NUM', 'Enter Your StrataPay Number', 'Your StrataPay Number', '6', '2', 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 ('StrataPay Send Receipt # Emails', 'MODULE_PAYMENT_STRATAPAY_SEND_RECEIPT_NUM_EMAIL', 'True', 'Send StrataPay Receipt # emails after successful payments?', '6', '3', '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 ('StrataPay Receipt # Email To', 'MODULE_PAYMENT_STRATAPAY_RCPT_EMAIL_TO', 'Enter Email Address', 'Enter the email address for StrataPay Receipt # emails. Blank will go to the store owner', '6', '4', 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 ('StrataPay Test Status', 'MODULE_PAYMENT_STRATAPAY_TEST_STATUS', 'Live', 'Transaction mode to use for the StrataPay Module - Test mode will use a test StrataPay Number for payments. Use credit card number 1111222233334444 to simulate a successful payment. Use 4444333322221111 to simulate a failed payment.', '6', '5', 'zen_cfg_select_option(array(\'Test\', \'Live\'), ', now())");
    }

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

    function keys() {
      return array('MODULE_PAYMENT_STRATAPAY_STATUS', 'MODULE_PAYMENT_STRATAPAY_NUM', 'MODULE_PAYMENT_STRATAPAY_SEND_RECEIPT_NUM_EMAIL', 'MODULE_PAYMENT_STRATAPAY_RCPT_EMAIL_TO', 'MODULE_PAYMENT_STRATAPAY_TEST_STATUS');
      return $keys;
    }
  }
?>