/** * Queue email with new order data * * @param bool $forceMode if true then email will be sent regardless of the fact that it was already sent previously * * @return Mage_Sales_Model_Order * @throws Exception */ public function queueNewOrderEmail($forceMode = false) { if (Mage::helper('customweb_subscription/cart')->isOrderSubscription($this) || Mage::registry('customweb_subscription_recurring_order') === true) { $this->sendNewSubscriptionOrderEmail(); } else { parent::queueNewOrderEmail($forceMode); } }
/** * Register authorized payment */ protected function _registerPaymentAuthorization() { $this->_importPaymentInformation(); $this->_order->getPayment()->setPreparedMessage($this->_createIpnComment(''))->setTransactionId($this->getRequestData('txn_id'))->setParentTransactionId($this->getRequestData('parent_txn_id'))->setCurrencyCode($this->getRequestData('mc_currency'))->setIsTransactionClosed(0)->registerAuthorizationNotification($this->getRequestData('mc_gross')); if (!$this->_order->getEmailSent()) { $this->_order->queueNewOrderEmail(); } $this->_order->save(); }
/** * Mark transaction as completed * * @param \PayPal\Api\WebhookEvent $webhookEvent */ protected function paymentSaleCompleted(\PayPal\Api\WebhookEvent $webhookEvent) { $paymentResource = $webhookEvent->getResource(); $parentTransactionId = $paymentResource->parent_payment; $payment = $this->_order->getPayment(); $payment->setTransactionId($paymentResource->id)->setCurrencyCode($paymentResource->amount->currency)->setParentTransactionId($parentTransactionId)->setIsTransactionClosed(true)->registerCaptureNotification($paymentResource->amount->total, true); $this->_order->save(); // notify customer $invoice = $payment->getCreatedInvoice(); if ($invoice && !$this->_order->getEmailSent()) { $this->_order->queueNewOrderEmail()->addStatusHistoryComment(Mage::helper('iways_paypalplus')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))->setIsCustomerNotified(true)->save(); } }
public function queueNewOrderEmail($forceMode = false) { $isDelete = false; if (!Mage::registry('ait_send_order_email')) { Mage::register('ait_send_order_email', 1); // aitoc code $isDelete = true; } $oResult = parent::queueNewOrderEmail($forceMode); if ($isDelete) { Mage::unregister('ait_send_order_email'); // aitoc code } return $oResult; }
/** * Processes payment confirmation, creates invoice if necessary, updates order status, * sends order confirmation to customer * * @param string $status * @param string $msg Order history message */ protected function _processSale($status, $msg) { switch ($status) { case self::MONEYBOOKERS_STATUS_SUCCESS: $this->_createInvoice(); $this->_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $msg); // save transaction ID $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id')); // send new order email $this->_order->queueNewOrderEmail(); $this->_order->setEmailSent(true); break; case self::MONEYBOOKERS_STATUS_PENDING: $this->_order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, $msg); // save transaction ID $this->_order->getPayment()->setLastTransId($this->getEventData('mb_transaction_id')); break; } $this->_order->save(); }
/** * Operate with order using information from silent post * * @param Mage_Sales_Model_Order $order */ protected function _processOrder(Mage_Sales_Model_Order $order) { $response = $this->getResponse(); $payment = $order->getPayment(); $payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0); $canSendNewOrderEmail = true; if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) { $canSendNewOrderEmail = false; $fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg(); $payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage); } if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) { $payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2)); } if ($response->getCvv2match() && $response->getCvv2match() != 'Y') { $payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match()); } switch ($response->getType()) { case self::TRXTYPE_AUTH_ONLY: $payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized()); break; case self::TRXTYPE_SALE: $payment->registerCaptureNotification($payment->getBaseAmountAuthorized()); break; } $order->save(); try { if ($canSendNewOrderEmail) { $order->queueNewOrderEmail(); } Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save(); } catch (Exception $e) { Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.')); } }
/** * If a new email can be sent for the order, queue it to be sent. * * @param Mage_Sales_Model_Order * @return self */ protected function _queueNewOrderEmail(Mage_Sales_Model_Order $order) { if ($order->getCanSendNewEmailFlag()) { try { $order->queueNewOrderEmail(); } catch (Exception $e) { $this->_logger->warning('Unable to queue new order email.', $this->_logContext->getMetaData(__CLASS__, [], $e)); } } return $this; }