From 082c26633f88078df0611c6e66a0aa54351421ae Mon Sep 17 00:00:00 2001 From: merdan Date: Tue, 10 Jan 2023 21:38:04 +0500 Subject: [PATCH] order_item resource --- .../API/Http/Resources/Customer/OrderResource.php | 2 +- packages/Sarga/Admin/src/Config/carriers.php | 13 +++++++++++++ packages/Sarga/Admin/src/Shipment/Courier.php | 4 ++-- packages/Sarga/Admin/src/Shipment/Pickup.php | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php index 9d0b1d1ee..aec0406ac 100644 --- a/packages/Sarga/API/Http/Resources/Customer/OrderResource.php +++ b/packages/Sarga/API/Http/Resources/Customer/OrderResource.php @@ -102,7 +102,7 @@ class OrderResource extends JsonResource $methodObject = new $methodClass; - return $methodObject->estimatedDelivery(); + return $methodObject->estimatedDelivery($this->created_at); } } \ No newline at end of file diff --git a/packages/Sarga/Admin/src/Config/carriers.php b/packages/Sarga/Admin/src/Config/carriers.php index 285a9d98f..63011a93b 100644 --- a/packages/Sarga/Admin/src/Config/carriers.php +++ b/packages/Sarga/Admin/src/Config/carriers.php @@ -26,5 +26,18 @@ return [ 'delivery_day_max' => '25', 'outlet_delivery' => '2', 'class' => 'Sarga\Admin\Shipment\Courier', + ], + + 'fly' => [ + 'code' => 'fly', + 'title' => 'Flight', + 'description' => 'Flight Shipping', + 'active' => false, + 'is_calculate_tax' => false, + 'weight_price' => '20', + 'delivery_day_min' => '20', + 'delivery_day_max' => '25', + 'outlet_delivery' => '2', + 'class' => 'Sarga\Admin\Shipment\Courier', ] ]; diff --git a/packages/Sarga/Admin/src/Shipment/Courier.php b/packages/Sarga/Admin/src/Shipment/Courier.php index 1e3766192..57d3ec235 100644 --- a/packages/Sarga/Admin/src/Shipment/Courier.php +++ b/packages/Sarga/Admin/src/Shipment/Courier.php @@ -62,7 +62,7 @@ class Courier extends AbstractShipping return $cartShippingRate; } - public function estimatedDelivery(){ - return Carbon::today()->addDays($this->getConfigData('delivery_day_max'))->format('d.m.Y'); + public function estimatedDelivery($date){ + return $date->addDays($this->getConfigData('delivery_day_max'))->format('d.m.Y'); } } \ No newline at end of file diff --git a/packages/Sarga/Admin/src/Shipment/Pickup.php b/packages/Sarga/Admin/src/Shipment/Pickup.php index ab7859ad7..8b8652042 100644 --- a/packages/Sarga/Admin/src/Shipment/Pickup.php +++ b/packages/Sarga/Admin/src/Shipment/Pickup.php @@ -62,7 +62,7 @@ class Pickup extends AbstractShipping return $cartShippingRate; } - public function estimatedDelivery(){ - return Carbon::today()->addDays($this->getConfigData('delivery_day_max'))->format('d.m.Y'); + public function estimatedDelivery($date){ + return $date->addDays($this->getConfigData('delivery_day_max'))->format('d.m.Y'); } } \ No newline at end of file