diff --git a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php index 0915d73d2..d30827179 100644 --- a/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php +++ b/packages/Webkul/API/Http/Controllers/Shop/CheckoutController.php @@ -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(); } } \ No newline at end of file