当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Order::sendNewOrderEmail方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order::sendNewOrderEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::sendNewOrderEmail方法的具体用法?PHP Mage_Sales_Model_Order::sendNewOrderEmail怎么用?PHP Mage_Sales_Model_Order::sendNewOrderEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order的用法示例。


在下文中一共展示了Mage_Sales_Model_Order::sendNewOrderEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: successAction

 public function successAction()
 {
     $order = new Mage_Sales_Model_Order();
     $lastOrderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($lastOrderId);
     $quoteId = $order->getQuoteId();
     $quote = Mage::getModel("sales/quote")->load($quoteId);
     try {
         $order->setTransactionIdBcash($quote->getTransactionIdBcash())->setStatusBcash($quote->getStatusBcash())->setDescriptionStatusBcash($quote->getDescriptionStatusBcash())->setPaymentLinkBcash($quote->getPaymentLinkBcash())->setPaymentMethodBcash($quote->getPaymentMethodBcash())->setInstallmentsBcash($quote->getInstallmentsBcash());
         $order->save();
         $order->sendNewOrderEmail();
     } catch (Exception $ex) {
     }
     $type = null;
     $payment_method_bcash = $order->getPaymentMethodBcash();
     if ($payment_method_bcash) {
         $helper = new Bcash_Pagamento_Helper_PaymentMethod();
         $type = $helper->getPaymentMethod($payment_method_bcash);
     }
     $this->loadLayout();
     $this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
     $block = $this->getLayout()->createBlock('Mage_Core_Block_Template', 'link_pagamento_bcash', array('template' => 'bcash/pagamento/checkout/success.phtml'));
     $block->setOrder($order);
     $block->setQuote($quote);
     $block->setType($type);
     $this->getLayout()->getBlock('content')->append($block);
     $this->_initLayoutMessages('checkout/session');
     Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
     $this->renderLayout();
 }
开发者ID:payu-br,项目名称:bcash-magento-transparente,代码行数:30,代码来源:PaymentController.php

示例2: sendNewOrderEmail

 /**
  * Send email with order data
  *
  * @return Mage_Sales_Model_Order
  */
 public function sendNewOrderEmail()
 {
     if (Mage::helper('customweb_subscription/cart')->isOrderSubscription($this) || Mage::registry('customweb_subscription_recurring_order') === true) {
         $this->sendNewSubscriptionOrderEmail();
     } else {
         parent::sendNewOrderEmail();
     }
 }
开发者ID:xiaoguizhidao,项目名称:extensiongsd,代码行数:13,代码来源:Order.php

示例3: sendNewOrderEmail

 public function sendNewOrderEmail()
 {
     Mage::register('ait_send_order_email', 1);
     // aitoc code
     $oResult = parent::sendNewOrderEmail();
     Mage::unregister('ait_send_order_email');
     // aitoc code
     return $oResult;
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:9,代码来源:FrontSalesOrder.php

示例4: sendMail

 /**
  * @param Mage_Sales_Model_Order $order
  */
 public function sendMail(Mage_Sales_Model_Order $order)
 {
     if (!$this->helper()->canUseAppEmulation()) {
         // Old Magento does not use app Emulation in emails yet, we must set the proper environment.
         $this->app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND, Mage_Core_Model_App_Area::PART_TRANSLATE);
         $this->app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND, Mage_Core_Model_App_Area::PART_DESIGN);
     }
     $order->sendNewOrderEmail();
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:12,代码来源:OrderConfirmation.php

示例5: _processOrder

 /**
  * 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();
     $customerId = $order->getCustomerId();
     if ($response->getResult() == self::RESPONSE_CODE_APPROVED && $response->getMethod() == 'CC' && $customerId && $payment->hasAdditionalInformation('cc_save_future') && $payment->getAdditionalInformation('cc_save_future') == 'Y') {
         // Obtain CC type
         $ccType = 'OT';
         $responseCcType = $response->getCardtype();
         if (!is_null($responseCcType)) {
             $payflowResponseCcTypesMap = array(0 => 'VI', 1 => 'MC', 2 => 'DI', 3 => 'AE', 4 => 'OT', 5 => 'JCB');
             if (isset($payflowResponseCcTypesMap[$responseCcType])) {
                 $ccType = $payflowResponseCcTypesMap[$responseCcType];
             }
         }
         $ccExpMonth = $response->getExpdate() ? substr($response->getExpdate(), 0, 2) : '';
         if ($ccExpMonth[0] == '0') {
             $ccExpMonth = $ccExpMonth[1];
         }
         // Create new stored card
         $customerstoredModel = Mage::getModel('cls_paypal/customerstored');
         $customerstoredModel->setData(array('transaction_id' => $response->getPnref(), 'customer_id' => $customerId, 'cc_type' => $ccType, 'cc_last4' => $response->getAcct() ? substr($response->getAcct(), -4) : '', 'cc_exp_month' => $ccExpMonth, 'cc_exp_year' => $response->getExpdate() ? '20' . substr($response->getExpdate(), 2) : '', 'date' => Varien_Date::formatDate(true, true), 'payment_method' => $payment->getMethod()));
         $customerstoredModel->save();
     }
     try {
         if ($canSendNewOrderEmail) {
             $order->sendNewOrderEmail();
         }
         Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.'));
     }
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:60,代码来源:Payflowlink.php

示例6: testSendNewOrderEmail

 /**
  * @magentoConfigFixture current_store design/theme/full_name default/default/default
  * @magentoDataFixture Mage/Sales/_files/order.php
  */
 public function testSendNewOrderEmail()
 {
     $order = new Mage_Sales_Model_Order();
     $order->loadByIncrementId('100000001');
     $order->setCustomerEmail('customer@example.com');
     $payment = $order->getPayment();
     $paymentInfoBlock = Mage::helper('Mage_Payment_Helper_Data')->getInfoBlock($payment);
     $paymentInfoBlock->setArea('invalid-area');
     $payment->setBlockMock($paymentInfoBlock);
     $this->assertEmpty($order->getEmailSent());
     $order->sendNewOrderEmail();
     $this->assertNotEmpty($order->getEmailSent());
     $this->assertEquals('frontend', $paymentInfoBlock->getArea());
 }
开发者ID:nayanchamp,项目名称:magento2,代码行数:18,代码来源:OrderTest.php

示例7: _registerPaymentCapture

 /**
  * Process completed payment (either full or partial)
  */
 public function _registerPaymentCapture()
 {
     $session = $session = Mage::getSingleton('checkout/session');
     $purchaseId = $session->getPurchaseId();
     $this->_order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
     $payment = $this->_order->getPayment();
     $payment->setTransactionId($purchaseId)->setCurrencyCode('EUR')->setIsTransactionClosed(0)->registerCaptureNotification($this->getRequestData('amount') / 100);
     Mage::helper('sign2pay')->setStatusOnOrder($this->_order, Mage::getStoreConfig('payment/sign2pay/complete_order_status', Mage::app()->getStore()));
     $this->_order->save();
     // notify customer
     $invoice = $payment->getCreatedInvoice();
     if ($invoice && !$this->_order->getEmailSent()) {
         $this->_order->sendNewOrderEmail()->addStatusHistoryComment(Mage::helper('sign2pay')->__('Notified customer about invoice #%s.', $invoice->getIncrementId()))->setIsCustomerNotified(true)->save();
     }
     return $this;
 }
开发者ID:ArjenMiedema,项目名称:magento-sign2pay,代码行数:19,代码来源:Processor.php

示例8: _confirmOrder

 /**
  * Confirm the payment of an order
  *
  * @param array $data
  */
 protected function _confirmOrder($data)
 {
     if (!$this->_succeeded($this->order)) {
         if ($data['paymentState'] == 'PENDING') {
             $this->order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, Mage::helper('wirecard_checkout_page')->__('The payment authorization is pending.'))->save();
         } else {
             $this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('wirecard_checkout_page')->__('The amount has been authorized and captured by Wirecard Checkout Page.'))->save();
             // invoice payment
             if ($this->order->canInvoice()) {
                 $invoice = $this->order->prepareInvoice();
                 $invoice->register()->capture();
                 Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
             }
             // send new order email to customer
             $this->order->sendNewOrderEmail();
         }
     }
     $payment = $this->order->getPayment();
     $additionalInformation = array();
     $additionalInformationString = '';
     foreach ($data as $fieldName => $fieldValue) {
         switch ($fieldName) {
             case 'amount':
             case 'currency':
             case 'language':
             case 'responseFingerprint':
             case 'responseFingerprintOrder':
             case 'form_key':
             case 'paymentState':
             case 'orderId':
                 break;
             default:
                 $additionalInformation[htmlentities($fieldName)] = htmlentities($fieldValue);
                 $additionalInformationString .= ' | ' . $fieldName . ' - ' . $fieldValue;
         }
     }
     if (count($additionalInformation) != 0) {
         $payment->setAdditionalInformation($additionalInformation);
         $payment->setAdditionalData(serialize($additionalInformation));
         if ($payment->hasAdditionalInformation()) {
             Mage::log('Added Additional Information to Order ' . $data['orderId'] . ' :' . $additionalInformationString);
         }
     }
     $payment->save();
 }
开发者ID:netzkollektiv,项目名称:wirecard-checkout-magento,代码行数:50,代码来源:ProcessingController.php

示例9: _getPostResponseActionUrl

 private function _getPostResponseActionUrl(Mage_Sales_Model_Order $order)
 {
     $token = $_GET['token'];
     $server = Mage::getSingleton('customer/session')->getServerMode();
     $url = getStatusUrl($server, $token);
     $resultJson = checkStatusPayment($url);
     $theResult = $resultJson['transaction']['processing']['result'];
     $returnCode = $resultJson['transaction']['processing']['return']['code'];
     $returnMessage = $resultJson['transaction']['processing']['return']['message'];
     $currency = $resultJson['transaction']['payment']['clearing']['currency'];
     $payment_type = substr($resultJson['transaction']['payment']['code'], -2);
     $refId = $resultJson['transaction']['identification']['uniqueId'];
     $pageName = '';
     $params = array();
     if ($theResult == 'ACK') {
         $order->getPayment()->setAdditionalInformation('IDENTIFICATION_REFERENCEID', $refId);
         $order->getPayment()->setAdditionalInformation('CURRENCY', $currency);
         $order->getPayment()->setAdditionalInformation('hyperpay_transaction_code', $payment_type);
         $order->save();
         $order->sendNewOrderEmail();
         if ($payment_type == 'PA') {
             $order->setState(Mage_Sales_Model_Order::STATE_NEW, true)->save();
         } else {
             Mage::helper('hyperpay')->invoice($order);
         }
         Mage::getModel('sales/quote')->load($order->getQuoteId())->setIsActive(false)->save();
         $pageName = 'checkout/onepage/success/';
     } else {
         Mage::getSingleton('core/session')->setPiHyperpayPaymentError($returnCode);
         $returnMessage .= " ( transaction id : " . $order->getIncrementId() . " )";
         $order->cancel()->save();
         $pageName = 'hyperpay/response/addErrorAndRedirect/';
         //            if (trim($this->getRequest()->getPost('FRONTEND_REQUEST_CANCELLED')) == 'false' && $this->getRequest()->getPost('PROCESSING_RETURN') != 'Cancelled by user') {
         $params = array('message' => $returnMessage);
         //            }
     }
     $params['_secure'] = true;
     //return Mage::getUrl($pageName, $params);
     $this->_redirect($pageName, $params);
 }
开发者ID:Aya-Mousa,项目名称:HyperpayMagentoo,代码行数:40,代码来源:ResponseController.php

示例10: responseAction

 public function responseAction()
 {
     $session = $this->_getCheckout();
     $order = Mage::getModel('sales/order');
     $request = $this->_checkReturnedPost();
     try {
         Mage::log($request);
         $parameters = array();
         foreach ($request as $key => $value) {
             $parameters[$key] = $request[$key];
         }
         $session = $this->_getCheckout();
         $isValidChecksum = false;
         $txnstatus = false;
         $authStatus = false;
         $mer_encrypted = Mage::getStoreConfig('payment/paytm_cc/inst_key');
         $const = (string) Mage::getConfig()->getNode('global/crypt/key');
         $mer_decrypted = Mage::helper('paytm')->decrypt_e($mer_encrypted, $const);
         //setting order status
         $order = Mage::getModel('sales/order');
         $order->loadByIncrementId($request['ORDERID']);
         if (!$order->getId()) {
             Mage::log('No order for processing found');
         }
         $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true)->save();
         //check returned checksum
         if (isset($request['CHECKSUMHASH']) && Mage::getStoreConfig('payment/paytm_cc/enable_checksum') == 1) {
             $return = Mage::helper('paytm')->verifychecksum_e($parameters, $mer_decrypted, $request['CHECKSUMHASH']);
             if ($return == "TRUE") {
                 $isValidChecksum = true;
             }
         }
         if (Mage::getStoreConfig('payment/paytm_cc/enable_checksum') == 0) {
             $isValidChecksum = true;
         }
         if ($request['STATUS'] == "TXN_SUCCESS") {
             $txnstatus = true;
         }
         $_testurl = NULL;
         if (Mage::getStoreConfig('payment/paytm_cc/mode') == 1) {
             $_testurl = Mage::helper('paytm/Data2')->STATUS_QUERY_URL_PROD;
         } else {
             $_testurl = Mage::helper('paytm/Data2')->STATUS_QUERY_URL_TEST;
         }
         if ($txnstatus && $isValidChecksum) {
             /*	if(Mage::getStoreConfig('payment/paytm_cc/checkstat')==1){
             			
             				
             				$data = array("MID" => Mage::helper('paytm')->decrypt_e(Mage::getStoreConfig('payment/paytm_cc/inst_id'),$const), "ORDERID" => Mage::getSingleton('checkout/session')->getLastRealOrderId());  
             				$JsonData =json_encode($data);
             				$data2 = 'JsonData='.$JsonData;
             				//curl call to verify transaction status
             				$ch = curl_init($_testurl);
             				curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
             				curl_setopt($ch, CURLOPT_POSTFIELDS, $data2);                                                                  
             				curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
             				curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
             				curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);		
             				curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
             				'Content-Type: application/json', 
             				'Content-Length: ' . strlen($data2))                                                                       
             				);  
             			
             				$results = curl_exec($ch);    
             				$resp = json_decode($results);
             				Mage::log($resp);
             				
             				if($resp->{'TXNAMOUNT'} == $parameters['TXNAMOUNT'] && $resp->{'STATUS'} == $parameters['STATUS'])
             					$authStatus = true;
             				else
             					$authStatus = false;
             			} 
             			else if(Mage::getStoreConfig('payment/paytm_cc/checkstat')==0) */
             $authStatus = true;
             if ($authStatus == false) {
                 $this->_processCancel($request);
             } else {
                 $this->_processSale($request);
                 $order_mail = new Mage_Sales_Model_Order();
                 $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
                 $order_mail->loadByIncrementId($incrementId);
                 try {
                     $order_mail->sendNewOrderEmail();
                 } catch (Exception $ex) {
                 }
             }
         } else {
             $this->_processCancel($request);
         }
     } catch (Mage_Core_Exception $e) {
         $this->getResponse()->setBody($this->getLayout()->createBlock($this->_failureBlockType)->setOrder($this->_order)->toHtml());
         $this->_processFail($request);
     }
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:94,代码来源:ProcessingController.php

示例11: sendNewOrderEmail

 public function sendNewOrderEmail()
 {
     Mage::app()->setCurrentStore($this->getStoreId());
     if (Mage::getStoreConfig('transactional/order/enabled')) {
         try {
             if (!Mage::helper('sales')->canSendNewOrderEmail($this->getStoreId())) {
                 return $this;
             }
             $customerEmail = $this->getCustomerEmail();
             $orderNumber = $this->getIncrementId();
             $orderDate = date("F j, Y, g:i a", strtotime($this->getCreatedAt()));
             $subTotal = $this->formatPriceTxt($this->getSubtotal());
             $taxTotal = $this->formatPriceTxt($this->getTaxAmount());
             $shipTotal = $this->formatPriceTxt($this->getShippingAmount());
             $grandTotal = $this->formatPriceTxt($this->getGrandTotal());
             $discAmount = $this->formatPriceTxt($this->getBaseDiscountAmount());
             $billingAddress = $this->getBillingAddress();
             $billFirstName = $billingAddress->getFirstname();
             $billLastName = $billingAddress->getLastname();
             $billAddress1 = $billingAddress->getStreet(1);
             $billAddress2 = $billingAddress->getStreet(2);
             $billCity = $billingAddress->getCity();
             $billCounty = $billingAddress->getRegion();
             $billPostCode = $billingAddress->getPostcode();
             $billCountry = $billingAddress->getCountry();
             $shippingAddress = $this->getShippingAddress();
             $shipFirstName = $shippingAddress->getFirstname();
             $shipLastName = $shippingAddress->getLastname();
             $shipAddress1 = $shippingAddress->getStreet(1);
             $shipAddress2 = $shippingAddress->getStreet(2);
             $shipCity = $shippingAddress->getCity();
             $shipCounty = $shippingAddress->getRegion();
             $shipPostCode = $shippingAddress->getPostcode();
             $shipCountry = $shippingAddress->getCountry();
             $payment = $this->getPayment();
             $paymentMethod = $payment->getMethodInstance()->getTitle();
             $paymentLastFourDigits = $payment->getCcLast4();
             $paymentCard = $payment->getCcType();
             $shippingMethod = $this->getShippingDescription();
             $orderLineItems = '';
             $htmlTemplate = Mage::getStoreConfig('transactional/order/lineItemsHtml');
             foreach ($this->getAllVisibleItems() as $item) {
                 $productModel = Mage::getModel('catalog/product')->load($item->getProductId());
                 $productType = $productModel->getTypeId();
                 $children = $item->getChildren();
                 $childrenCount = count($children);
                 if (Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE == $productType && $childrenCount > 0) {
                     $productModel = Mage::getModel('catalog/product')->load($children[0]->getProductId());
                 }
                 $product = Mage::helper('transactional/product')->getProductEntity($productModel, false, false, false);
                 $prodGiftMessage = Mage::helper('giftmessage/message')->getGiftMessage($item->getGiftMessageId())->getData('message');
                 if ($prodGiftMessage != '') {
                     $prodGiftMsgStr = 'Gift Message: ' . $prodGiftMessage;
                 } else {
                     $prodGiftMsgStr = '';
                 }
                 $tags = array('[IMAGE_URL]', '[TITLE]', '[SKU]', '[QUANTITY]', '[PRICE]', '[LINE_ITEM_TOTAL]', '[LINK_URL]', '[GIFT_MSG]');
                 $values = array($product['image'], $product['name'], $product['sku'], number_format($item->getQtyOrdered(), 0), $this->formatPriceTxt($item->getPrice()), $this->formatPriceTxt($item->getRowTotal()), $product['url_path'], $prodGiftMsgStr);
                 $tmpHtml = str_replace($tags, $values, $htmlTemplate);
                 $orderLineItems = $orderLineItems . $tmpHtml;
             }
             $giftMessage = Mage::helper('giftmessage/message')->getGiftMessage($this->getGiftMessageId())->getData('message');
             Mage::helper('transactional')->sendOrderEmail($customerEmail, $orderNumber, $orderDate, $subTotal, $shipTotal, $taxTotal, $discAmount, $grandTotal, $billFirstName, $billLastName, $billAddress1, $billAddress2, $billCity, $billCounty, $billPostCode, $billCountry, $shipFirstName, $shipLastName, $shipAddress1, $shipAddress2, $shipCity, $shipCounty, $shipPostCode, $shipCountry, $paymentMethod, $shippingMethod, $paymentLastFourDigits, $paymentCard, $orderLineItems, $giftMessage);
             return $this;
         } catch (Exception $ex) {
             return parent::sendNewOrderEmail();
         }
     }
     return parent::sendNewOrderEmail();
 }
开发者ID:RxOuchy,项目名称:LDS_Client_Solutions,代码行数:70,代码来源:Order.php

示例12: lastStep

 public function lastStep($order_key, $answer_key)
 {
     /*COMENTO LAS PARTES DONDE SE UTILIZAN LOS ESTADOS CREADOS POR EL MODULO*/
     Mage::log("init: " . __METHOD__);
     $todopago_connector = Mage::helper('modulodepago2/connector')->getConnector();
     // /a este metodo es al que me va a devolver el gateway en caso que todo salga ok
     Mage::log("Modulo de pago - TodoPago ==> secondStep - orderid: " . $order_key);
     Mage::log("Modulo de pago - TodoPago ==> secondStep - AnswerKey: " . $answer_key);
     $order = new Mage_Sales_Model_Order();
     $order->loadByIncrementId($order_key);
     //merchant
     $merchant = Mage::helper('modulodepago2/ambiente')->get_merchant();
     // Security
     $security = Mage::helper('modulodepago2/ambiente')->get_security_code();
     $requestkey = $order->getTodopagoclave();
     // ahora vuelvo a consumir web service para confirmar la transaccion
     $optionsAnswer = array('Security' => $security, 'Merchant' => $merchant, 'RequestKey' => $requestkey, 'AnswerKey' => $answer_key);
     Mage::log("Modulo de pago - TodoPago ==> secondStep (" . $order_key . ") - AnswerKey: " . json_encode($optionsAnswer));
     try {
         Mage::log("try " . __METHOD__);
         $second_step = $todopago_connector->getAuthorizeAnswer($optionsAnswer);
         Mage::log("Modulo de pago - TodoPago ==> secondStep (" . $order_key . ") - second_step: " . json_encode($second_step));
         $todopagotable = new Todopago_Modulodepago2_Model_Todopagotable();
         $todopagotable->load($order_key, "order_id");
         $todopagotable->setAnswerKey($answer_key);
         $todopagotable->setGetauthorizeanswerStatus(Mage::getModel('core/date')->date('Y-m-d H:i:s') . " - " . $second_step["StatusCode"] . " - " . $second_step['StatusMessage']);
         $todopagotable->save();
         //para saber si es un cupon
         if (strlen($second_step['Payload']['Answer']["BARCODE"]) > 0) {
             $status = Mage::getStoreConfig('payment/modulodepago2/estado_offline');
             if (empty($status)) {
                 $status = Mage::getStoreConfig('payment/todopago_avanzada/estado_offline');
             }
             $state = $this->_get_new_order_state($status);
             if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
                 $message = "Todo Pago (TEST): " . $second_step['StatusMessage'];
             } else {
                 $message = "Todo Pago: " . $second_step['StatusMessage'];
             }
             $order->setState($state, $status, $message);
             try {
                 $order->sendNewOrderEmail();
             } catch (Exception $e) {
                 Mage::log("catch : " . __METHOD__);
                 Mage::log("message: " . var_export($e, true));
                 $order->sendOrderUpdateEmail(true, $message);
             }
             $order->save();
             Mage_Core_Controller_Varien_Action::_redirect('modulodepago2/cupon/index', array('_secure' => true, 'nroop' => $order_key, 'venc' => $second_step['Payload']['Answer']["COUPONEXPDATE"], 'total' => $second_step['Payload']['Request']['AMOUNT'], 'code' => $second_step['Payload']['Answer']["BARCODE"], 'tipocode' => $second_step['Payload']['Answer']["BARCODETYPE"], 'empresa' => $second_step['Payload']['Answer']["PAYMENTMETHODNAME"]));
         } elseif ($second_step['StatusCode'] == -1) {
             $status = Mage::getStoreConfig('payment/modulodepago2/order_aprov');
             if (empty($status)) {
                 $status = Mage::getStoreConfig('payment/todopago_avanzada/order_aprov');
             }
             $state = $this->_get_new_order_state($status);
             if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
                 $message = "Todo Pago (TEST): " . $second_step['StatusMessage'];
             } else {
                 $message = "Todo Pago: " . $second_step['StatusMessage'];
             }
             $order->setState($state, $status, $message);
             try {
                 $order->sendNewOrderEmail();
             } catch (Exception $e) {
                 Mage::log("catch : " . __METHOD__);
                 Mage::log("message: " . var_export($e, true));
                 $order->sendOrderUpdateEmail(true, $message);
             }
             $payment = $order->getPayment();
             $payment->setTransactionId($second_step['AuthorizationKey']);
             $payment->setParentTransactionId($payment->getTransactionId());
             $payment->save();
             $order->save();
             $invoice = $order->prepareInvoice()->setTransactionId(1)->addComment("Invoice created.")->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE)->register()->pay();
             Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
         } elseif ($second_step['StatusCode'] != -1) {
             $status = Mage::getStoreConfig('payment/modulodepago2/estado_denegada');
             if (empty($status)) {
                 $status = Mage::getStoreConfig('payment/todopago_avanzada/estado_denegada');
             }
             $state = $this->_get_new_order_state($status);
             if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
                 $message = "Todo Pago (TEST): " . $second_step['StatusMessage'];
             } else {
                 $message = "Todo Pago: " . $second_step['StatusMessage'];
             }
             $order->cancel();
             Mage::log("Orden cancelada");
             $order->setState($state, $status, $message);
             $order->sendOrderUpdateEmail(true, $message);
             $order->save();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
         }
     } catch (Exception $e) {
         Mage::log("catch : " . __METHOD__);
         $status = Mage::getStoreConfig('payment/modulodepago2/estado_denegada');
         if (empty($status)) {
             $status = Mage::getStoreConfig('payment/todopago_avanzada/estado_denegada');
         }
//.........这里部分代码省略.........
开发者ID:TodoPago,项目名称:Plugin-Magento,代码行数:101,代码来源:PaymentController.php

示例13: sendEmail

 /**
  * Send a e-mail with shopping order.
  */
 private function sendEmail()
 {
     $order = new Mage_Sales_Model_Order();
     $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order->loadByIncrementId($incrementId);
     try {
         $order->sendNewOrderEmail();
     } catch (Exception $ex) {
         die($ex);
     }
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:14,代码来源:PaymentController.php

示例14: _transactionUnconfirmed

 /**
  * unconfirmed transaction
  * 
  * @param SofortLib_TransactionData $transData
  * @param Mage_Sales_Model_Order $order
  * @param boolean $forceUpdate = false to gerate update
  * @return void
  */
 private function _transactionUnconfirmed($transData, $order, $forceUpdate = false)
 {
     $payment = $order->getPayment();
     $transaction = $transData->getTransaction();
     $statusReason = $transData->getStatusReason();
     // rechnung
     if ($transData->isSofortrechnung() && ($statusReason == 'confirm_invoice' || $forceUpdate)) {
         $order->setState('sofort');
         //customer may have changed the address during payment process
         $address = $transData->getInvoiceAddress();
         $order->getBillingAddress()->setStreet($address['street'] . ' ' . $address['street_number'])->setFirstname($address['firstname'])->setLastname($address['lastname'])->setCompany($address['company'])->setPostcode($address['zipcode'])->setCity($address['city'])->setCountryId($address['country_code']);
         $address = $transData->getShippingAddress();
         $order->getShippingAddress()->setStreet($address['street'] . ' ' . $address['street_number'])->setFirstname($address['firstname'])->setLastname($address['lastname'])->setCompany($address['company'])->setPostcode($address['zipcode'])->setCity($address['city'])->setCountryId($address['country_code']);
         $order->save();
         $waitingStatus = Mage::getStoreConfig('payment/sofort/sofortrechnung_order_status_waiting');
         if ($waitingStatus == 'unchanged') {
             $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Payment successfull. Invoice needs to be confirmed.', $transaction))->setIsCustomerNotified(true);
         } else {
             $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('Payment successfull. Invoice needs to be confirmed.', $transaction), $waitingStatus)->setIsCustomerNotified(true);
         }
         $order->setIsVisibleOnFront(true);
         if (!$order->getEmailSent()) {
             $order->setEmailSent(true);
             $order->save();
             $order->sendNewOrderEmail();
         }
     } else {
         // mark for notify
         $order->setState('sofort');
     }
     $order->save();
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:40,代码来源:SofortController.php

示例15: sendNewOrderEmail

 public function sendNewOrderEmail()
 {
     if ($_REQUEST['payment']['method'] == 'offpaypal') {
         $this->setData('offpaytype', $_REQUEST['payment']['offtype']);
         $storeId = $this->getStore()->getId();
         $data = $this->getData();
         if (!Mage::helper('sales')->canSendNewOrderEmail($storeId)) {
             return $this;
         }
         // Get the destination email addresses to send copies to
         $copyTo = $this->_getEmails(self::XML_PATH_EMAIL_COPY_TO);
         $copyMethod = Mage::getStoreConfig(self::XML_PATH_EMAIL_COPY_METHOD, $storeId);
         // Start store emulation process
         $appEmulation = Mage::getSingleton('core/app_emulation');
         $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
         try {
             // Retrieve specified view block from appropriate design package (depends on emulated store)
             $paymentBlock = Mage::helper('payment')->getInfoBlock($this->getPayment())->setIsSecureMode(true);
             $paymentBlock->getMethod()->setStore($storeId);
             $paymentBlockHtml = $paymentBlock->toHtml();
         } catch (Exception $exception) {
             // Stop store emulation process
             $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
             throw $exception;
         }
         // Stop store emulation process
         $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
         $customerName = $this->getCustomerName();
         $mailer = Mage::getModel('core/email_template_mailer');
         $emailInfo = Mage::getModel('core/email_info');
         $emailInfo->addTo($this->getCustomerEmail(), $customerName);
         if ($copyTo && $copyMethod == 'bcc') {
             // Add bcc to customer email
             foreach ($copyTo as $email) {
                 $emailInfo->addBcc($email);
             }
         }
         $mailer->addEmailInfo($emailInfo);
         // Email copies are sent as separated emails if their copy method is 'copy'
         if ($copyTo && $copyMethod == 'copy') {
             foreach ($copyTo as $email) {
                 $emailInfo = Mage::getModel('core/email_info');
                 $emailInfo->addTo($email);
                 $mailer->addEmailInfo($emailInfo);
             }
         }
         $templateId = 22;
         // Set all required params and send emails
         $mailer->setSender(Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId));
         $mailer->setStoreId($storeId);
         $mailer->setTemplateId($templateId);
         $mailer->setTemplateParams(array('order' => $this, 'billing' => $this->getBillingAddress(), 'payment_html' => $paymentBlockHtml, 'paypalurl' => Mage::getUrl('offlinepay/redirect/index', array('orderid' => $data['increment_id']))));
         $mailer->send();
         $this->setEmailSent(true);
         $this->_getResource()->saveAttribute($this, 'email_sent');
         return $this;
     } else {
         if ($_REQUEST['payment']['method'] == 'offsagepay') {
             //Do nothing
         } else {
             return parent::sendNewOrderEmail();
         }
     }
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:64,代码来源:Order.php


注:本文中的Mage_Sales_Model_Order::sendNewOrderEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。