/**
  * @param OrderEvent $event
  *
  * Check if we're the payment module, and send the payment confirmation email to the customer if it's the case.
  */
 public function sendConfirmationEmail(OrderEvent $event)
 {
     if ($event->getOrder()->getPaymentModuleId() === Cheque::getModuleId()) {
         if ($event->getOrder()->isPaid(true)) {
             $order = $event->getOrder();
             $this->mailer->sendEmailToCustomer('order_confirmation_cheque', $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef()]);
         }
     }
 }
Beispiel #2
0
 /**
  * Send email to notify customer that files for virtual products are available
  *
  * @param OrderEvent $event
  * @throws \Exception
  */
 public function sendEmail(OrderEvent $event)
 {
     $order = $event->getOrder();
     // Be sure that we have a document to download
     $virtualProductCount = OrderProductQuery::create()->filterByOrderId($order->getId())->filterByVirtual(true)->filterByVirtualDocument(null, Criteria::NOT_EQUAL)->count();
     if ($virtualProductCount > 0) {
         $customer = $order->getCustomer();
         $this->mailer->sendEmailToCustomer('mail_virtualproduct', $customer, ['customer_id' => $customer->getId(), 'order_id' => $order->getId(), 'order_ref' => $order->getRef(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt()]);
     } else {
         Tlog::getInstance()->warning("Virtual product download message not sent to customer: there's nothing to downnload");
     }
 }
 public function update_status(OrderEvent $event)
 {
     if ($event->getOrder()->getDeliveryModuleId() === FreeShipping::getModuleId()) {
         if ($event->getOrder()->isSent()) {
             $contact_email = ConfigQuery::getStoreEmail();
             if ($contact_email) {
                 $order = $event->getOrder();
                 $customer = $order->getCustomer();
                 $this->mailer->sendEmailToCustomer(FreeShipping::MESSAGE_SEND_CONFIRMATION, $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef(), 'customer_id' => $customer->getId(), 'order_date' => $order->getCreatedAt(), 'update_date' => $order->getUpdatedAt(), 'package' => $order->getDeliveryRef()]);
             }
         }
     }
 }
Beispiel #4
0
 public function updateStatus(OrderEvent $event)
 {
     $order = $event->getOrder();
     if ($order->isPaid() && $order->getPaymentModuleId() == Atos::getModuleId()) {
         if (Atos::getConfigValue('send_payment_confirmation_message')) {
             $this->mailer->sendEmailToCustomer(Atos::CONFIRMATION_MESSAGE_NAME, $order->getCustomer(), ['order_id' => $order->getId(), 'order_ref' => $order->getRef()]);
         }
         // Send confirmation email if required.
         if (Atos::getConfigValue('send_confirmation_message_only_if_paid')) {
             $event->getDispatcher()->dispatch(TheliaEvents::ORDER_SEND_CONFIRMATION_EMAIL, $event);
         }
         Tlog::getInstance()->debug("Confirmation email sent to customer " . $order->getCustomer()->getEmail());
     }
 }
Beispiel #5
0
 public function lostPassword(LostPasswordEvent $event)
 {
     if (null !== ($customer = CustomerQuery::create()->filterByEmail($event->getEmail())->findOne())) {
         $password = Password::generateRandom(8);
         $customer->setPassword($password)->save();
         $this->mailer->sendEmailToCustomer('lost_password', $customer, ['password' => $password]);
     }
 }
Beispiel #6
0
 /**
  * @param OrderEvent $event
  *
  * @throws \Exception if the message cannot be loaded.
  */
 public function sendConfirmationEmail(OrderEvent $event)
 {
     $this->mailer->sendEmailToCustomer('order_confirmation', $event->getOrder()->getCustomer(), ['order_id' => $event->getOrder()->getId(), 'order_ref' => $event->getOrder()->getRef()]);
 }