diff --git a/app/Http/Middleware/CheckClientExistence.php b/app/Http/Middleware/CheckClientExistence.php index 3944a4470edc..0a9302b0f656 100644 --- a/app/Http/Middleware/CheckClientExistence.php +++ b/app/Http/Middleware/CheckClientExistence.php @@ -37,14 +37,13 @@ class CheckClientExistence ->where('email', auth()->guard('contact')->user()->email) ->whereNotNull('email') ->where('email', '<>', '') - ->distinct('company_id') - ->distinct('email') + ->distinct('client_id') ->whereNotNull('company_id') ->whereHas('client', function ($query) { return $query->where('is_deleted', false); }) ->whereHas('company', function ($query){ - return $query->where('id', auth()->guard('contact')->user()->client->company_id); + return $query->where('companies.account_id', auth()->guard('contact')->user()->company->account_id); }) ->get(); diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index c1a3aaee3197..ccc0126d3ed2 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -82,6 +82,9 @@ class PaymentFailureMailer implements ShouldQueue //determine if this user has the right permissions $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure_all','payment_failure', 'payment_failure_user', 'all_notifications']); + if(!is_string($this->error)) + $this->error = "Undefined error. Please contact the administrator for further information."; + //if mail is a method type -fire mail!! if (($key = array_search('mail', $methods)) !== false) { unset($methods[$key]); diff --git a/app/PaymentDrivers/Stripe/FPX.php b/app/PaymentDrivers/Stripe/FPX.php index 8a73ce6c98d4..ac52f5d963b3 100644 --- a/app/PaymentDrivers/Stripe/FPX.php +++ b/app/PaymentDrivers/Stripe/FPX.php @@ -141,6 +141,6 @@ class FPX $this->stripe->client->company, ); - throw new PaymentFailed('Failed to process the payment.', 500); + throw new PaymentFailed('Failed to process the payment.', 400); } }