From f43909141fb71a27f9f9e2eef0ad733bab642347 Mon Sep 17 00:00:00 2001 From: paulwer Date: Sun, 24 Mar 2024 10:53:20 +0100 Subject: [PATCH] brevo webhook + better attachement fetching cycle + fixes for brevo key integration namings --- app/Http/Controllers/BrevoController.php | 153 +++++++++++- app/Http/Controllers/MailgunController.php | 2 +- app/Jobs/Brevo/ProcessBrevoInboundWebhook.php | 182 ++++++++++++++ app/Jobs/Brevo/ProcessBrevoWebhook.php | 2 +- .../Mailgun/ProcessMailgunInboundWebhook.php | 86 +++++-- app/Providers/AppServiceProvider.php | 6 +- composer.lock | 227 +++++++++--------- config/services.php | 8 +- routes/api.php | 1 + 9 files changed, 527 insertions(+), 140 deletions(-) create mode 100644 app/Jobs/Brevo/ProcessBrevoInboundWebhook.php diff --git a/app/Http/Controllers/BrevoController.php b/app/Http/Controllers/BrevoController.php index e1dce175f485..c87b4ff0f285 100644 --- a/app/Http/Controllers/BrevoController.php +++ b/app/Http/Controllers/BrevoController.php @@ -11,8 +11,10 @@ namespace App\Http\Controllers; +use App\Jobs\Brevo\ProcessBrevoInboundWebhook; use App\Jobs\Brevo\ProcessBrevoWebhook; use Illuminate\Http\Request; +use Log; /** * Class PostMarkController. @@ -26,13 +28,13 @@ class BrevoController extends BaseController } /** - * Process Postmark Webhook. + * Process Brevo Webhook. * * * @OA\Post( - * path="/api/v1/postmark_webhook", - * operationId="postmarkWebhook", - * tags={"postmark"}, + * path="/api/v1/brevo_webhook", + * operationId="brevoWebhook", + * tags={"brevo"}, * summary="Processing webhooks from PostMark", * description="Adds an credit to the system", * @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"), @@ -61,7 +63,7 @@ class BrevoController extends BaseController */ public function webhook(Request $request) { - if ($request->has('token') && $request->get('token') == config('services.brevo.key')) { + if ($request->has('token') && $request->get('token') == config('services.brevo.secret')) { ProcessBrevoWebhook::dispatch($request->all())->delay(10); return response()->json(['message' => 'Success'], 200); @@ -69,4 +71,145 @@ class BrevoController extends BaseController return response()->json(['message' => 'Unauthorized'], 403); } + + + /** + * Process Brevo Inbound Webhook. + * + * + * @OA\Post( + * path="/api/v1/brevo_inbound_webhook", + * operationId="brevoInboundWebhook", + * tags={"brevo"}, + * summary="Processing inbound webhooks from Brevo", + * description="Adds an credit to the system", + * @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"), + * @OA\Parameter(ref="#/components/parameters/X-Requested-With"), + * @OA\Parameter(ref="#/components/parameters/include"), + * @OA\Response( + * response=200, + * description="Returns the saved credit object", + * @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"), + * @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"), + * @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"), + * @OA\JsonContent(ref="#/components/schemas/Credit"), + * ), + * @OA\Response( + * response=422, + * description="Validation error", + * @OA\JsonContent(ref="#/components/schemas/ValidationError"), + * + * ), + * @OA\Response( + * response="default", + * description="Unexpected Error", + * @OA\JsonContent(ref="#/components/schemas/Error"), + * ), + * ) + * + * array ( + * 'items' => + * array ( + * 0 => + * array ( + * 'Uuid' => + * array ( + * 0 => 'd9f48d52-a344-42a4-9056-9733488d9fa3', + * ), + * 'Recipients' => + * array ( + * 0 => 'test@test.de', + * ), + * 'MessageId' => '', + * 'InReplyTo' => NULL, + * 'From' => + * array ( + * 'Name' => 'Max Mustermann', + * 'Address' => 'max@mustermann.de', + * ), + * 'To' => + * array ( + * 0 => + * array ( + * 'Name' => NULL, + * 'Address' => 'test@test.de', + * ), + * ), + * 'Cc' => + * array ( + * ), + * 'Bcc' => + * array ( + * ), + * 'ReplyTo' => NULL, + * 'SentAtDate' => 'Sat, 23 Mar 2024 18:18:20 +0100', + * 'Subject' => 'TEST', + * 'Attachments' => + * array ( + * 0 => + * array ( + * 'Name' => 'flag--sv-1x1.svg', + * 'ContentType' => 'image/svg+xml', + * 'ContentLength' => 79957, + * 'ContentID' => 'f_lu4ct6s20', + * 'DownloadToken' => 'eyJmb2xkZXIiOiIyMDI0MDMyMzE3MTgzNi45OS43OTgwMDM4MDQiLCJmaWxlbmFtZSI6ImZsYWctLXN2LTF4MS5zdmcifQ', + * ), + * ), + * 'Headers' => + * array ( + * 'Received' => 'by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56b0af675deso3877288a12.1 for ; Sat, 23 Mar 2024 10:18:36 -0700 (PDT)', + * 'DKIM-Signature' => 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=mustermann.de; s=google; t=1711214316; x=1711819116; darn=test.de; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=eBSl5M0zvmTd+dFXGXMMSWrQ4nCvUdyVx+1Xpl+YuX8=; b=ackw3d+qTvZk4JKxomvH626MvfwmH23mikOUc2hWwYiO6unmQgPs2w5spnkmD9aCZ9 G+3nPSYKntugOmqWstZH3z4B063U4Y6j5hTc19WtCyyb9UR+XD+C6L10yc6ez8QUhlZT uAGqDoJ+E8+dBxiMul2pow19lC88t3QxRXU+i8zScniV7SFkwzziCEODaB61yI0DXsZB bUkx5Gx6cztKaNVF2QgguF2nQnJFUnD2nabVFsihyJ5r6y61rkSM/YTfMJuES772lnhv IeF+vwiFNEPKafrchce6YJcvo5Vd5lYFK4LtHyCy3mwJpX2QY+WnWAfferZ2YfgEL0Sf K3Pw==', + * 'X-Google-DKIM-Signature' => 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711214316; x=1711819116; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eBSl5M0zvmTd+dFXGXMMSWrQ4nCvUdyVx+1Xpl+YuX8=; b=fg4tXZnstRBexYlC6MD7C7is0kQj+xY66cSJ78tSa7PtSFQzY0zajDMsepMCGiiWmN /Pc/tRtk53pru/OtfzRT9pbM6mhM1arIt+QaQBQGU5xZVV5JXfPmdnPzXqAbQztyeHrk UcEkz+qDN3JNoidw2dJhhdt5MxdKssR572NwtBrn/rN7f1o/ThWzEz+P0o06GVBpxVYP wM0EkvcJj2SUOcn36kmp1ccbMUwYCU2h1JmniEFY8RTqu2il13iXoBvG4YPxe0c0hJ6z zw1N5rONeQM113N1rpbQzS1QLSngczuOhN24M3TOwrHJIec/BxrOW6KWl/uPUqiZAf65 f0tg==', + * 'X-Gm-Message-State' => 'AOJu0YzKhR1HY1oUXoq++LLpl6UOz1S60NfPxuPXBLcP+6aACYle8rqQ fYHe2rQYTpg4KWiOswu858STOW8qmiewXD6gH/LbmEFs7sknRyDPNr/+L0cv828A3o+SOvXu3uP SY6H1aNSwIpqTRhJ+nNjTuSUpuSoABd9fYXFwPuivV0DtBhoVmpE=', + * 'X-Google-Smtp-Source' => 'AGHT+IHdA9ZhW0dQxgOYx2OXBGmu4pzSR/zwJ0vcPNXFSqttKCPS2oTw1a9b2mMdhyUeoRAwP5TmhHlAtqUUrOPwkgg=', + * 'X-Received' => 'by 2002:a50:d74c:0:b0:567:3c07:8bbc with SMTP id i12-20020a50d74c000000b005673c078bbcmr2126401edj.21.1711214316135; Sat, 23 Mar 2024 10:18:36 -0700 (PDT)', + * 'MIME-Version' => '1.0', + * 'From' => 'Max Mustermann ', + * 'Date' => 'Sat, 23 Mar 2024 18:18:20 +0100', + * 'Message-ID' => '', + * 'Subject' => 'TEST', + * 'To' => 'test@test.de', + * 'Content-Type' => 'multipart/mixed', + * ), + * 'SpamScore' => 2.8, + * 'ExtractedMarkdownMessage' => 'TEST', + * 'ExtractedMarkdownSignature' => NULL, + * 'RawHtmlBody' => '
TEST
', + * 'RawTextBody' => 'TEST', + * 'EMLDownloadToken' => 'eyJmb2xkZXIiOiIyMDI0MDMyMzE3MTgzNi45OS43OTgwMDM4MDQiLCJmaWxlbmFtZSI6InNtdHAuZW1sIn0', + * ), + * ), + * ) + */ + public function inboundWebhook(Request $request) + { + $input = $request->all(); + + // TODO: validation for client credentials by recipient + // if (!($request->has('token') && $request->get('token') == config('services.brevo.secret'))) + // return response()->json(['message' => 'Unauthorized'], 403); + + if (!array_key_exists('items', $input)) { + Log::info('Failed: Message could not be parsed, because required parameters are missing.'); + return response()->json(['message' => 'Failed. Invalid Parameters.'], 400); + } + + foreach ($input["items"] as $item) { + + if (!array_key_exists('Recipients', $item) || !array_key_exists('MessageId', $item)) { + Log::info('Failed: Message could not be parsed, because required parameters are missing. At least one item was invalid.'); + return response()->json(['message' => 'Failed. Invalid Parameters. At least one item was invalid.'], 400); + } + + if (!array_key_exists('Attachments', $item) || count($item['Attachments']) == 0) { + Log::info('Brevo: InboundParsing: SoftFail: Message ignored because of missing attachments. No Actions would have been taken...'); + continue; + } + + ProcessBrevoInboundWebhook::dispatch($item)->delay(10); + + } + + return response()->json(['message' => 'Success'], 201); + } } diff --git a/app/Http/Controllers/MailgunController.php b/app/Http/Controllers/MailgunController.php index 05f3d25aba40..b26952598005 100644 --- a/app/Http/Controllers/MailgunController.php +++ b/app/Http/Controllers/MailgunController.php @@ -78,7 +78,7 @@ class MailgunController extends BaseController } /** - * Process Mailgun Webhook. + * Process Mailgun Inbound Webhook. * * * @OA\Post( diff --git a/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php b/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php new file mode 100644 index 000000000000..aab2adad3a29 --- /dev/null +++ b/app/Jobs/Brevo/ProcessBrevoInboundWebhook.php @@ -0,0 +1,182 @@ + + * array ( + * 0 => 'd9f48d52-a344-42a4-9056-9733488d9fa3', + * ), + * 'Recipients' => + * array ( + * 0 => 'test@test.de', + * ), + * 'MessageId' => '', + * 'InReplyTo' => NULL, + * 'From' => + * array ( + * 'Name' => 'Max Mustermann', + * 'Address' => 'max@mustermann.de', + * ), + * 'To' => + * array ( + * 0 => + * array ( + * 'Name' => NULL, + * 'Address' => 'test@test.de', + * ), + * ), + * 'Cc' => + * array ( + * ), + * 'Bcc' => + * array ( + * ), + * 'ReplyTo' => NULL, + * 'SentAtDate' => 'Sat, 23 Mar 2024 18:18:20 +0100', + * 'Subject' => 'TEST', + * 'Attachments' => + * array ( + * 0 => + * array ( + * 'Name' => 'flag--sv-1x1.svg', + * 'ContentType' => 'image/svg+xml', + * 'ContentLength' => 79957, + * 'ContentID' => 'f_lu4ct6s20', + * 'DownloadToken' => 'eyJmb2xkZXIiOiIyMDI0MDMyMzE3MTgzNi45OS43OTgwMDM4MDQiLCJmaWxlbmFtZSI6ImZsYWctLXN2LTF4MS5zdmcifQ', + * ), + * ), + * 'Headers' => + * array ( + * 'Received' => 'by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56b0af675deso3877288a12.1 for ; Sat, 23 Mar 2024 10:18:36 -0700 (PDT)', + * 'DKIM-Signature' => 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=mustermann.de; s=google; t=1711214316; x=1711819116; darn=test.de; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=eBSl5M0zvmTd+dFXGXMMSWrQ4nCvUdyVx+1Xpl+YuX8=; b=ackw3d+qTvZk4JKxomvH626MvfwmH23mikOUc2hWwYiO6unmQgPs2w5spnkmD9aCZ9 G+3nPSYKntugOmqWstZH3z4B063U4Y6j5hTc19WtCyyb9UR+XD+C6L10yc6ez8QUhlZT uAGqDoJ+E8+dBxiMul2pow19lC88t3QxRXU+i8zScniV7SFkwzziCEODaB61yI0DXsZB bUkx5Gx6cztKaNVF2QgguF2nQnJFUnD2nabVFsihyJ5r6y61rkSM/YTfMJuES772lnhv IeF+vwiFNEPKafrchce6YJcvo5Vd5lYFK4LtHyCy3mwJpX2QY+WnWAfferZ2YfgEL0Sf K3Pw==', + * 'X-Google-DKIM-Signature' => 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711214316; x=1711819116; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eBSl5M0zvmTd+dFXGXMMSWrQ4nCvUdyVx+1Xpl+YuX8=; b=fg4tXZnstRBexYlC6MD7C7is0kQj+xY66cSJ78tSa7PtSFQzY0zajDMsepMCGiiWmN /Pc/tRtk53pru/OtfzRT9pbM6mhM1arIt+QaQBQGU5xZVV5JXfPmdnPzXqAbQztyeHrk UcEkz+qDN3JNoidw2dJhhdt5MxdKssR572NwtBrn/rN7f1o/ThWzEz+P0o06GVBpxVYP wM0EkvcJj2SUOcn36kmp1ccbMUwYCU2h1JmniEFY8RTqu2il13iXoBvG4YPxe0c0hJ6z zw1N5rONeQM113N1rpbQzS1QLSngczuOhN24M3TOwrHJIec/BxrOW6KWl/uPUqiZAf65 f0tg==', + * 'X-Gm-Message-State' => 'AOJu0YzKhR1HY1oUXoq++LLpl6UOz1S60NfPxuPXBLcP+6aACYle8rqQ fYHe2rQYTpg4KWiOswu858STOW8qmiewXD6gH/LbmEFs7sknRyDPNr/+L0cv828A3o+SOvXu3uP SY6H1aNSwIpqTRhJ+nNjTuSUpuSoABd9fYXFwPuivV0DtBhoVmpE=', + * 'X-Google-Smtp-Source' => 'AGHT+IHdA9ZhW0dQxgOYx2OXBGmu4pzSR/zwJ0vcPNXFSqttKCPS2oTw1a9b2mMdhyUeoRAwP5TmhHlAtqUUrOPwkgg=', + * 'X-Received' => 'by 2002:a50:d74c:0:b0:567:3c07:8bbc with SMTP id i12-20020a50d74c000000b005673c078bbcmr2126401edj.21.1711214316135; Sat, 23 Mar 2024 10:18:36 -0700 (PDT)', + * 'MIME-Version' => '1.0', + * 'From' => 'Max Mustermann ', + * 'Date' => 'Sat, 23 Mar 2024 18:18:20 +0100', + * 'Message-ID' => '', + * 'Subject' => 'TEST', + * 'To' => 'test@test.de', + * 'Content-Type' => 'multipart/mixed', + * ), + * 'SpamScore' => 2.8, + * 'ExtractedMarkdownMessage' => 'TEST', + * 'ExtractedMarkdownSignature' => NULL, + * 'RawHtmlBody' => '
TEST
', + * 'RawTextBody' => 'TEST', + * 'EMLDownloadToken' => 'eyJmb2xkZXIiOiIyMDI0MDMyMzE3MTgzNi45OS43OTgwMDM4MDQiLCJmaWxlbmFtZSI6InNtdHAuZW1sIn0', + * ), + * ) + */ + public function __construct(private array $input) + { + } + + /** + * Execute the job. + * + * TODO: insert Mail from Storage + * + * @return void + */ + public function handle() + { + + // brevo defines recipients as array, and we should check all of them, to be sure + foreach ($this->input["Recipients"] as $recipient) { + + // match company + $company = MultiDB::findAndSetDbByExpenseMailbox($recipient); + if (!$company) { + Log::info('unknown Expense Mailbox occured while handling an inbound email from brevo: ' . $recipient); + continue; + } + + $company_brevo_secret = $company->settings?->email_sending_method === 'client_brevo' && $company->settings?->brevo_secret ? $company->settings?->brevo_secret : null; + if (empty ($company_brevo_secret) && empty (config('services.brevo.secret'))) + throw new \Error("no brevo credenitals found, we cannot get the attachement"); + + // prepare data for ingresEngine + $ingresEmail = new IngresEmail(); + + $ingresEmail->from = $this->input["From"]["Address"]; + $ingresEmail->to = $recipient; + $ingresEmail->subject = $this->input["Subject"]; + $ingresEmail->body = $this->input["RawHtmlBody"]; + $ingresEmail->text_body = $this->input["RawTextBody"]; + $ingresEmail->date = Carbon::createFromTimeString($this->input["SentAtDate"]); + + // parse documents as UploadedFile from webhook-data + foreach ($this->input["Attachments"] as $attachment) { + + // download file and save to tmp dir + if (!empty ($company_brevo_secret)) { + + $attachment = null; + try { + + $brevo = new InboundParsingApi(null, Configuration::getDefaultConfiguration()->setApiKey("api-key", $company_brevo_secret)); + $attachment = $brevo->getInboundEmailAttachment($attachment["DownloadToken"]); + + } catch (\Error $e) { + if (config('services.brevo.secret')) { + Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + + $brevo = new InboundParsingApi(null, Configuration::getDefaultConfiguration()->setApiKey("api-key", config('services.brevo.secret'))); + $attachment = $brevo->getInboundEmailAttachment($attachment["DownloadToken"]); + + } else + throw $e; + } + $ingresEmail->documents[] = TempFile::UploadedFileFromRaw($attachment, $attachment["Name"], $attachment["ContentType"]); + + } else { + + $brevo = new InboundParsingApi(null, Configuration::getDefaultConfiguration()->setApiKey("api-key", config('services.brevo.secret'))); + $ingresEmail->documents[] = TempFile::UploadedFileFromRaw($brevo->getInboundEmailAttachment($attachment["DownloadToken"]), $attachment["Name"], $attachment["ContentType"]); + + } + + } + + (new IngresEmailEngine($ingresEmail))->handle(); + + } + } +} diff --git a/app/Jobs/Brevo/ProcessBrevoWebhook.php b/app/Jobs/Brevo/ProcessBrevoWebhook.php index 92959f7d2e8b..48ddb9a87942 100644 --- a/app/Jobs/Brevo/ProcessBrevoWebhook.php +++ b/app/Jobs/Brevo/ProcessBrevoWebhook.php @@ -421,7 +421,7 @@ class ProcessBrevoWebhook implements ShouldQueue public function getRawMessage(string $message_id) { - $brevo_secret = !empty($this->company->settings->brevo_secret) ? $this->company->settings->brevo_secret : config('services.brevo.key'); + $brevo_secret = !empty ($this->company->settings->brevo_secret) ? $this->company->settings->brevo_secret : config('services.brevo.secret'); $brevo = new TransactionalEmailsApi(null, Configuration::getDefaultConfiguration()->setApiKey('api-key', $brevo_secret)); $messageDetail = $brevo->getTransacEmailContent($message_id); diff --git a/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php b/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php index 80be1b354422..11e81f1b0633 100644 --- a/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php +++ b/app/Jobs/Mailgun/ProcessMailgunInboundWebhook.php @@ -173,13 +173,44 @@ class ProcessMailgunInboundWebhook implements ShouldQueue } // fetch message from mailgun-api - $mailgun_domain = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_domain ? $company->settings?->mailgun_domain : config('services.mailgun.domain'); - $mailgun_secret = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_secret ? $company->settings?->mailgun_secret : config('services.mailgun.secret'); - $credentials = $mailgun_domain . ":" . $mailgun_secret . "@"; - $messageUrl = explode("|", $this->input)[1]; - $messageUrl = str_replace("http://", "http://" . $credentials, $messageUrl); - $messageUrl = str_replace("https://", "https://" . $credentials, $messageUrl); - $mail = json_decode(file_get_contents($messageUrl)); + $company_mailgun_domain = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_domain ? $company->settings?->mailgun_domain : null; + $company_mailgun_secret = $company->settings?->email_sending_method === 'client_mailgun' && $company->settings?->mailgun_secret ? $company->settings?->mailgun_secret : null; + if (!($company_mailgun_domain && $company_mailgun_secret) && !(config('services.mailgun.domain') && config('services.mailgun.secret'))) + throw new \Error("no mailgun credenitals found, we cannot get the attachements and files"); + + $mail = null; + if ($company_mailgun_domain && $company_mailgun_secret) { + + $credentials = $company_mailgun_domain . ":" . $company_mailgun_secret . "@"; + $messageUrl = explode("|", $this->input)[1]; + $messageUrl = str_replace("http://", "http://" . $credentials, $messageUrl); + $messageUrl = str_replace("https://", "https://" . $credentials, $messageUrl); + + try { + $mail = json_decode(file_get_contents($messageUrl)); + } catch (\Error $e) { + if (config('services.mailgun.secret')) { + Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + + $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; + $messageUrl = explode("|", $this->input)[1]; + $messageUrl = str_replace("http://", "http://" . $credentials, $messageUrl); + $messageUrl = str_replace("https://", "https://" . $credentials, $messageUrl); + $mail = json_decode(file_get_contents($messageUrl)); + + } else + throw $e; + } + + } else { + + $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; + $messageUrl = explode("|", $this->input)[1]; + $messageUrl = str_replace("http://", "http://" . $credentials, $messageUrl); + $messageUrl = str_replace("https://", "https://" . $credentials, $messageUrl); + $mail = json_decode(file_get_contents($messageUrl)); + + } // prepare data for ingresEngine $ingresEmail = new IngresEmail(); @@ -192,15 +223,42 @@ class ProcessMailgunInboundWebhook implements ShouldQueue $ingresEmail->date = Carbon::createFromTimeString($mail->Date); // parse documents as UploadedFile from webhook-data - foreach ($mail->attachments as $attachment) { - - // prepare url with credentials before downloading :: https://github.com/mailgun/mailgun.js/issues/24 - $url = $attachment->url; - $url = str_replace("http://", "http://" . $credentials, $url); - $url = str_replace("https://", "https://" . $credentials, $url); + foreach ($mail->attachments as $attachment) { // prepare url with credentials before downloading :: https://github.com/mailgun/mailgun.js/issues/24 // download file and save to tmp dir - $ingresEmail->documents[] = TempFile::UploadedFileFromUrl($url, $attachment->name, $attachment->{"content-type"}); + if ($company_mailgun_domain && $company_mailgun_secret) { + + try { + + $credentials = $company_mailgun_domain . ":" . $company_mailgun_secret . "@"; + $url = $attachment->url; + $url = str_replace("http://", "http://" . $credentials, $url); + $url = str_replace("https://", "https://" . $credentials, $url); + $ingresEmail->documents[] = TempFile::UploadedFileFromUrl($url, $attachment->name, $attachment->{"content-type"}); + + } catch (\Error $e) { + if (config('services.mailgun.secret')) { + Log::info("Error while downloading with company credentials, we try to use defaul credentials now..."); + + $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; + $url = $attachment->url; + $url = str_replace("http://", "http://" . $credentials, $url); + $url = str_replace("https://", "https://" . $credentials, $url); + $ingresEmail->documents[] = TempFile::UploadedFileFromUrl($url, $attachment->name, $attachment->{"content-type"}); + + } else + throw $e; + } + + } else { + + $credentials = config('services.mailgun.domain') . ":" . config('services.mailgun.secret') . "@"; + $url = $attachment->url; + $url = str_replace("http://", "http://" . $credentials, $url); + $url = str_replace("https://", "https://" . $credentials, $url); + $ingresEmail->documents[] = TempFile::UploadedFileFromUrl($url, $attachment->name, $attachment->{"content-type"}); + + } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 8ab1e78c91f6..84083f546fee 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -126,18 +126,18 @@ class AppServiceProvider extends ServiceProvider new Dsn( 'brevo+api', 'default', - config('services.brevo.key') + config('services.brevo.secret') ) ); }); - Mailer::macro('brevo_config', function (string $brevo_key) { + Mailer::macro('brevo_config', function (string $brevo_secret) { // @phpstan-ignore /** @phpstan-ignore-next-line **/ Mailer::setSymfonyTransport( (new BrevoTransportFactory)->create( new Dsn( 'brevo+api', 'default', - $brevo_key + $brevo_secret ) ) ); diff --git a/composer.lock b/composer.lock index 70f2ca5f20c4..fed2fd9e57f5 100644 --- a/composer.lock +++ b/composer.lock @@ -369,21 +369,22 @@ }, { "name": "amphp/parallel", - "version": "v2.2.7", + "version": "v2.2.8", "source": { "type": "git", "url": "https://github.com/amphp/parallel.git", - "reference": "ffda869c33c30627b6eb5c25f096882d885681dc" + "reference": "efd71b342b64c2e46d904e4eb057ed5ab20f8e2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parallel/zipball/ffda869c33c30627b6eb5c25f096882d885681dc", - "reference": "ffda869c33c30627b6eb5c25f096882d885681dc", + "url": "https://api.github.com/repos/amphp/parallel/zipball/efd71b342b64c2e46d904e4eb057ed5ab20f8e2d", + "reference": "efd71b342b64c2e46d904e4eb057ed5ab20f8e2d", "shasum": "" }, "require": { "amphp/amp": "^3", "amphp/byte-stream": "^2", + "amphp/cache": "^2", "amphp/parser": "^1", "amphp/pipeline": "^1", "amphp/process": "^2", @@ -440,7 +441,7 @@ ], "support": { "issues": "https://github.com/amphp/parallel/issues", - "source": "https://github.com/amphp/parallel/tree/v2.2.7" + "source": "https://github.com/amphp/parallel/tree/v2.2.8" }, "funding": [ { @@ -448,20 +449,20 @@ "type": "github" } ], - "time": "2024-03-16T16:15:46+00:00" + "time": "2024-03-19T16:09:34+00:00" }, { "name": "amphp/parser", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/amphp/parser.git", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151" + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/parser/zipball/ff1de4144726c5dad5fab97f66692ebe8de3e151", - "reference": "ff1de4144726c5dad5fab97f66692ebe8de3e151", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", "shasum": "" }, "require": { @@ -502,7 +503,7 @@ ], "support": { "issues": "https://github.com/amphp/parser/issues", - "source": "https://github.com/amphp/parser/tree/v1.1.0" + "source": "https://github.com/amphp/parser/tree/v1.1.1" }, "funding": [ { @@ -510,7 +511,7 @@ "type": "github" } ], - "time": "2022-12-30T18:08:47+00:00" + "time": "2024-03-21T19:16:53+00:00" }, { "name": "amphp/pipeline", @@ -707,16 +708,16 @@ }, { "name": "amphp/socket", - "version": "v2.2.4", + "version": "v2.3.0", "source": { "type": "git", "url": "https://github.com/amphp/socket.git", - "reference": "4223324c627cc26d44800630411e64856d3344bc" + "reference": "acc0a2f65ab498025ba5641f7cce499c4b1ed4b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/socket/zipball/4223324c627cc26d44800630411e64856d3344bc", - "reference": "4223324c627cc26d44800630411e64856d3344bc", + "url": "https://api.github.com/repos/amphp/socket/zipball/acc0a2f65ab498025ba5641f7cce499c4b1ed4b5", + "reference": "acc0a2f65ab498025ba5641f7cce499c4b1ed4b5", "shasum": "" }, "require": { @@ -779,7 +780,7 @@ ], "support": { "issues": "https://github.com/amphp/socket/issues", - "source": "https://github.com/amphp/socket/tree/v2.2.4" + "source": "https://github.com/amphp/socket/tree/v2.3.0" }, "funding": [ { @@ -787,7 +788,7 @@ "type": "github" } ], - "time": "2024-02-28T15:56:06+00:00" + "time": "2024-03-19T20:01:53+00:00" }, { "name": "amphp/sync", @@ -1343,16 +1344,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.301.2", + "version": "3.301.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "7f8180275e624cb566d8af77d2f1c958bf5be35b" + "reference": "18c0ebd71d3071304f1ea02aa9af75f95863177a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7f8180275e624cb566d8af77d2f1c958bf5be35b", - "reference": "7f8180275e624cb566d8af77d2f1c958bf5be35b", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/18c0ebd71d3071304f1ea02aa9af75f95863177a", + "reference": "18c0ebd71d3071304f1ea02aa9af75f95863177a", "shasum": "" }, "require": { @@ -1432,9 +1433,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.301.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.301.6" }, - "time": "2024-03-18T18:06:18+00:00" + "time": "2024-03-22T18:05:21+00:00" }, { "name": "bacon/bacon-qr-code", @@ -4662,23 +4663,23 @@ }, { "name": "imdhemy/google-play-billing", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/imdhemy/google-play-billing.git", - "reference": "bb94f3b6ddb021605815e528f31b8c930c41677c" + "reference": "7f2b032354568fa50858e0f6dd25592d975b3979" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/imdhemy/google-play-billing/zipball/bb94f3b6ddb021605815e528f31b8c930c41677c", - "reference": "bb94f3b6ddb021605815e528f31b8c930c41677c", + "url": "https://api.github.com/repos/imdhemy/google-play-billing/zipball/7f2b032354568fa50858e0f6dd25592d975b3979", + "reference": "7f2b032354568fa50858e0f6dd25592d975b3979", "shasum": "" }, "require": { "ext-json": "*", "google/auth": "^1.26", "guzzlehttp/guzzle": "^7.5.1", - "nesbot/carbon": "^2.66", + "nesbot/carbon": "^2.66|^3.0", "php": ">=8.0" }, "require-dev": { @@ -4707,9 +4708,9 @@ "description": "Google Play Billing", "support": { "issues": "https://github.com/imdhemy/google-play-billing/issues", - "source": "https://github.com/imdhemy/google-play-billing/tree/1.5.1" + "source": "https://github.com/imdhemy/google-play-billing/tree/1.5.2" }, - "time": "2023-12-15T10:25:05+00:00" + "time": "2024-03-19T17:56:34+00:00" }, { "name": "imdhemy/laravel-purchases", @@ -5434,16 +5435,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.3", + "version": "v10.48.4", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "5791c052b41c6b593556adc687076bfbdd13c501" + "reference": "7e0701bf59cb76a51f7c1f7bea51c0c0c29c0b72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/5791c052b41c6b593556adc687076bfbdd13c501", - "reference": "5791c052b41c6b593556adc687076bfbdd13c501", + "url": "https://api.github.com/repos/laravel/framework/zipball/7e0701bf59cb76a51f7c1f7bea51c0c0c29c0b72", + "reference": "7e0701bf59cb76a51f7c1f7bea51c0c0c29c0b72", "shasum": "" }, "require": { @@ -5548,7 +5549,7 @@ "league/flysystem-sftp-v3": "^3.0", "mockery/mockery": "^1.5.1", "nyholm/psr7": "^1.2", - "orchestra/testbench-core": "^8.18", + "orchestra/testbench-core": "^8.23.4", "pda/pheanstalk": "^4.0", "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^10.0.7", @@ -5637,7 +5638,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2024-03-15T10:17:07+00:00" + "time": "2024-03-21T13:36:36+00:00" }, { "name": "laravel/prompts", @@ -6911,16 +6912,16 @@ }, { "name": "league/uri", - "version": "7.4.0", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5" + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/bf414ba956d902f5d98bf9385fcf63954f09dce5", - "reference": "bf414ba956d902f5d98bf9385fcf63954f09dce5", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/bedb6e55eff0c933668addaa7efa1e1f2c417cc4", + "reference": "bedb6e55eff0c933668addaa7efa1e1f2c417cc4", "shasum": "" }, "require": { @@ -6989,7 +6990,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri/tree/7.4.0" + "source": "https://github.com/thephpleague/uri/tree/7.4.1" }, "funding": [ { @@ -6997,20 +6998,20 @@ "type": "github" } ], - "time": "2023-12-01T06:24:25+00:00" + "time": "2024-03-23T07:42:40+00:00" }, { "name": "league/uri-interfaces", - "version": "7.4.0", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3" + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/bd8c487ec236930f7bbc42b8d374fa882fbba0f3", - "reference": "bd8c487ec236930f7bbc42b8d374fa882fbba0f3", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/8d43ef5c841032c87e2de015972c06f3865ef718", + "reference": "8d43ef5c841032c87e2de015972c06f3865ef718", "shasum": "" }, "require": { @@ -7073,7 +7074,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.0" + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.4.1" }, "funding": [ { @@ -7081,7 +7082,7 @@ "type": "github" } ], - "time": "2023-11-24T15:40:42+00:00" + "time": "2024-03-23T07:42:40+00:00" }, { "name": "livewire/livewire", @@ -7461,16 +7462,16 @@ }, { "name": "mollie/mollie-api-php", - "version": "v2.65.0", + "version": "v2.66.0", "source": { "type": "git", "url": "https://github.com/mollie/mollie-api-php.git", - "reference": "3920816c311ec785f47f160204296d1b7f918da5" + "reference": "d7d09ac62a565e818bf49d04acb2f0432da758a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/3920816c311ec785f47f160204296d1b7f918da5", - "reference": "3920816c311ec785f47f160204296d1b7f918da5", + "url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/d7d09ac62a565e818bf49d04acb2f0432da758a9", + "reference": "d7d09ac62a565e818bf49d04acb2f0432da758a9", "shasum": "" }, "require": { @@ -7547,9 +7548,9 @@ ], "support": { "issues": "https://github.com/mollie/mollie-api-php/issues", - "source": "https://github.com/mollie/mollie-api-php/tree/v2.65.0" + "source": "https://github.com/mollie/mollie-api-php/tree/v2.66.0" }, - "time": "2024-01-23T12:39:48+00:00" + "time": "2024-03-19T13:33:42+00:00" }, { "name": "moneyphp/money", @@ -9868,16 +9869,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.26.0", + "version": "1.27.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" + "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", - "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/86e4d5a4b036f8f0be1464522f4c6b584c452757", + "reference": "86e4d5a4b036f8f0be1464522f4c6b584c452757", "shasum": "" }, "require": { @@ -9909,9 +9910,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.27.0" }, - "time": "2024-02-23T16:05:55+00:00" + "time": "2024-03-21T13:14:53+00:00" }, { "name": "pragmarx/google2fa", @@ -11969,16 +11970,16 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.16.3", + "version": "1.16.4", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "59db18c2e20d49a0b6d447bb1c654f6c123beb9e" + "reference": "ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/59db18c2e20d49a0b6d447bb1c654f6c123beb9e", - "reference": "59db18c2e20d49a0b6d447bb1c654f6c123beb9e", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53", + "reference": "ddf678e78d7f8b17e5cdd99c0c3413a4a6592e53", "shasum": "" }, "require": { @@ -12017,7 +12018,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.3" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.16.4" }, "funding": [ { @@ -12025,7 +12026,7 @@ "type": "github" } ], - "time": "2024-03-07T07:35:57+00:00" + "time": "2024-03-20T07:29:11+00:00" }, { "name": "spatie/php-structure-discoverer", @@ -16590,16 +16591,16 @@ }, { "name": "composer/pcre", - "version": "3.1.2", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace" + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/4775f35b2d70865807c89d32c8e7385b86eb0ace", - "reference": "4775f35b2d70865807c89d32c8e7385b86eb0ace", + "url": "https://api.github.com/repos/composer/pcre/zipball/5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", + "reference": "5b16e25a5355f1f3afdfc2f954a0a80aec4826a8", "shasum": "" }, "require": { @@ -16641,7 +16642,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.2" + "source": "https://github.com/composer/pcre/tree/3.1.3" }, "funding": [ { @@ -16657,7 +16658,7 @@ "type": "tidelift" } ], - "time": "2024-03-07T15:38:35+00:00" + "time": "2024-03-19T10:26:25+00:00" }, { "name": "composer/semver", @@ -16940,16 +16941,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.52.0", + "version": "v3.52.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "a3564bd66f4bce9bc871ef18b690e2dc67a7f969" + "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/a3564bd66f4bce9bc871ef18b690e2dc67a7f969", - "reference": "a3564bd66f4bce9bc871ef18b690e2dc67a7f969", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/6e77207f0d851862ceeb6da63e6e22c01b1587bc", + "reference": "6e77207f0d851862ceeb6da63e6e22c01b1587bc", "shasum": "" }, "require": { @@ -17020,7 +17021,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.52.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.52.1" }, "funding": [ { @@ -17028,7 +17029,7 @@ "type": "github" } ], - "time": "2024-03-18T18:40:11+00:00" + "time": "2024-03-19T21:02:43+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -17083,25 +17084,25 @@ }, { "name": "laracasts/cypress", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/laracasts/cypress.git", - "reference": "dd4e61188d4edaf65ffa18851a5df38d0fa0619a" + "reference": "449f9d69da75091c77327093e5727a5c739a4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laracasts/cypress/zipball/dd4e61188d4edaf65ffa18851a5df38d0fa0619a", - "reference": "dd4e61188d4edaf65ffa18851a5df38d0fa0619a", + "url": "https://api.github.com/repos/laracasts/cypress/zipball/449f9d69da75091c77327093e5727a5c739a4cf8", + "reference": "449f9d69da75091c77327093e5727a5c739a4cf8", "shasum": "" }, "require": { - "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", + "illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", "php": "^8.0" }, "require-dev": { - "orchestra/testbench": "^6.0|^7.0|^8.0", - "phpunit/phpunit": "^8.0|^9.5.10", + "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0", + "phpunit/phpunit": "^8.0|^9.5.10|^10.5", "spatie/laravel-ray": "^1.29" }, "type": "library", @@ -17136,9 +17137,9 @@ ], "support": { "issues": "https://github.com/laracasts/cypress/issues", - "source": "https://github.com/laracasts/cypress/tree/3.0.1" + "source": "https://github.com/laracasts/cypress/tree/3.0.2" }, - "time": "2023-02-16T20:00:16+00:00" + "time": "2024-03-19T14:07:37+00:00" }, { "name": "larastan/larastan", @@ -17310,16 +17311,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.9", + "version": "1.6.11", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06" + "reference": "81a161d0b135df89951abd52296adf97deb0723d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", - "reference": "0cc058854b3195ba21dc6b1f7b1f60f4ef3a9c06", + "url": "https://api.github.com/repos/mockery/mockery/zipball/81a161d0b135df89951abd52296adf97deb0723d", + "reference": "81a161d0b135df89951abd52296adf97deb0723d", "shasum": "" }, "require": { @@ -17331,8 +17332,8 @@ "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.6.10", - "symplify/easy-coding-standard": "^12.0.8" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", "autoload": { @@ -17389,7 +17390,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-12-10T02:24:34+00:00" + "time": "2024-03-21T18:34:15+00:00" }, { "name": "myclabs/deep-copy", @@ -17754,16 +17755,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.10.63", + "version": "1.10.65", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ad12836d9ca227301f5fb9960979574ed8628339" + "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ad12836d9ca227301f5fb9960979574ed8628339", - "reference": "ad12836d9ca227301f5fb9960979574ed8628339", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/3c657d057a0b7ecae19cb12db446bbc99d8839c6", + "reference": "3c657d057a0b7ecae19cb12db446bbc99d8839c6", "shasum": "" }, "require": { @@ -17812,7 +17813,7 @@ "type": "tidelift" } ], - "time": "2024-03-18T16:53:53+00:00" + "time": "2024-03-23T10:30:26+00:00" }, { "name": "phpunit/php-code-coverage", @@ -18137,16 +18138,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.13", + "version": "10.5.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7" + "reference": "86376e05e8745ed81d88232ff92fee868247b07b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/20a63fc1c6db29b15da3bd02d4b6cf59900088a7", - "reference": "20a63fc1c6db29b15da3bd02d4b6cf59900088a7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/86376e05e8745ed81d88232ff92fee868247b07b", + "reference": "86376e05e8745ed81d88232ff92fee868247b07b", "shasum": "" }, "require": { @@ -18218,7 +18219,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.15" }, "funding": [ { @@ -18234,7 +18235,7 @@ "type": "tidelift" } ], - "time": "2024-03-12T15:37:41+00:00" + "time": "2024-03-22T04:17:47+00:00" }, { "name": "sebastian/cli-parser", @@ -18608,16 +18609,16 @@ }, { "name": "sebastian/environment", - "version": "6.0.1", + "version": "6.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951" + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/43c751b41d74f96cbbd4e07b7aec9675651e2951", - "reference": "43c751b41d74f96cbbd4e07b7aec9675651e2951", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984", + "reference": "8074dbcd93529b357029f5cc5058fd3e43666984", "shasum": "" }, "require": { @@ -18632,7 +18633,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "6.1-dev" } }, "autoload": { @@ -18660,7 +18661,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/6.0.1" + "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0" }, "funding": [ { @@ -18668,7 +18669,7 @@ "type": "github" } ], - "time": "2023-04-11T05:39:26+00:00" + "time": "2024-03-23T08:47:14+00:00" }, { "name": "sebastian/exporter", diff --git a/config/services.php b/config/services.php index ae434aba6575..b0d9851df34e 100644 --- a/config/services.php +++ b/config/services.php @@ -31,7 +31,7 @@ return [ ], 'brevo' => [ - 'key' => env('BREVO_SECRET', ''), + 'secret' => env('BREVO_SECRET', ''), ], 'postmark' => [ @@ -39,12 +39,12 @@ return [ ], 'postmark-outlook' => [ - 'token' => env('POSTMARK_OUTLOOK_SECRET',''), + 'token' => env('POSTMARK_OUTLOOK_SECRET', ''), 'from' => [ 'address' => env('POSTMARK_OUTLOOK_FROM_ADDRESS', '') ], ], - + 'microsoft' => [ 'client_id' => env('MICROSOFT_CLIENT_ID'), 'client_secret' => env('MICROSOFT_CLIENT_SECRET'), @@ -62,6 +62,7 @@ return [ 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('SES_REGION', 'us-east-1'), ], + 'sparkpost' => [ 'secret' => env('SPARKPOST_SECRET'), ], @@ -117,6 +118,7 @@ return [ 'key' => env('ZIP_TAX_KEY', false), ], ], + 'chorus' => [ 'client_id' => env('CHORUS_CLIENT_ID', false), 'secret' => env('CHORUS_SECRET', false), diff --git a/routes/api.php b/routes/api.php index b404ef53b465..4560a549174a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -431,6 +431,7 @@ Route::post('api/v1/postmark_webhook', [PostMarkController::class, 'webhook'])-> Route::post('api/v1/mailgun_webhook', [MailgunController::class, 'webhook'])->middleware('throttle:1000,1'); Route::post('api/v1/mailgun_inbound_webhook', [MailgunController::class, 'inboundWebhook'])->middleware('throttle:1000,1'); Route::post('api/v1/brevo_webhook', [BrevoController::class, 'webhook'])->middleware('throttle:1000,1'); +Route::post('api/v1/brevo_inbound_webhook', [BrevoController::class, 'inboundWebhook'])->middleware('throttle:1000,1'); Route::get('token_hash_router', [OneTimeTokenController::class, 'router'])->middleware('throttle:500,1'); Route::get('webcron', [WebCronController::class, 'index'])->middleware('throttle:100,1'); Route::post('api/v1/get_migration_account', [HostedMigrationController::class, 'getAccount'])->middleware('guest')->middleware('throttle:100,1');