Closed (fixed)
Project:
UC Recurring Payments and Subscriptions
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
27 Jan 2011 at 15:42 UTC
Updated:
27 Mar 2014 at 00:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
univate commentedThat sounds like a feature for 7.x? not that I'm stopping work on this in 6.x, just that until ubercart 6.x supports rules, which sounds like that isn't likely, I'm not sure its worth the effort.
Comment #2
trevorwh commentedUnivate - I don't disagree - but since UC Recurring is still in development, and I need to port to rules anyway (our 6.x env is built on rules), would you be opposed to integrating it if I can get it stable with rules?
Comment #3
univate commentedI wouldn't be opposed to adding rules in 6.x. My preference would be to have this done for 7.x first as it is actually needed to complete the 7.x port (this is the only thing really missing).
Any contributions would be a good start.
Comment #4
nate.dame commentedJust curious -- any progress here?
Comment #5
CraigBertrand commentedI am also wondering about the status of this? I am building with d6 and uc_rules and really need some way to expose uc_recurring events/status to rules.
Comment #6
Xomby commentedAfter patching up the latest dev (2012-Apr-25) with some missing lines from #51 from #992252: uc_recurring Drupal 7 port and the OP post from #1387418: Notice: Undefined index: cancel callback in uc_recurring_invoke() and manually adding a rule for "cancelled subscriptions"... it's working for me so far.
Comment #7
Xomby commentedI don't have time to make a patch at the moment, but here's a zip of the whole module for your review.
I did add the "revoke on cancelled" rule to it though.
enjoy! (I hope)
*note - don't forget to clear caches after you install this, otherwise new rules will not appear (along with some other red text)
Comment #8
Stellanhaglund commentedHi I tried your module with rules, but it does´t work for me.
Have anyone fixed this?
Thanks,
Comment #9
mmilano commentedXomby, I'm about to dig in to make this work for a project I'm on. I can try to make a patch if I get it going.
I ran a diff on your code and most if not all files were modified. To get rules working, is the code to focus on just in the subscription module?
Comment #10
InvincibleCreative commentedI'm also hoping to get this fixed. Any progress @mmilano?
Comment #11
mmilano commentedI'll most likely be digging into this component within a week or 2. I will report if I do have any progress.
Comment #12
univate commentedi pulled out the rules changes into a patch
Comment #13
dsbrianwebster commentedSubscribing
Comment #14
dsbrianwebster commentedI'm willing to pay someone to finish this asap.
Comment #15
duckzland commentedTested the patch, seems working for the initial order creation -> give certain roles.
Tested rules :
1. order creation -> give certain roles.
2. subscription cancelled via paypal -> remove roles
The other rules not tested yet:
1. subscription expired -> give roles
2. subscription expired -> remove roles
3. subscription cancelled -> remove roles4. og stuff
Comment #16
lupus78 commentedI've tested the patch too, and it works! I'm surprised this wasn't fixed in the "Recommended release", many issues are reporting this feature missing: #1355396: Error on Checkout and no Role Assigned, #1921672: Role not being set after initial payment
Comment #17
tinker commentedMinor code cleanup, trailing whitespace, undeclared arrays, missing line at end. (apply with: git am)
Comment #18
tinker commentedSorry please ignore #17 - I forgot to rebase. This is a cumulative patch of work so far and can be applied directly to clean 7.x-2.x-dev.
Comment #19
tinker commented- Renamed uc_recurring rules event labels from "Recurring order renewal..." to "Recurring fee renewal ..." since we are dealing with fees that can be recurring orders or recurring products. These events are invoked on a per fee level, with possibility of multiple fees in one order, so it does not make sense to use order in the title.
- Added rules event 'uc_recurring_product_renewal_created' which is invoked when the recurring product fee is created during checkout. This is different to event 'uc_recurring_renewal_complete' which is triggered when the recurring fee is charged (normally at a later date). This is not invoked for recurring orders. NOTE: there is a bug in ubercart that will stop hook_order('submit') from processing correctly if the customer is not logged in. Please bear this in mind if testing this event. See #1669968: hook_uc_checkout_complete() is called outside of checkout process (when payment is entered)
This is a cumulative patch of work so far and can be applied directly to clean 7.x-2.x-dev using 'git am'.
Comment #20
lukio commentedHi!
I recently test the patch. The order status must be "Completed" or "Payment received" to assigne the role?. I'm testing this module using authorize.net ARB. When I did the checkout ubercart says that the order is Completed but when I open the order, the status is "Payment received", so no role is assigned, because the rules check if the order status is "Completed".
Do u have any idea what could be wrong?
Thanks!
Luciano
Comment #21
tinker commentedLukio, The status has to be completed because that is the only time that ubercart knows the users account or has created one (anonymous checkout or not logged in). The link in #19 is a patch to resolve this exact issue. It will load or create an account when the payment is entered. If/when that patch gets committed the trigger can bee changed to 'When a payment is entered' rather than order status change.
Comment #22
lukio commentedHi tinker,
It would have a problem with correct rule to use 'Payment Received', if my site always must create a user prior to making the purchase?
Thanks!
Comment #23
tinker commented@lukio, You could configure the store not to allow anonymous checkout. If users are always logged in then you can use a rules that works on payment received status or payment entered trigger. Alternatively if you use an instant payment gateway such as Authorize.net then you can use a trigger 'customer completes checkout' with 'order balance <= 0'.
Comment #24
lukio commented@tinker! you rule! ;p
Comment #25
tinker commented@lukio, Glad I could help. Be sure to post back here about your experience using the patch. Let us know if something does not work or if everything works.
Comment #26
dsbrianwebster commentedThanks everyone who helped with this patch. @Tinker, I second the sentiments in comment #24.
Here's my experience with the patch.
1. Patch applied cleanly to current dev version!
2. Grant user roles on subscription created -SUCCESS
3. Revoke user roles on subscription expired - SUCCESS
4. Grant user roles on subscription expired. - SUCCESS
Note: The label for this rule is incorrect: "Grant user roles on subscription created." created should be "expired"
5. Revoke user roles on subscription cancelled. --xomby - SUCCESS
Note: While this worked as expected, I disabled the rule on my project. For the site I'm working on there are annual subscribers. So conceivably someone who paid for a year on Jan 1, then cancels on March 1, with this rule on, immediately has their role revoked even though they paid for the rest of the year. With this rule off, the role successfully expires at the end of the cycle, via the Revoke user roles on subscription expired. This behavior is more logical IMO, but this is still a nice rule/option to have depending on how you want to handle cancellations.
The customer notification email rules weren't working for me, I created my own rules that do work using the send mail action, rather than the Send an order email regarding order renewal action. This may be where the problem lies, will need to dig further though.
What do we need to do to roll this into the alpha branch?
Comment #27
duckzland commented5. Revoke user roles on subscription cancelled. --xomby - SUCCESS
Got the same issue, maybe adding a condition for checking if user still has active subscription before revoking the roles?
Comment #28
univate commentedCommited patch from #19
Comment #29
univate commented