Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
activatepaysystemaction.php
1<?php
2
4
7
15{
16 private function checkParams(int $id): Sale\Result
17 {
18 $result = new Sale\Result();
19
20 if (!Sale\PaySystem\Manager::isExist($id))
21 {
22 $result->addError(new Main\Error("PaySystem with id '{$id}' not found"));
23 }
24
25 return $result;
26 }
27
28 public function run(int $id)
29 {
30 $checkParamsResult = $this->checkParams($id);
31 if (!$checkParamsResult->isSuccess())
32 {
33 $this->addErrors($checkParamsResult->getErrors());
34 return;
35 }
36
37 $activateResult = $this->activatePaySystem($id);
38 if (!$activateResult->isSuccess())
39 {
40 $this->addErrors($activateResult->getErrors());
41 }
42 }
43
44 private function activatePaySystem($id): Main\ORM\Data\UpdateResult
45 {
46 return Sale\PaySystem\Manager::update($id, ['ACTIVE' => 'Y']);
47 }
48}
addErrors(array $errors)
Definition action.php:213