Invoke paypal payment when node is updated

EmmaD - December 2, 2007 - 16:51
Project:PayPal Node
Version:5.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:budda
Status:by design
Description

I'm using taxonomy terms to differentiate between a paid and free listing. This works well - when 'paid' is selected, paypal node sends the user to paypal; when 'free' is selected, paypal is not invoked.

However, I need to invoke paypal if the term changes as well. Since paypal node does not get called when content is updated, I can't get this to happen.

If a 'listing' changes from 'free' to 'paid', the user needs to be redirected to paypal. What part of the code determines when paypal is invoked? Is this something i could change?

Thanks.

#1

budda - February 9, 2008 - 17:54
Assigned to:Anonymous» budda
Status:active» needs review

The magic happens in function paypalnode_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { function of paypalnode.module

I think you just need to add a check for 'update', such as:

...
switch($op) {
                        case 'update':
case 'insert':

        // If the content is going to cost to publish, collect the money

        $amount = paypalnode_calculate_fee($node->nid);
...

Let me know if it works for your setup - will save me setting up a test site to simulate what you're doing.

#2

budda - February 29, 2008 - 00:20
Status:needs review» by design

I added this functionality, then removed it. The reason being - it will mess up the payment reporting because this looks at the last price that was calculated.

If somebody pays for one combination, then changes the terms and pays for another combination, the reporting would loose details about the first payment.

Make your users create new nodes. Maybe provide a way to clone the current one (node clone module?).

 
 

Drupal is a registered trademark of Dries Buytaert.