diff --git a/packages/Webkul/Admin/src/Resources/lang/ar/app.php b/packages/Webkul/Admin/src/Resources/lang/ar/app.php index 0ccd131d3..47955d6eb 100644 --- a/packages/Webkul/Admin/src/Resources/lang/ar/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/ar/app.php @@ -1354,7 +1354,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/de/app.php b/packages/Webkul/Admin/src/Resources/lang/de/app.php index c92eccd9b..86b0b8e7e 100755 --- a/packages/Webkul/Admin/src/Resources/lang/de/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/de/app.php @@ -1337,7 +1337,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ], ], ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/en/app.php b/packages/Webkul/Admin/src/Resources/lang/en/app.php index a13fd6dc7..9bf01841b 100755 --- a/packages/Webkul/Admin/src/Resources/lang/en/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/en/app.php @@ -1359,7 +1359,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/es/app.php b/packages/Webkul/Admin/src/Resources/lang/es/app.php index 326807c6e..4ab3d79ee 100644 --- a/packages/Webkul/Admin/src/Resources/lang/es/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/es/app.php @@ -1319,7 +1319,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/fa/app.php b/packages/Webkul/Admin/src/Resources/lang/fa/app.php index 48b46a175..d46642783 100644 --- a/packages/Webkul/Admin/src/Resources/lang/fa/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/fa/app.php @@ -1355,7 +1355,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/it/app.php b/packages/Webkul/Admin/src/Resources/lang/it/app.php index 78a64f7c4..d762ca351 100644 --- a/packages/Webkul/Admin/src/Resources/lang/it/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/it/app.php @@ -1360,7 +1360,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/nl/app.php b/packages/Webkul/Admin/src/Resources/lang/nl/app.php index 10533d012..916bc9599 100644 --- a/packages/Webkul/Admin/src/Resources/lang/nl/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/nl/app.php @@ -1355,7 +1355,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/pl/app.php b/packages/Webkul/Admin/src/Resources/lang/pl/app.php index 58f3aa364..1e8e5a832 100644 --- a/packages/Webkul/Admin/src/Resources/lang/pl/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/pl/app.php @@ -1344,7 +1344,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; \ No newline at end of file diff --git a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php index 48572638c..7181bea8d 100755 --- a/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/pt_BR/app.php @@ -1358,7 +1358,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Admin/src/Resources/lang/tr/app.php b/packages/Webkul/Admin/src/Resources/lang/tr/app.php index f30682dbb..89483cb0f 100644 --- a/packages/Webkul/Admin/src/Resources/lang/tr/app.php +++ b/packages/Webkul/Admin/src/Resources/lang/tr/app.php @@ -1341,7 +1341,10 @@ return [ 'instructions' => 'Instructions', 'custom-scripts' => 'Custom Scripts', 'custom-css' => 'Custom CSS', - 'custom-javascript' => 'Custom Javascript' + 'custom-javascript' => 'Custom Javascript', + 'paypal-smart-button' => 'Paypal Smart Button', + 'client-id' => 'Client Id', + 'client-id-info' => 'Use "sb" for testing.' ] ] ]; diff --git a/packages/Webkul/Payment/src/Config/paymentmethods.php b/packages/Webkul/Payment/src/Config/paymentmethods.php index a3c4bdeb0..a542526fa 100755 --- a/packages/Webkul/Payment/src/Config/paymentmethods.php +++ b/packages/Webkul/Payment/src/Config/paymentmethods.php @@ -16,16 +16,5 @@ return [ 'class' => 'Webkul\Payment\Payment\MoneyTransfer', 'active' => true, 'sort' => 2, - ], - - 'paypal_standard' => [ - 'code' => 'paypal_standard', - 'title' => 'Paypal Standard', - 'description' => 'Paypal Standard', - 'class' => 'Webkul\Paypal\Payment\Standard', - 'sandbox' => true, - 'active' => true, - 'business_account' => 'test@webkul.com', - 'sort' => 3, ] ]; \ No newline at end of file diff --git a/packages/Webkul/Payment/src/Config/system.php b/packages/Webkul/Payment/src/Config/system.php index 7150e1655..56aec4ae8 100755 --- a/packages/Webkul/Payment/src/Config/system.php +++ b/packages/Webkul/Payment/src/Config/system.php @@ -113,64 +113,5 @@ return [ ], ] ] - ], [ - 'key' => 'sales.paymentmethods.paypal_standard', - 'name' => 'admin::app.admin.system.paypal-standard', - 'sort' => 3, - 'fields' => [ - [ - 'name' => 'title', - 'title' => 'admin::app.admin.system.title', - 'type' => 'text', - 'validation' => 'required', - 'channel_based' => false, - 'locale_based' => true, - ], [ - 'name' => 'description', - 'title' => 'admin::app.admin.system.description', - 'type' => 'textarea', - 'channel_based' => false, - 'locale_based' => true, - ], [ - 'name' => 'business_account', - 'title' => 'admin::app.admin.system.business-account', - 'type' => 'select', - 'type' => 'text', - 'validation' => 'required', - ], [ - 'name' => 'active', - 'title' => 'admin::app.admin.system.status', - 'type' => 'boolean', - 'validation' => 'required', - 'channel_based' => false, - 'locale_based' => true - ], [ - 'name' => 'sandbox', - 'title' => 'admin::app.admin.system.sandbox', - 'type' => 'boolean', - 'validation' => 'required', - 'channel_based' => false, - 'locale_based' => true, - ], [ - 'name' => 'sort', - 'title' => 'admin::app.admin.system.sort_order', - 'type' => 'select', - 'options' => [ - [ - 'title' => '1', - 'value' => 1, - ], [ - 'title' => '2', - 'value' => 2, - ], [ - 'title' => '3', - 'value' => 3, - ], [ - 'title' => '4', - 'value' => 4, - ], - ], - ] - ] ] ]; \ No newline at end of file diff --git a/packages/Webkul/Payment/src/Providers/PaymentServiceProvider.php b/packages/Webkul/Payment/src/Providers/PaymentServiceProvider.php index 2399513bb..61e4e3762 100755 --- a/packages/Webkul/Payment/src/Providers/PaymentServiceProvider.php +++ b/packages/Webkul/Payment/src/Providers/PaymentServiceProvider.php @@ -44,6 +44,7 @@ class PaymentServiceProvider extends ServiceProvider return new Payment(); }); } + /** * Register package config. * diff --git a/packages/Webkul/Paypal/src/Config/paymentmethods.php b/packages/Webkul/Paypal/src/Config/paymentmethods.php new file mode 100755 index 000000000..d5cd28675 --- /dev/null +++ b/packages/Webkul/Paypal/src/Config/paymentmethods.php @@ -0,0 +1,23 @@ + [ + 'code' => 'paypal_standard', + 'title' => 'Paypal Standard', + 'description' => 'Paypal Standard', + 'class' => 'Webkul\Paypal\Payment\Standard', + 'sandbox' => true, + 'active' => true, + 'business_account' => 'test@webkul.com', + 'sort' => 3, + ], + + 'paypal_smart_button' => [ + 'code' => 'paypal_smart_button', + 'title' => 'Paypal Smart Button', + 'description' => 'Paypal Smart Button', + 'class' => 'Webkul\Paypal\Payment\SmartButton', + 'sandbox' => true, + 'active' => true, + 'sort' => 4, + ] +]; \ No newline at end of file diff --git a/packages/Webkul/Paypal/src/Config/system.php b/packages/Webkul/Paypal/src/Config/system.php new file mode 100755 index 000000000..4aa4e7c8d --- /dev/null +++ b/packages/Webkul/Paypal/src/Config/system.php @@ -0,0 +1,117 @@ + 'sales.paymentmethods.paypal_standard', + 'name' => 'admin::app.admin.system.paypal-standard', + 'sort' => 3, + 'fields' => [ + [ + 'name' => 'title', + 'title' => 'admin::app.admin.system.title', + 'type' => 'text', + 'validation' => 'required', + 'channel_based' => false, + 'locale_based' => true, + ], [ + 'name' => 'description', + 'title' => 'admin::app.admin.system.description', + 'type' => 'textarea', + 'channel_based' => false, + 'locale_based' => true, + ], [ + 'name' => 'business_account', + 'title' => 'admin::app.admin.system.business-account', + 'type' => 'select', + 'type' => 'text', + 'validation' => 'required', + ], [ + 'name' => 'active', + 'title' => 'admin::app.admin.system.status', + 'type' => 'boolean', + 'validation' => 'required', + 'channel_based' => false, + 'locale_based' => true + ], [ + 'name' => 'sandbox', + 'title' => 'admin::app.admin.system.sandbox', + 'type' => 'boolean', + 'validation' => 'required', + 'channel_based' => false, + 'locale_based' => true, + ], [ + 'name' => 'sort', + 'title' => 'admin::app.admin.system.sort_order', + 'type' => 'select', + 'options' => [ + [ + 'title' => '1', + 'value' => 1, + ], [ + 'title' => '2', + 'value' => 2, + ], [ + 'title' => '3', + 'value' => 3, + ], [ + 'title' => '4', + 'value' => 4, + ], + ], + ] + ] + ], [ + 'key' => 'sales.paymentmethods.paypal_smart_button', + 'name' => 'admin::app.admin.system.paypal-smart-button', + 'sort' => 3, + 'fields' => [ + [ + 'name' => 'title', + 'title' => 'admin::app.admin.system.title', + 'type' => 'text', + 'validation' => 'required', + 'channel_based' => false, + 'locale_based' => true, + ], [ + 'name' => 'description', + 'title' => 'admin::app.admin.system.description', + 'type' => 'textarea', + 'channel_based' => false, + 'locale_based' => true, + ], [ + 'name' => 'client_id', + 'title' => 'admin::app.admin.system.client-id', + 'info' => 'admin::app.admin.system.client-id-info', + 'type' => 'select', + 'type' => 'text', + 'validation' => 'required', + ], [ + 'name' => 'active', + 'title' => 'admin::app.admin.system.status', + 'type' => 'boolean', + 'validation' => 'required', + 'channel_based' => false, + 'locale_based' => true + ], [ + 'name' => 'sort', + 'title' => 'admin::app.admin.system.sort_order', + 'type' => 'select', + 'options' => [ + [ + 'title' => '1', + 'value' => 1, + ], [ + 'title' => '2', + 'value' => 2, + ], [ + 'title' => '3', + 'value' => 3, + ], [ + 'title' => '4', + 'value' => 4, + ], + ], + ] + ] + ] +]; \ No newline at end of file diff --git a/packages/Webkul/Paypal/src/Helpers/Ipn.php b/packages/Webkul/Paypal/src/Helpers/Ipn.php index 9d52e7a1c..855e0d479 100755 --- a/packages/Webkul/Paypal/src/Helpers/Ipn.php +++ b/packages/Webkul/Paypal/src/Helpers/Ipn.php @@ -118,9 +118,7 @@ class Ipn */ protected function prepareInvoiceData() { - $invoiceData = [ - "order_id" => $this->order->id, - ]; + $invoiceData = ["order_id" => $this->order->id,]; foreach ($this->order->items as $item) { $invoiceData['invoice']['items'][$item->id] = $item->qty_to_invoice; diff --git a/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php new file mode 100755 index 000000000..7501236a5 --- /dev/null +++ b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php @@ -0,0 +1,268 @@ +orderRepository = $orderRepository; + + $this->invoiceRepository = $invoiceRepository; + } + + /** + * Success payment + * + * @return \Illuminate\Http\JsonResponse + */ + public function details() + { + $cart = Cart::getCart(); + + $billingAddressLines = $this->getAddressLines($cart->billing_address->address1); + + $data = [ + 'intent' => 'CAPTURE', + + 'payer' => [ + 'name' => [ + 'given_name' => $cart->billing_address->first_name, + 'surname' => $cart->billing_address->last_name, + ], + + 'address' => [ + 'address_line_1' => current($billingAddressLines), + 'address_line_2' => last($billingAddressLines), + 'admin_area_2' => $cart->billing_address->city, + 'admin_area_1' => $cart->billing_address->state, + 'postal_code' => $cart->billing_address->postcode, + 'country_code' => $cart->billing_address->country, + ], + + 'email_address' => $cart->billing_address->email, + + 'phone' => [ + 'phone_type' => 'MOBILE', + + 'phone_number' => [ + 'national_number' => $cart->billing_address->phone, + ], + ], + ], + + 'application_context' => [ + 'shipping_preference' => 'NO_SHIPPING' + ], + + 'purchase_units' => [ + [ + 'amount' => [ + 'value' => (float) $cart->sub_total + $cart->tax_total + ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0) - $cart->discount_amount, + 'currency_code' => $cart->cart_currency_code, + + 'breakdown' => [ + 'item_total' => [ + 'currency_code' => $cart->cart_currency_code, + 'value' => (float) $cart->sub_total, + ], + + 'shipping' => [ + 'currency_code' => $cart->cart_currency_code, + 'value' => (float) ($cart->selected_shipping_rate ? $cart->selected_shipping_rate->price : 0), + ], + + 'tax_total' => [ + 'currency_code' => $cart->cart_currency_code, + 'value' => (float) $cart->tax_total, + ], + + 'discount' => [ + 'currency_code' => $cart->cart_currency_code, + 'value' => (float) $cart->discount_amount, + ], + ], + ], + + 'items' => $this->getLineItems($cart), + ], + ] + ]; + + if ($cart->haveStockableItems() && $cart->shipping_address) { + $shippingAddressLines = $this->getAddressLines($cart->shipping_address->address1); + + $data['purchase_units'][0] = array_merge($data['purchase_units'][0], [ + 'shipping' => [ + 'address' => [ + 'address_line_1' => current($billingAddressLines), + 'address_line_2' => last($billingAddressLines), + 'admin_area_2' => $cart->shipping_address->city, + 'admin_area_1' => $cart->shipping_address->state, + 'postal_code' => $cart->shipping_address->postcode, + 'country_code' => $cart->shipping_address->country, + ], + ], + ]); + } + + return $data; + } + + /** + * Return cart items + * + * @param string $cart + * @return array + */ + public function getLineItems($cart) + { + $lineItems = []; + + foreach ($cart->items as $item) { + $lineItems[] = [ + 'unit_amount' => [ + 'currency_code' => $cart->cart_currency_code, + 'value' => (float) $item->price, + ], + 'quantity' => $item->quantity, + 'name' => $item->name, + 'sku' => $item->sku, + ]; + } + + return $lineItems; + } + + /** + * Return convert multiple address lines into 2 address lines + * + * @param string $address + * @return array + */ + public function getAddressLines($address) + { + $address = explode(PHP_EOL, $address, 2); + + $addressLines = [current($address)]; + + if (isset($address[1])) { + $addressLines[] = str_replace(["\r\n", "\r", "\n"], ' ', last($address)); + } else { + $addressLines[] = ''; + } + + return $addressLines; + } + + /** + * Save order + * + * @return \Illuminate\Http\Response + */ + public function saveOrder() + { + if (Cart::hasError()) { + return response()->json(['redirect_url' => route('shop.checkout.cart.index')], 403); + } + + try { + Cart::collectTotals(); + + $this->validateOrder(); + + $cart = Cart::getCart(); + + $order = $this->orderRepository->create(Cart::prepareDataForOrder()); + + $this->orderRepository->update(['status' => 'processing'], $order->id); + + if ($order->canInvoice()) { + $invoice = $this->invoiceRepository->create($this->prepareInvoiceData($order)); + } + + Cart::deActivateCart(); + + session()->flash('order', $order); + + return response()->json([ + 'success' => true, + ]); + } catch (\Exception $e) { + session()->flash('error', trans('shop::app.common.error')); + + throw $e; + } + } + + /** + * Prepares order's invoice data for creation + * + * @param \Webkul\Sales\Models\Order $order + * @return array + */ + protected function prepareInvoiceData($order) + { + $invoiceData = ["order_id" => $order->id,]; + + foreach ($order->items as $item) { + $invoiceData['invoice']['items'][$item->id] = $item->qty_to_invoice; + } + + return $invoiceData; + } + + /** + * Validate order before creation + * + * @return void|\Exception + */ + public function validateOrder() + { + $cart = Cart::getCart(); + + if ($cart->haveStockableItems() && ! $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->haveStockableItems() && ! $cart->selected_shipping_rate) { + throw new \Exception(trans('Please specify shipping method.')); + } + + if (! $cart->payment) { + throw new \Exception(trans('Please specify payment method.')); + } + } +} \ No newline at end of file diff --git a/packages/Webkul/Paypal/src/Http/routes.php b/packages/Webkul/Paypal/src/Http/routes.php index ff1a320b4..20818e6eb 100755 --- a/packages/Webkul/Paypal/src/Http/routes.php +++ b/packages/Webkul/Paypal/src/Http/routes.php @@ -9,6 +9,12 @@ Route::group(['middleware' => ['web']], function () { Route::get('/cancel', 'Webkul\Paypal\Http\Controllers\StandardController@cancel')->name('paypal.standard.cancel'); }); + + Route::prefix('paypal/smart-button')->group(function () { + Route::get('/details', 'Webkul\Paypal\Http\Controllers\SmartButtonController@details')->name('paypal.smart_button.details'); + + Route::post('/save-order', 'Webkul\Paypal\Http\Controllers\SmartButtonController@saveOrder')->name('paypal.smart_button.save_order'); + }); }); Route::get('paypal/standard/ipn', 'Webkul\Paypal\Http\Controllers\StandardController@ipn')->name('paypal.standard.ipn'); diff --git a/packages/Webkul/Paypal/src/Payment/SmartButton.php b/packages/Webkul/Paypal/src/Payment/SmartButton.php new file mode 100644 index 000000000..48ca893bc --- /dev/null +++ b/packages/Webkul/Paypal/src/Payment/SmartButton.php @@ -0,0 +1,22 @@ +addTemplate('paypal::checkout.onepage.paypal-smart-button'); + }); + } +} \ No newline at end of file diff --git a/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php b/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php index a17382b3e..b815ed97b 100755 --- a/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php +++ b/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php @@ -16,5 +16,33 @@ class PaypalServiceProvider extends ServiceProvider include __DIR__ . '/../Http/routes.php'; $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'paypal'); + + $this->app->register(EventServiceProvider::class); + } + + /** + * Register services. + * + * @return void + */ + public function register() + { + $this->registerConfig(); + } + + /** + * Register package config. + * + * @return void + */ + protected function registerConfig() + { + $this->mergeConfigFrom( + dirname(__DIR__) . '/Config/paymentmethods.php', 'paymentmethods' + ); + + $this->mergeConfigFrom( + dirname(__DIR__) . '/Config/system.php', 'core' + ); } } diff --git a/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php b/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php new file mode 100644 index 000000000..a83d2c936 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/views/checkout/onepage/paypal-smart-button.blade.php @@ -0,0 +1,52 @@ + + + \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php index b22dbe34e..c523f4d80 100755 --- a/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/checkout/onepage.blade.php @@ -88,9 +88,11 @@
@@ -482,7 +484,7 @@ methodSelected: function() { this.$emit('onShippingMethodSelected', this.selected_shipping_method) - eventBus.$emit('after-shipping-method-selected'); + eventBus.$emit('after-shipping-method-selected', this.selected_shipping_method); } } }) @@ -535,7 +537,7 @@ methodSelected: function() { this.$emit('onPaymentMethodSelected', this.payment) - eventBus.$emit('after-payment-method-selected'); + eventBus.$emit('after-payment-method-selected', this.payment); } } }) diff --git a/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php b/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php index e8af8b389..80a6f1faa 100755 --- a/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/layouts/master.blade.php @@ -97,15 +97,14 @@ @elseif ($warning = session('warning')) window.flashMessages = [{'type': 'alert-warning', 'message': "{{ $warning }}" }]; @elseif ($error = session('error')) - window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" } - ]; + window.flashMessages = [{'type': 'alert-error', 'message': "{{ $error }}" }]; @elseif ($info = session('info')) - window.flashMessages = [{'type': 'alert-info', 'message': "{{ $info }}" } - ]; + window.flashMessages = [{'type': 'alert-info', 'message': "{{ $info }}" }]; @endif window.serverErrors = []; - @if(isset($errors)) + + @if (isset($errors)) @if (count($errors)) window.serverErrors = @json($errors->getMessages()); @endif diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/checkout/onepage.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/checkout/onepage.blade.php index a6744c0d4..1832feeb8 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/checkout/onepage.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/checkout/onepage.blade.php @@ -67,6 +67,7 @@ class="theme-btn" @click="placeOrder()" :disabled="!isPlaceOrderEnabled" + v-if="selected_payment_method.method != 'paypal_smart_button'" id="checkout-place-order-button"> {{ __('shop::app.checkout.onepage.place-order') }} @@ -78,6 +79,8 @@