- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/webform/resultentity.php
- Класс: Bitrix\Crm\WebForm\ResultEntity
- Вызов: ResultEntity::fillOrderPaymentsAndDeliveries
private function fillOrderPaymentsAndDeliveries(Crm\Order\Order $order, array $formData): void
{
$paymentCollection = $order->getPaymentCollection();
$payment = $paymentCollection->current();
if (!$payment)
{
$orderPaySystem = $this->getDefaultOrderPaySystem($order);
if ($orderPaySystem)
{
$payment = $paymentCollection->createItem($orderPaySystem);
$payment->setField('SUM', $order->getPrice());
}
}
if ($order->isChanged())
{
$result = $order->save();
if (!$result->isSuccess())
{
return;
}
}
$this->orderId = $order->getId();
if ($payment)
{
$this->paymentId = $payment->getId();
}
$this->resultEntityPack[] = [
'RESULT_ID' => $this->resultId,
'ENTITY_NAME' => \CCrmOwnerType::OrderName,
'ITEM_ID' => $this->orderId,
'IS_DUPLICATE' => false,
'IS_AUTOMATION_RUN' => false,
];
}