1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
currency.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Sale\Services\PaySystem\Restrictions;
4
5
use Bitrix\Currency\CurrencyManager;
6
use Bitrix\Main\ArgumentTypeException;
7
use Bitrix\Main\Localization\Loc;
8
use Bitrix\Sale\Internals\CollectableEntity;
9
use Bitrix\Sale\Internals\Entity;
10
use Bitrix\Sale\Order;
11
use Bitrix\Sale\Payment;
12
use Bitrix\Sale\PaySystem;
13
use Bitrix\Sale\PaySystem\Service;
14
use Bitrix\Sale\Services\Base;
15
16
Loc::loadMessages(__FILE__);
17
18
class
Currency
extends
Base\Restriction
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
{
82
$data
=
PaySystem\Manager::getById
(
$entityId
);
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
}
Bitrix\Currency\CurrencyManager\getCurrencyList
static getCurrencyList()
Определения
currencymanager.php:109
Bitrix\Main\ArgumentTypeException
Определения
ArgumentTypeException.php:9
Bitrix\Sale\PaySystem\Manager\getById
static getById($id)
Определения
manager.php:93
Bitrix\Sale\Payment
Определения
payment.php:19
Bitrix\Sale\Services\PaySystem\Restrictions\Currency\check
static check($params, array $restrictionParams, $serviceId=0)
Определения
currency.php:26
Bitrix\Sale\Services\PaySystem\Restrictions\Currency\getClassTitle
static getClassTitle()
Определения
currency.php:62
Bitrix\Sale\Services\PaySystem\Restrictions\Currency\save
static save(array $fields, $restrictionId=0)
Определения
currency.php:112
Bitrix\Sale\Services\PaySystem\Restrictions\Currency\getClassDescription
static getClassDescription()
Определения
currency.php:70
Bitrix\Sale\Services\PaySystem\Restrictions\Currency\getOnApplyErrorMessage
static getOnApplyErrorMessage()
Определения
currency.php:75
$options
$options
Определения
commerceml2.php:49
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
$code
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения
options.php:195
Bitrix\Catalog\Restriction
Определения
toolavailabilitymanager.php:3
Bitrix\Currency
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\Service
$order
$order
Определения
payment.php:8
$entityId
$entityId
Определения
payment.php:4
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
sale
lib
services
paysystem
restrictions
currency.php
Создано системой
1.14.0