News:

Looking for documentation? Take a look on our wiki

Main Menu

PayPal and another payment method (przelewy24)

Started by panjarek, October 01, 2017, 18:39:09 PM

Previous topic - Next topic

panjarek

Hello,

I have strange problem with PayPal standard and other payment plugin (Przelewy24). After confirming a payment within paypal, during the redirection to the shop page, the system calls the wrong plugin to process the payment (przelewy24 not paypal). I added a call stack below to show how system reacts. Do you have any idea how can I solve it?

VirtueMart 3.2.
Joomla 3.7.5
PHP 7.21

Call stack
#   Function   Location
1   ()   JROOT/plugins/vmpayment/przelewy24/przelewy24.php:597
2   plgVmPaymentPrzelewy24->plgVmOnPaymentResponseReceived()   JROOT/libraries/joomla/event/event.php:70
3   JEvent->update()   JROOT/libraries/joomla/event/dispatcher.php:160
4   JEventDispatcher->trigger()   JROOT/components/com_virtuemart/controllers/vmplg.php:71
5   VirtueMartControllerVmplg->PaymentResponseReceived()   JROOT/components/com_virtuemart/controllers/vmplg.php:53
6   VirtueMartControllerVmplg->pluginResponseReceived()   JROOT/libraries/legacy/controller/legacy.php:709
7   JControllerLegacy->execute()   JROOT/components/com_virtuemart/virtuemart.php:125
8   require_once()   JROOT/libraries/cms/component/helper.php:389
9   JComponentHelper::executeComponent()   JROOT/libraries/cms/component/helper.php:364
10   JComponentHelper::renderComponent()   JROOT/libraries/cms/application/site.php:191
11   JApplicationSite->dispatch()   JROOT/libraries/cms/application/site.php:230
12   JApplicationSite->doExecute()   JROOT/libraries/cms/application/cms.php:265
13   JApplicationCms->execute()   JROOT/index.php:49

Best regard
Jarek S.

K&K media production

you should ask the developer of przelewy24

there is no verification inside plgVmOnPaymentResponseReceived()


panjarek

Thanks for answer, I have already created ticket in their system about it and waiting for answer, but I thought that maybe you have any suggestions how to fix it. 

panjarek

Service Przelewy24 promised to correct the plugin, but it may take a while. If someone is looking for fast solution: error is in file /plugins/vmpayment/przelewy24/przelewy24.php, function plgVmOnPaymentResponseReceived, around line 573, plugin check in wrong way if response belongs to it or not (probable there are more places to correct).

In my case this was a temporary solution ("Added" comment):
        // success
        $order_id = JRequest::getString('on');

        if (!empty($order_id)) {
            $db = JFactory::getDBO();
            $db->setQuery('SELECT p24.*, ord.order_status, ord.virtuemart_order_id FROM ' . $this->_tablename . ' as p24 JOIN `#__virtuemart_orders` as ord using(virtuemart_order_id) WHERE p24.order_number="' . $order_id . '"');
            $payment_db = $db->loadObject();

            $modelOrder = VmModel::getModel('orders');
            $order = $modelOrder->getOrder($payment_db->virtuemart_order_id);
           
            //< Added
            if (is_null($payment_db)) {
return null;
}
            // Added >

            if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id)))
                return null;

            if ($payment_db->order_status == 'C') {
                $ga_script = '';
                if (strlen($method->key_ga)) {
                    $ga_script = $this->generateGoogleAnalyticsTrackingCode($order_id, $order, $method);
                }
                JFactory::getApplication()->enqueueMessage(JText::_('PLG_PRZLELEWY24_SUCCESS') . $ga_script);
            } elseif ($payment_db->order_status == 'X') {
                JError::raiseWarning(100, JText::_('PLG_PRZLELEWY24_FAIL'));
                JFactory::getApplication()->enqueueMessage(JText::_('PLG_PRZLELEWY24_FAIL'));
            } else {
                JFactory::getApplication()->enqueueMessage(JText::_('PLG_PRZLELEWY24_WAITING'));
            }
        }

panjarek

The error was solved in version 3.3.12 of this plugin.