Exemplo n.º 1
0
 /**
  * Send Mails
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem
  * @paran string $type
  * @param string $class
  * @param string $function
  *
  * @return void
  */
 protected function sendMails(\Extcode\Cart\Domain\Model\Order\Item $orderItem, $type, $class, $function)
 {
     $billingAddress = $orderItem->getBillingAddress()->_loadRealInstance();
     $shippingAddress = null;
     if ($orderItem->getShippingAddress()) {
         $shippingAddress = $orderItem->getShippingAddress()->_loadRealInstance();
     }
     $data = ['orderItem' => $orderItem, 'cart' => $this->cart, 'billingAddress' => $billingAddress, 'shippingAddress' => $shippingAddress];
     $signalSlotDispatcher = $this->objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
     $signalSlotDispatcher->dispatch($class, $function . 'AfterUpdatePaymentAndBefore' . ucfirst($type) . 'Mail', $data);
     $paymentId = $orderItem->getPayment()->getServiceId();
     $paymentStatus = $orderItem->getPayment()->getStatus();
     if (intval($this->pluginSettings['payments']['options'][$paymentId]['sendBuyerEmail'][$paymentStatus]) == 1) {
         $this->sendBuyerMail($orderItem, $billingAddress, $shippingAddress);
     }
     if (intval($this->pluginSettings['payments']['options'][$paymentId]['sendSellerEmail'][$paymentStatus]) == 1) {
         $this->sendSellerMail($orderItem, $billingAddress, $shippingAddress);
     }
     $signalSlotDispatcher = $this->objectManager->get('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
     $signalSlotDispatcher->dispatch($class, $function . 'AfterUpdatePaymentAndAfter' . ucfirst($type) . 'Mail', $data);
 }