Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19945

api.contribute.repeattransaction fails to renew membership under certain conditions

    Details

    • 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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              peterhartmann Peter Hartmann
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: