From 33cc1089003599ad9c7b7173b321f1ddabc5cfff Mon Sep 17 00:00:00 2001 From: IceToast Date: Mon, 6 Feb 2023 11:32:19 +0100 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=F0=9F=90=9B=20getCsrfIgnoredRoutes?= =?UTF-8?q?=20map=20all=20routes=20just=20once?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Helpers/ExtensionHelper.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Helpers/ExtensionHelper.php b/app/Helpers/ExtensionHelper.php index fdf880ab..7e1bbda3 100644 --- a/app/Helpers/ExtensionHelper.php +++ b/app/Helpers/ExtensionHelper.php @@ -51,13 +51,11 @@ class ExtensionHelper $routes = array_merge($routes, $config['RoutesIgnoreCsrf']); } - // add extension/ infront of every route - foreach ($routes as $key => $route) { - $routes[$key] = 'extensions/' . $route; - } + // map over the routes and add the extension name as prefix + $result = array_map(fn ($item) => "extensions/{$item}", $routes); } - return $routes; + return $result; } /** From 29e9ed6e4ab86af376fae7ae512174e28196adcf Mon Sep 17 00:00:00 2001 From: IceToast Date: Mon, 6 Feb 2023 11:57:14 +0100 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Wrong=20class=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/CleanupOpenPayments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/CleanupOpenPayments.php b/app/Console/Commands/CleanupOpenPayments.php index 31510b6a..6fd96a7a 100644 --- a/app/Console/Commands/CleanupOpenPayments.php +++ b/app/Console/Commands/CleanupOpenPayments.php @@ -5,7 +5,7 @@ namespace App\Console\Commands; use App\Models\Payment; use Illuminate\Console\Command; -class CleanupPayments extends Command +class CleanupOpenPayments extends Command { /** * The name and signature of the console command. From 01fc6333032f1726a828eecbb135631174d0bb1a Mon Sep 17 00:00:00 2001 From: IceToast Date: Mon, 6 Feb 2023 20:42:17 +0100 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=F0=9F=9A=91=EF=B8=8F=20Set=20Theme?= =?UTF-8?q?=20to=20default=20when=20no=20setting=20or=20setting=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Providers/AppServiceProvider.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 8fae42a6..6299bf4f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -46,9 +46,9 @@ class AppServiceProvider extends ServiceProvider } //if none of result array is true. it sets ok to false - if (! in_array(true, $result)) { + if (!in_array(true, $result)) { $ok = false; - $validator->setCustomMessages(['multiple_date_format' => 'The format must be one of '.implode(',', $parameters)]); + $validator->setCustomMessages(['multiple_date_format' => 'The format must be one of ' . implode(',', $parameters)]); } return $ok; @@ -60,7 +60,7 @@ class AppServiceProvider extends ServiceProvider view()->share('useful_links', $useful_links); } } catch (Exception $e) { - Log::error("Couldnt find useful_links. Probably the installation is not completet. ".$e); + Log::error("Couldnt find useful_links. Probably the installation is not completet. " . $e); } //only run if the installer has been executed @@ -71,12 +71,14 @@ class AppServiceProvider extends ServiceProvider config([$setting->key => $setting->value]); } - if(!file_exists(base_path('themes') . "/" . config("SETTINGS::SYSTEM:THEME"))){ + if (!file_exists(base_path('themes') . "/" . config("SETTINGS::SYSTEM:THEME"))) { config(['SETTINGS::SYSTEM:THEME' => "default"]); } - if(config('SETTINGS::SYSTEM:THEME') !== config('theme.active')){ - Theme::set(config("SETTINGS::SYSTEM:THEME"), "default"); + if (config('SETTINGS::SYSTEM:THEME') && config('SETTINGS::SYSTEM:THEME') !== config('theme.active')) { + Theme::set(config("SETTINGS::SYSTEM:THEME", "default"), "default"); + } else { + Theme::set("default", "default"); } // Set Mail Config @@ -126,7 +128,7 @@ class AppServiceProvider extends ServiceProvider } try { - $stringfromfile = file(base_path().'/.git/HEAD'); + $stringfromfile = file(base_path() . '/.git/HEAD'); $firstLine = $stringfromfile[0]; //get the string from the array From b8946d8666b8b42ca9016da7597b133a4ae2f4b7 Mon Sep 17 00:00:00 2001 From: IceToast Date: Tue, 7 Feb 2023 13:59:09 +0100 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=F0=9F=9A=91=EF=B8=8F=20Paypal=20aut?= =?UTF-8?q?hentication=20error=20->=20blank=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PaymentGateways/PayPal/index.php | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/app/Extensions/PaymentGateways/PayPal/index.php b/app/Extensions/PaymentGateways/PayPal/index.php index 88abc809..11ac4473 100644 --- a/app/Extensions/PaymentGateways/PayPal/index.php +++ b/app/Extensions/PaymentGateways/PayPal/index.php @@ -9,6 +9,7 @@ use App\Models\User; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; +use Illuminate\Support\Facades\Log; use PayPalCheckoutSdk\Core\PayPalHttpClient; use PayPalCheckoutSdk\Core\ProductionEnvironment; use PayPalCheckoutSdk\Core\SandboxEnvironment; @@ -74,7 +75,7 @@ function PaypalPay(Request $request) "application_context" => [ "cancel_url" => route('payment.Cancel'), "return_url" => route('payment.PayPalSuccess', ['payment' => $payment->id]), - 'brand_name' => config('app.name', 'Laravel'), + 'brand_name' => config('app.name', 'Controlpanel.GG'), 'shipping_preference' => 'NO_SHIPPING' ] @@ -85,14 +86,23 @@ function PaypalPay(Request $request) // Call API with your client and get a response for your call $response = getPayPalClient()->execute($request); + // check for any errors in the response + if ($response->statusCode != 201) { + throw new \Exception($response->statusCode); + } + + // make sure the link is not empty + if (empty($response->result->links[1]->href)) { + throw new \Exception('No redirect link found'); + } + Redirect::away($response->result->links[1]->href)->send(); return; } catch (HttpException $ex) { - error_log($ex->statusCode); - error_log($ex->getMessage()); - + Log::error('PayPal Payment: ' . $ex->getMessage()); $payment->delete(); - Redirect::route('payment.Cancel'); + + Redirect::route('store.index')->with('error', 'Payment failed')->send(); return; } } From 128015f0fae38b9d1e7190f803291e6d39581278 Mon Sep 17 00:00:00 2001 From: IceToast Date: Tue, 7 Feb 2023 14:18:22 +0100 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20=F0=9F=8C=90=20localization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Extensions/PaymentGateways/PayPal/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Extensions/PaymentGateways/PayPal/index.php b/app/Extensions/PaymentGateways/PayPal/index.php index 11ac4473..648913ae 100644 --- a/app/Extensions/PaymentGateways/PayPal/index.php +++ b/app/Extensions/PaymentGateways/PayPal/index.php @@ -102,7 +102,7 @@ function PaypalPay(Request $request) Log::error('PayPal Payment: ' . $ex->getMessage()); $payment->delete(); - Redirect::route('store.index')->with('error', 'Payment failed')->send(); + Redirect::route('store.index')->with('error', __('Payment failed'))->send(); return; } }