Fixes for payment failure mailers

This commit is contained in:
David Bomba 2021-11-26 16:33:49 +11:00
parent f6f9e7a7a1
commit 9086b224ce
3 changed files with 10 additions and 2 deletions

View File

@ -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) {

View File

@ -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) {

View File

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