本文整理汇总了PHP中Mage_Sales_Model_Order::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::setStatus方法的具体用法?PHP Mage_Sales_Model_Order::setStatus怎么用?PHP Mage_Sales_Model_Order::setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::setStatus方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _send
/**
* Send the order create request to the api.
*
* @return self
*/
protected function _send()
{
Mage::dispatchEvent($this->_beforeOrderSendEvent, ['order' => $this->_order, 'payload' => $this->_payload]);
try {
$reply = $this->_api->setRequestBody($this->_payload)->send()->getResponseBody();
} catch (NetworkException $e) {
$this->_logger->warning('Caught a network error sending order create. Will retry later.', $this->_logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (UnsupportedOperation $e) {
$this->_logger->critical('[%s] Order create request saved, but not sent. See exception log.', $this->_logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (UnsupportedHttpAction $e) {
$this->_logger->critical('[%s] Order create request saved, but not sent. See exception log.', $this->_logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (Exception $e) {
throw $this->_logUnhandledException($e);
}
if ($reply->isSuccessful()) {
$this->_order->setStatus(self::STATUS_SENT);
Mage::dispatchEvent($this->_successfulOrderCreateEvent, ['order' => $this->_order]);
} else {
throw $this->_logUnhandledException();
}
return $this;
}
示例2: _send
/**
* Send the order create request to the api.
*
* @return self
*/
protected function _send()
{
Mage::dispatchEvent($this->_beforeOrderSendEvent, ['order' => $this->_order, 'payload' => $this->_payload]);
$logger = $this->_logger;
$logContext = $this->_logContext;
try {
$reply = $this->_api->setRequestBody($this->_payload)->send()->getResponseBody();
} catch (NetworkError $e) {
$logger->warning('Caught a network error sending order create. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (UnsupportedOperation $e) {
$logger->critical('The order create operation is unsupported in the current configuration. Order saved, but not sent. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (UnsupportedHttpAction $e) {
$logger->critical('The order create operation is configured with an unsupported HTTP action. Order saved, but not sent. See exception log for more details.', $logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
$logger->logException($e, $logContext->getMetaData(__CLASS__, [], $e));
return $this;
} catch (Exception $e) {
throw $this->_logUnhandledException($e);
}
if ($reply->isSuccessful()) {
$this->_order->setStatus(self::STATUS_SENT);
Mage::dispatchEvent($this->_successfulOrderCreateEvent, ['order' => $this->_order]);
} else {
throw $this->_logUnhandledException();
}
return $this;
}
示例3: updateByTransactionStatus
/**
* @param Mage_Sales_Model_Order $order
* @param Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus
* @return void
*/
public function updateByTransactionStatus(Mage_Sales_Model_Order $order, Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus)
{
// Update Status of Transaction
$order->setPayoneTransactionStatus($transactionStatus->getTxaction());
// Update dunning status
if ($transactionStatus->getReminderlevel()) {
$order->setPayoneDunningStatus($transactionStatus->getReminderlevel());
}
// Status mapping of Order by Transaction Status
$statusMapping = $this->getConfigStore()->getGeneral()->getStatusMapping();
$txAction = $transactionStatus->getTxaction();
/**
* @var $paymentMethod Payone_Core_Model_Payment_Method_Abstract
*/
$paymentMethod = $order->getPayment()->getMethodInstance();
$type = $paymentMethod->getMethodType();
// Mapping
$mapping = $statusMapping->getByType($type);
if (!is_array($mapping) or !array_key_exists($txAction, $mapping)) {
return;
}
// Check for valid Mapping
$mappingOrderState = $mapping[$txAction];
if (!is_array($mappingOrderState) or !array_key_exists('status', $mappingOrderState) or !array_key_exists('state', $mappingOrderState)) {
return;
}
// Get State / Status and set to Order
$newOrderState = $mappingOrderState['state'];
$newOrderStatus = $mappingOrderState['status'];
if ($newOrderState != '') {
$order->setState($newOrderState, $newOrderStatus);
} else {
$order->setStatus($newOrderStatus);
}
}
示例4: _registerPaymentReversal
/**
* Process payment reversal and cancelled reversal notification
*/
protected function _registerPaymentReversal()
{
$reasonCode = isset($this->_request['reason_code']) ? $this->_request['reason_code'] : null;
$reasonComment = $this->_info->explainReasonCode($reasonCode);
$notificationAmount = $this->_order->getBaseCurrency()->formatTxt($this->_request['mc_gross'] + $this->_request['mc_fee']);
$paymentStatus = $this->_filterPaymentStatus(isset($this->_request['payment_status']) ? $this->_request['payment_status'] : null);
$orderStatus = $paymentStatus == Mage_Paypal_Model_Info::PAYMENTSTATUS_REVERSED ? Mage_Paypal_Model_Info::ORDER_STATUS_REVERSED : Mage_Paypal_Model_Info::ORDER_STATUS_CANCELED_REVERSAL;
/**
* Change order status to PayPal Reversed/PayPal Cancelled Reversal if it is possible.
*/
$transactionId = Mage::helper('paypal')->getHtmlTransactionId($this->_config->getMethodCode(), $this->_request['txn_id']);
$message = Mage::helper('paypal')->__('IPN "%s". %s Transaction amount %s. Transaction ID: "%s"', $this->_request['payment_status'], $reasonComment, $notificationAmount, $transactionId);
$this->_order->setStatus($orderStatus);
$this->_order->save();
$this->_order->addStatusHistoryComment($message, $orderStatus)->setIsCustomerNotified(false)->save();
}
示例5: _processPendingPayment
/**
* processes an order awaiting payment. Sets its new state and status.
*
* @param $newStates
* @param bool $description
* @return bool
*/
protected function _processPendingPayment($newStates, $description = false)
{
$description = Mage::helper('buckaroo3extended')->__($description);
$description .= " (#{$this->_postArray['brq_statuscode']})";
//sets the transaction key if its defined ($trx)
//will retrieve it from the response array, if response actually is an array
if (!$this->_order->getTransactionKey() && array_key_exists('brq_transactions', $this->_postArray)) {
$this->_order->setTransactionKey($this->_postArray['brq_transactions']);
}
if ($this->_order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
$this->_order->addStatusHistoryComment($description, $newStates[1])->save();
$this->_order->setStatus($newStates[1])->save();
} else {
$this->_order->addStatusHistoryComment($description)->save();
}
return true;
}
示例6: _captureOrder
/**
* Capture order's payment using AIM.
*
* @param Mage_Sales_Model_Order $order
*/
protected function _captureOrder(Mage_Sales_Model_Order $order)
{
$payment = $order->getPayment();
if ($payment->getAdditionalInformation('payment_type') == self::ACTION_AUTHORIZE_CAPTURE) {
try {
$payment->setTransactionId(null)->setParentTransactionId($this->getResponse()->getXTransId())->capture(null);
// set status from config for AUTH_AND_CAPTURE orders.
if ($order->getState() == Mage_Sales_Model_Order::STATE_PROCESSING) {
$orderStatus = $this->getConfigData('order_status');
if (!$orderStatus || $order->getIsVirtual()) {
$orderStatus = $order->getConfig()->getStateDefaultStatus(Mage_Sales_Model_Order::STATE_PROCESSING);
}
if ($orderStatus) {
$order->setStatus($orderStatus);
}
}
$order->save();
} catch (Exception $e) {
Mage::logException($e);
//if we couldn't capture order, just leave it as NEW order.
}
}
}
示例7: 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'));
//.........这里部分代码省略.........
示例8: paymentSaleReversed
/**
* Mark transaction as reversed
*
* @param \PayPal\Api\WebhookEvent $webhookEvent
*/
protected function paymentSaleReversed(\PayPal\Api\WebhookEvent $webhookEvent)
{
$this->_order->setStatus(Mage_Paypal_Model_Info::ORDER_STATUS_REVERSED);
$this->_order->save();
$this->_order->addStatusHistoryComment($webhookEvent->getSummary(), Mage_Paypal_Model_Info::ORDER_STATUS_REVERSED)->setIsCustomerNotified(false)->save();
}
示例9: 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));
}
}
示例10: __updateStatusOrder
private function __updateStatusOrder(Mage_Sales_Model_Order $order)
{
$order->setState('Processing');
$order->setStatus(Eway_Rapid31_Model_Config::ORDER_STATUS_AUTHORISED);
$order->save();
}
示例11: urlerrorAction
public function urlerrorAction()
{
// este m�to es al que me dva a devolder el gateway en caso que algo salga mal
$order_id = $this->getRequest()->get('Order');
Mage::log("Modulo de pago - TodoPago ==> urlerror - orderid: " . $order_id);
$answer = $this->getRequest()->get('Answer');
Mage::log("Modulo de pago - TodoPago ==> urlerror - AnswerKey: " . $answer);
$order = new Mage_Sales_Model_Order();
$order->loadByIncrementId($order_id);
if (Mage::getStoreConfig('payment/modulodepago2/modo_test_prod') == "test") {
$order->setStatus('test_todopago_canceled');
$order->addStatusHistoryComment("Todo Pago (TEST): error en el pago del formulario");
} else {
$order->setStatus(Mage::getStoreConfig('payment/todopago_avanzada/estado_denegada'));
$order->addStatusHistoryComment("Todo Pago: error en el pago del formulario");
}
$order->save();
Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
}
示例12: __updateStatusOrder
private function __updateStatusOrder(Mage_Sales_Model_Order $order)
{
$state_config = Mage::getStoreConfig('payment/ewayrapid_general/verify_eway_order');
$order->setState($state_config);
$order->setStatus($state_config);
$order->save();
}
示例13: _processApproved
/**
* Handle Approved answer
*
* @throws Exception
*/
protected function _processApproved()
{
$state = $this->_paymentMethod->getConfigData('after_pay_status');
$this->_order->setStatus($state)->addStatusHistoryComment('WayForPay returned an Approved status.');
$this->_order->save();
}