Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
manager.php
1<?php
2
4
7
8class Manager extends Base\RestrictionManager
9{
10 protected static $classNames = null;
11
15 public static function getEventName()
16 {
17 return 'onSalePaySystemRestrictionsClassNamesBuildList';
18 }
19
23 protected static function getBuildInRestrictions()
24 {
25 return array(
26 '\Bitrix\Sale\Services\PaySystem\Restrictions\PersonType' => 'lib/services/paysystem/restrictions/persontype.php',
27 '\Bitrix\Sale\Services\PaySystem\Restrictions\Price' => 'lib/services/paysystem/restrictions/price.php',
28 '\Bitrix\Sale\Services\PaySystem\Restrictions\PercentPrice' => 'lib/services/paysystem/restrictions/percentprice.php',
29 '\Bitrix\Sale\Services\PaySystem\Restrictions\Currency' => 'lib/services/paysystem/restrictions/currency.php',
30 '\Bitrix\Sale\Services\PaySystem\Restrictions\Delivery' => 'lib/services/paysystem/restrictions/delivery.php',
31 '\Bitrix\Sale\Services\PaySystem\Restrictions\Site' => 'lib/services/paysystem/restrictions/site.php',
32 '\Bitrix\Sale\Services\PaySystem\Restrictions\TradeBinding' => 'lib/services/paysystem/restrictions/tradebinding.php',
33 '\Bitrix\Sale\Services\PaySystem\Restrictions\ProductCategory' => 'lib/services/paysystem/restrictions/productcategory.php',
34 '\Bitrix\Sale\Services\PaySystem\Restrictions\ConcreteProduct' => 'lib/services/paysystem/restrictions/concreteproduct.php',
35 );
36 }
37
41 protected static function getServiceType()
42 {
43 return parent::SERVICE_TYPE_PAYMENT;
44 }
45
46 public static function getPriceRange(Payment $payment, $paySystemId)
47 {
48 $result = array();
49
50 $classes = array(
51 '\Bitrix\Sale\Services\PaySystem\Restrictions\PercentPrice',
52 '\Bitrix\Sale\Services\PaySystem\Restrictions\Price'
53 );
54
55 $params = array(
56 'select' => array('CLASS_NAME', 'PARAMS'),
57 'filter' => array(
58 'SERVICE_ID' => $paySystemId,
59 '=CLASS_NAME' => $classes
60 )
61 );
62
63 $dbRes = Manager::getList($params);
64 while ($data = $dbRes->fetch())
65 {
66 $range = $data['CLASS_NAME']::getRange($payment, $data['PARAMS']);
67
68 if (!$result['MAX'] || $range['MAX'] < $result['MAX'])
69 $result['MAX'] = $range['MAX'];
70
71 if (!$result['MIN'] || $range['MIN'] > $result['MIN'])
72 $result['MIN'] = $range['MIN'];
73 }
74
75 return $result;
76 }
77}
static getList(array $parameters=[])
Definition manager.php:135
static getPriceRange(Payment $payment, $paySystemId)
Definition manager.php:46