I'm trying to figure out how cancelled PayPal WPS subscriptions are supposed to be expired.

The fees associated with the PayPal subscriptions are set to own_handler = 1 in the database, but uc_recurring_get_fees_for_expiration() only looks for fees that have own_handler = 0. This looks like uc_recurring is expecting PayPal to handle the expiration, but, as far as I can tell, there aren't any further IPNs coming from PayPal once a subscription is cancelled.

Comments

univate’s picture

When I used paypal a few years ago they sent a IPN message on expiration - i think its a message with txn_type = "subscr_eot"

Not sure the paypal code here is handling that message to actually "expire" the subscription - shouldn't be a massive amount of effort to add that.

Take a look in modules/uc_recurring_hosted/uc_recurring_hosted.paypal_ipn.inc

  case 'subscr_eot':
  case 'subscr_cancel':
    $fees = uc_recurring_get_fees($order);
    if ($fee = $fees[0]) {
      uc_recurring_fee_cancel($fee->rfid, $fee);
    }
    $ipn->txn_id = check_plain($_POST['subscr_id']); // subscriptions do not have a txn_id, so we will record the subscr_id instead
    break;
KirkF’s picture

Since I'm not seeing any PayPal IPNs for expiration, I figure I can modify the query in uc_recurring_get_fees_for_expiration() to ignore the own_handler setting.

Before I do that, though, I wanted to make sure that this won't cause any other problems - I don't think it will, since the site is only using PayPal for purchasing subscriptions.

Thanks!

dunx’s picture

Issue summary: View changes

So a WPS recurring fee doesn't actually expire? Not ideal and a fairly major issue!

No idea why a WPS recurring order is set to have its own handler as the subscr_eot IPN is treated exactly the same way as a subscr_cancel.

As the poster above said, just modify the sql in uc_recurring_get_fees_for_expiration.

From:
$result = db_query("SELECT * FROM {uc_recurring_users} WHERE remaining_intervals = 0 AND next_charge <= %d AND own_handler = 0 AND status <> %d ORDER BY order_id DESC", time(), UC_RECURRING_FEE_STATUS_EXPIRED);

To:
$result = db_query("SELECT * FROM {uc_recurring_users} WHERE remaining_intervals = 0 AND next_charge <= %d AND (own_handler = 0 OR (own_handler = 1 AND fee_handler = 'paypal_wps')) AND status <> %d ORDER BY order_id DESC", time(), UC_RECURRING_FEE_STATUS_EXPIRED);

And yes, I know... I should be moving to D7 before anybody else says it ;)

apaderno’s picture

Status: Active » Closed (outdated)

I am closing this issue, since it's for a Drupal version no longer supported.