resolve issue 2964

This commit is contained in:
Annika Wolff 2020-04-29 10:03:37 +02:00
parent c88ca31b94
commit 5e1c0ac5d2
1 changed files with 5 additions and 19 deletions

View File

@ -14,6 +14,8 @@ use Webkul\Checkout\Http\Requests\CustomerAddressForm;
use Webkul\Sales\Repositories\OrderRepository;
use Illuminate\Support\Str;
use Cart;
use Exception;
use Webkul\Shop\Http\Controllers\OnepageController;
class CheckoutController extends Controller
{
@ -197,26 +199,10 @@ class CheckoutController extends Controller
/**
* Validate order before creation
*
* @return mixed
* @throws Exception
*/
public function validateOrder()
public function validateOrder(): void
{
$cart = Cart::getCart();
if (! $cart->shipping_address) {
throw new \Exception(trans('Please check shipping address.'));
}
if (! $cart->billing_address) {
throw new \Exception(trans('Please check billing address.'));
}
if (! $cart->selected_shipping_rate) {
throw new \Exception(trans('Please specify shipping method.'));
}
if (! $cart->payment) {
throw new \Exception(trans('Please specify payment method.'));
}
app(OnepageController::class)->validateOrder();
}
}