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


PHP Mage_Sales_Model_Order_Payment::setCcType方法代码示例

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


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

示例1: processResponse

 /**
  * 
  * @param Allopass_Hipay_Model_Api_Response_Gateway $gatewayResponse
  * @param Mage_Sales_Model_Order_Payment $payment
  * @param float $amount
  */
 public function processResponse($gatewayResponse, $payment, $amount)
 {
     $order = $payment->getOrder();
     $customer = Mage::getModel('customer/customer')->load($order->getCustomerId());
     //$defaultExceptionMessage = Mage::helper('hipay')->__('Error in process response!');
     switch ($this->getConfigPaymentAction()) {
         case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE:
             $requestType = self::OPERATION_AUTHORIZATION;
             $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH;
             $defaultExceptionMessage = Mage::helper('hipay')->__('Payment authorization error.');
             break;
         case Mage_Payment_Model_Method_Abstract::ACTION_AUTHORIZE_CAPTURE:
             $requestType = self::OPERATION_SALE;
             $newTransactionType = Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE;
             $defaultExceptionMessage = Mage::helper('hipay')->__('Payment capturing error.');
             break;
     }
     //add data to payment object
     if ($payment->getCcType() == "") {
         $payment->setCcType($gatewayResponse->getPaymentProduct());
     }
     switch ($gatewayResponse->getState()) {
         case self::STATE_COMPLETED:
         case self::STATE_PENDING:
             switch ((int) $gatewayResponse->getStatus()) {
                 case 111:
                     //denied
                     $this->addTransaction($payment, $gatewayResponse->getTransactionReference(), $newTransactionType, array('is_transaction_closed' => 0), array(), Mage::helper('hipay')->getTransactionMessage($payment, $requestType, null, $amount));
                     if ($order->getState() == Mage_Sales_Model_Order::STATE_HOLDED) {
                         $order->unhold();
                     }
                     if (!($status = $this->getConfigData('order_status_payment_refused'))) {
                         $status = $order->getStatus();
                     }
                     if ($status == Mage_Sales_Model_Order::STATE_HOLDED && $order->canHold()) {
                         $order->hold();
                     } elseif ($status == Mage_Sales_Model_Order::STATE_CANCELED && $order->canCancel()) {
                         $order->cancel();
                     }
                     $order->addStatusToHistory($status, Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, null, $amount, true, $gatewayResponse->getMessage()));
                     $order->save();
                     break;
                 case 112:
                     //Authorized and pending
                     $this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
                     $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
                     $status = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
                     if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
                         $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
                         $status = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
                     }
                     $this->_setFraudDetected($gatewayResponse, $customer, $payment, $amount);
                     $order->setState($state, $status, $gatewayResponse->getMessage());
                     $payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
                     $payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
                     $order->save();
                     break;
                 case 142:
                     //Authorized Requested
                     if ($order->getStatus() == self::STATUS_CAPTURE_REQUESTED || $order->getStatus() == Mage_Sales_Model_Order::STATE_PROCESSING || $order->getStatus() == Mage_Sales_Model_Order::STATE_COMPLETE || $order->getStatus() == Mage_Sales_Model_Order::STATE_CLOSED || $order->getStatus() == self::STATUS_PENDING_CAPTURE) {
                         // for logic process
                         break;
                     }
                     $this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_AUTH, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
                     $state = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
                     if (defined('Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW')) {
                         $state = Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW;
                     }
                     $status = self::STATUS_AUTHORIZATION_REQUESTED;
                     $order->setState($state, $status, $gatewayResponse->getMessage());
                     $payment->setAmountAuthorized($gatewayResponse->getAuthorizedAmount());
                     $payment->setBaseAmountAuthorized($gatewayResponse->getAuthorizedAmount());
                     $order->save();
                     break;
                 case 114:
                     //Expired
                     if ($order->getStatus() != self::STATUS_PENDING_CAPTURE) {
                         // for logic process
                         break;
                     }
                     $this->addTransaction($payment, $gatewayResponse->getTransactionReference(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, array('is_transaction_closed' => 0), array($this->_realTransactionIdKey => $gatewayResponse->getTransactionReference()), Mage::helper('hipay')->getTransactionMessage($payment, self::OPERATION_AUTHORIZATION, $gatewayResponse->getTransactionReference(), $amount, true));
                     /**
                      * We change status to expired and state to holded
                      * So the administrator can try to capture transaction even if
                      * the auhorization was expired
                      * 
                      */
                     $state = Mage_Sales_Model_Order::STATE_HOLDED;
                     $status = self::STATUS_EXPIRED;
                     $order->setState($state, $status, $gatewayResponse->getMessage());
                     $order->save();
                     break;
                 case 115:
                     //Canceled
//.........这里部分代码省略.........
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:101,代码来源:Abstract.php


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