BasketService
extends BasketService
in package
Uses
ServiceTrait
This is the BasketService class.
Remember that a service is an extension of a SDK model that allows to add additional actions to a model request or create new methods to simplify some common requests. In this case, the BasketService extends the SDK\Services\BasketService.
Tags
Table of Contents
POV_MULTIPLE_VALUES | = [\SDK\Enums\OptionType::MULTIPLE_SELECTION, \SDK\Enums\OptionType::MULTIPLE_SELECTION_IMAGE] | |
---|---|---|
POV_SINGLE_VALUE | = [\SDK\Enums\OptionType::BOOLEAN, \SDK\Enums\OptionType::ATTACHMENT, \SDK\Enums\OptionType::DATE, \SDK\Enums\OptionType::SHORT_TEXT, \SDK\Enums\OptionType::SINGLE_SELECTION, \SDK\Enums\OptionType::SELECTOR, \SDK\Enums\OptionType::LONG_TEXT, \SDK\Enums\OptionType::SINGLE_SELECTION_IMAGE] | |
buildElementCollection() | This method returns and ElementCollection from the given data and class | : bool |
generateParametersGroupFromArray() | This method sets a parametersGroup object with the filters indicated in params (array key=>value). | : array<string|int, mixed> |
mergePaymentSystemsWithPluginProperties() | : void | |
parseOptionValue() | This method parses the given basket product option and returns it. | : array<string|int, mixed> |
validateParameterGroup() | This method validates the given parametersGroup. Returns true if valid, false otherwise. | : bool |
getAllElementCollectionItems() | Returns all available items filtered with the given parameters | : ElementCollection|null |
Constants
POV_MULTIPLE_VALUES
public
mixed
POV_MULTIPLE_VALUES
= [\SDK\Enums\OptionType::MULTIPLE_SELECTION, \SDK\Enums\OptionType::MULTIPLE_SELECTION_IMAGE]
POV_SINGLE_VALUE
public
mixed
POV_SINGLE_VALUE
= [\SDK\Enums\OptionType::BOOLEAN, \SDK\Enums\OptionType::ATTACHMENT, \SDK\Enums\OptionType::DATE, \SDK\Enums\OptionType::SHORT_TEXT, \SDK\Enums\OptionType::SINGLE_SELECTION, \SDK\Enums\OptionType::SELECTOR, \SDK\Enums\OptionType::LONG_TEXT, \SDK\Enums\OptionType::SINGLE_SELECTION_IMAGE]
Methods
buildElementCollection()
This method returns and ElementCollection from the given data and class
public
buildElementCollection(array<string|int, mixed> $data, string $class) : bool
Parameters
- $data : array<string|int, mixed>
- $class : string
Return values
bool —generateParametersGroupFromArray()
This method sets a parametersGroup object with the filters indicated in params (array key=>value).
public
generateParametersGroupFromArray(ParametersGroup &$parametersGroup, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $parametersGroup : ParametersGroup
- $params : array<string|int, mixed>
Return values
array<string|int, mixed> —with the applied filters
mergePaymentSystemsWithPluginProperties()
public
static mergePaymentSystemsWithPluginProperties(ElementCollection $paymentSystems, array<string|int, mixed> $pluginProperties) : void
Parameters
- $paymentSystems : ElementCollection
- $pluginProperties : array<string|int, mixed>
Return values
void —parseOptionValue()
This method parses the given basket product option and returns it.
public
static parseOptionValue(Option $option) : array<string|int, mixed>
The return is an array containing up to three values in these keys: self::POV_VALUE, self::POV_SHORT_DESCRIPTION, self::POV_LONG_DESCRIPTION.
Parameters
- $option : Option
Return values
array<string|int, mixed> —validateParameterGroup()
This method validates the given parametersGroup. Returns true if valid, false otherwise.
public
validateParameterGroup(ParametersGroup $parametersGroup) : bool
Parameters
- $parametersGroup : ParametersGroup
Return values
bool —getAllElementCollectionItems()
Returns all available items filtered with the given parameters
protected
getAllElementCollectionItems(string $elementClass, string $resource, ParametersGroup $params) : ElementCollection|null
Parameters
- $elementClass : string
- $resource : string
- $params : ParametersGroup
-
object with the needed filters to send to the API resource