News:

Support the VirtueMart project and become a member

Main Menu

Developing a VM Extension / Plugin

Started by xpozay, July 14, 2011, 11:44:55 AM

Previous topic - Next topic

xpozay

Hi there,

I was just looking through your wiki for payment plugins and found this class - plgVmOnConfirmedOrderStorePaymentData(),

Is this the class that we would use to initiate a call after a confirmed order?  For example, if I wanted to update some external databases with customer information after a successful order.

Thanks

alatak

#1
Hi,

Actually it depends how your payment is confirmed: if the order is confirmed via an asynchrone notification (like notify for paypal), you should use plgVmOnPaymentNotification function.

xpozay

OK thanks.

Does this then mean that if I allow payment from paypal, cheque, athorise.net each would require their own plugin?  I would have thought that upon order status change a call to external plugin would be feasible.

Milbo

this looks like to 2 questions mixed.

First every payment needs its own plugin. We want to provide a generic plugin for form based payments as you had already in vm1.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Dade

Hi all,
I'm new to this forums as I'm dealing for the first time with VirtueMart component due to a new project I'm working with.

Just to share with the rest of the community that I'm trying to create a payment extensions for AlphaUserPoints component. I am not a programmer at all (but I learn fast :P), hence I may share with the community the code to get it improved and free.

Great component btw, I had already tested older beta release of VM 2.0 and it has been a nice improvement. I will try to report bugs when I find them.

GGz!

xpozay

Thanks.  Actually there should only be 1 question - which is in my original post.  Just trying to confirm that only that one class "plgVmOnConfirmedOrderStorePaymentData()"  is required to be called post confirmed order.  My aim is to update an external table with some of the order details.

However, alatak statement has confused me, saying that it depends on how the payment is confirmed.  I would have thought that no matter how the payment is done, a single class can be used for "post confirmed orders".  From a process / business point of view, we don't really care how something is paid as long as it is paid.

Thanks for your help


alatak

HI

Sorry if i confused you.
May be you can tell me what kind if payment you are trying to develop, and may be I can be more helpfull.


xpozay

Hi thanks.

I am actually not trying to create a payment.  I want to initiate a task after any successful order (ie confirmed order whether paid or not).  For example, as soon as a order is confirmed (paid or free), then I want to make a call to a function which will update a series of external databases such as an event or CRM system.

Thanks

Milbo

imho and afaik,

the function plgVmOnConfirmedOrderStorePaymentData is just replaced by plgVmOnPaymentNotification. This is a small "error", yes. I have to restructure it a bit. But in your case only the name of the function may change (and then within the next 2 weeks).
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

xpozay

Hi again,

I was just looking back through some of my older posts.  This particular thread I didn't think was addressed completely - perhaps I didn't communicate my thoughts well enough.  At the same time I came across this post
http://forum.virtuemart.net/index.php?topic=90563.0
which is after the "same thing" or at least after the same process / concept.

Basically, I think it is imperative that there be a way to call pieces of code (VM or 3rd party) once particular events happen.  For one, it would be when an order status has changed, say from pending to completed.  This will allow developers to create code that adds users to groups, perform calculations on data, send email notifications, run a report, etc.  the list is endless.

For me, once a payment has been confirmed, I need to execute the following tasks:
- send notification
- add user details to database records
- call a web services function to grant user access to another application (external to Joomla)
- generate an invoice
- create a pdf certificate
- create an email account - again using web services

Now I don't expect VM to do all of this, however, It would seem appropriate for VM to kick off the process as it knows when a particular event has occurred.

This is done well in Tienda today and works wonderfully.  It's easy to setup and allows Tienda to manage the payment and the 3rd party code to its job too. With the earlier releases of VM we had to hack the payment class code such as ps_paypal, etc. code to make the calls.  Clearly hacking the code would not be a desirable solution.

Is there now a way to achieve this?

Thanks


alatak

Hi

Did you even try VM2?
QuoteFor me, once a payment has been confirmed, I need to execute the following tasks:
- send notification
It does

Quote
- add user details to database records
It does

Quote
- call a web services function to grant user access to another application (external to Joomla)
It does not yet. But really this is an advanced feature.

Quote
- generate an invoice
It does not yet. Just create an invoice is not difficult. But the invoice should be coupled with a delivery system.
Phoca did a great job for VM1. May be they will adpat to VM2?

Quote
- create a pdf certificate
Joomla 1.7 does not support PDFs any longer. And anyway will be coupled with the invoice / delivery system.

Quote
- create an email account - again using web services
an email account? using web services?
An user account is created.
why using web services?

Please try first VM2, and then send us recommendations!


ursule15

#11
I am exactly same request as xpozay, and no, afaik, vm or vm2 does not have this feature (but I'm not an expert, I will appreciate to be wrong on that point).

Basically, the idea is to launch sql request (or whatever code it is) after order has been confirmed (or whatever order status we want).

Any idea what is the modification / hack to do ?
What function / class  to use ? plgVmOnConfirmedOrderStorePaymentData  ? plgVmOnPaymentNotification ? Something else ?

@alatak - Valerie, des idées ? ;-)

Thanks.


Cleanshooter

As Valerie mentioned many of the tasks that you want to do are done with-in VM already.  If you want to modify the process you would probably need to "hack" or modify the code.  Especially if you want VM to modify external/custom databases.   The other option is to create a VM2 plug-in that will handle the tasks you described.  However in order to create a plug-in you may want to wait until VM2 is released.
- Cleanshooter