compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-589: Changes to accommodate for webforms to update the next contribution date #391

Closed omarabuhussein closed 3 years ago

omarabuhussein commented 3 years ago

Overview

In this PR I did two changes to accommodate for webforms to update the payment plan "next scheduled contribution date":

1- Moved the code that calculates "next scheduled contribution date" for the membership admin to a service class (CRM_MembershipExtras_Service_PaymentPlanNextContributionDate), and created a WebformAPI class (CRM_MembershipExtras_WebformAPI_PaymentPlanNextContributionDateUpdater) that calls it. Now all we need is to call the latter class from webform_civicrm_membership_extras after all the upfront contributions are created, and it will take care of updating the "next scheduled contribution date".

2- I added checks to ensure that the code that corrects the installments received date based on the cycle day will only work for "Monthly" payment plans, since we will soon drop support for cycle day for non monthly payment plans (which as we discussed in our calls before is something that does not make much sense in "annual" payment plans context).