Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PPF-55 Moved classes around related to Mailjet / Sending mail #1334

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Mails/Addresses.php → app/Domain/Mail/Addresses.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Mails;
namespace App\Domain\Mail;

use Illuminate\Support\Collection;
use Symfony\Component\Mime\Address;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

declare(strict_types=1);

namespace App\Mails;
namespace App\Domain\Mail;

use App\Domain\Contacts\Contact;
use App\Domain\Integrations\Events\IntegrationActivated;
use App\Domain\Integrations\Events\IntegrationBlocked;
use App\Domain\Integrations\Repositories\IntegrationRepository;
use App\Domain\Mail\Mailer;
use Symfony\Component\Mime\Address;

final class MailManager
Expand Down Expand Up @@ -40,7 +39,6 @@ public function sendIntegrationActivatedMail(IntegrationActivated $integrationAc
'lastName' => $contact->lastName,
'contactType' => $contact->type->value,
'integrationName' => $integration->name,
//@todo Should we add a language preference to contacts?
'url' => $this->baseUrl . '/nl/integraties/' . $integration->id,
'type' => $integration->type->value,
]
Expand Down
1 change: 0 additions & 1 deletion app/Domain/Mail/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace App\Domain\Mail;

use App\Mails\Addresses;
use Symfony\Component\Mime\Address;

interface Mailer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Domain\Mail;
namespace App\Mails\MailJet;

final class MailjetConfig
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

declare(strict_types=1);

namespace App\Domain\Mail;
namespace App\Mails\MailJet;

use App\Mails\Addresses;
use App\Domain\Mail\Addresses;
use App\Domain\Mail\Mailer;
use App\Domain\Mail\MailNotSend;
use Mailjet\Client;
use Mailjet\Resources;
use Psr\Log\LoggerInterface;
Expand Down
7 changes: 4 additions & 3 deletions app/Mails/MailServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
use App\Domain\Integrations\Events\IntegrationBlocked;
use App\Domain\Integrations\Repositories\IntegrationRepository;
use App\Domain\Mail\Mailer;
use App\Domain\Mail\MailjetConfig;
use App\Domain\Mail\MailjetMailer;
use App\Domain\Mail\MailManager;
use App\Mails\MailJet\MailjetConfig;
use App\Mails\MailJet\MailjetMailer;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;
use Mailjet\Client;
Expand Down Expand Up @@ -42,7 +43,7 @@ public function register(): void
$this->app->get(IntegrationRepository::class),
(int)config(MailjetConfig::TEMPLATE_INTEGRATION_ACTIVATED),
(int)config(MailjetConfig::TEMPLATE_INTEGRATION_BLOCKED),
env('APP_URL')
config('url')
);
});

Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
App\ProjectAanvraag\ProjectAanvraagServiceProvider::class,
App\Keycloak\KeycloakServiceProvider::class,
App\Search\SearchServiceProvider::class,
App\Mails\MailServiceProvider::class,
\App\Mails\MailServiceProvider::class,
\App\Notifications\NotificationsProvider::class,
],

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Tests\Mails;
namespace Domain\Mail;

use App\Domain\Contacts\Contact;
use App\Domain\Contacts\ContactType;
Expand All @@ -13,9 +13,9 @@
use App\Domain\Integrations\IntegrationStatus;
use App\Domain\Integrations\IntegrationType;
use App\Domain\Integrations\Repositories\IntegrationRepository;
use App\Domain\Mail\Addresses;
use App\Domain\Mail\Mailer;
use App\Mails\Addresses;
use App\Mails\MailManager;
use App\Domain\Mail\MailManager;
use PHPUnit\Framework\MockObject\MockObject;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Mime\Address;
Expand Down Expand Up @@ -44,7 +44,7 @@ protected function setUp(): void
$integrationRepository,
self::TEMPLATE_ACTIVATED_ID,
self::TEMPLATE_BLOCKED_ID,
'http://www.example.com/'
'http://www.example.com'
);

// @todo Let add all types of contacts here, it might be the case that we only sent the email to specific type of contacts
Expand Down Expand Up @@ -151,7 +151,7 @@ public static function mailDataProvider(): array
'templateId' => self::TEMPLATE_ACTIVATED_ID,
'subject' => 'Publiq platform - Integration activated',
'expectedParameters' => [
'url' => 'http://www.example.com//nl/integraties/' . self::INTEGRATION_ID,
'url' => 'http://www.example.com/nl/integraties/' . self::INTEGRATION_ID,
'integrationName' => 'Mock Integration',
'type' => 'search-api',
],
Expand Down
Loading