Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2009
    Location
    Europe
    Posts
    58
    Plugin Contributions
    1

    help question Developing a new payment module for Posnet - need a professional advice!

    I am a newbie in Zencart, but that did not discourage me from commencing to design a new credit card payment module!
    (Well, to be honnest, i have mostly converted it from Paypal's payment module
    Nevertheless, i have some issues that i need desperate help


    The cc payment module works for a local bank here, in the way that the customer is directed to the banks payment page. Upon entering the details, customer is redirected back to the site (but not the zencart store) where a local php file asks for confirmation, and back to the bank, and finally back to the site again, with success or failure code. Now, this part is performed by an already existing PHP code given by the bank -and i have slightly modified it - so no trouble with this.

    I have written an additional piece of code -posnet_merchant_return.php - which more or less works a bit like paypal's ipn_main_handler. Upon completion of the payment process, posnet_merchant_retrurn redirects to the Checkout Process page by:

    PHP Code:
    zen_redirect(zen_href_link(FILENAME_CHECKOUT_PROCESS'referer=posnetoos&stat=success&xid=' $oosData['XID'] , 'SSL')); 
    It works fine in the way the checkout success or failure information is presented in the zencart store, and an order e-mail is being produced etc. However, the cart items are being confused. The items that seems to be sold are totally different.

    I am probably doing something really silly, but i have no idea of what it is

    Can somebody tell me what do i need to do (what parameters to pass) along with the html redirect so that correct order is generated!
    Thanks for any kind of help in advance!

  2. #2
    Join Date
    Jun 2009
    Location
    Europe
    Posts
    58
    Plugin Contributions
    1

    Default Re: Developing a new payment module for Posnet - need a professional advice!

    By the way, I recognized that in ipn_main_handler the order creation is done within this exteranal routine:
    PHP Code:
    zen_db_perform(TABLE_ORDERS_STATUS_HISTORY$sql_data_array);
        if (
    $extraDebugipn_debug_email('Breakpoint: 5k - OSH update done');
        
    $order->create_add_products($insert_id2);
        if (
    $extraDebugipn_debug_email('Breakpoint: 5L - adding products');
        
    $order->send_order_email($insert_id2);
        if (
    $extraDebugipn_debug_email('Breakpoint: 5m - emailing customer');
        
    $_SESSION['cart']->reset(true);
        if (
    $extraDebugipn_debug_email('Breakpoint: 5n - emptying cart'); 
    I have recognized this sytem, but have not adoped it, since i didn't know how to commence after this, i mean which page to call? I have concluded that redirecting to checkout_success was a more reasonable way? Or is it?

  3. #3
    Join Date
    Jun 2009
    Location
    Europe
    Posts
    58
    Plugin Contributions
    1

    Default Re: Developing a new payment module for Posnet - need a professional advice!

    Forgot to mention earlier that I am using Zencart version 1.3.8a.
    My site is on a Linux machine with Apache 2 server where PHP 5.2.9 and MySQL 5.0.77 is running.

    Now i have read in another thread http://www.zen-cart.com/forum/showthread.php?t=86662 where its suggested that the session may need to be recreated, however i do not think that it is my exact problem, because i am checking in debug mode zen session id is correct, however when the order is placed the customer name and contents are totally wrong.
    Any ideas I would really appreciate!

  4. #4
    Join Date
    Jun 2009
    Location
    Europe
    Posts
    58
    Plugin Contributions
    1

    red flag Re: Developing a new payment module for Posnet - need a professional advice!

    Well, i will continue my monolog and hope somebody is listening:

    I have made the following test:
    I have email logged zen_session_id() and $_SESSION['customer_id'] to see where the session information is lost.
    It seems that the session id is always correct, however $_SESSION['customer_id'] is lost/changed somewhere along the way.
    The customer id is correct last in the payment module's process_button() function. After here there is a browser redirect to the payment gateway address as it is given by form_action_url.

    Now, upon return from the payment gateway (and some intermediate files which are isolated from Zen-store) posnet_merchant_return.php is called. As i mentioned earlier this is cloned and modified from ipn_main_handler.php.
    In almost beginning of posnet_merchant_return.php application_top is included:
    PHP Code:
    /**
     * Include custom application_top.php
     */
    $show_all_errors true;
    $current_page_base 'posnetoos';
    $loaderPrefix 'posnet_oos';

    require(
    'includes/application_top.php'); 
    So, $_SESSION['customer_id'] is changed/lost right after that.
    Is it possible to mess up logged in customer with application_top initalization?!

    (There is also a posnet_oos.core.php file present in the auto_loaders folder, which only loads some extra functions in breakpoint 60!)
    PHP Code:
    /**
     * Breakpoint 60.
     * 
     * require('includes/init_includes/init_general_funcs.php'); 
     * require('includes/init_includes/init_tlds.php'); 
     * 
     */
      
    $autoLoadConfig[60][] = array('autoType'=>'init_script',
                                    
    'loadFile'=> 'init_general_funcs.php');
      
    $autoLoadConfig[60][] = array('autoType'=>'init_script',
                                    
    'loadFile'=> 'init_tlds.php');
    /**
     * Include Posnet-specific functions
     * require('includes/modules/payment/posnet/posnet_functions.php');
     */

      
    $autoLoadConfig[60][] = array('autoType'=>'include',
                                    
    'loadFile'=> DIR_WS_MODULES 'payment/posnet/posnet_functions.php'); 

  5. #5
    Join Date
    Jun 2009
    Location
    Europe
    Posts
    58
    Plugin Contributions
    1

    Default Re: Developing a new payment module for Posnet - need a professional advice!

    Actually i lied, there is one another change at posnet_oos.core.php at breakpoint 70:
    PHP Code:
    /**
     * Breakpoint 70.
     * 
     * require('includes/init_includes/init_sessions.php'); 
     * 
     */
      
    $autoLoadConfig[70][] = array('autoType'=>'init_script',
                                    
    'loadFile'=> 'init_sessions.php');
      
    $autoLoadConfig[71][] = array('autoType'=>'init_script',
                                    
    'loadFile'=> 'init_posnet_oos_sessions.php'); 
    the init_posnet_oos_sessions.php function there has a paypal ipn inherited function (ipn_get_stored_session) which modifies the session! Somehow it had got a wrong variable, and the session was mixed
    So, this concludes my monologue!

 

 

Similar Threads

  1. Need Barclay (EPDQ) Payment Module for new platform of barclay
    By kirti in forum Addon Payment Modules
    Replies: 0
    Last Post: 20 Nov 2012, 02:28 PM
  2. Replies: 2
    Last Post: 24 Apr 2012, 07:03 PM
  3. Need Advice for Massive Shipping Module
    By r1formetoo in forum Addon Shipping Modules
    Replies: 1
    Last Post: 27 Oct 2010, 04:16 AM
  4. Need Advice With Payment Module(s)
    By eradio in forum Addon Payment Modules
    Replies: 0
    Last Post: 7 Nov 2007, 09:04 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