Fix for double Update Entity Webhook call

This commit is contained in:
David Bomba 2021-10-27 15:40:14 +11:00
parent 369acc27be
commit a6c9e0e8b3
4 changed files with 7 additions and 4 deletions

View File

@ -42,7 +42,7 @@ class CreditEmailedNotification implements ShouldQueue
$credit = $event->invitation->credit; $credit = $event->invitation->credit;
$credit->last_sent_date = now(); $credit->last_sent_date = now();
$credit->save(); $credit->saveQuietly();
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() ); $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() );

View File

@ -42,7 +42,7 @@ class InvoiceEmailedNotification implements ShouldQueue
$invoice = $event->invitation->invoice; $invoice = $event->invitation->invoice;
$invoice->last_sent_date = now(); $invoice->last_sent_date = now();
$invoice->save(); $invoice->saveQuietly();
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'invoice', $event->template))->build() ); $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'invoice', $event->template))->build() );

View File

@ -42,7 +42,7 @@ class QuoteEmailedNotification implements ShouldQueue
$quote = $event->invitation->quote; $quote = $event->invitation->quote;
$quote->last_sent_date = now(); $quote->last_sent_date = now();
$quote->save(); $quote->saveQuietly();
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'quote', $event->template))->build() ); $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'quote', $event->template))->build() );

View File

@ -405,6 +405,10 @@ class BaseDriver extends AbstractPaymentDriver
public function sendFailureMail(string $error) public function sendFailureMail(string $error)
{ {
if (!is_null($this->payment_hash)) {
$this->unWindGatewayFees($this->payment_hash);
}
PaymentFailedMailer::dispatch( PaymentFailedMailer::dispatch(
$this->payment_hash, $this->payment_hash,
$this->client->company, $this->client->company,
@ -419,7 +423,6 @@ class BaseDriver extends AbstractPaymentDriver
if ($this->payment_hash && is_array($this->payment_hash->invoices())) { if ($this->payment_hash && is_array($this->payment_hash->invoices())) {
$nmo = new NinjaMailerObject; $nmo = new NinjaMailerObject;
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build()); $nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build());
$nmo->company = $this->client->company; $nmo->company = $this->client->company;