Skip to content

Commit

Permalink
Update PaymentService.php (#249)
Browse files Browse the repository at this point in the history
* Update PaymentService.php

* Fix BelpostLabelService

* Format Oneami code

* Format Oneami code

* 416. Index page

* Format Oneami code

* #430 Internal movement: contact person

* Format Oneami code

* Update PaymentService.php

* Update InstallmentOrderService.php

* Update InstallmentOrderService.php

---------

Co-authored-by: Oneami <Oneami@users.noreply.github.com>
Oneami and Oneami authored Jun 19, 2024
1 parent 02527e2 commit a58f818
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/Services/Order/InstallmentOrderService.php
Original file line number Diff line number Diff line change
@@ -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) {
5 changes: 1 addition & 4 deletions src/app/Services/Payment/PaymentService.php
Original file line number Diff line number Diff line change
@@ -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}. Распределите сумму по товарам!",
]);

0 comments on commit a58f818

Please sign in to comment.