Fixes for FPX mailer and multi company selector in Client Portal

This commit is contained in:
David Bomba 2022-02-27 11:31:01 +11:00
parent d9655de72f
commit 4b4b4cf60c
3 changed files with 6 additions and 4 deletions

View File

@ -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();

View File

@ -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]);

View File

@ -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);
}
}