OrderCompleteSubscriber
extends AutoService
in package
implements
EventSubscriberInterface
uses
IsActiveTrait
Class OrderCompleteSubscriber
Tags
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
$active
private
bool
$active
= TRUE
Methods
getSubscribedEvents()
public
static getSubscribedEvents() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>isActive()
public
isActive() : bool
Return values
boolonOrderComplete()
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
$thisgetRelatedMemberships()
Get memberships related to the contribution.
private
static getRelatedMemberships(int $contributionID) : array<string|int, mixed>
Parameters
- $contributionID : int
Tags
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