Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
checktrait.php
1
<?php
2
3
namespace
Bitrix\Sale\PaySystem\Cashbox
;
4
5
use
Bitrix\Main
;
6
use
Bitrix\Sale
;
7
8
Main\Localization\Loc::loadMessages(__FILE__);
9
14
trait CheckTrait
15
{
20
private
function
buildCheckQuery(
Sale
\
Payment
$payment):
Sale
\PaySystem\
ServiceResult
21
{
22
$result =
new
Sale\PaySystem\ServiceResult
();
23
24
$documents = Sale\Cashbox\CheckManager::collateDocuments([$payment]);
25
$document = current($documents);
26
if
($document)
27
{
28
$check = Sale\Cashbox\CheckManager::createByType($document[
'TYPE'
]);
29
if
($check)
30
{
31
$check->setEntities($document[
'ENTITIES'
]);
32
$check->setRelatedEntities($document[
'RELATED_ENTITIES'
]);
33
34
$service = $payment->getPaySystem();
35
if
($service)
36
{
38
$cashboxClass = $service->getCashboxClass();
39
$kkm = $cashboxClass::getKkmValue($service);
40
41
$cashboxData = Sale\Cashbox\Manager::getList([
42
'select'
=> [
'ID'
],
43
'filter'
=> [
44
'=ACTIVE'
=>
'Y'
,
45
'=HANDLER'
=> $cashboxClass,
46
'=KKM_ID'
=> $kkm,
47
],
48
])->fetch();
49
50
if
($cashboxData)
51
{
52
$cashbox = Sale\Cashbox\Manager::getObjectById($cashboxData[
'ID'
]);
53
if
($cashbox)
54
{
55
$result->setData($cashbox->buildCheckQuery($check));
56
}
57
}
58
else
59
{
60
$result->addError(
61
new
Main\
Error
(
62
Main\Localization\
Loc::getMessage
(
'SALE_PAYSYSTEM_CASHBOX_CHECKTRAIT_CASHBOX_NOT_FOUND_ERROR'
)
63
)
64
);
65
}
66
}
67
else
68
{
69
$result->addError(
70
new
Main\Error(
71
Main\Localization\
Loc::getMessage
(
'SALE_PAYSYSTEM_CASHBOX_CHECKTRAIT_SERVICE_IS_EMPTY_ERROR'
)
72
)
73
);
74
}
75
}
76
else
77
{
78
$result->addError(
79
new
Main\
Error
(
80
Main\Localization\
Loc::getMessage
(
'SALE_PAYSYSTEM_CASHBOX_CHECKTRAIT_CHECK_IS_EMPTY_ERROR'
)
81
)
82
);
83
}
84
}
85
else
86
{
87
$result->addError(
88
new
Main\
Error
(
89
Main\Localization\
Loc::getMessage
(
'SALE_PAYSYSTEM_CASHBOX_CHECKTRAIT_DOCUMENT_IS_EMPTY_ERROR'
)
90
)
91
);
92
}
93
94
return
$result;
95
}
96
}
Bitrix\Main\Error
Definition
error.php:14
Bitrix\Main\Localization\Loc\getMessage
static getMessage($code, $replace=null, $language=null)
Definition
loc.php:29
Bitrix\Sale\PaySystem\ServiceResult
Definition
serviceresult.php:14
Bitrix\Sale\Payment
Definition
payment.php:19
Bitrix\Main
Bitrix\Sale\PaySystem\Cashbox
Definition
checktrait.php:3
Bitrix\Sale
Bitrix\Translate\Error
trait Error
Definition
error.php:11
Sale
modules
sale
lib
paysystem
cashbox
checktrait.php
Создано системой
1.10.0