Skip to content

Commit

Permalink
feat: Add TransactionSuccessNotification for succe
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Mar 11, 2024
1 parent 94957c7 commit bda6df5
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions app/Notifications/TransactionSuccessNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class TransactionSuccessNotification extends Notification implements ShouldQueue
{
use Queueable;

protected $transactionDetails;

public function __construct(array $transactionDetails)
{
$this->transactionDetails = $transactionDetails;
}

public function via($notifiable)
{
return ['mail'];
}

public function toMail($notifiable)
{
return (new MailMessage)
->subject('Transaction Successful')
->greeting('Hello!')
->line('Your transaction has been successfully processed.')
->line('Transaction ID: ' . $this->transactionDetails['transaction_id'])
->line('Amount: $' . number_format($this->transactionDetails['amount'], 2))
->action('View Transaction', url('/transactions/' . $this->transactionDetails['transaction_id']))
->line('Thank you for using our application!');
}

public function toArray($notifiable)
{
return [
'transaction_id' => $this->transactionDetails['transaction_id'],
'amount' => $this->transactionDetails['amount'],
];
}
}

0 comments on commit bda6df5

Please sign in to comment.