Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sage pay Server


DamanC

Recommended Posts

Sorry to post this in here but hopefully this may give me something more to play with.

 

I'm having issues integrating sage pay server into OSC and have hit a brick wall : http://www.oscommerce.com/forums/topic/375636-sage-pay-server-error-5006/

 

This issue is sage pay rejects an order because it receives no response from the 'notifcation URL'.

 

The URL is

 

notificationurl=https://www.mydomain.co.uk/checkout_process.php?check=SERVER&osCsid=07859e3396eba48a966ab5164f53296a

 

and is generated from a bit of code in the sage_pay_server.php file;

 

           if ( MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal' ) {
             $error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
           } else {
             $error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
           }

           $result = 'Status=OK' . chr(13) . chr(10) .
                     'RedirectURL=' . $error_url;
         } else {
           $result = 'Status=OK' . chr(13) . chr(10) .
                     'RedirectURL=' . tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PROCESS&key=' . md5($sage_pay_server_securitykey) . '&VPSTxId=' . $HTTP_POST_VARS['VPSTxId'] . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
         }
       } else {
         tep_session_unregister('sage_pay_server_securitykey');
         tep_session_unregister('sage_pay_server_nexturl');

         $error = $this->getErrorMessageNumber($HTTP_POST_VARS['StatusDetail']);

         if ( MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal' ) {
           $error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
         } else {
           $error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
         }

         $result = 'Status=INVALID' . chr(13) . chr(10) .
                   'RedirectURL=' . $error_url;
       }

       echo $result;

 

with particular attention to

 

'RedirectURL=' . tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PROCESS&key=' . md5($sage_pay_server_securitykey) . '&VPSTxId=' . $HTTP_POST_VARS['VPSTxId'] . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);

 

I'm not entirely convinced my notification URL should contain

amp;

can anyone see or think why it might be?

 

 

Also, is there anything I can change to perhaps make the redirect/notification url static such as 'checkout_success.php? I'm no Guru but have fuffed about with it for ages but don't know the correct syntax.

 

Appreciate your time :)

Link to comment
Share on other sites

  • 6 months later...

I think that a temporary solution to this may be to go to the html_output file and change:

 

$link = str_replace('&', '&', $link);

to

$link = str_replace('&', '&', $link);

 

Be aware that this is hardly ideal as it invalidates the code, (& did not start a character reference (& probably should have been escaped as &).

 

I'm hoping that someone will have a better solution though, as this is not the best way to do this.

Link to comment
Share on other sites

I have been searching online for some info on "PHP backspace" and this seems the way to remove the & from what I can find out. However, I am no great PHP programmer, and don't know how to implement this to get it to work.

Link to comment
Share on other sites

You can use the .htaccess file to change the the url from& to & which should solve your problem.

 

Add this to your .htaccess file:

 

RewriteCond %{QUERY_STRING} ^(.*)&(.*)$

RewriteRule ^(.*)$ /$1?%1&%2 [L,R=301]

 

I hope this helps.

 

Best regards,

 

Ian

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...