$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id=' . $order_id;
$order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE);
$order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
$saleCode = $_POST['SaleOrderId'];
$ResCode = $_POST['ResCode'];
$trnsID = $_POST['SaleReferenceId'];
$lalaPayment_Get = lalaPaymentHika::getLala($ResCode,$this->payment_params->terminal_id,$this->payment_params->terminal_un,$this->payment_params->terminal_pw,$saleCode,$trnsID);
if($lalaPayment_Get[0]){
$order = new stdClass();
$order->order_id = $dbOrder->order_id;
$order->old_status->order_status=$dbOrder->order_status;
$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id='.$order->order_id;
$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
$order_text .= "\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
/////////////////
/////////////
echo 'Transation success. trnsID:'. $trnsID . "\r\n\r\n";
$mailer = JFactory::getMailer();
$config =& hikashop_config();
$sender = array(
$config->get('from_email'),
$config->get('from_name')
);
$mailer->setSender($sender);
$mailer->addRecipient(explode(',',$config->get('payment_notification_email')));
$order->order_status = 'confirmed';
$order->history->history_data = "Tracking Code:: ".$trnsID;
$order->history->history_reason = JText::_('OK');
$order->history->history_notified=1;
$order->history->history_payment_id = $element->payment_id;
$order->history->history_payment_method =$element->payment_type;
$order->history->history_type = 'payment';
$order_status = $order->order_status;
$order->mail_status = $statuses[$order->order_status];
$mailer->setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Lala',$order->mail_status,$dbOrder->order_number));
$body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Lala',$order->mail_status)).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order->mail_status).' '.JText::sprintf('Transaction Code',$trnsID)."\r\n\r\n".$order_text;
$mailer->setBody($body);
$mailer->Send();
$orderClass->save($order);
$order_num = $dbOrder->order_number;
$app =& JFactory::getApplication();
$httpsHikashop = HIKASHOP_LIVE;
$return_url = $httpsHikashop.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$orderid.$this->url_itemid;
$app->redirect($return_url,"Thank you. Your Transaction:: $trnsID Your Order:: $order_num");
return true;
}else{
$order = new stdClass();
$order->order_id = $dbOrder->order_id;
$order->old_status->order_status=$dbOrder->order_status;
$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id='.$order->order_id;
$order_text = "\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$dbOrder->order_number,HIKASHOP_LIVE);
$order_text .= "\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
/////////////////
$mailer = JFactory::getMailer();
$config =& hikashop_config();
$sender = array(
$config->get('from_email'),
$config->get('from_name')
);
$order_num = $dbOrder->order_number;
$mailer->setSender($sender);
$mailer->addRecipient(explode(',',$config->get('payment_notification_email')));
$order->order_status = 'cancelled';
$order->history->history_data = "Your Payment $order_num Canceled";
$order->history->history_reason = JText::_($lalaPayment_Get[1]);
$order->history->history_notified=1;
$order->history->history_payment_id = $element->payment_id;
$order->history->history_payment_method =$element->payment_type;
$order->history->history_type = 'payment';
$order_status = $order->order_status;
$order->mail_status=$statuses[$order->order_status];
$mailer->setSubject(JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','lala',$order->mail_status,$dbOrder->order_number));
$body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','lala',$order->mail_status)).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order->mail_status)."\r\n\r\n".$order_text;
$mailer->setBody($body);
$mailer->Send();
$orderClass->save($order);
$app =& JFactory::getApplication();
$httpsHikashop = HIKASHOP_LIVE;
$return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$orderid.$this->url_itemid;
$app->redirect($return_url,$lalaPayment_Get[1]);
return false;
}
}