News:

Looking for documentation? Take a look on our wiki

Main Menu

Triger plgVmOnPaymentNotification

Started by rosen4o, November 20, 2011, 09:22:56 AM

Previous topic - Next topic

rosen4o

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???

alatak

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.

rosen4o

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?

alatak

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.

rosen4o


bob30

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.

alatak

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;
}

Pisu

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.
Pisu - Team VMItalia (Supporto Italiano VirtueMart)
www.stefanobagnatica.it | www.vmitalia.net

DannyM

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?
Web Designer  <- PL|UK : VirtueMart Support
Platform: Mac OsX
http://www.danielmiara.com