public function onCheckServicePackageAvailability(int $id_package, object $service) : bool

Fires while checking whether a package is able to redeem a specific service.


Description

This hook can be used to apply additional conditions while checking whether a service can be redeemed by the specified package.

When this hook is triggered, the system already validated the standard conditions and the service is going to be included within the list of available services.

The system validates only the services that have been assigned to the targeted package. In case a package has no assigned services, this hook won't be triggered.


Parameters

$id_package

(int)  The targeted package ID.

$service

(object)  The object holding the service details.

Return Value

Boolean. False to mark the service as not available.


Example

/**
 * This hook can be used to apply additional conditions while checking whether a
 * service can be redeemed by the specified package. When this hook is triggered,
 * the system already validated the standard conditions and the service is going
 * to be included within the list of available services.
 *
 * @param   integer  $id_package  The package identifier.
 * @param   object   $service     The service to check.
 *
 * @return  boolean  Return false to flag the service as NOT available.
 */
public function onCheckServicePackageAvailability($id_package, $service)
{
    /**
     * @todo add here further validations
     */

    return true;
}

Changelog

VersionDescription
1.7 Introduced.
Last Update: 2021-10-08 14:25
Helpful?