Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order status not updating after payment


scrivo

Recommended Posts

Im using the Payway payment module, everything is working fine except that when the server-to-server data is transferred, the order status doesnt update.

This is content on the register_payment_payway.php file, which is used in the server-to-server communication:

 

 

<?php
/*
$Id: checkout_process.php 1750 2007-12-21 05:20:28Z hpdl $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2007 osCommerce

Released under the GNU General Public License
*/
require('includes/application_top.php');
include_once('includes/functions/payway_utility.php');
require_once('includes/modules/payment/payway.php');
require(DIR_WS_CLASSES . 'payment.php');
$payment_modules = new payment($payment);

if ( $headers['content-type'] == 'application/xml' )
{
   $xmlData = file_get_contents('php://input');
   $parser = new XMLThing( $xmlData );
   $response = $parser->parse();
   $entry_line = $dtime . " Server-to-server data: \r\n";
   while ( list( $key, $value ) = each( $response['PaymentResponse'] ) )
   {
       $params[$key] = $value;
       // We reccommend you don't log your password.
       if ( $key != 'password' )
       {
           $entry_line = $entry_line . '  ' . $key . ' = ' . $value . "\r\n";
       }
   }
}
else
{
   $entry_line = $dtime . " Server-to-server post\r\nPOST Parameters: \r\n";
   foreach ( $_POST as $paramName => $paramValue )
   {
       $params[$paramName] = $paramValue;
       if ( $paramName != 'password' )
       {
           $entry_line = $entry_line . '  ' . $paramName . ' = ' . $paramValue . "\r\n";
       }
   }
   $entry_line = $entry_line . "GET Parameters: \r\n";
   foreach ( $_GET as $paramName => $paramValue )
   {
       $params[$paramName] = $paramValue;
       if ( $paramName != 'password' )
       {
           $entry_line = $entry_line . '  ' . $paramName . ' = ' . $paramValue . "\r\n";
       }
   }
}

//debugLog( $entry_line );

if (getenv(HTTP_X_FORWARDED_FOR)) {
   $ip_address = $REMOTE_ADDR;
} else {
   $ip_address = $_SERVER['REMOTE_ADDR'];
}
if ( $ip_address != MODULE_PAYMENT_PAYWAY_SERVER_IP )
{
   $testString = "HTTP/1.1 403 PayWay server IP not authenticated.";
   header( $testString );
   echo "PayWay server IP not authenticated: " . $ip_address;
}
else if ( $params['username'] != MODULE_PAYMENT_PAYWAY_SECURITY_TOKEN_USERNAME || $params['password'] != MODULE_PAYMENT_PAYWAY_SECURITY_TOKEN_PASSWORD )
{
   header( "HTTP/1.1 403 Incorrect Username and Password" );
   echo "Incorrect Username and password";
}
else
{
   // Save payment

   // If error results, return HTTP 500

   // Otherwise, just return success
   //trigger_error(mysql_escape_string($params['payment_reference']));
   if(MODULE_PAYMENT_PAYWAY_PAID_ORDER_STATUS_ID  >0) {
   	header("Location: http://www.google.com");
       tep_db_query("UPDATE ".TABLE_ORDERS." SET orders_status='".MODULE_PAYMENT_PAYWAY_PAID_ORDER_STATUS_ID."'" .
           // ",payway_payment_reference='".mysql_escape_string($params['payment_reference'])."'," .
           //"payway_receipt_no='".mysql_escape_string($params['no_receipt'])."'" .
           " WHERE orders_id=".mysql_escape_string($params['payment_reference']));
       tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY .
         "(orders_id, orders_status_id, date_added, customer_notified, comments) values (" . $params["payment_reference"] . ", " . MODULE_PAYMENT_PAYWAY_PAID_ORDER_STATUS_ID . ", now(), 1, '***PayWay Payment Data***
         Payment Reference#: ".mysql_escape_string($params['payment_reference'])."
         Receipt No#: ".mysql_escape_string($params['no_receipt']) . "')");
       echo "Success";
   }
   else
   {
       header( "HTTP/1.1 500 Payment order status not set correctly" );
       echo("Payment order status not set correctly");
   }
}
?>

 

Can anyone see anything wrong with this code or anything i may have set wrong?

Link to comment
Share on other sites

  • 1 year later...
  • 2 years later...

i would remove those //commented lines from within the string

 

tep_db_query("UPDATE ".TABLE_ORDERS." SET orders_status='".MODULE_PAYMENT_PAYWAY_PAID_ORDER_STATUS_ID."'" .
// ",payway_payment_reference='".mysql_escape_string($params['payment_reference'])."'," .
//"payway_receipt_no='".mysql_escape_string($params['no_receipt'])."'" .
" WHERE orders_id=".mysql_escape_string($params['payment_reference']));

 

tep_db_query("UPDATE ".TABLE_ORDERS." SET orders_status='".MODULE_PAYMENT_PAYWAY_PAID_ORDER_STATUS_ID."'" .
" WHERE orders_id=".mysql_escape_string($params['payment_reference']));

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...