Documentation

OrderCompleteSubscriber extends AutoService
in package
implements EventSubscriberInterface uses IsActiveTrait

Class OrderCompleteSubscriber

Tags
service

civi_membership_order_complete

This class provides the default behaviour for updating memberships on completion of contribution (On "Order Complete")

Table of Contents

Interfaces

EventSubscriberInterface

Properties

$active  : bool

Methods

getSubscribedEvents()  : array<string|int, mixed>
isActive()  : bool
onOrderComplete()  : void
Default handler for Membership on "Order Complete" Note that the "civi.order.complete" will trigger for all "Completed orders" so you should check if there is actually a membership to update.
setActive()  : $this
getRelatedMemberships()  : array<string|int, mixed>
Get memberships related to the contribution.
updateMembershipBasedOnCompletionOfContribution()  : void
Update the memberships associated with a contribution if it has been completed.

Properties

Methods

getSubscribedEvents()

public static getSubscribedEvents() : array<string|int, mixed>
Tags
inheritDoc
Return values
array<string|int, mixed>

onOrderComplete()

Default handler for Membership on "Order Complete" Note that the "civi.order.complete" will trigger for all "Completed orders" so you should check if there is actually a membership to update.

public onOrderComplete(OrderCompleteEvent $event) : void
Parameters
$event : OrderCompleteEvent

setActive()

public setActive(bool $active) : $this
Parameters
$active : bool
Return values
$this

getRelatedMemberships()

Get memberships related to the contribution.

private static getRelatedMemberships(int $contributionID) : array<string|int, mixed>
Parameters
$contributionID : int
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

updateMembershipBasedOnCompletionOfContribution()

Update the memberships associated with a contribution if it has been completed.

private static updateMembershipBasedOnCompletionOfContribution(int $contributionID, string|null $changeDate) : void

Note that the way in which $memberships are loaded as objects is pretty messy & I think we could just load them in this function. Code clean up would compensate for any minor performance implication.

Parameters
$contributionID : int

The Contribution ID that was Completed

$changeDate : string|null

If provided, specify an alternative date to use as "today" calculation of membership dates

Tags
throws
CRM_Core_Exception
throws
UnauthorizedException

        
On this page

Search results