<?php
namespace App\Notifications\User;
use Carbon\Carbon;
use App\Models\Transaction;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
class CardPaymentEmailNotification extends Notification
{
use Queueable;
public $transaction_id;
public $user;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($transaction_id,$user)
{
$this->transaction_id = $transaction_id;
$this->user = $user;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
$transaction_data = Transaction::where('id',$this->transaction_id)->first();
$user = $this->user;
$date = Carbon::now();
$dateTime = $date->format('Y-m-d h:i:s A');
return (new MailMessage)
->greeting("Hello ".$user->fullname." !")
->subject("Order placed using ".'****'. substr($transaction_data->details->card_payment->card_number,-4))
->line("Request Amount: " . $transaction_data->request_amount.' '. $transaction_data->request_currency)
->line("Transaction ID: " .$transaction_data->trx_id)
->line("Status: " . $transaction_data->stringStatus->value)
->line("Date And Time: " .$dateTime)
->line('Thank you for using our application!');
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}
To access the Kueue Pay Developer API, you’ll need an API key. You can obtain your API key by logging in to your Kueue Pay merchant account and navigating to the API section. Collect Client ID , Secret ID & Merchant ID Carefully. Keep your API key confidential and do not share it publicly.