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


PHP Mage_Sales_Model_Abstract::setTransactionId方法代码示例

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


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

示例1: _addTransaction

 /**
  * Create transaction,
  * prepare its insertion into hierarchy and add its information to payment and comments
  *
  * To add transactions and related information,
  * the following information should be set to payment before processing:
  * - transaction_id
  * - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
  * - parent_transaction_id (optional)
  * - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
  *
  * If the sales document is specified, it will be linked to the transaction as related for future usage.
  * Currently transaction ID is set into the sales object
  * This method writes the added transaction ID into last_trans_id field of the payment object
  *
  * To make sure transaction object won't cause trouble before saving, use $failsafe = true
  *
  * @param string $type
  * @param Mage_Sales_Model_Abstract $salesDocument
  * @param bool $failsafe
  * @return null|Mage_Sales_Model_Order_Payment_Transaction
  */
 protected function _addTransaction($type, $salesDocument = null, $failsafe = false)
 {
     if ($this->getSkipTransactionCreation()) {
         $this->unsTransactionId();
         return null;
     }
     // look for set transaction ids
     $transactionId = $this->getTransactionId();
     if (null !== $transactionId) {
         // set transaction parameters
         $transaction = false;
         if ($this->getOrder()->getId()) {
             $transaction = $this->_lookupTransaction($transactionId);
         }
         if (!$transaction) {
             $transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
         }
         $transaction->setOrderPaymentObject($this)->setTxnType($type)->isFailsafe($failsafe);
         if ($this->hasIsTransactionClosed()) {
             $transaction->setIsClosed((int) $this->getIsTransactionClosed());
         }
         //set transaction addition information
         if ($this->_transactionAdditionalInfo) {
             foreach ($this->_transactionAdditionalInfo as $key => $value) {
                 $transaction->setAdditionalInformation($key, $value);
             }
         }
         // link with sales entities
         $this->setLastTransId($transactionId);
         $this->setCreatedTransaction($transaction);
         $this->getOrder()->addRelatedObject($transaction);
         if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
             $salesDocument->setTransactionId($transactionId);
             // TODO: linking transaction with the sales document
         }
         // link with parent transaction
         $parentTransactionId = $this->getParentTransactionId();
         if ($parentTransactionId) {
             $transaction->setParentTxnId($parentTransactionId);
             if ($this->getShouldCloseParentTransaction()) {
                 $parentTransaction = $this->_lookupTransaction($parentTransactionId);
                 if ($parentTransaction) {
                     if (!$parentTransaction->getIsClosed()) {
                         $parentTransaction->isFailsafe($failsafe)->close(false);
                     }
                     $this->getOrder()->addRelatedObject($parentTransaction);
                 }
             }
         }
         return $transaction;
     }
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:74,代码来源:Lpayment.php

示例2: _addTransaction

 /**
  * Create transaction, prepare its insertion into hierarchy and add its information to payment and comments
  *
  * To add transactions and related information, the following information should be set to payment before processing:
  * - transaction_id
  * - is_transaction_closed (optional) - whether transaction should be closed or open (closed by default)
  * - parent_transaction_id (optional)
  * - should_close_parent_transaction (optional) - whether to close parent transaction (closed by default)
  *
  * If the sales document is specified, it will be linked to the transaction as related for future usage.
  * Currently transaction ID is set into the sales object
  * This method writes the added transaction ID into last_trans_id field of the payment object
  *
  * To make sure transaction object won't cause trouble before saving, use $failsafe = true
  *
  * @param Mage_Sales_Model_Order_Payment
  * @param string $type
  * @param Mage_Sales_Model_Abstract $salesDocument
  * @param bool $failsafe
  * @return null|Mage_Sales_Model_Order_Payment_Transaction
  */
 protected function _addTransaction($payment, $type, $salesDocument = null, $failsafe = false)
 {
     // look for set transaction ids
     $transactionId = $payment->getTransactionId();
     if (null !== $transactionId) {
         // set transaction parameters
         /*$transaction = Mage::getModel('sales/order_payment_transaction')
         		->setOrderPaymentObject($payment)
         		->setTxnType($type)
         		->setTxnId($transactionId)
         		->isFailsafe($failsafe)
         		;*/
         // set transaction parameters
         //$transaction = false;
         $transaction = $this->_lookupTransaction($payment, $transactionId);
         if (!$transaction) {
             $transaction = Mage::getModel('sales/order_payment_transaction')->setTxnId($transactionId);
         }
         $transaction->setOrderPaymentObject($payment)->setTxnType($type)->isFailsafe($failsafe);
         if ($payment->hasIsTransactionClosed()) {
             $transaction->setIsClosed((int) $payment->getIsTransactionClosed());
         }
         // link with sales entities
         $payment->setLastTransId($transactionId);
         $payment->setCreatedTransaction($transaction);
         $payment->getOrder()->addRelatedObject($transaction);
         if ($salesDocument && $salesDocument instanceof Mage_Sales_Model_Abstract) {
             $salesDocument->setTransactionId($transactionId);
             // TODO: linking transaction with the sales document
         }
         // link with parent transaction Not used because transaction Id is the same
         $parentTransactionId = $payment->getParentTransactionId();
         if ($parentTransactionId) {
             $transaction->setParentTxnId($parentTransactionId);
             if ($payment->getShouldCloseParentTransaction()) {
                 $parentTransaction = $this->_lookupTransaction($payment, $parentTransactionId);
                 //
                 if ($parentTransaction) {
                     $parentTransaction->isFailsafe($failsafe)->close(false);
                     $payment->getOrder()->addRelatedObject($parentTransaction);
                 }
             }
         }
         return $transaction;
     }
 }
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:67,代码来源:Abstract.php


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