public function onOrderCreated(vStore\Shop\Order $order)
 {
     $this->template->order = $order;
     if ($this->template->getFile() == "") {
         $this->template->setFile(__DIR__ . '/Templates/email.orderConfirmation.latte');
     }
     $this->message->addTo($order->customer->email, $order->customer->displayName);
     $this->message->setSubject('Potvrzeni objednavky c. ' . vStore\Latte\Helpers\Shop::formatOrderId($order->id));
     $this->message->setHtmlBody($this->template);
     $this->message->send();
 }
 public function onOrderCreated(vStore\Shop\Order $order)
 {
     if (!$order->payment instanceof vStore\Shop\InvoicePaymentMethod) {
         return;
     }
     //--------------
     $invoiceFile = $this->context->shopInvoiceGenerator->generate($order);
     //--------------
     $this->template->order = $order;
     if ($this->template->getFile() == "") {
         $this->template->setFile(__DIR__ . '/Templates/email.invoice.latte');
     }
     $this->message->addTo($order->customer->email, $order->customer->displayName);
     $this->message->setSubject('Vase proforma faktura k objednavce c. ' . vStore\Latte\Helpers\Shop::formatOrderId($order->id));
     $this->message->setHtmlBody($this->template);
     $this->message->addAttachment($invoiceFile, null, 'application/pdf');
     $this->message->send();
 }