本文整理汇总了PHP中Mage_Sales_Model_Order::addStatusToHistory方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::addStatusToHistory方法的具体用法?PHP Mage_Sales_Model_Order::addStatusToHistory怎么用?PHP Mage_Sales_Model_Order::addStatusToHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::addStatusToHistory方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrder
/**
* Processes payment for specified order
* @param Mage_Sales_Model_Order $Order
* @return
*/
public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
{
// Set order as pending
$Order->addStatusToHistory('pending', '', false)->save();
// Throw exception to suspend subscription
throw new AW_Sarp_Exception("Suspending subscription till order status change to completed");
}
示例2: cancelaPedido
public function cancelaPedido(Mage_Sales_Model_Order $order)
{
$paymentMethod = $order->getPayment()->getMethodInstance()->getCode();
$listPaymentMethodsIdeasa = Mage::helper('base')->listPaymentMethods();
$this->logger->info('Processando cancelamento do pedido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
try {
if ($order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
$order->cancel();
//força o cancelamento
if ($order->getStatus() != Mage_Sales_Model_Order::STATE_CANCELED) {
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('Pedido cancelado'), $notified = false);
} else {
$order->addStatusToHistory($order->getStatus(), Mage::helper('base')->__('Pedido cancelado.'));
}
if ($order->hasInvoices() != '') {
$order->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('base')->__('O pagamento e o pedido foram cancelados, mas não foi possível retornar os produtos ao estoque pois já havia uma fatura gerada para este pedido.'), $notified = false);
}
$order->save();
}
if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethod) && Mage::helper('base/module')->isPagSeguroDiretoExists() && $paymentMethod == $listPaymentMethodsIdeasa[0]) {
Mage::getModel('pagsegurodireto/notification')->sendEmail($order);
}
} catch (Exception $e) {
$this->logger->error("Erro ao cancelar pedido {$orderId} \n {$e->__toString}()");
}
$this->logger->info('Cancelamento do pedido foi concluido ' . $order->getRealOrderId() . ', do modulo: ' . $paymentMethod);
return;
}
示例3: responseAction
public function responseAction()
{
require_once 'Zend/Crypt/Hmac.php';
$txnid = "";
$txnrefno = "";
$txnstatus = "";
$txnmsg = "";
$firstName = "";
$lastName = "";
$email = "";
$street1 = "";
$city = "";
$state = "";
$country = "";
$pincode = "";
$mobileNo = "";
$signature = "";
$reqsignature = "";
$data = "";
$txnGateway = "";
$paymentMode = "";
$maskedCardNumber = "";
$cardType = "";
$flag = "dataTampered";
$order = $this->getOrder();
$orderAmount = round($order->getData('grand_total'), 2);
$config = Mage::getSingleton('citrus/config');
$secretKey = $config->getSecretKey();
$session = Mage::getSingleton('checkout/session');
if ($_POST) {
if (isset($_POST['TxId'])) {
$txnid = $_POST['TxId'];
$data .= $txnid;
}
if (isset($_POST['TxStatus'])) {
$txnstatus = $_POST['TxStatus'];
$data .= $txnstatus;
}
if (isset($_POST['amount'])) {
$amount = $_POST['amount'];
$data .= $amount;
}
if (isset($_POST['pgTxnNo'])) {
$pgtxnno = $_POST['pgTxnNo'];
$data .= $pgtxnno;
}
if (isset($_POST['issuerRefNo'])) {
$issuerrefno = $_POST['issuerRefNo'];
$data .= $issuerrefno;
}
if (isset($_POST['authIdCode'])) {
$authidcode = $_POST['authIdCode'];
$data .= $authidcode;
}
if (isset($_POST['firstName'])) {
$firstName = $_POST['firstName'];
$data .= $firstName;
}
if (isset($_POST['lastName'])) {
$lastName = $_POST['lastName'];
$data .= $lastName;
}
if (isset($_POST['pgRespCode'])) {
$pgrespcode = $_POST['pgRespCode'];
$data .= $pgrespcode;
}
if (isset($_POST['addressZip'])) {
$pincode = $_POST['addressZip'];
$data .= $pincode;
}
if (isset($_POST['signature'])) {
$signature = $_POST['signature'];
}
/*signature data end*/
$respSignature = $this->generateHmacKey($data, $secretKey);
if ($signature != "" && strcmp($signature, $respSignature) != 0 || $orderAmount != $amount) {
$flag = "dataTampered";
} else {
$flag = "dataValid";
}
if (strtoupper($txnstatus) != "SUCCESS") {
$flag = "dataTampered";
} else {
$flag = "dataValid";
}
}
$debug = Mage::getModel('citrus/api_debug')->load($TxnID, "transact_id");
$debug->setResponseBody($data);
$debug->save();
if ($flag == "dataValid") {
$_order = new Mage_Sales_Model_Order();
$orderId = $session->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
$_order->sendNewOrderEmail();
try {
$payment = $_order->getPayment();
$payment->setTransactionId($TxnID)->capture(null);
$_order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
$_order->setStatus('created');
$_order->addStatusToHistory($_order->getStatus(), Mage::helper('citrus')->__('Customer successfully returned from citrus'));
//.........这里部分代码省略.........
示例4: processOrder
/**
* Processes payment for specified order
* @param Mage_Sales_Model_Order $Order
* @return
*/
public function processOrder(Mage_Sales_Model_Order $PrimaryOrder, Mage_Sales_Model_Order $Order = null)
{
// Set order as complete
$Order->addStatusToHistory('complete', '', false)->save();
// Throw exception to suspend subscription
}
示例5: SFAResponseAction
public function SFAResponseAction()
{
include "Sfa/EncryptionUtil.php";
$config = Mage::getSingleton('payseal/config');
$merchantId = trim($config->getMerchantId());
$keyPath = str_replace("/", "//", $config->getKeyPath()) . $merchantId . ".key";
$strMerchantId = $merchantId;
$astrFileName = $keyPath;
$astrClearData;
$ResponseCode = "";
$Message = "";
$TxnID = "";
$ePGTxnID = "";
$AuthIdCode = "";
$RRN = "";
$CVRespCode = "";
$session = Mage::getSingleton('checkout/session');
$session->setData("redirected", "false");
if ($_POST) {
if ($_POST['DATA'] == null) {
print "null is the value";
}
$astrResponseData = $_POST['DATA'];
$astrDigest = $_POST['EncryptedData'];
$oEncryptionUtilenc = new EncryptionUtil();
$astrsfaDigest = $oEncryptionUtilenc->getHMAC($astrResponseData, $astrFileName, $strMerchantId);
if (strcasecmp($astrDigest, $astrsfaDigest) == 0) {
parse_str($astrResponseData, $output);
if (array_key_exists('RespCode', $output) == 1) {
$ResponseCode = $output['RespCode'];
}
if (array_key_exists('Message', $output) == 1) {
$Message = $output['Message'];
}
if (array_key_exists('TxnID', $output) == 1) {
$TxnID = $output['TxnID'];
}
if (array_key_exists('ePGTxnID', $output) == 1) {
$ePGTxnID = $output['ePGTxnID'];
}
if (array_key_exists('AuthIdCode', $output) == 1) {
$AuthIdCode = $output['AuthIdCode'];
}
if (array_key_exists('RRN', $output) == 1) {
$RRN = $output['RRN'];
}
if (array_key_exists('CVRespCode', $output) == 1) {
$CVRespCode = $output['CVRespCode'];
}
}
}
$debug = Mage::getModel('payseal/api_debug')->load($TxnID, "transact_id");
$debug->setResponseBody(print_r($output, 1));
$debug->save();
if ($output['RespCode'] == 2 && $Message == "No Suitable Acquirer Found" || $output['RespCode'] == 0) {
$_order = new Mage_Sales_Model_Order();
$orderId = $session->getLastRealOrderId();
$_order->loadByIncrementId($orderId);
$_order->sendNewOrderEmail();
try {
$payment = $_order->getPayment();
$payment->setTransactionId($TxnID)->capture(null);
$_order->setStatus('created');
$_order->addStatusToHistory($_order->getStatus(), Mage::helper('payseal')->__('Customer successfully returned from payseal'));
$_order->save();
} catch (Exception $e) {
Mage::logException($e);
//if we couldn't capture order, just leave it as NEW order.
}
$session->getQuote()->setIsActive(false)->save();
$this->_redirect('checkout/onepage/success', array('_secure' => true));
} else {
$this->_redirect('checkout/onepage/failure', array('_secure' => true));
}
}
示例6: _processCancel
/**
* Processed order cancelation
* @param string $msg Order history message
*/
protected function _processCancel($msg)
{
$this->_order->cancel();
$this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, $msg);
$this->_order->save();
}
示例7: cancel
/**
* Cancel order
*
* @param Mage_Sales_Model_Order $order
* @return string Amazon Transaction Id
* Modified to use MWS instead of SOAP
*/
public function cancel($order)
{
$_document = '<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>' . $this->getMerchantIdentifier() . '</MerchantIdentifier>
</Header>
<MessageType>OrderAcknowledgement</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>
<OrderAcknowledgement>
<AmazonOrderID>' . $order->getExtOrderId() . '</AmazonOrderID>
<MerchantOrderID>' . $order->getRealOrderId() . '</MerchantOrderID>
<StatusCode>Failure</StatusCode>
</OrderAcknowledgement>
</Message>
</AmazonEnvelope>';
$this->_processMWSRequest($_document, "_POST_ORDER_ACKNOWLEDGEMENT_DATA_");
Mage::log("Order cancel request sent with reference ID " . $this->_result . " !");
//Adding reference id to order comments for polling later
$comment = $order->addStatusToHistory(Mage_Sales_Model_Order::STATE_PROCESSING, Mage::helper('amazonpayments')->__('Cancelled Reference ID:' . $this->_result . ' and Amazon order ID:' . $order->getExtOrderId()))->save();
return $this->_result;
}