• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/orderdiscountbase.php
  • Класс: BitrixSaleOrderDiscountBase
  • Вызов: OrderDiscountBase::validateCoupon
static function validateCoupon(array $fields)
{
	$result = new Result();

	if (
		!static::isValidCouponTypeInternal($fields['TYPE'])
	)
	{
		$result->addError(new MainEntityEntityError(
			Loc::getMessage(
				'SALE_ORDER_DISCOUNT_ERR_COUPON_TYPE_BAD',
				array('#COUPON#' => $fields['COUPON'])
			),
			self::ERROR_ID
		));
	}

	if (empty($fields['COUPON_ID']) || (int)$fields['COUPON_ID'] <= 0)
	{
		$result->addError(new MainEntityEntityError(
			Loc::getMessage(
				'SALE_ORDER_DISCOUNT_ERR_COUPON_ID_BAD',
				array('#COUPON#' => $fields['COUPON'])
			),
			self::ERROR_ID
		));
	}

	return $result;
}