public function onBeforeValidateCustomerSubscription(mixed $customer, array $services, mixed $checkin) : bool

Fires before checking whether a customer owns an active subscription.


Description

This hook can be used to apply additional conditions to the subscription validation.

It can be used to skip the default system validations.

NOTE: calling $customer->isSubscribed() would result in recursion.


Parameters

$customer

(VAPCustomer)  The object holding the customer details.

$id

(array)  A list of services to check.

$checkin

(string)  An optional check-in date (UTC).

Return Value

Boolean. True to flag the customer as subscribed, false to flag it as expired or not yet subscribed, null to rely on the default system.


Example

/**
 * This hook can be used to apply additional conditions to the subscription validation.
 * It can be used to skip the default system validations.
 *
 * @param   VAPCustomer  $customer  The customer details.
 * @param   array        $services  A list of services to check.
 * @param   mixed        $checkin   An optional check-in date (UTC).
 *
 * @return  mixed        True to flag the customer as subscribed, false to flag it as
 *                       expired or not yet subscribed, null to rely on the default system.
 */
public function onBeforeValidateCustomerSubscription($customer, $id, $checkin)
{
    /**
     * @todo here it is possible to intercept the default validation method
     */

    return true;
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 16:51
Helpful?