mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Added payment confirmation email for license purchases
This commit is contained in:
parent
051aec19c0
commit
a4e949daec
@ -3,18 +3,20 @@
|
|||||||
use ninja\repositories\PaymentRepository;
|
use ninja\repositories\PaymentRepository;
|
||||||
use ninja\repositories\InvoiceRepository;
|
use ninja\repositories\InvoiceRepository;
|
||||||
use ninja\repositories\AccountRepository;
|
use ninja\repositories\AccountRepository;
|
||||||
|
use ninja\mailers\ContactMailer;
|
||||||
|
|
||||||
class PaymentController extends \BaseController
|
class PaymentController extends \BaseController
|
||||||
{
|
{
|
||||||
protected $creditRepo;
|
protected $creditRepo;
|
||||||
|
|
||||||
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo)
|
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo, ContactMailer $contactMailer)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->paymentRepo = $paymentRepo;
|
$this->paymentRepo = $paymentRepo;
|
||||||
$this->invoiceRepo = $invoiceRepo;
|
$this->invoiceRepo = $invoiceRepo;
|
||||||
$this->accountRepo = $accountRepo;
|
$this->accountRepo = $accountRepo;
|
||||||
|
$this->contactMailer = $contactMailer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@ -423,6 +425,9 @@ class PaymentController extends \BaseController
|
|||||||
'hideHeader' => true
|
'hideHeader' => true
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$name = "{$license->first_name} {$license->last_name}";
|
||||||
|
$this->contactMailer->sendLicensePaymentConfirmation($name, $license->email, LICENSE_PRICE, $license->license_key);
|
||||||
|
|
||||||
return View::make('public.license', $data);
|
return View::make('public.license', $data);
|
||||||
|
|
||||||
//return Redirect::away(Session::get('return_url') . "?license_key={$license->license_key}");
|
//return Redirect::away(Session::get('return_url') . "?license_key={$license->license_key}");
|
||||||
|
@ -73,4 +73,21 @@ class ContactMailer extends Mailer {
|
|||||||
$user = $payment->invitation->user;
|
$user = $payment->invitation->user;
|
||||||
$this->sendTo($payment->contact->email, $user->email, $user->getDisplayName(), $subject, $view, $data);
|
$this->sendTo($payment->contact->email, $user->email, $user->getDisplayName(), $subject, $view, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendLicensePaymentConfirmation($name, $email, $amount, $license)
|
||||||
|
{
|
||||||
|
$view = 'payment_confirmation';
|
||||||
|
$subject = trans('texts.payment_subject');
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
'accountName' => trans('texts.email_from'),
|
||||||
|
'clientName' => $name,
|
||||||
|
'emailFooter' => false,
|
||||||
|
'paymentAmount' => Utils::formatMoney($amount, 1),
|
||||||
|
'showNinjaFooter' => false,
|
||||||
|
'emailMessage' => "Your license: $license",
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->sendTo($email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
|
||||||
|
}
|
||||||
}
|
}
|
@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}<p/>
|
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}<p/>
|
||||||
|
|
||||||
|
@if (isset($emailMessage) && $emailMessage)
|
||||||
|
{{ $emailMessage }}<p/>
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($emailFooter)
|
@if ($emailFooter)
|
||||||
{{ nl2br($emailFooter) }}
|
{{ nl2br($emailFooter) }}
|
||||||
@else
|
@else
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}
|
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}
|
||||||
|
|
||||||
|
@if (isset($emailMessage) && $emailMessage)
|
||||||
|
{{ $emailMessage }}
|
||||||
|
@endif
|
||||||
|
|
||||||
@if ($emailFooter)
|
@if ($emailFooter)
|
||||||
{{ $emailFooter }}
|
{{ $emailFooter }}
|
||||||
@else
|
@else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user