Hi,
I am about to migrate an existing payment solution from virtuemart 1.x to 2. I have three questions.
I see that everything is different, and the module should now be implemented as a plugin.
1. Does any guides exist for porting from old payment extensions to new payment plugins?
Also i have looked a bit at the standard and paypal solution for v2 - a method called "plgVmAfterCheckoutDoPayment" is used. But i cannot find any documentation at all about this function.
2. Any fresh documentation that describes plgVmAfterCheckoutDoPayment?
3. Should i wait with the implementation until v2 is more mature and documented, or can i expect the current release to be close to the final thing?
Regards Jens
Hi,
I rewrote the payment workflow last week.
QuoteAlso i have looked a bit at the standard and paypal solution for v2 - a method called "plgVmAfterCheckoutDoPayment" is used. But i cannot find any documentation at all about this function.
And added some functions. I still need to update the wiki ...
I will tell you as soon as i have done it.
If you use the SVN you can have a look at the new paypal plugin.
i have question :)
how to get paramters in plgVmOnPaymentNotification?
$params->get('some_param');
Hi,
Please have a look at the paypal plugin.
yes, but in PP function > plgVmOnPaymentNotification dont have parametrs :)
Hi,
Quoteyes, but in PP function > plgVmOnPaymentNotification dont have parametrs :)
Are we looking at the same code?
here are the parameters for that function
function plgVmOnPaymentNotification($pelement, $virtuemart_paymentmethod_id, $return_context, $virtuemart_order_id, $new_status)
The method called plgVmAfterCheckoutDoPayment has been replaced by:
function plgVmOnConfirmedOrderGetPaymentForm($virtuemart_order_id, $orderData, $return_context, $html)
All the bank payment i know have a return context parameter in their forms. You must send it.
And afaik, this parameter is always sent back with the notification.
This parameter actually contains the session id. It is used when the shopper did not return to the shop after his payment, to delete his cart.
Quote1. Does any guides exist for porting from old payment extensions to new payment plugins?
plgVmOnPaymentNotification corresponds to the notify.php for paypal for example in VM1.
plgVmOnConfirmedOrderGetPaymentForm correspond to the code that was excuted in the "more payment info" in VM1
thx, but my mistake
I try add to function plgVmOnPaymentNotification param $params->get('debug')
enyone?
Hi,
Yes i can help.
But what is the question?
:)
how add paramter
$params->get('debug')
to plgVmOnPaymentNotification?
I add
$params = new JParameter($paramstring);
$params->get('debug')
Hi,
Payment methods are joomla plugins.
The parameters you have in $params come from the xml file.
Please read this
http://docs.joomla.org/Creating_a_Plugin_for_Joomla_1.5
and ofc
http://dev.virtuemart.net/projects/virtuemart/wiki/Plugin_system
ok i know
but tell me - why the double set param?
1. once in plugin
2. second in vm payments
Hi,
No there is no double set of parameters. There is only one xml file. There is one Joomla plugin.
But you can use several times the same plugin.
Look at the shipping. You have one Joomla plugin, but you can reuse the same ode to create several rates.
You can do the same with the payment.
The xml gives you the possible params, as in joomla
But the values must be stored in the datebase, for this we provide some tools, so that plugins can use their own tables.
ok thx
how to send post_variables method="post"? :)
I don't know what happen but after installation com_virtuemart.1.9.8k my payment plugin not working :(
Hi,
did you see that post:
http://forum.virtuemart.net/index.php?topic=92568.0
yes, but i have different problem.
VM (k)
1. On start front page -> white page - > helped turn off vm cart module
When I go to cart I see white page (J1.5 & 1.7) - new/clear installation vm (k).
2. my payment plugin not working (based on PPal from vm (g) )
:(
Hi,
You cannot mix G plugin versions with the component version J.
Hi,
The payment form is displayed by the function plgVmOnConfirmedOrderGetPaymentForm().
Please explain to me:
Before notify:
paymentnotification&pelement=paypal
now is:
paymentnotification&tmpl=component
What is a "component"?
How do you identify a payment?
Hi,
&tmpl=component is used in the query string when there is no need to call the modules, menus, and any other template stuff, which is the case in Payment notification.
In the case of Paypal, in the call plgVmOnConfirmedOrderGetPaymentForm(), some data is stored in the paypal payment table, and specially the order number.
On receiving the paypal Notification, you get data in a POST. And in the POST you get back the order number.
By looking in the paypal payment table, you can identify your payment with the order number.
If you don't find the order number, that means that it is not the correct payment method.
And if you find it, then you can process the notification.
This is payment dependant. You can add what you want/need in the query string.
Quote from: alatak on November 07, 2011, 18:25:53 PM
Hi,
&tmpl=component is used in the query string when there is no need to call the modules, menus, and any other template stuff, which is the case in Payment notification.
Hi,
I see but how identifies the payment plugin: This is PayPal but no LLoyds, DUpay etc.
Before notify:
paymentnotification&pelement=paypal
paymentnotification&pelement=LLoyds
paymentnotification&pelement=DUpay
Can I add &pelement= to URL?
Hi,
Yes you can, if you need it.
But anyway Joomla scans all payment.
If you need to have the pelement to make sure that it is the correct payment plugin, you can add it.
For Paypal, i use the order number to find out if it is the correct payment plugin.
ok thx i try ;)
Hi I'm back :)
I have question
function plgVmOnPaymentNotification() {
if (!class_exists('VirtueMartModelOrders'))
require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
$data = JRequest::get('post');
$order_number = $data['control'];
$virtuemart_order_id = VirtueMartModelOrders::getOrderIdByOrderNumber($order_number);
$method = $this->getVmPluginMethod($payment->virtuemart_paymentmethod_id);
echo $method->status_success;
return true;
}
My $method->status_success is empty ... but why?
hi
look how it is done in paypal. And do the same :)
because in your code $payment is not set
you forgot that line
$payment = $this->getDataByOrderId($virtuemart_order_id);
THX now works fine ;)
Paypal pluging exits if there is no parameter named invoice in the post or if it doesn't macth any order id.
I'm trying to develop a payment module that also need an asynchronous notification and I want it to be compatible with paypal plugin so that the shop owners can have both instaled and published at the same time.
If I use JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'), as notification URL in my plugin and the paypal plugin is also installed paypal plugin spoils the process because my bank doesn't send any parameter named "invoice" and the plgVmOnPaymentNotification methos of my plugin is never executed.
Everithing works fine If I uninstall the paypal plugin or if i comment the line 365 in the paypal.php. But this is not valid for me because I would like to distribute my pluging and its installation shouldn't interfere with other plugins.
Is this a bug in paypal plginc or is thera any workaround?
Quote from: ZhenIT Sofware on January 26, 2012, 17:57:54 PM
If I use JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'), as notification URL in my plugin and the paypal plugin is also installed paypal plugin spoils the process because my bank doesn't send any parameter named "invoice" and the plgVmOnPaymentNotification methos of my plugin is never executed.
Your bank must send to you order_id or order_number to identify payment.
This is a "strange" solution. Some bank have problem with redirect this url/param
Of course, our bank sends us the order_number but in the POST but the parameter name is not "invoice".
At index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component the plgVmOnPaymentNotification of all installed plugins are called, if it happens that the plgVmOnPaymentNotification of paypal plugin is called before the plgVmOnPaymentNotification of my method as there is no pamrameter named "invoice" the paypal plugin exits (line 365) and the plgVmOnPaymentNotification of all other plugings are not called.
Let's say that paypal plugin has some kind of egocentric behaviour.
Well, what I mean is that paypal's puging behaviour should be more like "Oh! there's no parameter named invoice. Ok, then this notification might not be addressed to me let's return it" but what it does is "There is no parameter named invoice, this must be an error I'll abort"
I have reported the same issue. The PayPal module should do a check to see if it is the correct payment method to action the IPN request. Better yet, the correct IPN request should be called outright and not run through all the modules that have that function.