• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/payment.php
  • Класс: BitrixSalePayment
  • Вызов: Payment::checkValueBeforeSet
protected function checkValueBeforeSet($name, $value)
{
	$result = parent::checkValueBeforeSet($name, $value);

	if ($name == "PAY_SYSTEM_ID")
	{
		if (intval($value) > 0 && !SalePaySystemManager::isExist($value))
		{
			$result->addError(
				new ResultError(
					Loc::getMessage('SALE_PAYMENT_WRONG_PAYMENT_SERVICE'),
					'SALE_PAYMENT_WRONG_PAYMENT_SERVICE'
				)
			);
		}
	}
	elseif ($name === 'ACCOUNT_NUMBER')
	{
		$dbRes = static::getList([
			'select' => ['ID'],
			'filter' => ['=ACCOUNT_NUMBER' => $value]
		]);

		if ($dbRes->fetch())
		{
			$result->addError(
				new ResultError(
					Loc::getMessage('SALE_PAYMENT_ACCOUNT_NUMBER_EXISTS')
				)
			);
		}
	}

	return $result;
}