uc_roles and PayPal IPN

Posts: 16
Joined: 08/16/2007

The uc_roles does a nice job of granting roles when order status is changed from pending to processing or shipped. Can the PayPal IPN notice trigger this automatically?

It looks like we need additional (or different) status options AND the ability to grant the roles automatically

I have a live site now that uses PayPal Standard. We get an IPN notice on the invoice when the payment has been completed at paypal. It would make sense for this to then change the status of the ubercart invoice automatically from pending which will then hopefully trigger the uc_roles module to add the appropriate role to the users account.

Posts: 5619
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Hmm.. you're right, it would be helpful to have a function that fires off whenever an order has been paid in full. There isn't anything at the moment, but it wouldn't be hard with a few lines of code. I'll be working on customizable and better integrated order statuses today if you can hold out a bit longer. Smiling

Posts: 116
Joined: 08/08/2007
Brain Stormer

Yes. This is a very useful idea.

I'm thinking a little more along these lines.

Would it be possible to determine the product "type" or "class" in the ipn? For instance "downloadable" or "subscription"? This could be done by a field, the actual product name or even a product id (node).

Then when the ipn is recieved, the customer that just bought the item and now has an uc / drupal account is assigned to a role. Or some other kind of permissions. That role or permissions can then be used to grant access to files or site content or whatever. Possible?

It's basically the foundation of subscription or download products.

That means that it probably would be good to have two sets of callbacks:

1) It might be cool to allow the current IPN callback to take an additional array argument that would contain an ordered list of callback functions to be executed in array index order on IPN callback

2) Then store admins can plug in callbacks as they see fit for their individual stores. This allows flexibility in the IPN mechnism.

3) Since you can plug in any callback into that array, i'd like to see a roles or permissions hook in uc to handle it.

thoughts?

Posts: 1376
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Sounds like a great idea to me, guys. I haven't yet gotten to the point where I can test fully our UC install. Is it setup right now to NOT automatically change an order's status from "pending" to "complete" based on a callback from PayPal? What about credit card orders?

Sorry I'm posting here, seems like you guys were kind of getting into that thread of conversation - so I thought I'd ask Smiling Thanks!

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 116
Joined: 08/08/2007
Brain Stormer

That's cool. I think this thread was more specific to PP IPN callbacks but i imagine the main callback could be generic enough to be used by a number of payment methods.

Note, that this callback mechanism as i proposed purely provides the infrastructure / hook to allow for payment callbacks. It doesn't actually provide the roles, file downloads, etc and other funcitonality i mentioned. folks would have to step up to the plate to write the callback functions to perform those ops. The key is having a hook that's generic enough to use for different payment methods.

Posts: 16
Joined: 08/16/2007

You are addressing EXACTLY the issue I was trying to present. I used the IPN example because that was the only callback I knew about.

The uc_roles modules seems to do a good job of adding user roles when the pending payment is changed to shipped, I am suspecting that it will also work when pending changes to processing (but I am not sure...yet)

I realize there are a lot of considerations to make, and additional status terminology might be needed also. In this case the status workflow might be 'order pending'--'payment received'--'order completed' with the 'payment received' being the only one automatically incremented by any of the payment method callbacks available.

I will be watching for any progress in this area...I hope my comments are helpful

Posts: 116
Joined: 08/08/2007
Brain Stormer

lowell, fwiw i'm frying other fish right now so i don't anticipate adding any code to implement this in the near future. I was merely pointing out ways that it might be best achieved. the uc guys prioritize the many feature requests they receive along with bug fixes. I imagine that list is growing all the time so picking and choosing what gets done is challenging.

therefore, i recommend that if you don't write this code yourself to periodically and actively (politely Smiling) followup on the status of this feature if you really want it. otherwise it may fall to the bottom of the list as other requests are deemed more important.

fwiw, if you have any php skills you might want to try yourself.