-
-
Save uno-de-piera/17d55a464ed49bcd3c0b460947874846 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
namespace Laravel\Cashier\Notifications; | |
use Laravel\Cashier\Payment; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Notifications\Notification; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Notifications\Messages\MailMessage; | |
class ConfirmPayment extends Notification implements ShouldQueue | |
{ | |
use Queueable; | |
/** | |
* The PaymentIntent identifier. | |
* | |
* @var string | |
*/ | |
public $paymentId; | |
/** | |
* The payment amount. | |
* | |
* @var string | |
*/ | |
public $amount; | |
/** | |
* Create a new payment confirmation notification. | |
* | |
* @param \Laravel\Cashier\Payment $payment | |
* @return void | |
*/ | |
public function __construct(Payment $payment) | |
{ | |
$this->paymentId = $payment->id; | |
$this->amount = $payment->amount(); | |
} | |
/** | |
* 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) | |
{ | |
$url = route('cashier.payment', ['id' => $this->paymentId]); | |
return (new MailMessage) | |
->greeting(__('Confirm your :amount payment', ['amount' => $this->amount])) | |
->line(__('Extra confirmation is needed to process your payment. Please continue to the payment page by clicking on the button below.')) | |
->action(__('Confirm Payment'), $url) | |
->line(__('Thanks').',') | |
->line(config('app.name')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment