VM2 Paypal status changes from Confirmed to Cancelled if you hit the Back button

Started by olgri, November 10, 2016, 23:24:00 PM

Previous topic - Next topic

olgri

Hi everyone,
Has anyone noticed the following bug in VM2? (I couldn't find anything on the forum).

Joomla! 2.5.28
VirtueMart 2.6.6

When you select Paypal as the payment method and the payment is successful, you get redirected back to the shop to the "Thank you for your order" page with the details of the order and Paypal Transaction ID.
The status of the order is "Confirmed" at this stage. All good.

Now, if you hit the back button in your browser (say accidentally - this is especially likely to happen if you are using a touch screen smartphone), you get redirected back to Paypal. Paypal then displays "Your payment was completed. To continue shopping, please return to the merchant." message and a "Return to [Shop Name]" button. Click the "Return to [Shop Name]" button and you get redirected back to the shop. However now you see a "You have cancelled your payment" message and the status of the order is updated to 'Cancelled'.

Money doesn't get refunded so the shopper is waiting for the goods to arrive and shop admins think the order was cancelled and therefore ignore it.

This has been happening more and more often recently. Probably because more and more people use their smartphones for online shopping.

Is there a fix for this issue?
Does this happen in VM3 as well?

Thanks.

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

olgri

That fixed it! Thanks a lot!!  :)

Just for a record...

plugins/vmpayment/paypal/paypal.php

plgVmOnUserPaymentCancel() function around line 602.

Add the following code before VmInfo(vmText::_('VMPAYMENT_PAYPAL_PAYMENT_CANCELLED'));


$method = $this->getPluginMethod($virtuemart_paymentmethod_id);
$oM = VmModel::getModel('orders');
$theorder = $oM->getOrder($virtuemart_order_id);
if ($theorder['details']['BT']->order_status == $method->status_success || $theorder['details']['BT']->order_status == $method->status_pending ||   $theorder['details']['BT']->order_status == $method->status_capture) {
return NULL;
}