diff --git a/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php index b3c7207d3..e63d21ad8 100755 --- a/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php +++ b/packages/Webkul/Paypal/src/Http/Controllers/SmartButtonController.php @@ -61,7 +61,7 @@ class SmartButtonController extends Controller try { return response()->json($this->smartButton->createOrder($this->buildRequestBody())); } catch (\Exception $e) { - throw $e; + return response()->json(json_decode($e->getMessage()), 400); } } @@ -76,7 +76,7 @@ class SmartButtonController extends Controller $this->smartButton->captureOrder(request()->input('orderData.orderID')); return $this->saveOrder(); } catch (\Exception $e) { - throw $e; + return response()->json(json_decode($e->getMessage()), 400); } } diff --git a/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php b/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php index b815ed97b..097a817e3 100755 --- a/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php +++ b/packages/Webkul/Paypal/src/Providers/PaypalServiceProvider.php @@ -15,6 +15,8 @@ class PaypalServiceProvider extends ServiceProvider { include __DIR__ . '/../Http/routes.php'; + $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'paypal'); + $this->loadViewsFrom(__DIR__ . '/../Resources/views', 'paypal'); $this->app->register(EventServiceProvider::class); @@ -29,7 +31,7 @@ class PaypalServiceProvider extends ServiceProvider { $this->registerConfig(); } - + /** * Register package config. * diff --git a/packages/Webkul/Paypal/src/Resources/lang/ar/app.php b/packages/Webkul/Paypal/src/Resources/lang/ar/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/ar/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/de/app.php b/packages/Webkul/Paypal/src/Resources/lang/de/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/de/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/en/app.php b/packages/Webkul/Paypal/src/Resources/lang/en/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/en/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/fa/app.php b/packages/Webkul/Paypal/src/Resources/lang/fa/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/fa/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/it/app.php b/packages/Webkul/Paypal/src/Resources/lang/it/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/it/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/ja/app.php b/packages/Webkul/Paypal/src/Resources/lang/ja/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/ja/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/nl/app.php b/packages/Webkul/Paypal/src/Resources/lang/nl/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/nl/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/pl/app.php b/packages/Webkul/Paypal/src/Resources/lang/pl/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/pl/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/pt_BR/app.php b/packages/Webkul/Paypal/src/Resources/lang/pt_BR/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/pt_BR/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; diff --git a/packages/Webkul/Paypal/src/Resources/lang/tr/app.php b/packages/Webkul/Paypal/src/Resources/lang/tr/app.php new file mode 100644 index 000000000..796b54254 --- /dev/null +++ b/packages/Webkul/Paypal/src/Resources/lang/tr/app.php @@ -0,0 +1,9 @@ + [ + 'universal-error' => 'Something went wrong!', + 'sdk-validation-error' => 'Client ID not recognized for either production or sandbox!', + 'authorization-error' => 'Client ID and Client Secret should be valid!' + ] +]; 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 index 207aaf56d..f94390ff3 100644 --- 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 @@ -14,8 +14,14 @@