Skip to content

Commit

Permalink
fix add upselling v1 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Jul 16, 2024
1 parent b75bd07 commit 1ea6ddc
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 24 deletions.
24 changes: 0 additions & 24 deletions src/Http/Controllers/Api/OrderController.php

This file was deleted.

57 changes: 57 additions & 0 deletions src/Http/Controllers/Api/V1/OrderController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php
namespace NexaMerchant\Upselling\Http\Controllers\Api\V1;

use Illuminate\Http\Request;
use NexaMerchant\Apis\Docs\V1\Admin\Models\Marketing\Event;
use NexaMerchant\Upselling\Http\Controllers\Api\Controller;
use Webkul\Sales\Repositories\OrderRepository;
use Webkul\Sales\Models\Order;

class OrderController extends Controller
{
public function __construct(OrderRepository $orderRepository)
{
// $this->middleware('auth:api');
}

public function index()
{
return response()->json(['code' => 200, 'message' => 'Index']);
}

// order create

public function store(Request $request)
{
$request->validate([
'name' => 'required',
'email' => 'required|email',
'password' => 'required',
]);

// check this email is exist or not
$order = $this->orderRepository->findOneWhere(['email' => $request->email, 'status' => Order::STATUS_PROCESSING]);
if(is_null($order)) {
return response()->json(['code' => 400, 'message' => 'Order not found']);
}

// add to cart

// use upselling rules to get products

// save payment method



// create order



return response()->json(['code' => 200, 'message' => 'Store']);
}

public function products(Request $request)
{
return response()->json(['code' => 200, 'message' => 'Products']);
}
}

0 comments on commit 1ea6ddc

Please sign in to comment.