Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
checkservice.php
1<?php
2
4
10
11if (!Main\Loader::includeModule('rest'))
12{
13 return;
14}
15
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}
static includeModule($moduleName)
Definition loader.php:69
static prepareIncomingParams(array $data)