Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Important
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.24, 4.7.15
-
Component/s: CiviCRM API
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Contributed Code
-
Verified?:No
Description
Passing contribution_recur_id to api.contribution.repeattransaction is presented as a valid way to process a recurring contribution and in turn renew a membership if one is associated with the recurring contribution.
What it actually does is repeat the previous transaction because of 'sort' => 'id DESC'.
This presents a problem with a very common real world scenerio: Member funds not avaiable -> card declined -> funds become available -> payment made.
Specifically, here's how it plays out.
1. A members credit card fails and we record that with as a failed contribution record.
2. When the funds become available the transaction goes through, we run api.contribution.repeattransaction(recur_id).
3. This repeats the failed contribution.
Seems like two choices are search for the previous Completed contribution instead of unconditionally the previous contribution.
Or try to guess what the intention of a failed contribution was.
I like the former.