diff --git a/app/Http/Controllers/APIs/Customer_API/SubscriptionController.php b/app/Http/Controllers/APIs/Customer_API/SubscriptionController.php index e9a81fc..dd65cd7 100644 --- a/app/Http/Controllers/APIs/Customer_API/SubscriptionController.php +++ b/app/Http/Controllers/APIs/Customer_API/SubscriptionController.php @@ -61,7 +61,8 @@ class SubscriptionController extends Controller } } catch (\Exception $e) { - Log::error("An error occurred in " . _METHOD_ . ": " . $e->getMessage(), ['exception' => $e]); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong')); } } @@ -80,7 +81,8 @@ class SubscriptionController extends Controller return view('Admin.pages.subscriptions.list-of-products', compact('productList')); } catch (\Exception $e) { - Log::error("An error occurred in " . _METHOD_ . ": " . $e->getMessage(), ['exception' => $e]); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); } } @@ -195,7 +197,7 @@ class SubscriptionController extends Controller $stripeId = $request->stripe_id; $timestamp = $request->timestamp_to_update; - + $updateSubscription = $stripe->subscriptions->update( $stripeId, ['trial_end' => $timestamp] //8 RD aUG @@ -303,7 +305,8 @@ class SubscriptionController extends Controller } catch (\Exception $e) { - Log::error("An error occurred in " . _METHOD_ . ": " . $e->getMessage(), ['exception' => $e]); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]); + return jsonResponseWithErrorMessage(__('auth.something_went_wrong')); // return redirect()->back()->with(['error' => "Something went wrong while subscription!" . $e->getMessage()]); @@ -368,9 +371,9 @@ class SubscriptionController extends Controller } catch (\Exception $e) { DB::rollBack(); + Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage(), ['exception' => $e]); return redirect()->back()->with(['error' => "Something went wrong while cancelling subscription!" . $e->getMessage()]); - // Log::error("An error occurred in " . _METHOD_ . ": " . $e->getMessage(), ['exception' => $e]); // return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500); } } diff --git a/resources/views/Admin/pages/subscriptions/my-subscription.blade.php b/resources/views/Admin/pages/subscriptions/my-subscription.blade.php index 2dfb63b..3da5b55 100644 --- a/resources/views/Admin/pages/subscriptions/my-subscription.blade.php +++ b/resources/views/Admin/pages/subscriptions/my-subscription.blade.php @@ -42,17 +42,17 @@