• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/action/entity/initiatepayaction.php
  • Класс: BitrixSaleControllerActionEntityInitiatePayAction
  • Вызов: InitiatePayAction::initPaymentEntities
private function initPaymentEntities(): void
{
	$paymentRow = SalePayment::getList([
		'filter' => ['ID' => (int)$this->params['PAYMENT_ID']],
		'select' => ['ORDER_ID', 'ID'],
		'limit' => 1
	]);
	if (!$paymentData = $paymentRow->fetch())
	{
		throw new InitiatePayException(
			'payment not found',
			SaleControllerErrorEnumeration::INITIATE_PAY_ACTION_PAYMENT_NOT_FOUND
		);
	}

	$paymentId = (int)$paymentData['ID'];
	$orderId = (int)$paymentData['ORDER_ID'];

	if (!$this->order = $this->findOrder($orderId))
	{
		throw new InitiatePayException(
			'order not found',
			SaleControllerErrorEnumeration::INITIATE_PAY_ACTION_ORDER_NOT_FOUND
		);
	}

	if (!$this->payment = $this->order->getPaymentCollection()->getItemById($paymentId))
	{
		throw new InitiatePayException(
			'payment not found',
			SaleControllerErrorEnumeration::INITIATE_PAY_ACTION_PAYMENT_NOT_FOUND
		);
	}
}