Question regarding new payment plugin

  • Posts: 1
  • Thank you received: 0
10 years 1 month ago #174050

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6

Hello,
I am developing a payment plugin for a bank's payment gateway from the example one offered in the Hikashop site.
The problem comes at the moment of receiving the gateway's notification of the payment. The bank requests a "response to a notification" as "a URL-coded document which only contains one text line (no HTML tags, etc.) in the format parameter=value". This parameter is the url for the user to be redirected.

If I kill the application right after echoing such line, the redirection works out fine:

function onPaymentNotification(&$statuses)
	{
	...
	else //If everything's OK, order is validated -> success
		{
			$this->modifyOrder($order_id, 'confirmed', true, true);
			$requestURL = "rurls=".HIKASHOP_LIVE."index.php?option=com_hikashop&ctrl=checkout&task=after_end"; // successful transaction 
			echo $requestURL;
			exit;
			// return true;
		};
	}

If I use the "return true" (as other plugins do), I get an error from the payment gateway. Which makes me think that using "return" leads to other functions that write something else to that response.
So my question is: is it wrong to use "exit" there? The order status changes and the user is notified that the order is confirmed. So what am I preventing Hikashop of doing? I checked the notify function in the checkout.php, but it's not clear to me what exactly is it doing.
Thank you in advance!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #174068

Hi,

If you just need to send content without HTML, the best is to use the method you use (do an exit).
By doing a return, you let Joomla continue his process and it will display your content in a HTML page (using the "component.php" file from your template).
So if you want to have the control on the output content, you have to use an exit. There is nothing wrong, don't worry.

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.

Time to create page: 0.056 seconds
Powered by Kunena Forum