compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-685: Simplify payment instalment validation logic #424

Closed olayiwola-compucorp closed 2 years ago

olayiwola-compucorp commented 2 years ago

Overview

Before now, the validation performed in the front-end is different from that performed in the back-end when creating a new membership with a payment plan, in this PR we ensure the same validation happens on both the front-end and back-end.

It also includes the work done in this PR where we prevent users from selecting membership types with different periods and duration.

Before

Currently, changes in the UI can allow a user to get around the validation, in some cases, this leads to errors, at times the user is able to create a membership with recurring membership bypassing the validation. laa-gg

After

Now the validation logic that happens in the backend also happens in the frontend. gg

Technical Details

We create a new class CRM_MembershipExtras_Helper_InstalmentValidator that acts as a helper class in performing necessary validation logic for creating a new membership with a payment plan.