mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-11 13:42:49 +01:00
some additional missing changes form handler method
This commit is contained in:
parent
1a88a81324
commit
1654d72bc2
@ -15,12 +15,14 @@ use App\DataMapper\Analytics\Mail\EmailBounce;
|
|||||||
use App\DataMapper\Analytics\Mail\EmailSpam;
|
use App\DataMapper\Analytics\Mail\EmailSpam;
|
||||||
use App\Jobs\Util\SystemLogger;
|
use App\Jobs\Util\SystemLogger;
|
||||||
use App\Libraries\MultiDB;
|
use App\Libraries\MultiDB;
|
||||||
|
use App\Models\Company;
|
||||||
use App\Models\CreditInvitation;
|
use App\Models\CreditInvitation;
|
||||||
use App\Models\InvoiceInvitation;
|
use App\Models\InvoiceInvitation;
|
||||||
use App\Models\PurchaseOrderInvitation;
|
use App\Models\PurchaseOrderInvitation;
|
||||||
use App\Models\QuoteInvitation;
|
use App\Models\QuoteInvitation;
|
||||||
use App\Models\RecurringInvoiceInvitation;
|
use App\Models\RecurringInvoiceInvitation;
|
||||||
use App\Models\SystemLog;
|
use App\Models\SystemLog;
|
||||||
|
use App\Notifications\Ninja\EmailBounceNotification;
|
||||||
use App\Notifications\Ninja\EmailSpamNotification;
|
use App\Notifications\Ninja\EmailSpamNotification;
|
||||||
use Brevo\Client\Configuration;
|
use Brevo\Client\Configuration;
|
||||||
use Brevo\Client\Model\GetTransacEmailContentEvents;
|
use Brevo\Client\Model\GetTransacEmailContentEvents;
|
||||||
@ -84,16 +86,21 @@ class ProcessBrevoWebhook implements ShouldQueue
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
MultiDB::findAndSetDbByCompanyKey($this->request['tags'][0]);
|
MultiDB::findAndSetDbByCompanyKey($this->request['tags'][0]);
|
||||||
|
$company = Company::where('company_key', $this->request['tags'][0])->first();
|
||||||
|
|
||||||
$this->invitation = $this->discoverInvitation($this->request['message-id']);
|
$this->invitation = $this->discoverInvitation($this->request['message-id']);
|
||||||
|
|
||||||
|
if ($company && $this->request['event'] == 'spam' && config('ninja.notification.slack')) {
|
||||||
|
$company->notification(new EmailSpamNotification($company))->ninja();
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->invitation) {
|
if (!$this->invitation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (array_key_exists('Details', $this->request)) {
|
if (array_key_exists('reason', $this->request)) {
|
||||||
// $this->invitation->email_error = $this->request['Details'];
|
$this->invitation->email_error = $this->request['reason'];
|
||||||
// } // no details, when error occured
|
}
|
||||||
|
|
||||||
switch ($this->request['event']) {
|
switch ($this->request['event']) {
|
||||||
case 'delivered':
|
case 'delivered':
|
||||||
@ -102,6 +109,11 @@ class ProcessBrevoWebhook implements ShouldQueue
|
|||||||
case 'hard_bounce':
|
case 'hard_bounce':
|
||||||
case 'invalid_email':
|
case 'invalid_email':
|
||||||
case 'blocked':
|
case 'blocked':
|
||||||
|
|
||||||
|
if ($this->request['subject'] == ctrans('texts.confirmation_subject')) {
|
||||||
|
$company->notification(new EmailBounceNotification($this->request['email']))->ninja();
|
||||||
|
}
|
||||||
|
|
||||||
return $this->processBounce();
|
return $this->processBounce();
|
||||||
case 'spam':
|
case 'spam':
|
||||||
return $this->processSpamComplaint();
|
return $this->processSpamComplaint();
|
||||||
|
Loading…
Reference in New Issue
Block a user