- Posts: 5
- Thank you received: 0
Custom payment plugin error with the order confirmation
9 years 2 weeks ago - 9 years 2 weeks ago #278376
by jose94h
Custom payment plugin error with the order confirmation was created by jose94h
-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.7.5
-- PHP version -- : 5.5.38
-- Browser(s) name and version -- : chrome
I made a plugin and the problem that I have is that in the function "onPaymentNotification" to confirm the order status it is not possible to make the funcion "getOrder" get the acrual order. When I check the log the variable "$dbOrder" is always empty and therefore "if(empty($this->payment_params))" is always true and I cannot continue processing the order status.
-- Joomla version -- : 3.7.5
-- PHP version -- : 5.5.38
-- Browser(s) name and version -- : chrome
I made a plugin and the problem that I have is that in the function "onPaymentNotification" to confirm the order status it is not possible to make the funcion "getOrder" get the acrual order. When I check the log the variable "$dbOrder" is always empty and therefore "if(empty($this->payment_params))" is always true and I cannot continue processing the order status.
Code:
function onPaymentNotification(&$statuses)
{
$vars = array();
$filter = JFilterInput::getInstance();
foreach($_REQUEST as $key => $value) //Se reciben todas las variables provenientes de un HTTP POST de PayU
{
$key = $filter->clean($key);
$value = JRequest::getString($key);
$vars[$key]=$value;
}
$this->writeToLog(print_r($vars,true)."Array Recibido\n\n\n");
//$order_id = (int)@$vars['reference_sale'];
$order_id = (string)@$vars['reference_sale'];
$this->writeToLog("\n Orden #: $order_id\n\n");
$this->writeToLog("\n 2\n\n");
$dbOrder = $this->getOrder($order_id);
$this->writeToLog("\n dbOrder: $dbOrder\n\n");
$this->writeToLog("\n 3\n\n");
$this->loadPaymentParams($dbOrder);
$this->writeToLog("\n 4\n\n");
if(empty($this->payment_params))
{
$this->writeToLog("\n payment_params vacio\n\n");
return false;
}
Last edit: 9 years 2 weeks ago by Jerome. Reason: removing duplicate content (please do not put your message in the "error message" while it's not your error message).
usage of [code] tag which is really, really nice !
Please Log in or Create an account to join the conversation.
9 years 2 weeks ago #278383
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Custom payment plugin error with the order confirmation
Hello,
First please note that the order_id must be a number and it need to contain the ID of an order created with the payment method.
Since your plugin right inherit from the HikaShop payment plugin ; the function getOrder will just get the order from the database.
The function loadPaymentParams will check that the plugin name is right according to the name of the plugin (stored in the $name variable).
And depending if your plugin is a multiple-instance or not, the code which will be processed to load the parameters will be different.
github.com/HikaShop/sample-payment-plugi...b/master/example.php
Regards,
First please note that the order_id must be a number and it need to contain the ID of an order created with the payment method.
Since your plugin right inherit from the HikaShop payment plugin ; the function getOrder will just get the order from the database.
The function loadPaymentParams will check that the plugin name is right according to the name of the plugin (stored in the $name variable).
And depending if your plugin is a multiple-instance or not, the code which will be processed to load the parameters will be different.
github.com/HikaShop/sample-payment-plugi...b/master/example.php
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
9 years 2 weeks ago #278463
by jose94h
Replied by jose94h on topic Custom payment plugin error with the order confirmation
Thank you very much. Now it is solved. The issue was that I was sending a string to the function getOrder and it wasn´t the ID of the order it was the Id number.
Thanks for your support.
Thanks for your support.
Please Log in or Create an account to join the conversation.
Time to create page: 0.135 seconds