I have developed a payment plugin and all is working nice, but it is not finished yet, because I have the following situation:
My payment plugin working without problem and the gateway send notification after user's payment.
The "onPaymentNotification" function get the notification without problem, but i dont know how to send I email to user warning about payment confirmation and delivery his serial and change order status from "created" to "confirmed". With Paypal, notification send email confirmation with serial and change status of the order, but with my plugin only receive notification but do not change status and do not send confirmation email with serial.
I am trying to send to user a confirmation email with his serial, but the code do not work (i've copyed part of code from paypal source):
private static function transactionNotification($notificationCode)
{
... (code above) ...
$parts = explode('|',$transaction->getReference());
$id = $parts[0]; // this is order_id
$nm = $parts[1]; // this is order_number
// all is working ok until here
$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id=' . $id;
$order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $nm, HIKASHOP_LIVE);
$order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url));
$order_status = $this->payment_params->verified_status;
$history->notified = 1;
$email = new stdClass();
$email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','PagSeguro','confirmed',$nm);
$email->body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','PagSeguro','Pago')).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order_status)."\r\n\r\n".$order_text;
$this->modifyOrder($id, $order_status, $history, $email);
return true;
}
What is wrong? Please help!
I just want that "onPaymentNotification" function change order status to "confirmed" and send to user a confirmation email with his serial.
Thk