News:

Looking for documentation? Take a look on our wiki

Main Menu

Payment plugin development

Started by smashingpumpkins, October 05, 2011, 22:42:26 PM

Previous topic - Next topic

DannyM

I don't know what happen but after installation com_virtuemart.1.9.8k my payment plugin not working :(

Web Designer  <- PL|UK : VirtueMart Support
Platform: Mac OsX
http://www.danielmiara.com

alatak


DannyM

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

alatak

Hi,

You cannot mix G plugin versions with the component version J.

alatak

Hi,

The payment form is displayed by the function plgVmOnConfirmedOrderGetPaymentForm().

DannyM

Please explain to me:

Before notify:
paymentnotification&pelement=paypal
now is:
paymentnotification&tmpl=component

What is a "component"?

How do you identify a payment?
Web Designer  <- PL|UK : VirtueMart Support
Platform: Mac OsX
http://www.danielmiara.com

alatak

#21
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.




DannyM

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

alatak

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.

DannyM

Web Designer  <- PL|UK : VirtueMart Support
Platform: Mac OsX
http://www.danielmiara.com

DannyM

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

alatak

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

DannyM

Web Designer  <- PL|UK : VirtueMart Support
Platform: Mac OsX
http://www.danielmiara.com

ZhenIT Sofware

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?

DannyM

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