1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Added payment confirmation email for license purchases

This commit is contained in:
Hillel Coren 2014-10-05 14:55:59 +03:00
parent 051aec19c0
commit a4e949daec
4 changed files with 31 additions and 1 deletions

View File

@ -3,18 +3,20 @@
use ninja\repositories\PaymentRepository;
use ninja\repositories\InvoiceRepository;
use ninja\repositories\AccountRepository;
use ninja\mailers\ContactMailer;
class PaymentController extends \BaseController
{
protected $creditRepo;
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo)
public function __construct(PaymentRepository $paymentRepo, InvoiceRepository $invoiceRepo, AccountRepository $accountRepo, ContactMailer $contactMailer)
{
parent::__construct();
$this->paymentRepo = $paymentRepo;
$this->invoiceRepo = $invoiceRepo;
$this->accountRepo = $accountRepo;
$this->contactMailer = $contactMailer;
}
public function index()
@ -423,6 +425,9 @@ class PaymentController extends \BaseController
'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 Redirect::away(Session::get('return_url') . "?license_key={$license->license_key}");

View File

@ -73,4 +73,21 @@ class ContactMailer extends Mailer {
$user = $payment->invitation->user;
$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);
}
}

View File

@ -9,6 +9,10 @@
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}<p/>
@if (isset($emailMessage) && $emailMessage)
{{ $emailMessage }}<p/>
@endif
@if ($emailFooter)
{{ nl2br($emailFooter) }}
@else

View File

@ -2,6 +2,10 @@
{{ trans('texts.payment_message', ['amount' => $paymentAmount]) }}
@if (isset($emailMessage) && $emailMessage)
{{ $emailMessage }}
@endif
@if ($emailFooter)
{{ $emailFooter }}
@else