Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Virtuemart and Realex

Options
  • 02-07-2010 2:59pm
    #1
    Registered Users Posts: 3,772 ✭✭✭


    Hi, I'm almost finished a site with Virtuemart and I'm using the Realex Virtuemart plugin available from the realex site. Unfortunately there is a bug in it which stops the confirmation emails being sent.

    Just wondering does anyone have a fixed version they would care to share?


Comments

  • Registered Users Posts: 3,772 ✭✭✭Scotty #


    err nevermind....

    just uncomment line 1195 in ps_checkout.php


  • Registered Users Posts: 7,711 ✭✭✭StupidLikeAFox


    While we'reon the subject, can someone clear this up for me?

    I am just trying to configure the referring and response urls, this may be a silly question but I presume the referring url is just what is in the address bar on the page where you confirm the order, just before you are redirected? And the response email is simply the page which we would want the customer to be redirected to?

    I am using Virtuemart with realex also!


  • Registered Users Posts: 3,772 ✭✭✭Scotty #


    The request url is simply your site.... http://www.yourdomain.ie/index.php
    The response url is the path to the realex_response.php file that would have been in the plugin zip you downloaded.


  • Registered Users Posts: 7,711 ✭✭✭StupidLikeAFox


    Cheers scotty, I had a feeling it was something simple like that alright!


  • Closed Accounts Posts: 6 estack


    Hi, I have installed this payment module and plugin three times now, once with virtuemart 1.1.4 on joomla 1.5.15 and then tried it on a fresh install of joomla 1.5.20 with virtuemart 1.1.5 and then I installed it on 1.5.9 with virtuemart 1.1.2 which is what it was originally built on.

    Every time i am getting the same error from realex - "Your transaction has been successful but there was a problem connecting back to the merchant's web site. Please contact the merchant and advise them that you received this error message. Thank you."

    Has anyone any idea why it would come back with this error as realex wont give any help at all and I cant figure it out. I am using the realex_redirect method. I have followed the instructions exactly and it is not working. Can anyone confirm that they have used the module and it worked without any modification.


  • Advertisement
  • Closed Accounts Posts: 585 ✭✭✭MrDarcy


    estack wrote: »
    Hi, I have installed this payment module and plugin three times now, once with virtuemart 1.1.4 on joomla 1.5.15 and then tried it on a fresh install of joomla 1.5.20 with virtuemart 1.1.5 and then I installed it on 1.5.9 with virtuemart 1.1.2 which is what it was originally built on.

    Every time i am getting the same error from realex - "Your transaction has been successful but there was a problem connecting back to the merchant's web site. Please contact the merchant and advise them that you received this error message. Thank you."

    Has anyone any idea why it would come back with this error as realex wont give any help at all and I cant figure it out. I am using the realex_redirect method. I have followed the instructions exactly and it is not working. Can anyone confirm that they have used the module and it worked without any modification.

    I'm surprised to hear Realex are not bending over backwards to help you, I've found them great in the past OP...

    Anyways, when I was integrating my site with Realex using the Redirect method, hooking the response back up to my response page was the bit that gave me the most bother but eventually I got it running fine.

    Can you post up the code for your transaction response page? Remember to not post up your connection string info if you have it in there or your web server email credentials if you have your response page set up to send a mail on the page, etc...

    I meant to say also, have you been onto realex and given them the URL of your response page?


  • Closed Accounts Posts: 6 estack


    hi mr darcy,

    thanks for the quick reply, I was on to realex and gave them the refferring urls which is basically :
    mysite.com/index.php and www.mysite.com/index.php and the response url which is www.mysite.com/components/com_virtuemart/realex_response.php and that is the exact location of the realex_response.php file.

    This is the realex_response.php file but I didn't make any changes to it from what was in the downloaded zip file from realex-

    <?php
    if ($_POST) {
    header("HTTP/1.0 200 OK");

    global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $database,
    $mosConfig_mailfrom, $mosConfig_fromname;

    /*** access Joomla's configuration file ***/
    $my_path = dirname(__FILE__);

    if( file_exists($my_path."/../../../configuration.php")) {
    $absolute_path = dirname( $my_path."/../../../configuration.php" );
    require_once($my_path."/../../../configuration.php");
    }
    elseif( file_exists($my_path."/../../configuration.php")){
    $absolute_path = dirname( $my_path."/../../configuration.php" );
    require_once($my_path."/../../configuration.php");
    }
    elseif( file_exists($my_path."/configuration.php")){
    $absolute_path = dirname( $my_path."/configuration.php" );
    require_once( $my_path."/configuration.php" );
    }
    else {
    die( "Joomla Configuration File not found!" );
    }

    $absolute_path = realpath( $absolute_path );

    // Set up the appropriate CMS framework
    if( class_exists( 'jconfig' ) ) {
    define( '_JEXEC', 1 );
    define( 'JPATH_BASE', $absolute_path );
    define( 'DS', DIRECTORY_SEPARATOR );

    // Load the framework
    require_once ( JPATH_BASE . DS . 'includes' . DS . 'defines.php' );
    require_once ( JPATH_BASE . DS . 'includes' . DS . 'framework.php' );

    // create the mainframe object
    $mainframe = & JFactory::getApplication( 'site' );

    // Initialize the framework
    $mainframe->initialise();

    // load system plugin group
    JPluginHelper::importPlugin( 'system' );

    // trigger the onBeforeStart events
    $mainframe->triggerEvent( 'onBeforeStart' );
    $lang =& JFactory::getLanguage();
    $mosConfig_lang = $GLOBALS = strtolower( $lang->getBackwardLang() );
    // Adjust the live site path
    $mosConfig_live_site = str_replace('/administrator/components/com_virtuemart', '', JURI::base());
    $mosConfig_absolute_path = JPATH_BASE;
    } else {
    define('_VALID_MOS', '1');
    require_once($mosConfig_absolute_path. '/includes/joomla.php');
    require_once($mosConfig_absolute_path. '/includes/database.php');
    $database = new database( $mosConfig_host, $mosConfig_user, $mosConfig_password, $mosConfig_db, $mosConfig_dbprefix );
    $mainframe = new mosMainFrame($database, 'com_virtuemart', $mosConfig_absolute_path );
    }

    // load Joomla Language File
    if (file_exists( $mosConfig_absolute_path. '/language/'.$mosConfig_lang.'.php' )) {
    require_once( $mosConfig_absolute_path. '/language/'.$mosConfig_lang.'.php' );
    }
    elseif (file_exists( $mosConfig_absolute_path. '/language/english.php' )) {
    require_once( $mosConfig_absolute_path. '/language/english.php' );
    }
    /*** END of Joomla config ***/


    /*** VirtueMart part ***/
    require_once($mosConfig_absolute_path.'/administrator/components/com_virtuemart/virtuemart.cfg.php');
    include_once( ADMINPATH.'/compat.joomla1.5.php' );
    require_once( ADMINPATH. 'global.php' );
    require_once( CLASSPATH. 'ps_main.php' );

    /* @MWM1: Logging enhancements (file logging & composite logger). */
    $vmLogIdentifier = "notify.php";
    require_once(CLASSPATH."Log/LogInit.php");

    /* Load the PayPal Configuration File */
    require_once( CLASSPATH. 'payment/ps_paypal.cfg.php' );

    if( PAYPAL_DEBUG == "1" ) {
    $debug_email_address = $mosConfig_mailfrom;
    }
    else {
    $debug_email_address = PAYPAL_EMAIL;
    }
    // restart session
    // Constructor initializes the session!
    $sess = new ps_session();

    /*** END VirtueMart part ***/
    }

    global $vendor_mail, $vendor_currency, $VM_LANG, $vmLogger;
    $database = new ps_DB;
    $ps_vendor_id = $_SESSION["ps_vendor_id"];
    $auth = $_SESSION;
    /* $ps_checkout = new ps_checkout; */

    require_once(CLASSPATH ."payment/ps_realex_redirect.cfg.php");

    $html = '<html><head></head><body>';

    $timestamp = $_POST;
    $result = $_POST;
    $orderid = $_POST;
    $message = $_POST;
    $authcode = $_POST;
    $pasref = $_POST;
    $realexmd5 = $_POST;

    //get the information from the module configuration

    $merchantid = REALEX_MERCHANTID;
    $secret = REALEX_SHARED_SECRET;

    $tmp = "$timestamp.$merchantid.$orderid.$result.$message.$pasref.$authcode";
    $md5hash = md5($tmp);
    $tmp = "$md5hash.$secret";
    $md5hash = md5($tmp);

    $d = $orderid; //this identifies the order record

    //Check to see if hashes match or not
    if ($md5hash != $realexmd5) {
    $html .= "The hashes do not match - response not authenticated!";
    $d = REALEX_INVALID_STATUS; // set order status to cancelled
    }else{

    if ($result == "00") {
    $html .= REALEX_SUCCESS_MESSAGE . '<br/><br/>';
    $html .= 'To continue browsing please <a href=' . URL . '><b><u>click here</u></b></a><br/><br/>';
    $d = REALEX_VERIFIED_STATUS; // set order status to cancelled
    }else{
    $html .= REALEX_ERROR_MESSAGE . '<br/><br/>';
    $html .= 'To try again please <a href=' . URL . '><b><u>click here</u></b></a><br /><br />';
    $d = REALEX_INVALID_STATUS; // set order status to cancelled
    }
    }

    $html .= '</body></html>';

    require_once ( CLASSPATH . 'ps_order.php' );

    $ps_order= new ps_order;

    $ps_order->order_status_update($d);

    echo $html;

    ?>

    I also got this from realex which is the logs of the test card transaction-

    $VAR1 = bless( {
    ''_content'' => ''500 Can\''t connect to :80 (Bad hostname \''\'')
    '',
    ''_rc'' => 500,
    ''_headers'' => bless( {
    ''client-warning'' => ''Internal response'',
    ''client-date'' => ''Tue, 31 Aug 2010 09:57:43 GMT'',
    ''content-type'' => ''text/plain''
    }, ''HTTP::Headers'' ),
    ''_msg'' =>
    ''Can\''t connect to :80 (Bad hostname \''\'')'',
    ''_request'' => bless( {
    ''_content'' => ''MERCHANT_ID=**********&ORDER_ID=38&ACCOUNT=internet&AMOUNT=4900&TIMESTAMP=20100831095729&MD5HASH=*********&RESULT=00&AUTHCODE=105742&MESSAGE=%5B+test+system+%5D+Authorised+105742&PASREF=12832486622580&AVSPOSTCODERESULT=U&AVSADDRESSRESULT=U&CVNRESULT=U&BATCHID=17228&pas_uuid=049a6dd00c0d4fa0bdec43b80ed5b510'',
    ''_uri'' => bless( do{\(my $o = ''[URL]http:///[/URL]'')}, ''URI::http'' ),
    ''_headers'' => bless( {
    ''user-agent'' => ''epage.cgi, getMerchantContent libwww-perl/5.805'',
    ''content-type'' => ''application/x-www-form-urlencoded'',
    ''range'' => ''bytes=0-49999'',
    ''content-length'' => 339
    }, ''HTTP::Headers'' ),
    ''_method'' => ''POST''
    }, ''HTTP::Request'' )
    }, ''HTTP::Response'' );

    Error connecting to client site:Can''t connect to :80 (Bad hostname '''')

    Any ideas?


  • Closed Accounts Posts: 585 ✭✭✭MrDarcy


    Hi OP, unfortunately mine is all done in C# so I can't be much help based on what you have there, but as you can prob work out from the Realex error it looks like a connectivity error.

    Have you currently got the site password protected before launching it properly??? If you have, (as I had once and ran into this prob), Realex will not be able to connect back to your site response page and you will get this error...


  • Closed Accounts Posts: 6 estack


    this is the code used in the virtuemart for joomla payment module. Did you use your own payment module for virtuemart?


  • Registered Users Posts: 3,772 ✭✭✭Scotty #


    estack wrote: »
    Every time i am getting the same error from realex - "Your transaction has been successful but there was a problem connecting back to the merchant's web site. Please contact the merchant and advise them that you received this error message. Thank you."

    When you set your site up with realex you have to give them 2 URL's. The request URL and the response URL. The response URL is the path to the realex_response.php file. Are you SURE you gave Realex the correct path and the file is at that location?


  • Advertisement
  • Registered Users Posts: 3,772 ✭✭✭Scotty #


    Sorry just read your other reply.

    I always put the response.php file in the root folder and I don't have any problems. Realex may have trouble accessing a file within a component folder depending on Joomla and VM's security (it may only be accessible from index.php?).


  • Closed Accounts Posts: 6 estack


    Hi scotty,

    Thanks for the reply, appreciate it.

    Yes, definitely gave the right response url and it is definitely in that location. I have checked this 50 times now because that would make the most sense as to why its not working. On the logs that realex sent me, it had the reponse url at the top and I clicked on it and it is going to the exact location that i have the file in.

    Can you tell me, is there anything differently you did from the instructions included in the module. If you didn't do anything differently, I want to go back to realex with the issue. They are saying its my problem to get it sorted but I can't find anything wrong.
    Thanks


  • Closed Accounts Posts: 585 ✭✭✭MrDarcy


    OP are you sure you have not got a password up on your site?


  • Closed Accounts Posts: 6 estack


    hi mrdarcy,

    no the site is up live and no password. i have actually loaded it three times and have it live every time


  • Registered Users Posts: 3,772 ✭✭✭Scotty #


    Move the realex_response.php to the root folder and inform Realex of the change. It's the only thing different between your setup and mine.


  • Closed Accounts Posts: 6 estack


    ok i did that and got the same error again, got on to realex and asked them to send me the logs which had the same message again but looking at the return url, a lightbulb went off over my head - no "http://&quot; before the return url. I hadn't included this when i sent through the url to realex and they had put it in without it. Rang them back, asked them to put it in and worked first time!!

    Thanks for all the help guys. Hopefully this will help someone else sometime


  • Closed Accounts Posts: 585 ✭✭✭MrDarcy


    estack wrote: »
    ok i did that and got the same error again, got on to realex and asked them to send me the logs which had the same message again but looking at the return url, a lightbulb went off over my head - no "http://&quot; before the return url. I hadn't included this when i sent through the url to realex and they had put it in without it. Rang them back, asked them to put it in and worked first time!!

    Thanks for all the help guys. Hopefully this will help someone else sometime

    That's probably the issue, I had submitted my response page URL all in lowercase, on my web server there were 2 letters that were in capital and that caused an issue for me, it's the last thing you'd expect to be an issue...


  • Closed Accounts Posts: 585 ✭✭✭MrDarcy


    estack wrote: »
    ok i did that and got the same error again, got on to realex and asked them to send me the logs which had the same message again but looking at the return url, a lightbulb went off over my head - no "http://&quot; before the return url. I hadn't included this when i sent through the url to realex and they had put it in without it. Rang them back, asked them to put it in and worked first time!!

    Thanks for all the help guys. Hopefully this will help someone else sometime

    Great to hear you got it hooked up OP. I had a bit of a headache with getting my response page to work right, it's the trickiest part of the prorcess I reckon.


Advertisement