- Posts: 5
- Thank you received: 0
onPaymentNotification() not invoked when returning
- franchsesko
-
Topic Author
- Offline
Less
More
11 years 8 months ago #187618
by franchsesko
onPaymentNotification() not invoked when returning was created by franchsesko
-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.2
-- PHP version -- : 5.4.26
-- Browser(s) name and version -- : Firefox last
-- Error-message(debug-mod must be tuned on) -- : None
Hi,
I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function.
successUrl: www.mysite.ch/index.php?option=com_hikas...der_id=29&Itemid=143
errorUrl : www.mysitech/index.php?option=com_hikash...der_id=29&Itemid=143
cancelUrl : www.mysite.ch/index.php?option=com_hikas...der_id=29&Itemid=143
My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console.
My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process.
Although message is notified to the user thanking them for their purchase.
How's that even possible ?!?
-- Joomla version -- : 3.2
-- PHP version -- : 5.4.26
-- Browser(s) name and version -- : Firefox last
-- Error-message(debug-mod must be tuned on) -- : None
Hi,
I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function.
successUrl: www.mysite.ch/index.php?option=com_hikas...der_id=29&Itemid=143
errorUrl : www.mysitech/index.php?option=com_hikash...der_id=29&Itemid=143
cancelUrl : www.mysite.ch/index.php?option=com_hikas...der_id=29&Itemid=143
My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console.
My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process.
Although message is notified to the user thanking them for their purchase.
How's that even possible ?!?
Please Log in or Create an account to join the conversation.
- franchsesko
-
Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
11 years 8 months ago #187653
by franchsesko
Replied by franchsesko on topic onPaymentNotification() not invoked when returning
By the way, under my avatar it's written "hikashop essential",so just to be fair because I think I missed the field or whatever, I've bought Hikashop business and so did my final customer. Just saying 
Help !
Help !
Please Log in or Create an account to join the conversation.
- franchsesko
-
Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
11 years 8 months ago #187696
by franchsesko
Replied by franchsesko on topic onPaymentNotification() not invoked when returning
OK, I did specify the notification url for the payment processor return, and then, in the onPaymentNotification() handler, i redirect to custom pages (error, ok or cancelled) with a location header.
Seems to work.
Seems to work.
Please Log in or Create an account to join the conversation.
11 years 8 months ago #187633
by Xavier
Replied by Xavier on topic onPaymentNotification() not invoked when returning
Hi,
Are you sure that it is not called ?
Do you have added some "echo" in that function and checked the payment log file in Configuration > Main > Files ?
Are you sure that it is not called ?
Do you have added some "echo" in that function and checked the payment log file in Configuration > Main > Files ?
Please Log in or Create an account to join the conversation.
- franchsesko
-
Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
11 years 8 months ago - 11 years 8 months ago #187722
by franchsesko
Replied by franchsesko on topic onPaymentNotification() not invoked when returning
Hi,
The payment log file is empty and seems to stays like that.
In my plugin, I do log activity to a file , so I'm quite sure the onPaymentNotification() was not called when the payment gateway jumped to the url I was giving this way:
(invoiceID being the order_id).
So I give always the same url to jump back to, whatever the payment processor result:
I added the "src=callback" parameter, so I know my notification function is being called back after jumping to the payment processor website, and not as an IPN asynchronous notification.
Then, as the processor posts back a "status" code (error, cancel or success), I can react (modifyOrder) and then redirect ("location:" header) to any page I want, which are now parameterized urls in the plugin configuration.
Works like a charm (at least seems to).
So, IPN style notifications are not necessary, but always possible and handled.
Hope this will remain rock solid; do you think anything may be wrong with that ?
The payment log file is empty and seems to stays like that.
In my plugin, I do log activity to a file , so I'm quite sure the onPaymentNotification() was not called when the payment gateway jumped to the url I was giving this way:
Code:
HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$invoiceID . $this->url_itemid
So I give always the same url to jump back to, whatever the payment processor result:
Code:
$success_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&&task=notify¬if_payment=' .
$this->name . '&tmpl=component&order_id='.
$order->order_id .
'&lang='.$this->locale .
$this->url_itemid . '&src=callback'
Then, as the processor posts back a "status" code (error, cancel or success), I can react (modifyOrder) and then redirect ("location:" header) to any page I want, which are now parameterized urls in the plugin configuration.
Works like a charm (at least seems to).
So, IPN style notifications are not necessary, but always possible and handled.
Hope this will remain rock solid; do you think anything may be wrong with that ?
Last edit: 11 years 8 months ago by Jerome. Reason: [code] is nice !
Please Log in or Create an account to join the conversation.
11 years 8 months ago #187738
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic onPaymentNotification() not invoked when returning
Hi,
For payment log, you have to "echo" something during the notification to put it in the log (if you return correctly from the function).
The best is to use the function "writeToLog" (if you extends from the HikaShopPaymentPlugin interface) so you can easily put content in the payment log even if you put an "exit" or do an "$app->redirect".
I hope that it will help you to debug your plugin.
Regards,
For payment log, you have to "echo" something during the notification to put it in the log (if you return correctly from the function).
The best is to use the function "writeToLog" (if you extends from the HikaShopPaymentPlugin interface) so you can easily put content in the payment log even if you put an "exit" or do an "$app->redirect".
I hope that it will help you to debug your plugin.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
- franchsesko
-
Topic Author
- Offline
Less
More
- Posts: 5
- Thank you received: 0
11 years 8 months ago #187870
by franchsesko
Replied by franchsesko on topic onPaymentNotification() not invoked when returning
Thanks Jerome,
I'm not quite at ease relying on "echo" to do anything in a class member, but I now understand why I saw these echo statements in the samples and why there was some kind of "history.>data = ob_get_clean()" statements lying around, which were also a bit confusing.
So, I've stripped all "echo"s away and I use the history->data member to effectively store the provider error messages or meaningful response data.
I missed the "writeToLog()" function.
I use a custom made "debug_print()" function (along with a debug flag to switch it on/off, and other decorations), that opens a file in append mode, write to it and closes it on each call.
So I have my own debug log file system, and that's what I used to see if my member functions were invoked or not.
I'm going publish that piece of debug in a post on my blog (francescofoti.com) for anyone who may be interested.
I'll eventually use the writeToLog() function anyway in a future release, to comply with your guidelines.
And, we should be going live with my Datatrans payment plugin tomorrow (tada!); after testing with real credit cards, on the final customer website: www.selfbox.ch (full https soon).
Btw, if you've got some sort of "certification" process for these kind of plugins, or a directory where I can list it, I'm interested, as I'm going to propose it on the market.
Thanks for your appreciated support.
Kind regards,
Francesco.
I'm not quite at ease relying on "echo" to do anything in a class member, but I now understand why I saw these echo statements in the samples and why there was some kind of "history.>data = ob_get_clean()" statements lying around, which were also a bit confusing.
So, I've stripped all "echo"s away and I use the history->data member to effectively store the provider error messages or meaningful response data.
I missed the "writeToLog()" function.
I use a custom made "debug_print()" function (along with a debug flag to switch it on/off, and other decorations), that opens a file in append mode, write to it and closes it on each call.
So I have my own debug log file system, and that's what I used to see if my member functions were invoked or not.
I'm going publish that piece of debug in a post on my blog (francescofoti.com) for anyone who may be interested.
I'll eventually use the writeToLog() function anyway in a future release, to comply with your guidelines.
And, we should be going live with my Datatrans payment plugin tomorrow (tada!); after testing with real credit cards, on the final customer website: www.selfbox.ch (full https soon).
Btw, if you've got some sort of "certification" process for these kind of plugins, or a directory where I can list it, I'm interested, as I'm going to propose it on the market.
Thanks for your appreciated support.
Kind regards,
Francesco.
Please Log in or Create an account to join the conversation.
11 years 8 months ago #187904
by nicolas
Replied by nicolas on topic onPaymentNotification() not invoked when returning
Hi,
That's great !
We're listing all the payment plugins 3rd party developers provide in our "payment plugins" section of the documentation.
We'll be happy to add a link to your page presenting it once you have it online. Just drop us a line via our contact form:
www.hikashop.com/support/contact-us.html
That's great !
We're listing all the payment plugins 3rd party developers provide in our "payment plugins" section of the documentation.
We'll be happy to add a link to your page presenting it once you have it online. Just drop us a line via our contact form:
www.hikashop.com/support/contact-us.html
Please Log in or Create an account to join the conversation.
Time to create page: 0.306 seconds