Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed Sep 7, 2024
1 parent 4b8db54 commit 539e31c
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions config/mails.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@
],

'events' => [
'soft_bounce' => [
'soft_bounced' => [
'notify' => ['mail'],
],

'hard_bounce' => [
'hard_bounced' => [
'notify' => ['mail'],
],

Expand All @@ -128,7 +128,7 @@
'treshold' => 99,
],

'complaint' => [
'complained' => [
//
],

Expand Down
2 changes: 1 addition & 1 deletion database/factories/MailEventFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function bounce(): Factory
{
return $this->state(function () {
return [
'type' => 'hard_bounce',
'type' => 'hard_bounced',
];
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/SendHighBounceRateNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Vormkracht10\Mails\Actions;

use Vormkracht10\Mails\Listeners\Concerns\SendsNotifications;
use Vormkracht10\Mails\Notifications\HighBounceRateNotification;
use Vormkracht10\Mails\Shared\AsAction;
use Vormkracht10\Mails\Traits\SendsNotifications;

class SendHighBounceRateNotifications
{
Expand Down
6 changes: 3 additions & 3 deletions src/Drivers/MailgunDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function getUuidFromPayload(array $payload): ?string

protected function getTimestampFromPayload(array $payload)
{
return $payload['DeliveredAt'] ?? $payload['BouncedAt'] ?? $payload['ReceivedAt'] ?? now();
return $payload['event-data']['timestamp'];
}

public function eventMapping(): array
Expand All @@ -48,9 +48,9 @@ public function eventMapping(): array
EventType::CLICKED->value => ['event-data.event' => 'clicked'],
EventType::COMPLAINED->value => ['event-data.event' => 'complained'],
EventType::DELIVERED->value => ['event-data.event' => 'delivered'],
EventType::SOFT_BOUNCED->value => ['event-data.event' => 'failed', 'severity' => 'temporary'],
EventType::HARD_BOUNCED->value => ['event-data.event' => 'failed', 'severity' => 'permanent'],
EventType::HARD_BOUNCED->value => ['event-data.event' => 'failed', 'event-data.severity' => 'permanent'],
EventType::OPENED->value => ['event-data.event' => 'opened'],
EventType::SOFT_BOUNCED->value => ['event-data.event' => 'failed', 'event-data.severity' => 'temporary'],
EventType::UNSUBSCRIBED->value => ['event-data.event' => 'unsubscribed'],
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/NotifyOnBounce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Vormkracht10\Mails\Listeners;

use Vormkracht10\Mails\Events\MailHardBounced;
use Vormkracht10\Mails\Listeners\Concerns\SendsNotifications;
use Vormkracht10\Mails\Notifications\BounceNotification;
use Vormkracht10\Mails\Traits\SendsNotifications;

class NotifyOnBounce
{
Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/NotifyOnSpamComplaint.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Vormkracht10\Mails\Listeners;

use Vormkracht10\Mails\Events\MailComplained;
use Vormkracht10\Mails\Listeners\Concerns\SendsNotifications;
use Vormkracht10\Mails\Notifications\SpamComplaintNotification;
use Vormkracht10\Mails\Traits\SendsNotifications;

class NotifyOnSpamComplaint
{
Expand Down
2 changes: 1 addition & 1 deletion src/Notifications/BounceNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use NotificationChannels\Discord\DiscordMessage;
use NotificationChannels\Telegram\TelegramMessage;
use Vormkracht10\Mails\Models\Mail;
use Vormkracht10\Mails\Notifications\Concerns\HasDynamicDrivers;
use Vormkracht10\Mails\Traits\HasDynamicDrivers;

class BounceNotification extends Notification implements ShouldQueue
{
Expand Down
2 changes: 1 addition & 1 deletion src/Notifications/HighBounceRateNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Illuminate\Notifications\Notification;
use NotificationChannels\Discord\DiscordMessage;
use NotificationChannels\Telegram\TelegramMessage;
use Vormkracht10\Mails\Notifications\Concerns\HasDynamicDrivers;
use Vormkracht10\Mails\Traits\HasDynamicDrivers;

class HighBounceRateNotification extends Notification implements ShouldQueue
{
Expand Down
2 changes: 1 addition & 1 deletion src/Notifications/SpamComplaintNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use NotificationChannels\Discord\DiscordMessage;
use NotificationChannels\Telegram\TelegramMessage;
use Vormkracht10\Mails\Models\Mail;
use Vormkracht10\Mails\Notifications\Concerns\HasDynamicDrivers;
use Vormkracht10\Mails\Traits\HasDynamicDrivers;

class SpamComplaintNotification extends Notification implements ShouldQueue
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Vormkracht10\Mails\Notifications\Concerns;
namespace Vormkracht10\Mails\Traits;

trait HasDynamicDrivers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Vormkracht10\Mails\Listeners\Concerns;
namespace Vormkracht10\Mails\Traits;

use Illuminate\Notifications\Notification;
use Illuminate\Support\Facades\Notification as Notifications;
Expand Down
2 changes: 1 addition & 1 deletion tests/PostmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
])->assertAccepted();

assertDatabaseHas((new MailEvent)->getTable(), [
'type' => EventType::HARD_BOUNCED->value,
'type' => EventType::SOFT_BOUNCED->value,
]);
});

Expand Down

0 comments on commit 539e31c

Please # to comment.