2018-09-13 11:10:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Webkul\Cart\Http\Controllers;
|
|
|
|
|
use Illuminate\Routing\Controller;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Response;
|
|
|
|
|
use Auth;
|
2018-09-20 10:01:51 +00:00
|
|
|
use Webkul\Shipping\Facades\Shipping;
|
2018-09-21 10:17:01 +00:00
|
|
|
use Webkul\Payment\Facades\Payment;
|
|
|
|
|
use Webkul\Cart\Facades\Cart;
|
2018-09-13 11:10:45 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Chekout controller for the customer
|
|
|
|
|
* and guest for placing order
|
|
|
|
|
*
|
2018-09-19 06:58:15 +00:00
|
|
|
* @author Jitendra Singh <jitendra@webkul.com>
|
2018-09-13 11:10:45 +00:00
|
|
|
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
|
|
|
|
*/
|
|
|
|
|
class CheckoutController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
2018-09-19 06:58:15 +00:00
|
|
|
* Contains route related configuration
|
2018-09-13 11:10:45 +00:00
|
|
|
*
|
2018-09-19 06:58:15 +00:00
|
|
|
* @var array
|
2018-09-13 11:10:45 +00:00
|
|
|
*/
|
|
|
|
|
protected $_config;
|
|
|
|
|
|
2018-09-19 06:58:15 +00:00
|
|
|
/**
|
|
|
|
|
* Create a new controller instance.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2018-09-13 11:10:45 +00:00
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
$this->_config = request('_config');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2018-09-19 06:58:15 +00:00
|
|
|
return view($this->_config['view']);
|
2018-09-13 11:10:45 +00:00
|
|
|
}
|
|
|
|
|
|
2018-09-20 10:01:51 +00:00
|
|
|
/**
|
|
|
|
|
* Saves customer address.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function saveAddress()
|
|
|
|
|
{
|
|
|
|
|
|
2018-09-21 10:17:01 +00:00
|
|
|
return response()->json(Shipping::collectRates());
|
2018-09-20 10:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Saves shipping method.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function saveShipping()
|
|
|
|
|
{
|
2018-09-21 10:17:01 +00:00
|
|
|
return response()->json(Payment::getSupportedPaymentMethods());
|
2018-09-20 10:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Saves payment method.
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function saveAPayment()
|
|
|
|
|
{
|
|
|
|
|
}
|
2018-09-13 11:10:45 +00:00
|
|
|
}
|