Jump to content

After Payment No confirmation mail in Preatshop 1.6 with Payu


ajaykakde21

Recommended Posts

Hi Team,

 

When customer makes payment after that no confirmation mail is sending to customer as well as admin.

Payment is successfully credited on my Payu account.

 

I really need your help.

 

For reference Please see my success.php file. 

 

<?php  
 
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../init.php');
include(dirname(__FILE__).'/payubiz.php');
include(dirname(__FILE__).'/../../header.php');
include(dirname(__FILE__).'/payubiz_common.inc');
 
// require_once dirname(__FILE__).'/../../classes/order/Order.php';
  //       require_once dirname(__FILE__).'/../../classes/order/OrderHistory.php';
 
$payu = new payubiz();
 
$response=$_REQUEST;
            
$key=Configuration::get('PAYUBIZ_MERCHANT_ID');
  $salt=Configuration::get('PAYUBIZ_MERCHANT_SALT');
 
$log=Configuration::get('PAYUBIZ_LOGS');
 
 
 
$baseUrl=Tools::getShopDomain(true, true).__PS_BASE_URI__;
$order_id= $response['txnid']-40000;
$transactionId= $response['mihpayid'];
 
$smarty->assign('baseUrl',$baseUrl);
$smarty->assign('orderId',$order_id);
$smarty->assign('transactionId',$transactionId);
 
$amount        = $response['amount'];
$productinfo   = $response['productinfo'];
$firstname     = $response['firstname'];;
$email         = $response['email'];
 
if($response['status'] == 'success' || $response['status'] == 'in progress')
{
 
   $Udf1 = $response['udf1'];
$Udf2 = $response['udf2'];
$Udf3 = $response['udf3'];
$Udf4 = $response['udf4'];
$Udf5 = $response['udf5'];
$Udf6 = $response['udf6'];
$Udf7 = $response['udf7'];
$Udf8 = $response['udf8'];
$Udf9 = $response['udf9'];
$Udf10 = $response['udf10'];
 
 $txnid=$response['txnid'];
 $keyString =  $key.'|'.$txnid.'|'.$amount.'|'.$productinfo.'|'.$firstname.'|'.$email.'|'.$Udf1.'|'.$Udf2.'|'.$Udf3.'|'.$Udf4.'|'.$Udf5.'|'.$Udf6.'|'.$Udf7.'|'.$Udf8.'|'.$Udf9.'|'.$Udf10;
 
     $keyArray = explode("|",$keyString);
 $reverseKeyArray = array_reverse($keyArray);
 $reverseKeyString=implode("|",$reverseKeyArray);
 
 
 
$status=$response['status'];
$saltString     = $salt.'|'.$status.'|'.$reverseKeyString;
$sentHashString = strtolower(hash('sha512', $saltString));               
 
$responseHashString=$_REQUEST['hash'];
 
if($sentHashString != $responseHashString)
{
$history = new OrderHistory();
$history->id_order = (int)($order_id);
$history->changeIdOrderState(Configuration::get('PS_OS_ERROR'), $history->id_order);
$history->add();
$smarty->display('failure.tpl');
             }
else
{
global $cart,$cookie;
$total = $amount;
$currency = new Currency(Tools::getValue('currency_payement', false) ? Tools::getValue('currency_payement') : $cookie->id_currency);
$customer = new Customer((int)$cart->id_customer);
 
if($response['status'] == 'success')
{
 
                   $payu->validateOrder((int)$cart->id, Configuration::get('PS_OS_PAYMENT'), $total, $payu->displayName, NULL, NULL, (int)$currency->id, false, $customer->secure_key);
 
                   $result = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'orders WHERE id_cart = ' . (int)$cart->id);                 
 
                    //$objOrder = new Order($result['id_order']); //order with id=1
// $history = new OrderHistory();
// $history->id_order = (int)$objOrder->id;
 
// $objOrder->setCurrentState(Configuration::get('PS_OS_PAYMENT')); 
 
// $i = $history->changeIdOrderState(Configuration::get('PS_OS_PAYMENT'), (int)($objOrder->id)); //order status=3  
 
                  }            
else
{
 
  $payu->validateOrder((int)$cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $payu->displayName, NULL, NULL, (int)$currency->id, false, $customer->secure_key);
 
  $result = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'orders WHERE id_cart = ' . (int)$cart->id);
 
//   $objOrder = new Order($result['id_order']); //order with id=1
// $history = new OrderHistory();
// $history->id_order = (int)$objOrder->id;
 
// $objOrder->setCurrentState(Configuration::get('PS_OS_PREPARATION')); 
 
// $history->changeIdOrderState(Configuration::get('PS_OS_PREPARATION'), (int)($objOrder->id)); //order status=3 
}
$smarty->display('success.tpl');
 
$result = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'orders WHERE id_cart = ' . (int)$cart->id);
 
if($log==1 )
{
pblog( 'payubiz Data: '. print_r( $response, true ) );
  $responseValue= str_replace( "'"," ",implode(",",$response));
  $successQuery="update ps_payubiz_order set payment_response='$responseValue', payment_method= '".$response["payment_source"]."', payment_status= '".$response["status"]."', id_order='".$result["id_order"]."'  where id_transaction= ".$response['txnid'];
  Db::getInstance()->Execute($successQuery);
}
 
            Tools::redirectLink(__PS_BASE_URI__ . 'order-detail.php?id_order=' . $result['id_order']);
 
}
 }
 
           include(dirname(__FILE__).'/../../footer.php');
?>
 
Link to comment
Share on other sites

I have been contacted to Payu.... Waiting for there response. Apart from there support can you please help me.

 

Its really urgent for me.

Right now I have Set " Enable SSL For All Pages " -> yes. No order is created neither mail confirmation.

But When I Set "Enable SSL For All Pages " -> No. then Order is created at backoffice but no mail confirmation.

PFA screenshot after setting "Enable SSL For All Pages " -> No

Please help me.

post-774222-0-82996500-1498722956_thumb.jpg

Edited by ajaykakde21 (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

But the thing is when i add product to cart and procced for payment and then if i am not doing payment and can cle the order then i got mail from prestashop that your order has been canceled. 

 

Then why not customer receive mail after making payment.

 

I had call with Payu the said there is no problem with PayU module.

 

Please suggest me its really urgent for me.

 

PFA

 

 

post-774222-0-25306100-1499673112_thumb.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...