/** * @param PaymentWasCreated $event */ public function createdPayment(PaymentWasCreated $event) { // only send emails for online payments if (!$event->payment->account_gateway_id) { return; } $this->contactMailer->sendPaymentConfirmation($event->payment); $this->sendEmails($event->payment->invoice, 'paid', $event->payment); $this->pushService->sendNotification($event->payment->invoice, 'paid'); }
/** * @param CreatePaymentRequest $request * @return \Illuminate\Http\RedirectResponse */ public function store(CreatePaymentRequest $request) { $input = $request->input(); $input['invoice_id'] = Invoice::getPrivateId($input['invoice']); $input['client_id'] = Client::getPrivateId($input['client']); $payment = $this->paymentRepo->save($input); if (Input::get('email_receipt')) { $this->contactMailer->sendPaymentConfirmation($payment); Session::flash('message', trans('texts.created_payment_emailed_client')); } else { Session::flash('message', trans('texts.created_payment')); } return redirect()->to($payment->client->getRoute()); }