Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
checkservice.php
1
<?php
2
3
namespace
Bitrix\Sale\Cashbox\Rest
;
4
5
use
Bitrix\Main
;
6
use
Bitrix\Rest\RestException
;
7
use
Bitrix\Sale\Cashbox\CheckManager
;
8
use
Bitrix\Sale\Helpers
;
9
use
Bitrix\Sale\Cashbox
;
10
11
if
(!Main\
Loader::includeModule
(
'rest'
))
12
{
13
return
;
14
}
15
20
class
CheckService
extends
RestService
21
{
22
private
const
ERROR_CHECK_NOT_FOUND =
'ERROR_CHECK_NOT_FOUND'
;
23
private
const
ERROR_CHECK_APPLY =
'ERROR_CHECK_APPLY'
;
24
30
private
static
function
checkParamsBeforeApplyCheck($params)
31
{
32
if
(!$params[
'UUID'
])
33
{
34
throw
new
RestException
(
'Parameter UUID is not defined'
, self::ERROR_CHECK_FAILURE);
35
}
36
37
$checkInfo =
CheckManager::getCheckInfoByExternalUuid
($params[
'UUID'
]);
38
if
(!$checkInfo)
39
{
40
throw
new
RestException
(
'Check not found'
, self::ERROR_CHECK_NOT_FOUND);
41
}
42
}
43
52
public
static
function
applyCheck
($params)
53
{
54
Helpers\Rest\AccessChecker::checkAccessPermission();
55
$params =
self::prepareIncomingParams
($params);
56
self::checkParamsBeforeApplyCheck($params);
57
58
$result = Cashbox\CashboxRest::applyCheckResult($params);
59
if
($result->isSuccess())
60
{
61
return
true
;
62
}
63
64
$errors = implode(
"\n"
, $result->getErrorMessages());
65
throw
new
RestException
($errors, self::ERROR_CHECK_APPLY);
66
}
67
}
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Definition
loader.php:69
Bitrix\Rest\RestException
Definition
restexception.php:6
Bitrix\Sale\Cashbox\CheckManager
Definition
checkmanager.php:24
Bitrix\Sale\Cashbox\CheckManager\getCheckInfoByExternalUuid
static getCheckInfoByExternalUuid($uuid)
Definition
checkmanager.php:1491
Bitrix\Sale\Cashbox\Rest\CheckService
Definition
checkservice.php:21
Bitrix\Sale\Cashbox\Rest\CheckService\applyCheck
static applyCheck($params)
Definition
checkservice.php:52
Bitrix\Sale\Cashbox\Rest\RestService
Definition
restservice.php:19
Bitrix\Sale\Cashbox\Rest\RestService\prepareIncomingParams
static prepareIncomingParams(array $data)
Definition
restservice.php:112
Bitrix\Main
Bitrix\Sale\Cashbox\Rest
Definition
cashboxservice.php:3
Bitrix\Sale\Cashbox
Definition
abstractcheck.php:3
Bitrix\Sale\Helpers
modules
sale
lib
cashbox
rest
checkservice.php
Создано системой
1.10.0