diff --git a/src/app/Services/Order/InstallmentOrderService.php b/src/app/Services/Order/InstallmentOrderService.php index c0c6eff5..d3456b1f 100644 --- a/src/app/Services/Order/InstallmentOrderService.php +++ b/src/app/Services/Order/InstallmentOrderService.php @@ -39,7 +39,7 @@ public function createInstallmentForm(Order $order) $onlinePaymentsSum = $order->getAmountPaidOrders(); $uniqItemsCount = $order->getUniqItemsCount(); foreach ($order->items as $itemKey => $item) { - if ($item->installment->num_payments === 0) { + if (!$item->installment?->num_payments) { continue; } if ($itemKey > 0) { diff --git a/src/app/Services/Payment/PaymentService.php b/src/app/Services/Payment/PaymentService.php index d3bab8e8..74c00234 100644 --- a/src/app/Services/Payment/PaymentService.php +++ b/src/app/Services/Payment/PaymentService.php @@ -142,7 +142,7 @@ public function autoSetOrderStatus(OnlinePayment $onlinePayment): void 'data' => fn ($query) => $query->with('installment'), ])->first(); - if (in_array($order->status_key, ['fitting', 'sent', 'installment'])) { + if (in_array($order->status_key, ['fitting', 'sent', 'installment', 'partial_complete'])) { $partialBuybackItemsCount = 0; $isInstallment = $order->payment_id === Installment::PAYMENT_METHOD_ID; $successfulPaymentsSum = $order->onlinePayments @@ -196,9 +196,6 @@ public function autoSetOrderStatus(OnlinePayment $onlinePayment): void $order->update(['status_key' => ($isPartialComplete ? 'partial_complete' : 'complete')]); } else { $order->update(['status_key' => 'delivered']); - $order->data->each(function (OrderItem $orderItem) { - $orderItem->update(['status_key' => 'waiting_refund']); - }); $order->adminComments()->create([ 'comment' => "Получен наложенный платеж на сумму {$paymentSum}. Распределите сумму по товарам!", ]);