$result = PaySystemActionTable::add($fields);
     if (!$result->isSuccess()) {
         $errorMessage .= join(',', $result->getErrorMessages());
     } else {
         $id = $result->getId();
         if ($id > 0) {
             $fields = array('PARAMS' => serialize(array('BX_PAY_SYSTEM_ID' => $id)), 'PAY_SYSTEM_ID' => $id);
             $result = PaySystemActionTable::update($id, $fields);
             if (!$result->isSuccess()) {
                 $errorMessage .= join(',', $result->getErrorMessages());
             }
             $service = PaySystem\Manager::getObjectById($id);
             $currency = $service->getCurrency();
             if ($currency) {
                 $params = array('SERVICE_ID' => $id, 'SERVICE_TYPE' => Restrictions\Manager::SERVICE_TYPE_PAYMENT, 'PARAMS' => array('CURRENCY' => $currency));
                 Restrictions\Manager::getClassesList();
                 $saveResult = \Bitrix\Sale\Services\PaySystem\Restrictions\Currency::save($params);
                 if (!$saveResult->isSuccess()) {
                     $errorMessage .= Loc::getMessage('SALE_PSE_ERROR_RSRT_CURRENCY_SAVE');
                 }
             }
         }
     }
 }
 if ($errorMessage === '') {
     if ($isConsumerChange) {
         $priorActionFile = $request->get('PRIOR_ACTION_FILE');
         if (empty($priorActionFile)) {
             BusinessValue::addConsumer('PAYSYSTEM_NEW', $data);
         } else {
             BusinessValue::changeConsumer('PAYSYSTEM_' . $id, $data);
示例#2
0
 }
 foreach ($ids as $id) {
     if ((int) $id <= 0) {
         continue;
     }
     switch ($_REQUEST['action']) {
         case "delete":
             $dbRes = \Bitrix\Sale\Internals\PaymentTable::getList(array('filter' => array('PAY_SYSTEM_ID' => $id)));
             if ($dbRes->fetch()) {
                 $lAdmin->AddGroupError(Loc::getMessage("SALE_DELETE_ERROR"), $id);
                 continue;
             }
             $restrictionList = \Bitrix\Sale\Services\PaySystem\Restrictions\Manager::getRestrictionsList($id);
             if ($restrictionList) {
                 // init restrictions
                 \Bitrix\Sale\Services\PaySystem\Restrictions\Manager::getClassesList();
                 foreach ($restrictionList as $restriction) {
                     $restriction["CLASS_NAME"]::delete($restriction['ID'], $id);
                 }
             }
             $result = Bitrix\Sale\Internals\PaySystemActionTable::delete($id);
             if (!$result->isSuccess()) {
                 if ($result->getErrorMessages()) {
                     $lAdmin->AddGroupError(join(', ', $result->getErrorMessages()), $id);
                 } else {
                     $lAdmin->AddGroupError(GetMessage("SPSAN_ERROR_DELETE"), $id);
                 }
             }
             break;
         case "activate":
         case "deactivate":