예제 #1
0
 /**
  * Format message
  *
  * @param User $user
  * @param Mail $mail
  *
  * @return \Swift_Mime_MimePart
  */
 public function formatMessage(User $user, Mail $mail)
 {
     // Get base template for email
     $templateContent = $this->twig->loadTemplate('StfalconEventBundle::email.html.twig');
     $text = $mail->replace(array('%fullname%' => $user->getFullname(), '%user_id%' => $user->getId()));
     $body = $templateContent->render(array('text' => $text, 'mail' => $mail));
     $message = \Swift_Message::newInstance()->setSubject($mail->getTitle())->setFrom('*****@*****.**', 'Frameworks Days')->setTo($user->getEmail())->setBody($body, 'text/html');
     return $message;
 }
예제 #2
0
 /**
  * Format message
  *
  * @param User $user          User
  * @param Mail $mail          Mail
  * @param bool $isTestMessage Test message (needed for admin mails)
  *
  * @return \Swift_Mime_MimePart
  */
 public function formatMessage(User $user, Mail $mail, $isTestMessage = false)
 {
     $text = $mail->replace(array('%fullname%' => $user->getFullname(), '%user_id%' => $user->getId()));
     $unsubscribeLink = $this->router->generate('unsubscribe', ['hash' => $user->getSalt(), 'userId' => $user->getId()], true);
     $body = $this->renderTwigTemplate('StfalconEventBundle::email.html.twig', ['text' => $text, 'mail' => $mail, 'unsubscribeLink' => $unsubscribeLink]);
     $title = $mail->getTitle();
     // Модифицируем заголовок, если рассылка является для админов, т.е. тестовой
     if ($isTestMessage) {
         // Тестовая рассылка
         $title = 'Тестовая рассылка для админов! ' . $title;
     }
     return $this->createMessage($title, $user->getEmail(), $body);
 }
예제 #3
0
 /**
  * @param Event     $event             Event
  * @param User      $user              User
  * @param Payment   $payment           Payment
  * @param FormView  $promoCodeFormView Promo code form view
  * @param PromoCode $promoCode         Promo code
  * @param FormView  $ticketFormView    Ticket form view
  * @param int       $discountAmount    Discount amount
  *
  * @return array
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function payAction($event, $user, $payment, $promoCodeFormView, $promoCode, $ticketFormView, $discountAmount)
 {
     $config = $this->container->getParameter('stfalcon_payment.config');
     $description = 'Оплата участия в конференции ' . $event->getName() . '. Плательщик ' . $user->getFullname() . ' (#' . $user->getId() . ')';
     /** @var InterkassaService $interkassa */
     $interkassa = $this->container->get('stfalcon_event.interkassa.service');
     $params['ik_co_id'] = $config['interkassa']['shop_id'];
     $params['ik_am'] = $payment->getAmount();
     $params['ik_pm_no'] = $payment->getId();
     $params['ik_desc'] = $description;
     $params['ik_loc'] = 'ru';
     $data = array('ik_co_id' => $config['interkassa']['shop_id'], 'ik_desc' => $description, 'ik_sign' => $interkassa->getSignHash($params));
     return array('data' => $data, 'event' => $event, 'payment' => $payment, 'promoCodeForm' => $promoCodeFormView, 'promoCode' => $promoCode, 'ticketForm' => $ticketFormView, 'discountAmount' => $discountAmount);
 }