Skip to content

Commit 8892e5e

Browse files
feat:[lar-152] send Sponsoring Thanks Mail
1 parent aaf76d4 commit 8892e5e

File tree

9 files changed

+5035
-17894
lines changed

9 files changed

+5035
-17894
lines changed

app/Filament/Resources/ArticleResource.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function table(Table $table): Table
8080
return $record->declined_at->format('d/m/Y');
8181
}
8282

83-
return 'depuis le '.$record->submitted_at->format('d/m/Y');
83+
return '';
8484
})
8585
->prefixBadges(function ($record) {
8686
if ($record->approved_at) {
@@ -97,8 +97,7 @@ public static function table(Table $table): Table
9797
];
9898
}
9999

100-
return [Badge::make('En attente')
101-
->color('warning')];
100+
return '';
102101
})
103102
->searchable()
104103
->sortable(),

app/Listeners/SendPaymentNotification.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,27 @@
55
namespace App\Listeners;
66

77
use App\Events\SponsoringPaymentInitialize;
8+
use App\Mail\SendSponsorThanksMail;
89
use App\Notifications\NewSponsorPaymentNotification;
910
use Illuminate\Notifications\AnonymousNotifiable;
11+
use Illuminate\Support\Facades\Mail;
1012

1113
final readonly class SendPaymentNotification
1214
{
1315
public function __construct(private AnonymousNotifiable $notifiable) {}
1416

1517
public function handle(SponsoringPaymentInitialize $event): void
1618
{
19+
/**
20+
* @var array $merchant
21+
* - 'email' (string)
22+
* - 'name' (string)
23+
*/
24+
$merchant = $event->transaction->getMetadata('merchant');
25+
1726
$this->notifiable->notify(new NewSponsorPaymentNotification($event->transaction));
27+
28+
Mail::to($merchant['email'])
29+
->send(new SendSponsorThanksMail($merchant['name']));
1830
}
1931
}

app/Livewire/Components/SponsorSubscription.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public function submit(): void
143143
'reference' => $payload->transaction->merchant_reference,
144144
'customer' => $payload->transaction->customer,
145145
'name' => $name,
146+
'email' => $email,
146147
'laravel_cm_id' => Auth::id() ?? null,
147148
'profile' => data_get($this->form->getState(), 'profile'),
148149
],

app/Mail/SendSponsorThanksMail.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Mail;
6+
7+
use Illuminate\Bus\Queueable;
8+
use Illuminate\Mail\Mailable;
9+
use Illuminate\Mail\Mailables\Content;
10+
use Illuminate\Mail\Mailables\Envelope;
11+
use Illuminate\Queue\SerializesModels;
12+
13+
final class SendSponsorThanksMail extends Mailable
14+
{
15+
use Queueable, SerializesModels;
16+
17+
public function __construct(public string $name) {}
18+
19+
public function envelope(): Envelope
20+
{
21+
return new Envelope(
22+
subject: __('emails/sponsor.subject'),
23+
);
24+
}
25+
26+
public function content(): Content
27+
{
28+
return new Content(
29+
markdown: 'emails.send-sponsor-thanks-mail',
30+
with: [
31+
'name' => $this->name,
32+
],
33+
);
34+
}
35+
36+
public function attachments(): array
37+
{
38+
return [];
39+
}
40+
}

0 commit comments

Comments
 (0)