Hi Seyi Thanks for the tips, but this didn't helped.
I would say the main problem is not that payment server get error, but the giftcard is not sent.
There is tips from payment server received by email with error:
Server sends data to: administrator/components/com_virtuemart/webtopay_notify.php, after data been processed it didn't had required answer "OK" text or you website was not reachable. So the payment server will ask your website for "OK" another two times.
To avoid such a massages we ask that your website would return "OK" when our server asks for it and right after that perform the rest of the tasks. payment system waits for 10 s to receive an answer.webtopay_notify.php around the end there is a function to update the order status to Confirmed.
<?php
$messages = Array();
function debug_msg( $msg ) {
global $messages;
if( @WEBTOPAY_DEBUG == "1" ) {
if( !defined( "_DEBUG_HEADER") ) {
echo " Webtopay Notify.php Debug OUTPUT";
define( "_DEBUG_HEADER", "1" );
}
$messages[] = "$msg";
echo end( $messages );
}
}
global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_lang, $database,
$mosConfig_mailfrom, $mosConfig_fromname;
$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['mosConfig_lang'] = 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 ***/
debug_msg( "1. Finished Initialization of the worldpay_notify.php script" );
/*** VirtueMart part ***/
define('PHPSHOPPATH', $mosConfig_absolute_path.'/administrator/components/com_virtuemart/');
require_once( PHPSHOPPATH."virtuemart.cfg.php");
require_once( CLASSPATH. "language.class.php" );
debug_msg( "1a. Included language class" );
//Set up the mailer to infor Warehouse of validated order
//require_once( $mosConfig_absolute_path . '/includes/phpmailer/class.phpmailer.php');
//$mail = new mosPHPMailer();
//$mail->PluginDir = $mosConfig_absolute_path . '/includes/phpmailer/';
//$mail->SetLanguage("en", $mosConfig_absolute_path . '/includes/phpmailer/language/');
/* load the VirtueMart Language File */
/* if (file_exists( ADMINPATH. 'languages/admin/'.$mosConfig_lang.'.php' )) {
require_once( ADMINPATH. 'languages/admin/'.$mosConfig_lang.'.php' );
} else {
require_once( ADMINPATH. 'languages/admin/english.php' );
}
*/
debug_msg( "2. Included admin language files" ); // this is a lie. but as the language isn't used it doesn't really matter.
require_once( CLASSPATH. 'payment/ps_webtopay.cfg.php' );
/* Load the VirtueMart database class */
require_once( CLASSPATH. 'ps_database.php' );
/*** END VirtueMart part ***/
require_once( CLASSPATH. 'libwebtopay/WebToPay.php' );
try {
$orderid = $_GET[WebToPay::PREFIX.'orderid'];
$response = WebToPay::checkResponse($_GET, array(
'projectid' => WEBTOPAY_PROJECTID,
'sign_password' => WEBTOPAY_PROJECT_PASSWORD,
'orderid' => $orderid,
'amount' => $_GET[WebToPay::PREFIX.'amount'],
'currency' => $_GET[WebToPay::PREFIX.'currency'],
));
$d['order_id'] = $orderid;
$d['order_status'] = WEBTOPAY_VERIFIED_STATUS;
require_once ( CLASSPATH . 'ps_order.php' );
$ps_order= new ps_order();
$ps_order->order_status_update($d);
echo 'OK';
}
catch (Exception $e) {
echo get_class($e).': '.$e->getMessage();
}
exit();