diff --git a/app/Jobs/Mail/PaymentFailedMailer.php b/app/Jobs/Mail/PaymentFailedMailer.php index 87663e159b16..58c6abc1059d 100644 --- a/app/Jobs/Mail/PaymentFailedMailer.php +++ b/app/Jobs/Mail/PaymentFailedMailer.php @@ -83,7 +83,9 @@ class PaymentFailedMailer implements ShouldQueue $this->company->company_users->each(function ($company_user) use($amount, $settings){ //determine if this user has the right permissions - $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure','all_notifications']); + // $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure_all','payment_failure','all_notifications']); + + $methods = $this->findUserEntityNotificationType($this->client, $company_user, ['payment_failure_all','payment_failure','all_notifications']); //if mail is a method type -fire mail!! if (($key = array_search('mail', $methods)) !== false) { diff --git a/app/Jobs/Mail/PaymentFailureMailer.php b/app/Jobs/Mail/PaymentFailureMailer.php index c54fb042377a..98a2c2448985 100644 --- a/app/Jobs/Mail/PaymentFailureMailer.php +++ b/app/Jobs/Mail/PaymentFailureMailer.php @@ -80,7 +80,7 @@ class PaymentFailureMailer implements ShouldQueue $this->company->company_users->each(function ($company_user) { //determine if this user has the right permissions - $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure','all_notifications']); + $methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure_all','payment_failure','all_notifications']); //if mail is a method type -fire mail!! if (($key = array_search('mail', $methods)) !== false) { diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index 4c9e05420c29..0e1ce5823a8e 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -79,6 +79,12 @@ trait UserNotifies $notifiable_methods = []; $notifications = $company_user->notifications; +nlog($company_user->notifications); +nlog($required_permissions); +nlog(count(array_intersect($required_permissions, ['all_user_notifications']))); +nlog(count(array_intersect($required_permissions, ['all_notifications']))); + +nlog(count(array_intersect($required_permissions, $notifications->email))); //conditional to define whether the company user has the required notification for the MAIL notification TYPE if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect($required_permissions, ['all_user_notifications'])) >= 1 || count(array_intersect($required_permissions, ['all_notifications'])) >= 1) { array_push($notifiable_methods, 'mail');