I've been looking at the issue shown in a screenshot attached to this post where, upon subscription purchase, user role is upgraded twice - even if payment status is not 'complete'.

I haven't fully debugged this, but I have made a little headway. Sorry I can't create a patch, but I can describe the code change that partially fixes this and point to the general location in the code where I *think* the remaining problem lies.

Using $Id: store.module,v 1.81 2006/03/04 03:11:34 gordon Exp $,

around line 765, store_change_role() doesn't seem to be conditional on a payment status of 'complete'...
so just change store_change_role($txn, $add_to_roles); to

  if ($paid) {
  store_change_role($txn, $add_to_roles);
  }

and from what I can tell, all will be well with *that particular instance* of the user role upgrade. (It happens properly, only on completed payment.)

Now, as for the other instance...

I've tinkered with store_change_role() on line 723, as well as the conditions for $add_to_roles = TRUE; on line 694. Nothing I've tried has had a correct impact on that instance, so I'm at a loss there.

Just thought I'd post what I have thus far in case it helps anyone who has plans to look at this issue.

Comments

guckie’s picture

Oops! I left this out...

Around line 735
change
if ($txn['payment_status'] == payment_get_status_id('completed')) $paid = TRUE;
to

     if ($txn['payment_status'] == payment_get_status_id('completed')) {
         $paid = TRUE;
         }

The partial fix I posted about doesnt work without this edit.

sime’s picture

Component: store.module » ec_recurring
Status: Active » Fixed

assume not relevant with new code

Anonymous’s picture

Status: Fixed » Closed (fixed)