generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: resend webhooks #3
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6a6fe5b
feat(ResendWebhook): resend mail sent event webhook
RichardGL11 7b70b8b
test(ResendMiddleware): it should thrown exception if mail header was…
RichardGL11 056172c
test: testing another events by resend
RichardGL11 a4321fa
Fix styling
RichardGL11 de08c7c
wip
RichardGL11 b0bdc13
Fix styling
RichardGL11 9a00dbd
refactor(HasMailTrait): refactor commom methos into trait
RichardGL11 e28827d
style: pint
RichardGL11 4b60a26
Fix styling
RichardGL11 15e3d1a
refactor: refactoring middlewares to abstract middleware and creating…
RichardGL11 120284d
style: pint
RichardGL11 26cd415
chore: renaming interface to BetterMailDTOContract
RichardGL11 a88834f
feat(Middleware): resend middleware through enums
RichardGL11 18f66e2
feat(User-Experience): publishing migrations and config file
RichardGL11 a1175a0
feat: publishing views
RichardGL11 97ab45f
docs(readme): adding content to config section on readme
RichardGL11 8ea9164
docs(readme): adding more information on readme
RichardGL11 81dff63
fix(Middlewares): fixing middlewares that was not been registered
RichardGL11 6a7a400
Fix styling
RichardGL11 0afb9c7
chore: fixing complained contract import
RichardGL11 d0d7a7f
refactor(ResendMiddlewarePackage): refactoring middleware to adapter
RichardGL11 7f37170
Fix styling
RichardGL11 6f982a0
refactor: abstracting model actions to events, and renaming middlewar…
RichardGL11 3d8b908
style: pint
RichardGL11 a0a36d6
chore: removing fromEvent methods
RichardGL11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| use Basement\BetterMails\Core\Contracts\BetterMiddlewareContract; | ||
| use Basement\BetterMails\Core\Enums\SupportedMailProvidersEnum; | ||
| use Basement\BetterMails\Core\Http\Controllers\WebhookController; | ||
| use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken; | ||
| use Illuminate\Support\Facades\Route; | ||
|
|
||
| Route::post('/webhook/{provider}', WebhookController::class) | ||
| ->whereIn('provider', SupportedMailProvidersEnum::cases()) | ||
| ->middleware([BetterMiddlewareContract::class]) | ||
| ->withoutMiddleware(VerifyCsrfToken::class) | ||
| ->name('filament-better-mails.webhook.store'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Concerns; | ||
|
|
||
| use Basement\BetterMails\Core\Models\BetterEmail; | ||
|
|
||
| trait HasMail | ||
| { | ||
| public function findMail(string $uuid): BetterEmail | ||
| { | ||
| return BetterEmail::query()->where('uuid', $uuid)->firstOrFail(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts; | ||
|
|
||
| interface BetterDTOContract | ||
| { | ||
| public static function fromWebhook(array $dto): self; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts; | ||
|
|
||
| interface BetterMiddlewareContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface ClickedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface ComplainedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface DeliveredEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface FailedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface HardBouncedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface OpenedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Contracts\External; | ||
|
|
||
| interface RecievedEventContract {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Concerns\HasMail; | ||
| use Basement\BetterMails\Core\Contracts\External\ClickedEventContract; | ||
|
|
||
| final class ClickedMailListener | ||
| { | ||
| use HasMail; | ||
|
|
||
| public function handle(ClickedEventContract $event): void | ||
| { | ||
| $mail = $this->findMail($event->dto->mailUuid); | ||
| $mail->clicked(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Concerns\HasMail; | ||
| use Basement\BetterMails\Core\Contracts\External\ComplainedEventContract; | ||
|
|
||
| final class ComplainedMailListener | ||
| { | ||
| use HasMail; | ||
|
|
||
| public function handle(ComplainedEventContract $event): void | ||
| { | ||
| $mail = $this->findMail($event->dto->mailUuid); | ||
| $mail->complained(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Concerns\HasMail; | ||
| use Basement\BetterMails\Core\Contracts\External\DeliveredEventContract; | ||
|
|
||
| final class DeliveredMailListener | ||
| { | ||
| use HasMail; | ||
|
|
||
| public function handle(DeliveredEventContract $event): void | ||
| { | ||
| $mail = $this->findMail($event->dto->mailUuid); | ||
| $mail->delivered(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Contracts\External\FailedEventContract; | ||
|
|
||
| final class FailedMailListener | ||
| { | ||
| public function handle(FailedEventContract $event): void {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Concerns\HasMail; | ||
| use Basement\BetterMails\Core\Contracts\External\HardBouncedEventContract; | ||
|
|
||
| final class HardBouncedMailListener | ||
| { | ||
| use HasMail; | ||
|
|
||
| public function handle(HardBouncedEventContract $event): void | ||
| { | ||
| $mail = $this->findMail($event->dto->mailUuid); | ||
| $mail->hardBounced(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Concerns\HasMail; | ||
| use Basement\BetterMails\Core\Contracts\External\OpenedEventContract; | ||
|
|
||
| final class OpenedMailListener | ||
| { | ||
| use HasMail; | ||
|
|
||
| public function handle(OpenedEventContract $event): void | ||
| { | ||
| $mail = $this->findMail($event->dto->mailUuid); | ||
| $mail->opened(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?php | ||
|
|
||
| namespace Basement\BetterMails\Core\Listeners\External; | ||
|
|
||
| use Basement\BetterMails\Core\Contracts\External\RecievedEventContract; | ||
|
|
||
| final class ReceivedMailListener | ||
| { | ||
| public function handle(RecievedEventContract $event): void {} | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.