Virtuemart 2.6 PayPal notify triggers update action in other payment plugins?

Started by ruudjonk, April 14, 2014, 13:17:01 PM

Previous topic - Next topic

ruudjonk

Hello all VM users/developers,

Currenty I've seen a VM shop that sends out the error email about a missing/unknow order ID. It looks like this is triggerd by the PayPal notifications and I noticed that the notify_url is set like:

$post_variables['notify_url'] = JURI::root() .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component' . '&lang='.JRequest::getCmd('lang','') ;

Shouldn't it include the PM code? It looks like url above triggers the update function from within another payment plugin, causing VM to send an error e-mail about the unknown Order ID.

Shouldn't it be something like:

$post_variables['notify_url'] = JURI::root() .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component' . '&lang='.JRequest::getCmd('lang',''). '&pm=' . $this->order['details']['BT']->virtuemart_paymentmethod_id ;


The shop is using Joomla 2.5.19 and VM 2.6.0.


ruudjonk

Another question about this.

The orderstatus also isn't updated when using PayPal, can it be because:

The notify url is like:
$post_variables['notify_url'] = JURI::root() .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component' . '&lang='.JRequest::getCmd('lang','') ;

If I'm correct, this triggerst the plgVmOnPaymentResponseReceived function within the PayPal plugin (when adding the pm code?). This function gets the order_number by doing:

$order_number = JRequest::getString('on', 0);

Only, the 'on' isn't added to the notify_url, just like the missing 'pm' variable.


Am I missing something or does this part of the PayPal plugin just don't work at the moment?





alatak

Hello
Quote$post_variables['notify_url'] = JURI::root() .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component' . '&lang='.JRequest::getCmd('lang','') ;
QuoteIf I'm correct, this triggerst the plgVmOnPaymentResponseReceived function within the PayPal plugin (when adding the pm code?).

the task pluginnotification triggers plgVmOnPaymentNotification event

and in that case the order number is returned in the paypal data
$paypal_data['invoice']

ruudjonk

Thank you Alatak for you reply,

Can you then also tell me how VM knows that it should call the even for the PayPal plugin and not for another plugin as this information isn't set within the callback to the url within:

$post_variables['notify_url'] = JURI::root() .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component' . '&lang='.JRequest::getCmd('lang','') ;

I thought that the PM variable was used to indentify the payment plugin that was used so the correct notification function was called.


I'm asking this as it looks like the PayPal callback to this url triggers the notification action within another plugin.

alatak

Hello

For the notification trigger
the data returned by Paypal are in the $_POST

1) the order number is returned in $paypal_data['invoice']
2) the function VirtueMartModelOrders::getOrderIdByOrderNumber returns the $virtuemart_order_id
3) the function getDatasByOrderId($virtuemart_order_id) returns the data from the payment plugin table for that virtuemart_order_id. The data returned contains the virtuemart_paymentmethod_id
4) the function  $this->getVmPluginMethod(virtuemart_paymentmethod_id); returns the method for the virtuemart_paymentmethod_id stored in the payment table
5) $this->selectedThisElement(payment_element) checks if it is the correct method that is selected. If it is not, then it does nothing.