1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
currency.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\Services\PaySystem\Restrictions;
4
5use Bitrix\Currency\CurrencyManager;
6use Bitrix\Main\ArgumentTypeException;
7use Bitrix\Main\Localization\Loc;
8use Bitrix\Sale\Internals\CollectableEntity;
9use Bitrix\Sale\Internals\Entity;
10use Bitrix\Sale\Order;
11use Bitrix\Sale\Payment;
12use Bitrix\Sale\PaySystem;
13use Bitrix\Sale\PaySystem\Service;
14use Bitrix\Sale\Services\Base;
15
16Loc::loadMessages(__FILE__);
17
19{
26 public static function check($params, array $restrictionParams, $serviceId = 0)
27 {
28 if (isset($restrictionParams) && is_array($restrictionParams['CURRENCY']))
29 return in_array($params, $restrictionParams['CURRENCY']);
30
31 return true;
32 }
33
39 protected static function extractParams(Entity $entity)
40 {
41 if ($entity instanceof Payment)
42 {
44 $collection = $entity->getCollection();
45
47 $order = $collection->getOrder();
48
49 return $order->getCurrency();
50 }
51 elseif ($entity instanceof Order)
52 {
53 return $entity->getCurrency();
54 }
55
56 throw new ArgumentTypeException('');
57 }
58
62 public static function getClassTitle()
63 {
64 return Loc::getMessage('SALE_PS_RESTRICTIONS_BY_CURRENCY');
65 }
66
70 public static function getClassDescription()
71 {
72 return Loc::getMessage('SALE_PS_RESTRICTIONS_BY_CURRENCY_DESC');
73 }
74
75 public static function getOnApplyErrorMessage(): string
76 {
77 return Loc::getMessage('SALE_PS_RESTRICTIONS_BY_CURRENCY_ON_APPLY_ERROR_MSG');
78 }
79
80 public static function getParamsStructure($entityId = 0)
81 {
83
84 $currencyList = CurrencyManager::getCurrencyList();
85
86 if ($data !== false)
87 {
89 $paySystem = new Service($data);
90 $psCurrency = $paySystem->getCurrency();
91
92 $options = array();
93 foreach ($psCurrency as $code)
94 $options[$code] = (isset($currencyList[$code])) ? $currencyList[$code] : $code;
95
96 if ($options)
97 {
98 return array(
99 "CURRENCY" => array(
100 "TYPE" => "ENUM",
101 'MULTIPLE' => 'Y',
102 "LABEL" => Loc::getMessage("SALE_PS_RESTRICTIONS_BY_CURRENCY_NAME"),
103 "OPTIONS" => $options
104 )
105 );
106 }
107 }
108
109 return array();
110 }
111
112 public static function save(array $fields, $restrictionId = 0)
113 {
114 return parent::save($fields, $restrictionId);
115 }
116
117
118}
static getCurrencyList()
Определения currencymanager.php:109
static getById($id)
Определения manager.php:93
Определения payment.php:19
static check($params, array $restrictionParams, $serviceId=0)
Определения currency.php:26
static save(array $fields, $restrictionId=0)
Определения currency.php:112
$options
Определения commerceml2.php:49
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$entity
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
Определения ufield.php:9
$order
Определения payment.php:8
$entityId
Определения payment.php:4
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$fields
Определения yandex_run.php:501