Download & Extend

limitation with ec_recurring and ec_donate

Project:e-Commerce recurring transactions
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

While working on getting recurring donations going with ec_donate, I have found that ec_recurring will only work with a transaction that has items that have a schedule attached to them.

For ec_donate, the transactions have no items, hence ec_recurring won't work. What I suggest is adding another stanza to handle this. It would be located in addition to the code in the ec_recurring_alloc_get_recurring() function in ec_recurring.alloc.inc

if(count($txn->items)==0 && $txn->type=='donation') { // this is a donation transaction
      module_load_include('inc', 'ec_recurring');
      $schedule = ec_recurring_schedule_load($form_state['values']['schedule_id']);
      $recurring = array(
        'name' => $schedule['name'],  
        'start_date' => _ec_recurring_expiry_calc($schedule),
        'price' => $txn->gross,
        'period' => $schedule['numunits'],
        'unit' => $schedule['unit'],
        'repeat' => $schedule['cycles'],
        'description' => 'Donation of ' .$txn->gross. ' recurring every ' .$schedule['numunits']. ' ' .$schedule['unit'],
      );
      return $recurring;

Comments

#1

The only other way I can see this working is for me to code ec_donate to actually add a single $item to the $txn which seems like a hack.

Thanks,
DaveA

#2

I have attached a patch which should address all the needs mentioned above.

Thanks!
Dave

AttachmentSize
patch_to_support_recurring_donations.patch 3.54 KB

#3

Gordon,

Can you please commit this patch?

This adds functionality for donations to be recurring without having to run all of ecommerce.

Thanks,
DaveA