update fix deadcode, security

This commit is contained in:
baodev0
2026-09-28 08:26:29 +07:00
parent 3af59bd9c5
commit 82080b5b84
452 changed files with 4857 additions and 26289 deletions
@@ -2,7 +2,6 @@
namespace App\Repositories\Api\Order;
use App\Enums\Invoice\InvoiceStatus;
use App\Enums\Order\OrderStatus;
use App\Models\Order;
use App\Models\OrderItem;
@@ -30,28 +29,6 @@ class OrderRepository extends BaseApiRepository implements OrderRepositoryInterf
);
}
// -------------------------------------------------------------------------
// processPayment
// -------------------------------------------------------------------------
public function processPayment(Order $order, string $method): Order
{
$order->update([
'status' => OrderStatus::ACTIVE->value,
'payment_method' => $method,
]);
if ($order->invoice) {
$order->invoice->update([
'status' => InvoiceStatus::PAID->value,
'payment_method' => $method,
'paid_at' => now(),
]);
}
return $order->fresh(['orderItems', 'invoice', 'customer']);
}
// -------------------------------------------------------------------------
// hasPendingOrder
// -------------------------------------------------------------------------
@@ -15,11 +15,6 @@ interface OrderRepositoryInterface extends BaseRepositoryInterface
*/
public function createItem(int $orderId, array $data): OrderItem;
/**
* Mark order as completed, update the related invoice as paid.
*/
public function processPayment(Order $order, string $method): Order;
/**
* Return true if the customer has any pending orders.
*/
@@ -34,4 +29,6 @@ interface OrderRepositoryInterface extends BaseRepositoryInterface
* Find an order by order_num, scoped to the owning customer.
*/
public function findByOrderNum(string $orderNum, int $customerId): ?Order;
public function findForCustomer(int $id, int $customerId): ?Order;
}