mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
fixes for payment notifications
This commit is contained in:
parent
bc688985e1
commit
c21ad042ce
@ -53,11 +53,11 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
|
|||||||
* @param $user
|
* @param $user
|
||||||
* @param $company
|
* @param $company
|
||||||
*/
|
*/
|
||||||
public function __construct($payment, $user, $company)
|
public function __construct($payment, $company)
|
||||||
{
|
{
|
||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
|
|
||||||
$this->user = $user;
|
$this->user = $payment->user;
|
||||||
|
|
||||||
$this->payment = $payment;
|
$this->payment = $payment;
|
||||||
|
|
||||||
@ -82,6 +82,8 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
|
|||||||
//if we need to set an email driver do it now
|
//if we need to set an email driver do it now
|
||||||
$this->setMailDriver();
|
$this->setMailDriver();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
$mail_obj = (new EntityPaidObject($this->payment))->build();
|
$mail_obj = (new EntityPaidObject($this->payment))->build();
|
||||||
$mail_obj->from = [$this->payment->user->email, $this->payment->user->present()->name()];
|
$mail_obj->from = [$this->payment->user->email, $this->payment->user->present()->name()];
|
||||||
|
|
||||||
@ -89,9 +91,16 @@ class EntityPaidMailer extends BaseMailerJob implements ShouldQueue
|
|||||||
Mail::to($this->user->email)
|
Mail::to($this->user->email)
|
||||||
->send(new EntityNotificationMailer($mail_obj));
|
->send(new EntityNotificationMailer($mail_obj));
|
||||||
|
|
||||||
//catch errors
|
} catch (Swift_TransportException $e) {
|
||||||
if (count(Mail::failures()) > 0) {
|
$this->failed($e->getMessage());
|
||||||
return $this->logMailError(Mail::failures(), $this->payment->client);
|
//$this->entityEmailFailed($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count(Mail::failures()) > 0) {
|
||||||
|
$this->logMailError(Mail::failures(), $this->entity->client);
|
||||||
|
} else {
|
||||||
|
// $this->entityEmailSucceeded();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,11 +62,8 @@ class PaymentNotification implements ShouldQueue
|
|||||||
if (($key = array_search('mail', $methods)) !== false) {
|
if (($key = array_search('mail', $methods)) !== false) {
|
||||||
unset($methods[$key]);
|
unset($methods[$key]);
|
||||||
|
|
||||||
//Fire mail notification here!!!
|
EntityPaidMailer::dispatch($payment, $payment->company);
|
||||||
//This allows us better control of how we
|
|
||||||
//handle the mailer
|
|
||||||
|
|
||||||
EntityPaidMailer::dispatch($payment, $user, $payment->company);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$notification = new NewPaymentNotification($payment, $payment->company);
|
$notification = new NewPaymentNotification($payment, $payment->company);
|
||||||
@ -84,7 +81,6 @@ class PaymentNotification implements ShouldQueue
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Google Analytics Track Revenue*/
|
/*Google Analytics Track Revenue*/
|
||||||
|
|
||||||
if (isset($payment->company->google_analytics_key)) {
|
if (isset($payment->company->google_analytics_key)) {
|
||||||
$this->trackRevenue($event);
|
$this->trackRevenue($event);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user