Webform CiviCRM Integration - Membership rules improvements


Overview 

The aim of these proposed changes is to facilitate more complex membership renewal structures in Webforms, for which start and end dates of new and existing memberships can be determined by/and or dependent upon a number of variables. Many organisations allow the purchase of more than one membership type simultaneously, and allow others to be added throughout the course of existing memberships. Often these 'add-on' memberships are not valid without an active 'base' membership and as such their start and end dates should be aligned.



Summary 

Phase 1:

Milestone 1 - Membership auto-select and Start Date

  • Automatically select by default all membership options that are currently active for the user
  • Start date visual changes: Adding all extra fields to membership tab as per mockup (incl help texts)
  • Logic for start date +membership types fields
Milestone 2 - End Date
  • End date visual changes: Adding all extra fields to membership tab as per mockup (incl help texts but excluding reduce number of instalments to fit shorter period option)
  • Logic for end date +membership types fields
  • Logic for pro-rate price of membership field
Milestone 3 - Validation
Phase 2:
Milestone 4 - Recurring Contribution Handling
Milestone 5 - Membership Extras Integration


Phase 1

(1) Membership auto-select and Start Date


IDRequirementSpecification
Notes/ Wireframes
1

Checkbox: Automatically/ default select all membership options that are currently active for the user





Current behaviour:

When a contact has only one membership and webform offers only 1 membership type to select, then webform will select this membership type on the form.

If I have more then one membership and there are multiple memberships available to select, and I already have several of them, webform will only pick one of them to select, even if both of the available options are provided separately as separate memberships on the webform. (Webform doesn't allow multiselect of memberships in one field).

Use case:

It is possible that a contact may have multiple memberships. When coming to renew, currently only the primary membership would be selected by default and the user would have to select any further memberships again.

For example: It may be that they have one "primary membership" and several "add on's" that they have purchased either at the same or a later date.

Proposed behaviour:

1.  If webform is being completed by an existing user/ organisation member, the form should recognise what active membership types the user already has and should pre-select form fields with existing membership types that I have, if they are available on the form.

The preferred configuration to support this would therefore be to create multiple "memberships", each with only one option fixed from the webform field configuration side. 


nb. We are not sure if we need an administrator option for this or we should just improve behaviour for this use case?





Configuration:

  1. Create multiple memberships with user select:

Specify base memberships as part of membership 1:

 

Specify add-ons as part of memberships 2+3: (similar configuration for both types)

Webform should select add-ons that I have as well as main membership that I have:

2

Start date visual changes: Add extra fields to webform membership tab (including help texts)





Current behaviour:

In Webform/CiviCRM it is not possible to specify the start date of a new membership comparatively to an existing membership. The system will either:

  • Start a new membership immediately as a new membership type (if it has a different membership organisation) leaving an existing membership record of a previous type.
  • Change your existing membership records "type" to the new membership type (if it has the same membership organisation) thereby removing any history of the contact having had the previous membership type.

It is not possible to delay the start of the new membership to the end of an existing membership of a different type.

Use case:

Organisations may wish to defer the start date of a membership to the end date of an existing membership when the contact is changing type. For example when I upgrade from a Junior to a Full membership, this should start only at the end of the Junior membership.

Organisations also may also want to make a membership start on a particular date, say when they have a fixed annual start date of membership.

Proposed behaviour:

  1. In Webform CiviCRM "Membership" Tab, add a "Start Date" select field to each membership instance. The select field should have the following options:

a) Automatic

(note: that this may not be immediate if you are renewing or in grace etc).

b) User select

c) Relative to active membership end date

2. Add a help icon with the following help text to the field label:

"'Automatic' indicates that the start date will follow normal CiviCRM rules. i.e. New memberships will start immediately from date of sign-up and renewals will extend memberships.

User select will create a new webform date component that the administrator can configure in many ways including adding a fixed or relative start or end date.

'Relative to active membership end date' will modify the start date of the new membership as follows:

It will first check whether the user has an existing membership of this type. If so it will follow the automatic membership rules.

If the user does not have a membership of this type, it will create a new membership and then check if the user has any active memberships of the relevant types specified. If not then the system will follow automatic membership rules.

If so it will set the start date of the new membership to be the day following the end date of the existing active membership.

If the user currently has multiple relevant membership types the start date will be one day following the end date of the membership with the latest end date."

3.  If user selects "relative to active membership end date" show a select membership types field. Allow multiselect. Required if shown.

https://compucorp.atlassian.net/browse/BASW-336





Logic for start date & membership field types




Start date field

Automatic - 

No change from current behaviour.

Current behaviour: 

When a new membership is created via webform the start date is immediate, unless the contact already has a membership of the same type they are signing up to. In this case the new membership starts the day after the current one ends. 

Relative to active membership end date - 

Current behaviour: 

In webform CiviCRM it is not possible to specify the start date of a new membership comparatively to an existing membership.

Proposed behaviour: 

New membership start date should be set to the day after the end date of the an existing active membership the user currently have.

This membership should be among the membership types that are specified in the start date rule configuration. If more than one matching membership exists, pick the one that has the latest end date. 

If no membership type is selected, new membership will start immediately once the current active membership with the latest end date has expired. Help text will display "If you do not select a membership type, new membership will start immediately once the current active membership with the latest end date has expired"

Membership type(s) field

  • Should be used to indicate which membership type(s) are relevant to the 'relative to active membership end date' field option. 
  • Multiple membership types can be chosen.



User select 

This has been included in the dropdown options so that the webform admin can implement forced 'automatic' or 'relative to active membership end date' conditionally based on other answers within the form



(2) End Date


RequirementSpecificationNotes/ Wireframes

End date visual changes: Adding all extra fields to membership tab as per mockup (incl help texts but excluding reduce number of instalments to fit shorter period option)




Current behaviour: 

In Webform CiviCRM it is not possible to specify the end date of a new membership comparatively to an existing membership. The system will:

  • End a new membership instance after the full membership period has lapsed. 

It is not possible to limit the duration of the new membership so that it ends at the same time that an existing membership ends. It is therefore also not possible to pro-rate the price of a new membership relative to the reduced membership duration if a new membership were to end at the same time as an existing one. 

Use case: 

Organisations may wish for a new membership to end at the same time as an existing one, for example if they do not allow the purchase of a new membership type without a specific pre-requisite membership type. 


Propossed behaviour: 

  1. In Webform CiviCRM "Membership" Tab, add a "End Date" select field to each membership instance. The select field should have the following options:

a) Automatic

b) User select

c) Relative to active membership end date

2. Add a help icon with the following help text to the field label:

" "Automatic" indicates that new membership end date will be calculated according to the start date and the membership duration"

3.  A "membership type" select field also needs to be added next to the "End Date" field.

  • All membership types will be available as options in the select field
  • The field should only show when "Relative to active membership end date" option is selected in the "Start Date" field.

4. A "Pro-rate price of membership" check box needs to be added next to the 'membership type' select field.

5. Add a help icon with the following help text to the field label: 

"If this box is ticket, the membership price will be calculated based on the number of days left until the end date compared to the number of days in a regular membership period".

6. A field to select Payment Installments: with 3 options should be shown:

  1. Pay in 1 installment
  2. Create a recurring contribution
  3. Add to future installments of relative membership type

7. Add help text icon with the following text for the field label: 

"To do"

'





Logic for End Date +membership Types fields

End date field:

Automatic - 

No change from existing behaviour

Current behaviour: 

When a new membership is created via webform the end date is calculated based on the standard membership term and the membership start date. 

Relative to active membership end date - 

Current behaviour

In Webform CiviCRM it is not possible to specify the end date of a new membership comparatively to an existing membership

Proposed behaviour

New membership will end at same time as specified current active membership type(s)

  1. If no membership type is selected, new membership will end when the current active membership with the latest end date ends. Help text to explain this. ""If you do not select a membership type, new membership will end when the current active membership with the latest end date expires""
  2. If multiple membership types are selected, end date of new membership will be relative to latest (active) end date of selected membership types.

Membership type(s)

  • Should be used to indicate which membership type(s) are relevant to the 'relative to active membership end date' field option. 



Logic for pro-rate price of membership field



  1. If the 'membership fee' field is enabled, then this is the price that should be pro-rated based on the start date of the membership, the number of days in a regular period and the number of days in the pro-rated period. 
  2. If the 'membership fee' field is not enabled, then the pro-rated calculation should be done based on the membership fee pulling from CiviCRM. 



Calculation: 

Pro-rated membership fee = (regular membership fee/ number of days in regular membership period) x number of days in pro-rated membership period

Logic for "Payment Instalments" field
  1. Pay in 1 instalment
  2. Create a new recurring contribution
  3. Add to future instalments of relative membership type

3) Add to future instalments of relative membership type

(Compucorp custom in membership extra's extension)

  • Add lines to recuring contribution template invoice
  • If no future contributions in existing membership plan then create a single contribution to be paid immediately.
  • Otherwise add lines to each available future contribution


(3) Membership date rules validation



RequirementSpecificationNotes/ Wireframes
(a) Validation rules
  1.  If any end date of membership user attempts to purchase is in the past (because of the relative logic), then user should not be able to complete the purchase and should be shown the message: "Unfortuntately you cannot purcahse this item as your membership has expired

2.  If 'relative to active membership end date' is selected and if no active membership of the selected types exists for the user, then we should show an error message. "Unfortunately you cannot purchase this item as your membership has expired".





Phase 2

Milestone 4 - Recurring Contribution Handling




UX improvements on start & end date configs

The following changes are to relabel the configs and options we added in phase 1:

  1. "Start date calculation" containing the following options:
    1. - Automatic -
    2. Selected date
    3. After the end date of selected membership(s)
  2. Adding a help text for "Start date calculation": 'Select - Automatic - to create/ renew membership following default calculation. \n Select "Selected date" to add a start date field to the form. \n Select "After the end date of selected membership(s)" to start the new membership term after an active membership of the selected types'.
  3. "End date calculation" containing the following options:
    1. - Automatic -
    2. Selected date
    3. Match the end date of selected membership(s)
  4. Adding a help text for "End date calculation": 'Select - Automatic - to create/ renew membership following default calculation. \n Select "Selected date" to add a start date field to the form. \n Select "Match the end date of selected membership(s)" to match the end date of the new membership term with the end date of an active membership of the selected types'.

Renew existing recurring contribution
  1. When "After the end date of selected memberships" is selected in the "Start Date Calculation", if instalment option on the contribution tab is also enabled, the "Renew existing recurring contribution" configuration should appear.
  2. "Renew existing recurring contribution" configuration should have a help text containing the following information "When there is an existing recurring contribution containing any of the selected membership types, this membership will be created as a renewal of the existing recurring contribution.

    1. If both the existing recurring contribution and the recurring contribution configuration on the form are not payment in instalments, a new contribution with full amount of the membership will be created under the same recurring contribution.

    2. If either the existing recurring contribution or the recurring contribution configuration on the form is payment in instalments, a new recurring contribution will be created and the old recurring contribution will no longer auto-renew."
  3. Once the webform is submitted, when there is an existing recurring contribution containing any of the selected membership types
    1. if both the existing recurring contribution and the recurring contribution configuration on the form are not payment in instalments:
      1. a new contribution with full amount of the membership will be created under the same recurring contribution.
    2. if either the existing recurring contribution or the recurring contribution configuration on the form is payment in instalments:
      1. a new recurring contribution will be created
      2. the new recurring contribution id will be linked to the "Next Payment Plan Period" field of the existing recurring contribution.

Add to existing recurring contribution
  1. When "Match the end date of selected memberships" is selected in the "End Date Calculation", the "Add to existing recurring contribution" configuration should appear.
  2. "Renew existing recurring contribution" configuration should have the following three options:
    1. No - default
    2. As an upgrade/ downgrade to selected memberships
    3. As an add-on
  3. Once the webform is submitted, when there is an existing recurring contribution containing any of the selected membership types
    1. If "As an add-on" is selected:
      1. the new membership will be created
      2. if the recurring contribution has any unpaid instalment contributions, the new membership amount will be split up evenly and added to each unpaid instalment contribution.
      3. if the recurring contribution has no unpaid instalment contribution, a contribution with the new membership amount will be created.
      4. The membership line will be added to the current period of the existing recurring contribution.
    2. If "As an upgrade/ downgrade to selected memberships" is selected:
      1. the new membership will be created
      2. the end date of the old membership will set to one day before the new membership start date
      3. if the recurring contribution has any unpaid instalment contributions, the old membership amount will be removed from any unpaid instalment contributions. The new membership amount will be split up evenly and added to each unpaid instalment contribution.
      4. if the recurring contribution has no unpaid instalment contribution, a contribution with the new membership amount will be created.
      5. The old membership line will be ended on one day before the new membership start date
      6. The new membership line will be added to the current period of the existing recurring contribution.

Pro-rate price of membership
  1. When "End Date Calculation" is not "Automatic", the "Pro-rate price of membership" configuration should appear.
  2. if "Pro-rate price of membership" option is enabled, the default membership amount will be pro-rated based on the difference of membership start date and end date comparing to the duration of the membership type. e.g. if the membership duration is one year, the difference is 8 months, then default membership amount will be 2/3 of the full amount.

Milestone 5

Overall mockup