I'm working with @wmortada debugging some recurring contribution membership renewal issues.
We have lots of memberships with recurring contributions but some of the memberships are not updating as expected when the recurring contribution is received.
The memberships that were not updating were not linked to the recurring contributions via the
civicrm_membership.contribution_recur_id field. So we added recurring contribution the link manually. My assumption was that when a contribution for a recurring contribution linked to a membership in this way is received, it would be linked to the membership. But this is not happening for those where we added the field manually.
As a result (as I understand it)
CRM_Contribute_BAO_Contribution::updateMembershipBasedOnCompletionOfContribution() is unable to find the related membership and update the membership end date.
We are using @artfulrobot's GoCardless extension for the recurring contribution.
civicrm_api3('Contribution', 'repeattransaction', $contribution); passing in params for a contribution linked to the recurring contribution.
Can anyone point me to the code that adds a membership payment for a contribution created by
Contribution.repeattransaction. Or do I have the wrong end of the stick?