Bitrix API

Price extends Price

Class RestrictionBase.

Base class for payment and delivery services restrictions.

Table of Contents

Properties

$easeSort  : int

Methods

check()  : bool
Checking the service parameters for compliance with the restriction.
checkByEntity()  : int
Checking the service parameters for compliance with the restriction by entity.
delete()  : DeleteResult
getClassDescription()  : mixed
getClassTitle()  : mixed
getCode()  : string
Get a restriction code that is comparable to the service handler restriction code.
getOnApplyErrorMessage()  : string
Returns message that will be display if error occurs while applying restriction
getParamsStructure()  : array<string|int, mixed>
Returns params structure to show it to user
getRange()  : array<string|int, mixed>
getSeverity()  : int
isAvailable()  : bool
isMyCode()  : bool
prepareData()  : bool
prepareParamsValues()  : array<string|int, mixed>
save()  : AddResult|UpdateResult
validateRestriction()  : Result
Checking the restriction for compliance with business rules.

Properties

$easeSort

public static int $easeSort = 100

100 - lightweight - just compare with params 200 - middleweight - may be use base queries 300 - hardweight - use base, and/or hard calculations

Methods

check()

Checking the service parameters for compliance with the restriction.

public static check(mixed $params, array<string|int, mixed> $restrictionParams[, int $serviceId = 0 ]) : bool
Parameters
$params : mixed
$restrictionParams : array<string|int, mixed>
$serviceId : int = 0
Return values
bool

checkByEntity()

Checking the service parameters for compliance with the restriction by entity.

public static checkByEntity(Entity $entity, array<string|int, mixed> $restrictionParams, int $mode[, int $serviceId = 0 ]) : int
Parameters
$entity : Entity
$restrictionParams : array<string|int, mixed>
$mode : int
$serviceId : int = 0
Tags
throws
NotImplementedException
Return values
int

delete()

public static delete(mixed $restrictionId[, int $entityId = 0 ]) : DeleteResult
Parameters
$restrictionId : mixed
$entityId : int = 0
Tags
throws
Exception
Return values
DeleteResult

getClassDescription()

public static getClassDescription() : mixed

getClassTitle()

public static getClassTitle() : mixed

getCode()

Get a restriction code that is comparable to the service handler restriction code.

public static getCode() : string

Bitrix restrictions will return name of restriction class. Vendor restrictions must return full classname with namespace.

Example 1: for bitrix currency restriction class **Bitrix\Currency** it will return 'currency'
Example 2: for vendor currency restriction class **Vendor\Currency** it will return 'Vendor\Currency'
Return values
string

getOnApplyErrorMessage()

Returns message that will be display if error occurs while applying restriction

public static getOnApplyErrorMessage() : string
Return values
string

getParamsStructure()

Returns params structure to show it to user

public static getParamsStructure([mixed $entityId = 0 ]) : array<string|int, mixed>
Parameters
$entityId : mixed = 0
Tags
throws
ArgumentException
Return values
array<string|int, mixed>

getRange()

public static getRange(Payment $payment, mixed $params) : array<string|int, mixed>
Parameters
$payment : Payment
$params : mixed
Tags
throws
ArgumentTypeException
Return values
array<string|int, mixed>

getSeverity()

public static getSeverity(mixed $mode) : int
Parameters
$mode : mixed
Return values
int

isAvailable()

public static isAvailable() : bool
Return values
bool

isMyCode()

public static isMyCode(string $code) : bool
Parameters
$code : string
Return values
bool

prepareData()

public static prepareData(array<string|int, mixed> $servicesIds) : bool
Parameters
$servicesIds : array<string|int, mixed>
Return values
bool

prepareParamsValues()

public static prepareParamsValues(array<string|int, mixed> $paramsValues[, int $entityId = 0 ]) : array<string|int, mixed>
Parameters
$paramsValues : array<string|int, mixed>
$entityId : int = 0
Return values
array<string|int, mixed>

save()

public static save(array<string|int, mixed> $fields[, int $restrictionId = 0 ]) : AddResult|UpdateResult
Parameters
$fields : array<string|int, mixed>
$restrictionId : int = 0
Tags
throws
Exception
Return values
AddResult|UpdateResult

validateRestriction()

Checking the restriction for compliance with business rules.

public static validateRestriction(array<string|int, mixed> $fields) : Result

For example, for the restriction "currency" in this method, you can compare which currencies the payment system works with which the restriction is linked.

Parameters
$fields : array<string|int, mixed>

restriction fields

Return values
Result

        
On this page

Search results