Developing new payment plugin

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #75325

I'm developing a new plugin payment to a credit card Italian manager.
I was inspired by paypal plugin.
The function onAfterOrderConfirm and onPaymentNotification is working, in the administration panel the order is confirmed.
But I've a problem, my payment gateway don't call a result url.
the instructions of my gateway tell me to call the notification and then make a redirect.

This is the notify example:

<?php

$paymentID = $_REQUEST['paymentid'];
$result = $_REQUEST['result'];
$auth = $_REQUEST['auth'];
$ref = $_REQUEST['ref'];
$tranid = $_REQUEST['tranid'];
$trackid = $_REQUEST['trackid'];
$details = $_REQUEST['udf1'];
$responsecode = $_REQUEST['responsecode'];

$reply = "REDIRECT=" . "http://www.nomedominio.it/nomecontesto/result.php?paymentid=" . $paymentID;

echo $reply;

?>

I've tried many solution for the redirect but the result page is always the product listing with the message "The cart is empty",
and in the case of payment confirmed that in case of cancellation of the payment.
It seems that the link index.php?option=com_hikashop&ctrl=checkout¬if_payment=monetaweb&task=notify... is called, but then the browser gets back the default address.
I therefore fail to give a message to the user of the payment.
I also tried to view the page thankyou, as the plugin authorize, but in not working.
I do not know how to do more...

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

  • Posts: 82723
  • Thank you received: 13338
  • MODERATOR
11 years 11 months ago #75566

Hi,

If the order is confirmed in the onPaymentNotification and that you user is actually redirected to that function, then you should just do a redirect where you want at the end of that function.

But it's kind of hard to help you without knowing what you did in your code nor the integration documentation of your payment gateway...

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

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #75860

at the end of the function onPaymentNotification, after receiving confirmation of payment from the gateway, I do the redirection:



But I'm not going to function after_end, but I go back to the default page, and I get the message empty cart.
In the administration part, I get the correct confirmation of payment, and I also receive the mail order confirmed properly. But I can not display a page with a message of payment confirmed for the user.

Last edit: 11 years 7 months ago by steraviz.

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

  • Posts: 26150
  • Thank you received: 4026
  • MODERATOR
11 years 11 months ago #76003

Hi,

Does this credit card system have a server-to-server notification ?
Does your customer is redirected to your right notification url ? With the orderId ?

If the orderId parameter is not present, it would be logical that the $dbOrder is not load properly so the notification would return "false" and the checkout would return to the first checkout step.
Because the cart is empty (the cart was empty during the "onAfterOrderConfirm"), the checkout can't display so it redirect the user to the home with the error message.

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.

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #76135

The orderId is present, I go to the end of the function.

On the backend I see the order confirmed. You may see on the image attachment.



This is mi function onPaymentNotification:

Attachments:
Last edit: 11 years 7 months ago by steraviz.

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

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #76144

I deleted the lines

//                    $app = JFactory::getApplication();
//       	    	$app->redirect($return_url, "Grazie per il tuo acquisto"); 

in an other order to see on the log the print of the Request:

Last edit: 11 years 7 months ago by steraviz.

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

  • Posts: 26150
  • Thank you received: 4026
  • MODERATOR
11 years 11 months ago #76190

Hi,

Do you use the "onAfterOrderConfirm" to redirect the user to the payment screen ?
In this function, if you use "$this->removeCart = true;", it would empty the cart.
If the cart is already empty, you can't show the "after_end" checkout view.
This view (after_end) would empty the cart and display a thank you message.

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.

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #76622

This is my onAfterOrderConfirm:
I don't use "$this->removeCart = true;"



The cart is deleted because on the configuration panel the voice "Clear cart when the order is" is set to Created.
If in this panel I set to Confirmed, at the end of payment procedure the browser return to Checkout with the cart full.
On the administrator panel the order is Confirmed, but on front-end it seems that nothing has happened.

Last edit: 11 years 7 months ago by steraviz.

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

  • Posts: 12
  • Thank you received: 1
11 years 11 months ago #76654

Excuse me, I finally discovered that the error in question is made from my payment gateway that calls the url of notification and after the url of cancellation.
Thank you for your patience.

The following user(s) said Thank You: Jerome

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

Time to create page: 0.066 seconds
Powered by Kunena Forum