Skip to main content

Plugin development: change order status

More
11 years 4 months ago #203812 by zizi80
change order status was created by zizi80
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.41

hi,
I created a plugin for payments following the directions of your examples, but I do not understand what I do or what I call function to change the order status in confirmed and sending email notification.

help me please

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203836 by Jerome
Replied by Jerome on topic change order status
Hi,

See the call of the function "modifyOrder".
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.

More
11 years 4 months ago - 11 years 4 months ago #203874 by zizi80
Replied by zizi80 on topic change order status
hello, the system of my bank did not give me the opportunity to use fully the strings of your code I had to change and create a plugin very different from yours; the problem is that at the end of the payment process, it redirects to the website of the page, I return confirmations positive, but I do not understand how to call me back or enable notifications and change was in the order confirmed, if I imposed connettendomi to DB do not start notifications, you help me

this function:
$this->modifyOrder($order_id, $this->payment_params->verified_status, true, true);
It does not work, I would like to recall the page checkout in function after_end ()
because I can get here with the variables that I need payment accepted.
Last edit: 11 years 4 months ago by zizi80.

Please Log in or Create an account to join the conversation.

More
11 years 4 months ago #203889 by Jerome
Replied by Jerome on topic change order status
Hi,

I can assure you that the modifyOrder function works perfectly when you give it the right parameters.
Without any details about your current implementation it will be more than complicated for us to give you advices or tips.
The sample plugin we published give all requires information to create a plugin ; you can take a look at the other payment plugin provided by the HikaShop package.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204205 by zizi80
Replied by zizi80 on topic change order status
hi,
it's called the variable hikashop expects to validate the payment?
that value must have?
the return page is this:http://mydomain.xxx/index.php?option=com_hikashop&ctrl=checkout&task=after_end&PaymentID=9113862441051600&TransID=9905603451051600&order_id=J2T01&postdate=0609&resultcode=APPROVED&auth=999999&Error=&ErrorText=&cardtype=VISA&payinst=VPAS&liability=Y&responsecode=00

that's what gives me the bank
but the status of the order is always created

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204270 by nicolas
Replied by nicolas on topic change order status
Hi,

That's not the link you want to give to your bank for your payment notification.
You want to give it:
mydomain.xxx/index.php?option=com_hikash...tif_payment='.$this- >name.'&tmpl=component
That way, you'll have your payment plugin called in the onPaymentNotification function of your payment plugin, and there, you'll be able to use the modifyOrder function as any other payment plugin. Then, you'll be able to redirect the customer to the normal after_end URL with a redirect call, as explained in the example plugin comments.

From the different bits of information you provided in your message, I don't see why you couldn't use the normal functions of payment plugins.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204317 by zizi80
Replied by zizi80 on topic change order status
hi,
when i open this page: mydomain.xxx/index.php?option=com_hikash...ample&tmpl=component
sending this variables:
&PaymentID=1476668360951610&TransID=1454898370951610&order_id=L2E34&postdate=0610&resultcode=APPROVED&auth=999999&Error=&ErrorText=&cardtype=VISA&payinst=VPAS&liability=Y&responsecode=00
the result page is empty(white)

I attach the pages of the plugin, configured with the parameters of the test bank

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204322 by nicolas
Replied by nicolas on topic change order status
Hi,

That's normal.
That's what it does by default.
The example plugin will display a blank page on the notification page as this normally is triggered by the payment gateway server, not the user browser.
But if you read the comments in the example plugin's notification function, you'll find this:
Code:
//To redirect the user, if needed. Here the redirection is useless : we are on server side (and not user side, so the redirect won't work), and the cancel url has been set on the payment platform merchant account // $this->app->redirect($cancel_url);
and:
Code:
// $this->app->redirect($return_url);

In your case, you want to uncomment these redirects so that the plugin redirects the user to the thank you page after confirming the order with the parameters of the notification URL.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204466 by zizi80
Replied by zizi80 on topic change order status
hi,
i uncomment this line
// $this->app->redirect($cancel_url);
// $this->app->redirect($return_url);
but the result is always white page:
mydomain.xxx/index.php?option=com_hikash...ample&tmpl=component
can you test my page please? i need a solution..
thanks

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204467 by Jerome
Replied by Jerome on topic change order status
Hi,

Yes, it won't work with the url you're using.
Code:
$order_id = (int)@$vars['order']; $dbOrder = $this->getOrder($order_id); // With the order, we can load the payment method, and thus all the payment parameters $this->loadPaymentParams($dbOrder); if(empty($this->payment_params)) return false;
If you do not specify an order in the parameters ; you can't load any order and the plugin will return "false".

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago - 11 years 3 months ago #204514 by zizi80
Replied by zizi80 on topic change order status
Forgive me, but I do not understand what I have to change, you can give me an example please

mydomain.xxx/index.php?option=com_hikash...ID=1895301471751620& order_id=256&postdate=0611&resultcode=APPROVED&auth=999999&Error=&ErrorText=&cardtype=VISA&payinst=VPAS&liability=Y&responsecode=00&clientid=

I tried to set order_id, but the result is the same
Last edit: 11 years 3 months ago by zizi80.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204528 by nicolas
Replied by nicolas on topic change order status
Hi,

As Jerome said, the example plugin expects that the order id is given in a parameter called "order" in the URL of the payment notification.
You used order_id instead of order so the plugin will stop at the load of the order at the beginning of the onPaymentNotification function since it couldn't find any order to load and thus the redirects won't be done as they are placed later in the function.

Remember that in order to confirm the order, the plugin needs to know the order_id for which the payment gateway is sending the payment notification, otherwise, it can't confirm the order.

So either you want to change the "order_id" parameter in the notification URL (but you might not be able to as it is your payment gateway redirecting to the user with these parameters in the URL), or you want to change to line:
Code:
$order_id = (int)@$vars['order'];
to:
Code:
$order_id = (int)@$vars['order_id'];

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago - 11 years 3 months ago #204570 by zizi80
Replied by zizi80 on topic change order status
I tried to set order_id, but the result is the same ,
the return url is
Code:
http://mydomani.xxx/index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=example&tmpl=component&PaymentID=7403553151051630&TransID=4867583161051630&order_id=261&postdate=0612&resultcode=APPROVED&auth=999999&Error=&ErrorText=&cardtype=MC&payinst=VPAS&liability=Y&responsecode=00
i tried this:
Code:
foreach($_GET as $key => $value) //foreach($_REQUEST as $key => $value) { $key = $filter->clean($key); $value = JRequest::getString($key); $vars[$key] = $value; }
and
Code:
// The load the parameters of the plugin in $this->payment_params and the order data based on the order_id coming from the payment platform $order_id =$_GET['order_id']; // (int)@$vars['order_id']; $dbOrder = $this->getOrder($order_id);

but the result is the same, white page
i attach my new example page
some patience please, help me
Last edit: 11 years 3 months ago by zizi80.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204573 by nicolas
Replied by nicolas on topic change order status
Hi,

Please understand that this is just an example plugin. It doesn't means that you need to keep everything as it is in it, or that you shouldn't change some of the code becasue the payment gateway does things a bit differently. With that example plugin, we're just giving you the most common example.
For example, in the onPaymentNotification function, there is a call to the "example_signature" function which generates a hash out of some expected parameters and compare it to the hash given by the payment gateway. That's often done in order to guarantee the authentication of the payment notification. This is also explained in the comments of the plugin.
In your case, there is no hash in the URL and thus nothing to check. So if you keep the hash signature check in that function the check will fail and thus you'll also get a white page as the process will stop before the code which does the redirect in your onPaymentNotification function.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204867 by zizi80
Replied by zizi80 on topic change order status
we are almost there,
accepts the payment and order status changes confirmed, but the page is always blank,does not redirect the user.
this url don't change:
Code:
http://mydomain.xxx/index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=example&tmpl=component&PaymentID=6666573151451660&TransID=1759369161451660&order_id=264&postdate=0615&resultcode=APPROVED&auth=999999&Error=&ErrorText=&cardtype=MC&payinst=VPAS&liability=Y&responsecode=00
i attach my example page.
if you look at the page and tell me why does not redirect, thank you very much
This attachment is hidden for guests.
Please log in or register to see it.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago - 11 years 3 months ago #204871 by Mohamed Thelji
Replied by Mohamed Thelji on topic change order status
Hello,
You'll have to redirect him yourself regarding the payment status, If the payment was :
- Successful, you'll have to redirect him through a thank you page
- Cancelled, or if an error occurred, you'll have to redirect him through an error page.
I'll also checked your code, and it seems like you're actually redirecting your customers with that code :
$this->app->redirect($cancel_url);
Or
$this->app->redirect($return);

Your issue is probably coming from the fact the following code isn't executed.
Last edit: 11 years 3 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204994 by zizi80
Replied by zizi80 on topic change order status
yes redirect function don't work
Code:
$this->app->redirect($cancel_url); Or $this->app->redirect($return);
I tried:
Code:
header('"location:'.HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=after_end&order_id='.$order_id . $this->url_itemid.'"' ); exit;
or
Code:
<meta http-equiv="refresh" content="0; url=<?php echo HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=after_end&order_id='.$order_id . $this->url_itemid; ?>">
or
Code:
<script language="javascript"> top.location.href = "<?php echo HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=after_end&order_id='.$order_id . $this->url_itemid; ?>"; </script>
but don't redirect, the page is alway white

Please Log in or Create an account to join the conversation.

More
11 years 3 months ago #204996 by Jerome
Replied by Jerome on topic change order status
Hi,

You might have a PHP fatal error which stop the process of your plugin.
You might have something before in the function which perform a "return false;".
I can assure you that "$this->app->redirect()" is working every time when it's called.

So if you have some troubles with development, I'll recommend you to be helped by a developer.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

Time to create page: 0.292 seconds
Powered by Kunena Forum