Type: New Feature
Affects Version/s: None
Fix Version/s: 1.5
Implement, test and document required APIs for the "Member" component classes. All APIs should follow our "new standards" (refer to the May 30 comment section here: http://issues.civicrm.org/jira/browse/CRM-983).
Membership APIs generally deal with one contact and (mostly) with one Membership record. Contact ID and MembershipType ID are passed as input params (we don't pass objects as input params).
- create_contact_membership : Requires contact ID and membership type. Other input params are optional. Default start date = current date; default end date and status are calculated based on membership type and membership status rules.
- get_contact_memberships: Requires contact ID, returns array of all memberships - including Membership properties. Also resolve and include the Membership Type "name" and Relationship Type "name".
NOTE: We also need this API to return memberships for contacts that are members based on their relationship to a direct member. Example: If contact_individual cid=23 is a "Household Member" of a contact_household (cid=21) record which has a Membership record - AND the MembershipType of this Membership record has a populated relationship_type_id value of 7 (Household Member of) - then get_contact_memberships should return the Membership record for both cid 23 and for cid 21.
- calc_membership_status: This API uses the "rules" encoded in the membership_status table to derive the MembershipStatus of a given Membership record. Requires Membership ID as input. Returns the MembershipStatus ID and Name. (This API will be used by the cron job that we implement to periodically update
Extend create, get, update contribution APIs to handle the two additional Contribution properties: