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


PHP Mage_Payment_Model_Info::setSkipTransactionCreation方法代码示例

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


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

示例1: _void

 /**
  * Send void request to MerchantWare gateway
  *
  * @param Mage_Payment_Model_Info $payment
  * @return $result
  * @throws Mage_Core_Exception
  */
 private function _void($payment)
 {
     $error = false;
     $soapClient = $this->getSoapApi();
     $this->iniRequest();
     //Add token
     if ($payment->getParentTransactionId() !== FALSE) {
         $this->_request->token = $payment->getParentTransactionId();
     } else {
         //Cannot void
         $error = Mage::helper('merchantware_directpost')->__('No previous transactions could be found.  Cannot void this transaction.');
         Mage::throwException($error);
     }
     //Add order info
     $order = $payment->getOrder();
     $this->_request->merchantTransactionId = $order->getIncrementId();
     $additionalInfo = array();
     try {
         $result = $soapClient->Void($this->_request);
         $result = $result->VoidResult;
         if (!empty($result->ErrorMessage)) {
             $additionalInfo['ErrorMessage'] = $result->ErrorMessage;
         }
         //Authorization is approved.
         $additionalInfo['ApprovalStatus'] = $result->ApprovalStatus;
         $additionalInfo['Amount'] = $result->Amount;
         $additionalInfo['AuthorizationCode'] = $result->AuthorizationCode;
         if (!empty($result->Cardholder)) {
             $additionalInfo['Cardholder'] = $result->Cardholder;
         }
         if (!empty($result->AvsResponse)) {
             $additionalInfo['AvsResponse'] = $result->AvsResponse;
         }
         if (!empty($result->CvResponse)) {
             $additionalInfo['CvResponse'] = $result->AvsResponse;
         }
         $additionalInfo['CardType'] = $result->CardType;
         if (!empty($result->InvoiceNumber)) {
             $additionalInfo['InvoiceNumber'] = $result->InvoiceNumber;
         }
         $additionalInfo['Token'] = $result->Token;
         $additionalInfo['TransactionDate'] = $result->TransactionDate;
         $additionalInfo['TransactionType'] = $result->TransactionType;
         if (!empty($result->ExtraData)) {
             $additionalInfo['ExtraData'] = $result->ExtraData;
         }
         switch ($this->_parseApprovalStatus($result->ApprovalStatus)) {
             case self::APPROVAL_STATUS_APPROVED:
                 //Void Approved.
                 $message = 'Type: Void | ApprovalStatus: ' . $result->ApprovalStatus . ' |  Amount: ' . $result->Amount;
                 $payment->setSkipTransactionCreation(false);
                 $payment->setTransactionId($result->Token)->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, null, false, $message)->setTransactionAdditionalInfo(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $additionalInfo)->setIsTransactionClosed(1)->save();
                 break;
             case self::APPROVAL_STATUS_DECLINED:
             case self::APPROVAL_STATUS_DECLINED_DUPLICATE:
             case self::APPROVAL_STATUS_FAILED:
                 $error = Mage::helper('merchantware_directpost')->__('Void request failed.  Gateway error response: %s', $result->ApprovalStatus, $result->ErrorMessage);
                 Mage::throwException($error);
                 break;
             case self::APPROVAL_STATUS_REFERRAL:
             default:
                 $error = Mage::helper('merchantware_directpost')->__('Unable to void this transaction. Gateway approval status: %s | Gateway error response: %s', $result->ApprovalStatus, $result->ErrorMessage);
                 Mage::throwException($error);
                 break;
         }
         return $result;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('merchantware_directpost')->__('Gateway request error: %s', $e->getMessage()));
     }
     if ($error !== false) {
         Mage::throwException($error);
     }
     return false;
 }
开发者ID:xiaoguizhidao,项目名称:tyler-live,代码行数:81,代码来源:Directpost.php


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