Adjustments for entity notifications

This commit is contained in:
David Bomba 2021-11-27 15:54:49 +11:00
parent 706e8cf240
commit dc1fe692a3
6 changed files with 11 additions and 17 deletions

View File

@ -85,7 +85,7 @@ class PaymentFailedMailer implements ShouldQueue
//determine if this user has the right permissions
// $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']);
$methods = $this->findUserEntityNotificationType($this->client, $company_user, ['payment_failure_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','payment_failure','all_notifications']);
$methods = $this->findCompanyUserNotificationType($company_user, ['payment_failure_all','payment_failure', 'payment_failure_user', 'all_notifications']);
//if mail is a method type -fire mail!!
if (($key = array_search('mail', $methods)) !== false) {

View File

@ -440,7 +440,7 @@ class BaseDriver extends AbstractPaymentDriver
$invoices->first()->invitations->each(function ($invitation) use ($nmo) {
if ($invitation->contact->email) {
if ((bool)$invitation->contact->send_email !== false && $invitation->contact->email) {
$nmo->to_user = $invitation->contact;
NinjaMailerJob::dispatch($nmo);

View File

@ -213,10 +213,10 @@ class CreditCard implements MethodInterface
if ($response->status == 'Declined') {
$this->checkout->unWindGatewayFees($this->checkout->payment_hash);
$this->checkout->sendFailureMail($response->response_summary);
// $this->checkout->sendFailureMail($response->response_summary);
//@todo - this will double up the checkout . com failed mails
$this->checkout->clientPaymentFailureMailer($response->status);
// $this->checkout->clientPaymentFailureMailer($response->status);
return $this->processUnsuccessfulPayment($response);
}

View File

@ -84,8 +84,9 @@ trait Utilities
public function processUnsuccessfulPayment(Payment $_payment, $throw_exception = true)
{
$this->getParent()->sendFailureMail($_payment->status . " " . optional($_payment)->response_summary);
$this->getParent()->sendFailureMail($_payment->response_summary);
$this->getParent()->clientPaymentFailureMailer($_payment->status);
$message = [
'server_response' => $_payment,
'data' => $this->getParent()->payment_hash->data,

View File

@ -61,18 +61,11 @@ trait UserNotifies
array_push($required_permissions, 'all_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)));
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect(['all_user_notifications'], $notifications->email)) >= 1 || count(array_intersect(['all_notifications'],$notifications->email)) >= 1) {
if (count(array_intersect($required_permissions, $notifications->email)) >= 1 || count(array_intersect(['all_notifications'],$notifications->email)) >= 1) {
array_push($notifiable_methods, 'mail');
}
nlog($notifiable_methods);
return $notifiable_methods;
}