Declined Mangopay transaction not properly redirected

  • Posts: 128
  • Thank you received: 2
7 years 7 months ago #267862

-- HikaShop version -- : 3.0.1
-- HikaMarket version -- : 1.7.3
-- Joomla version -- : 3.6.5
-- PHP version -- : 5.6

Hi there,

I’m using MangoPay as the payment method and I have an issue when the user’s card is declined by MangoPay since the user is NOT being redirected to the URL I expect it to.

In the Payment method Configuration I have setup a Cancel URL as follows:
myweb.com/index.php?option=com_content&view=article&id=15

Which is a Jomla menu item which contains a single article.

However when the payment is declined by Mangopay the user is redirected back to:
myweb.com/component/hikashop/order/cancel_order?lang=en

Which is a completely blank page (on the component area of Joomla).

I have also noticed that the order created before redirecting the user to the MangoPay gateway where the card is inserted, stays as created. And in the Payment method configuration I have setup Invalid Status as Cancelled. Shouldn’t the order be cancelled automatically?

No errors in the MangoPay log.

To generate the declined payment in MangoPay sandbox you have to use a valid testing card and type 999 as CVV code

Thanks!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #267863

Hello,

The redirection to that HikaShop page is logical and expected.
That HikaShop task need to update the order and then load the "cancel url" stored in the plugin configuration to perform a redirection.
In any case a redirection should be made.

So if you have a full blank page in "cancel_order", it indicates a PHP fatal error.
Please take a look at your PHP error log in order to check that error and have more details about it.

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: 128
  • Thank you received: 2
7 years 7 months ago #267911

Hi, thanks,

Sorry it is not a full blank page. All the modules, menus, etc load fine, it is just the area where the component displays has no content at all (see attached)

I'm testing on a testing environment with PHP error reporting set to maximum and I don't see any fatal error, warning, notice or anything in fact. Nothing gets added to the error log either when I perform this operation.

The order does not get updated and there is no redirection to the cancel url which I have setup in the plugin config.

PS: I have tested the same scenario (card declined) with the Stripe Plugin and it works fine, the order gets automatically cancelled. However in the Stripe Plugin there is no "Cancell URL" so I could not see if that works

Attachments:
Last edit: 7 years 7 months ago by sabroso.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 7 months ago #267916

Hello,

Okay.
Regarding the URL, it looks like the fact that there is no "order_id" in the parameter, HikaShop is not able to determine what is the current order id to determine which payment plugin load to get his cancel url.
But HikaShop should have the "order_id" information in the current session ; so that is strange that it cannot retrieve it...

In the hikashoppayment mangopay plugin, you can replace the line

$redirect_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order';
By
$redirect_url = HIKASHOP_LIVE . 'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=' . (int)$order_id;
In order to force the "order_id" in the URL and then HikaShop should continue his normal process.

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: 128
  • Thank you received: 2
7 years 6 months ago #268049

Thanks Jerome,

That fixes the redirection issue, now the "Cancel URL" configured in the MangoPay payment plugin is loaded after a cancelled or failed transaction.

However, the order stays as CREATED. Which is confusing to both the Vendor and the Customer.

When I tested this with the Stripe Payment Plugin, once the payment is rejected the order status gets automatically changed to CANCELLED and both the Vendor and the Client get an email saying the status of their order has changed to CANCELLED.

Shouldn't the MangoPay payment plugin do this as well?

Thanks!

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 6 months ago #268056

Hello,

That's not the role of the plugin ; that's the goal of the "order&task=cancel_order" of HikaShop.

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: 128
  • Thank you received: 2
7 years 6 months ago #268103

OK, what I meant is WHY the order is NOT cancelled when the payment is cancelled/declined by MangoPay?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 6 months ago #268105

Hello,

As I mentioned in my previous message ; that's not related to the plugin.
So please open a new thread in the HikaShop section of the forum.

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: 128
  • Thank you received: 2
7 years 6 months ago #268536

Hi Jerome,

I reported the fact that the order was not getting automatically cancelled when the payment was cancelled/declined by MangoPay in the HIkashop Forum as you suggested:

www.hikashop.com/forum/3-bug-report/8899...mangopay.html#268534

It turns out the problem can be fixed by adding the following patch to the MangPay Payment plugin in the paymentNotificationSecureReturn function, right before the line:

if(empty($this->app))

The patch would be:
	elseif(isset($payIn->Status) && $payIn->Status == 'FAILED') {
			$order_status = $this->payment_params->invalid_status;
			$history = new stdClass();
			$history->notified = 1;
			$history->data = 'MangoPay Secure Return: '.$payIn->Status;
			$this->modifyOrder($order_id, $order_status, $history, true);
		}

This greatly enhances the usability of the plugin, so I think it will be a good idea to include it in the plugin moving forward.

What do you think?

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 6 months ago #268538

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.

Moderators: Obsidev
Time to create page: 0.071 seconds
Powered by Kunena Forum