• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/cashbox/cashboxpaysystem.php
  • Класс: BitrixSaleCashboxCashboxPaySystem
  • Вызов: CashboxPaySystem::check
public function check(Check $check): SaleResult
{
	$result = new SaleResult();

	$checkParamsResult = $this->checkParams($check);
	if (!$checkParamsResult->isSuccess())
	{
		$result->addErrors($checkParamsResult->getErrors());
		return $result;
	}

	$payment = CheckManager::getPaymentByCheck($check);
	if (!$payment)
	{
		$result->addError(
			new MainError(
				MainLocalizationLoc::getMessage('SALE_CASHBOX_PAYSYSTEM_PAYMENT_NOT_FOUND')
			)
		);
		return $result;
	}

	$url = $this->getCheckUrl();
	$fields = $this->getDataForCheck($payment);
	$sendMethod = $this->getCheckHttpMethod();

	$sendResult = $this->send($url, $payment, $fields, $sendMethod);
	if (!$sendResult->isSuccess())
	{
		$result->addErrors($sendResult->getErrors());
		return $result;
	}

	$processCheckResult = $this->processCheckResult($sendResult);
	if ($processCheckResult->isSuccess())
	{
		$onAfterProcessCheckResult = $this->onAfterProcessCheck($processCheckResult, $payment);
		if (!$onAfterProcessCheckResult->isSuccess())
		{
			$result->addErrors($onAfterProcessCheckResult->getErrors());
		}
	}
	else
	{
		$result->addErrors($processCheckResult->getErrors());
	}

	return $result;
}