コード例 #1
0
ファイル: OrderAbstract.php プロジェクト: kewaunited/xcart
 /**
  * A "change status" handler
  *
  * @return void
  */
 protected function processCancel()
 {
     if ($this->isNotificationsAllowed()) {
         \XLite\Core\Mailer::getInstance()->sendOrderCanceled($this, $this->isIgnoreCustomerNotifications());
     }
     $this->isNotificationSent = true;
 }
コード例 #2
0
ファイル: Settings.php プロジェクト: kingsj/core
 /**
  * Action to send test email notification
  *
  * @return void
  */
 protected function doActionTestEmail()
 {
     $request = \XLite\Core\Request::getInstance();
     $error = \XLite\Core\Mailer::getInstance()->sendTestEmail($request->test_from_email_address, $request->test_to_email_address, $request->test_email_body);
     \XLite\Core\Session::getInstance()->test_email_error = $error;
     $this->setReturnURL($this->buildURL('settings', '', array('page' => 'Email')));
 }
コード例 #3
0
ファイル: CheckoutAbstract.php プロジェクト: kewaunited/xcart
 /**
  * Do payment
  * :TODO: to revise
  * :FIXME: decompose
  *
  * @return void
  */
 protected function doPayment()
 {
     $cart = $this->getCart();
     if (isset(\XLite\Core\Request::getInstance()->notes)) {
         $cart->setNotes(\XLite\Core\Request::getInstance()->notes);
     }
     if ($cart->hasCartStatus()) {
         $cart->setDate(\XLite\Core\Converter::time());
     }
     // Get first (and only) payment transaction
     $transaction = $cart->getFirstOpenPaymentTransaction();
     $result = null;
     $paymentStatusCode = null;
     if ($transaction) {
         // Process transaction
         $result = $transaction->handleCheckoutAction();
         $pstatus = $cart->getCalculatedPaymentStatus(true);
         if ($pstatus !== \XLite\Model\Order\Status\Payment::STATUS_QUEUED) {
             $paymentStatusCode = $pstatus;
         }
     } elseif (!$cart->isOpen()) {
         // Cart is payed - create dump transaction
         $result = \XLite\Model\Payment\Transaction::COMPLETED;
         $paymentStatusCode = $cart->getCalculatedPaymentStatus(true);
     } else {
         $paymentStatusCode = $cart->getPaymentStatusCode();
     }
     if (\XLite\Model\Payment\Transaction::PROLONGATION === $result) {
         $this->set('silent', true);
         exit(0);
     } elseif (\XLite\Model\Payment\Transaction::SILENT === $result) {
         $this->paymentWidgetData = $transaction->getPaymentMethod()->getProcessor()->getPaymentWidgetData();
         $this->set('silent', true);
     } elseif (\XLite\Model\Payment\Transaction::SEPARATE === $result) {
         $this->setReturnURL($this->buildURL('checkoutPayment'));
     } elseif ($cart->isOpen()) {
         // Order is open - go to Select payment method step
         if ($transaction && $transaction->getNote()) {
             \XLite\Core\TopMessage::getInstance()->add($transaction->getNote(), array(), null, $transaction->isFailed() ? \XLite\Core\TopMessage::ERROR : \XLite\Core\TopMessage::INFO, true);
         }
         $this->setReturnURL($this->buildURL('checkout'));
     } else {
         if ($cart->isPayed()) {
             $paymentStatus = $paymentStatusCode ?: \XLite\Model\Order\Status\Payment::STATUS_PAID;
             $this->processSucceed();
         } elseif ($transaction && $transaction->isFailed()) {
             $paymentStatus = \XLite\Model\Order\Status\Payment::STATUS_DECLINED;
         } else {
             $paymentStatus = \XLite\Model\Order\Status\Payment::STATUS_QUEUED;
             $this->processSucceed();
             \XLite\Core\Mailer::getInstance()->sendOrderCreated($cart);
         }
         if ($paymentStatus) {
             $cart->setPaymentStatus($paymentStatus);
             \XLite\Core\Database::getEM()->flush();
         }
         \XLite\Core\TopMessage::getInstance()->clearTopMessages();
         $this->setReturnURL($this->buildURL(\XLite\Model\Order\Status\Payment::STATUS_DECLINED === $paymentStatus ? 'checkoutFailed' : 'checkoutSuccess', '', $cart->getOrderNumber() ? array('order_number' => $cart->getOrderNumber()) : array('order_id' => $cart->getOrderId())));
     }
     // Commented out in connection with E:0041438
     //$this->updateCart();
 }
コード例 #4
0
ファイル: Invoice.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Display Kount result on the invoice or not
  *
  * @return bool 
  */
 protected function isDisplayKountResult()
 {
     return \XLite\Module\CDev\XPaymentsConnector\Core\Kount::getInstance()->getKountData($this->getOrder()) && \XLite\Core\Mailer::getInstance()->isMailSendToAdmin();
 }
コード例 #5
0
ファイル: Order.php プロジェクト: kewaunited/xcart
 /**
  * Send order changed notification
  *
  * @return void
  */
 protected function sendOrderChangeNotification()
 {
     if ($this->getSendNotificationFlag()) {
         \XLite\Core\Mailer::getInstance()->sendOrderAdvancedChangedCustomer($this->getOrder());
     }
 }
コード例 #6
0
ファイル: Mailer.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Composes mail message.
  *
  * @param string $from          The sender email address
  * @param string $to            The email address to send mail to
  * @param string $dir           The directiry there mail parts template located
  * @param array  $customHeaders The headers you want to add/replace to. OPTIONAL
  * @param string $interface     Interface to use for mail OPTIONAL
  * @param string $languageCode  Language code OPTIONAL
  *
  * @return void
  */
 public function compose($from, $to, $dir, array $customHeaders = array(), $interface = \XLite::CUSTOMER_INTERFACE, $languageCode = '')
 {
     static::$composeRunned = true;
     if ('' === $languageCode && \XLite::ADMIN_INTERFACE === $interface && !\XLite::isAdminZone()) {
         $languageCode = \XLite\Core\Config::getInstance()->General->default_admin_language;
     }
     \XLite\Core\Translation::setTmpMailTranslationCode($languageCode);
     // initialize internal properties
     $this->set('from', $from);
     $this->set('to', $to);
     $this->set('customHeaders', $customHeaders);
     $this->set('dir', $dir);
     $subject = $this->compile($this->get('subjectTemplate'), $interface);
     $subject = \XLite\Core\Mailer::getInstance()->populateVariables($subject);
     $this->set('subject', $subject);
     $this->set('body', $this->compile($this->get('layoutTemplate'), $interface));
     $body = $this->get('body');
     $body = \XLite\Core\Mailer::getInstance()->populateVariables($body);
     // find all images and fetch them; replace with cid:...
     $fname = tempnam(LC_DIR_COMPILE, 'mail');
     file_put_contents($fname, $body);
     $this->imageParser = new \XLite\Model\MailImageParser();
     $this->imageParser->webdir = \XLite::getInstance()->getShopURL('', false);
     $this->imageParser->parse($fname);
     $this->set('body', $this->imageParser->result);
     $this->set('images', $this->imageParser->images);
     ob_start();
     // Initialize PHPMailer from configuration variables (it should be done once in a script execution)
     $this->initMailFromConfig();
     // Initialize Mail from inner set of variables.
     $this->initMailFromSet();
     $output = ob_get_contents();
     ob_end_clean();
     if ('' !== $output) {
         \XLite\Logger::getInstance()->log('Mailer echoed: "' . $output . '". Error: ' . $this->mail->ErrorInfo);
     }
     // Check if there is any error during mail composition. Log it.
     if ($this->mail->isError()) {
         \XLite\Logger::getInstance()->log('Compose mail error: ' . $this->mail->ErrorInfo);
     }
     if (file_exists($fname)) {
         unlink($fname);
     }
     \XLite\Core\Translation::setTmpMailTranslationCode('');
     static::$composeRunned = false;
 }
コード例 #7
0
ファイル: Order.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Process PIN codes 
  * 
  * @return void
  */
 public function processPINCodes()
 {
     $missingCount = 0;
     foreach ($this->getItems() as $item) {
         if ($item->getProduct()->getPinCodesEnabled()) {
             if (!$item->countPinCodes()) {
                 $item->acquirePinCodes();
                 $missingCount += $item->countMissingPinCodes();
             }
             if ($item->countPinCodes()) {
                 $item->salePinCodes();
             }
         }
     }
     if ($missingCount) {
         \XLite\Core\Mailer::getInstance()->sendAcquirePinCodesFailedAdmin($this);
         \XLite\Core\TopMessage::addError('Could not assign X PIN codes to order #Y.', array('count' => $missingCount, 'orderId' => $this->getOrderNumber()));
     }
 }
コード例 #8
0
ファイル: Order.php プロジェクト: kingsj/core
 /**
  * A "change status" handler
  *
  * @return void
  */
 protected function processFail()
 {
     \XLite\Core\Mailer::getInstance()->sendFailedOrder($this);
 }
コード例 #9
0
 /**
  * Return all variables
  *
  * @return array
  */
 protected function getVariables()
 {
     return \XLite\Core\Mailer::getInstance()->getAllVariables();
 }