VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: rosen4o on November 20, 2011, 09:22:56 AM

Title: Triger plgVmOnPaymentNotification
Post by: rosen4o on November 20, 2011, 09:22:56 AM
I'm trying to make payment plugin but can get information from notify
I'm redirecting the notify request to:
index.php?option=com_virtuemart&view=paymentresponse&task=paymentnotification&tmpl=component

But there are triggered all payment plugins and no information is received on my plugin.

How can I direct response for payment only to one plugin???
Title: Re: Triger plgVmOnPaymentNotification
Post by: alatak on November 20, 2011, 18:44:10 PM
Hi

QuoteHow can I direct response for payment only to one plugin???
It is the way Joomla plugins are used. All the plugins are triggered for a specific event.
You must have in your code a value that will identify if it is the correct plugin called or not.
If it is not, the value null is returned.
It is the correct plugin, then you can do execute the code.
Title: Re: Triger plgVmOnPaymentNotification
Post by: rosen4o on November 21, 2011, 08:53:33 AM
So when information is returned to
index.php?option=com_virtuemart&view=paymentresponse&task=paymentnotification&tmpl=component

All plugins are trigerred and the information is passed to all plgVmOnPaymentNotification functions in the plugins, so i need to check in every plugin if the information is responced to him.
Right?
Title: Re: Triger plgVmOnPaymentNotification
Post by: alatak on November 21, 2011, 09:19:50 AM
Hi,
QuoteAll plugins are trigerred and the information is passed to all plgVmOnPaymentNotification functions in the plugins, so i need to check in every plugin if the information is responced to him.

Yes it is correct.
Title: Re: Triger plgVmOnPaymentNotification
Post by: rosen4o on November 21, 2011, 13:39:08 PM
Thanks
Title: Re: Triger plgVmOnPaymentNotification
Post by: bob30 on December 28, 2011, 17:41:56 PM
Hello, I am developing payment gateway for virtuemart 2.0 and having problems with plgVmOnPaymentNotification method. When plgVmOnPaymentNotification is triggered paypal gateway starts executing code without any checks, gets undefined index error (because of different data) and due to improper data validation exist script execution and therefore my plugins plgVmOnPaymentNotification method is not being executed. The interesting part is that there is no created paypal payment method in Virtuemart admin. Paypal code that screws up (note the "exit"):

if (!$virtuemart_order_id) {
       $this->_debug = true; // force debug here
       $this->logInfo('plgVmOnPaymentNotification: virtuemart_order_id not found ', 'ERROR');
       // send an email to admin, and ofc not update the order status: exit  is fine
       $this->sendEmailToVendorAndAdmins(JText::_('VMPAYMENT_PAYPAL_ERROR_EMAIL_SUBJECT'), JText::_('VMPAYMENT_PAYPAL_UNKNOW_ORDER_ID'));
      
       exit;
}

Should I recommend my clients to uninstall paypal payment plugin? Or maybe there will be a fix soon? I do not want to make core code or other plugin code changes.
Title: Re: Triger plgVmOnPaymentNotification
Post by: alatak on December 28, 2011, 17:58:01 PM
Hi,

yes you are rith. There is abug there.

Meanwhile i fix it coorectly, you can replace that code with
if (!$virtuemart_order_id) {
      return;
}
Title: Re: Triger plgVmOnPaymentNotification
Post by: Pisu on December 29, 2011, 17:11:24 PM
Can you say if the way to call the "plgVmOnPaymentNotification" event will be always the same, after that fix? You will only fix that code in Paypal plugin?

There is a thing I don't understand.. In the plgVmOnPaymentResponseReceived event you have passed a "pm=XX" parameter, to know the ID of payment plugin, so you don't have to cross-check with the order number. Why this "pm=XX" is not used also in plgVmOnUserPaymentCancel and plgVmOnPaymentNotification? I think it would be more clear.
Title: Re: Triger plgVmOnPaymentNotification
Post by: DannyM on January 06, 2012, 20:02:36 PM
Quote from: Pisu on December 29, 2011, 17:11:24 PM
Can you say if the way to call the "plgVmOnPaymentNotification" event will be always the same, after that fix? You will only fix that code in Paypal plugin?

There is a thing I don't understand.. In the plgVmOnPaymentResponseReceived event you have passed a "pm=XX" parameter, to know the ID of payment plugin, so you don't have to cross-check with the order number. Why this "pm=XX" is not used also in plgVmOnUserPaymentCancel and plgVmOnPaymentNotification? I think it would be more clear.

yes, I have same question?