예제 #1
0
 /**
  * @author SL
  * @param string $id
  * @param EmailApplicationService $emailApplicationService
  * @param Request $request
  * @return string
  */
 public function previewEmail($id, EmailApplicationService $emailApplicationService, Request $request)
 {
     $installation = $this->fetchInstallation($id);
     $templateHelper = EmailConfigurationTemplateHelper::makeFromJson($installation->email_configuration);
     $name = $templateHelper->has('retailer_name') ? $templateHelper->get('retailer_name') : $installation->name;
     try {
         return $emailApplicationService->getView(TemplatesController::fetchDefaultTemplateForInstallation($installation), array_merge(['installation_logo' => $installation->custom_logo_url, 'customer_title' => 'Title', 'customer_last_name' => 'Surname', 'installation_name' => $name, 'order_description' => 'Example Order from ' . $name, 'payment_regular' => 0, 'apply_url' => '#', 'payments' => 0, 'order_amount' => 0, 'deposit_amount' => 0, 'loan_amount' => 0, 'total_repayment' => 0, 'offered_rate' => 0, 'apr' => 0, 'loan_cost' => 0], $templateHelper->toArray(), $request->all()));
     } catch (\Exception $e) {
         return view('emails.applications.blank')->with('content', 'Problem rendering template');
     }
 }
예제 #2
0
 /**
  * @author EB
  * @param Application $application
  * @return Application
  * @throws RedirectException
  */
 private function sendApplicationEmail(Application $application)
 {
     try {
         $this->emailApplicationService->sendDefaultApplicationEmail($application, TemplatesController::fetchDefaultTemplateForInstallation($application->installation), array_merge(EmailTemplateEngine::getEmailTemplateFields($application), $this->applicationSynchronisationService->getCreditInfoForApplication($application->id), ['template_footer' => $application->installation->getDefaultTemplateFooterAsHtml(), 'installation_name' => $application->installation->name, 'installation_logo' => $application->installation->custom_logo_url, 'apply_url' => $application->ext_resume_url], EmailConfigurationTemplateHelper::makeFromJson($application->installation->email_configuration)->toArray()));
         ApplicationEvent\ApplicationEventHelper::addEvent($application, ApplicationEvent::TYPE_RESUME_EMAIL, Auth::user());
     } catch (\Exception $e) {
         throw $this->redirectWithException('installations/' . $application->installation->id . '/applications/' . $application->id, 'Unable to send Application via Email: ' . $e->getMessage(), $e);
     }
     return $application;
 }