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


PHP Varien_Object::getLastTransId方法代码示例

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


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

示例1: refund

 /**
  * Request an online refund
  * 
  * @param Varien_Object $payment
  * @param string $amount
  * 
  * @since 1.0.2
  * @return \Icepay_IceAdvanced_Model_Checkout_Standard
  */
 public function refund(Varien_Object $payment, $amount)
 {
     // Get Magento Order
     $order = $payment->getOrder();
     // Get StoreId
     $storeId = $order->getStoreId();
     // Check if Auto Refund is enabled
     if (!Mage::getStoreConfig(Icepay_IceCore_Model_Config::AUTOREFUND, $storeId)) {
         return $this;
     }
     // Fetch ICEPAY merchant settings
     $merchantID = Mage::getStoreConfig(Icepay_IceCore_Model_Config::MERCHANTID, $storeId);
     $secretCode = Mage::getStoreConfig(Icepay_IceCore_Model_Config::SECRETCODE, $storeId);
     // Get CurrencyCode
     $currency = $order->getOrderCurrencyCode();
     // Amount must be in cents
     $amount = (int) (string) ($amount * 100);
     // Fetch ICEPAY Payment ID
     $paymentID = $payment->getLastTransId();
     // Setup webservice
     $webservice = Mage::getModel('Icepay_IceAdvanced_Model_Webservice_Refund');
     $webservice->init($merchantID, $secretCode);
     // Request refund
     try {
         $webservice->requestRefund($paymentID, $amount, $currency);
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError("ICEPAY: Refund Failed! {$e->getMessage()}");
         Mage::helper('icecore')->log("ICEPAY: Refund Failed! {$e->getMessage()}");
     }
     return $this;
 }
开发者ID:jonathanselander,项目名称:Magento,代码行数:40,代码来源:Standard.php

示例2: wasLastTxnLessThan24HrsAgo

 public function wasLastTxnLessThan24HrsAgo(Varien_Object $payment)
 {
     $lastTxnId = $payment->getLastTransId();
     $lastTxn = $payment->getTransaction($lastTxnId);
     $timeOfLastTxn = $lastTxn->getData('created_at');
     //check if last txn was less than 24 hrs ago (86400 seconds == 24 hrs)
     return time() - strtotime($timeOfLastTxn) < 86400;
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:8,代码来源:Orderview.php

示例3: _request

    /**
     * Send request to datatrans
     *
     * @param Varien_Object $payment
     * @param float $amount
     * @param string $reqType
     * @return SimpleXMLElement
     */
    protected function _request(Varien_Object $payment, $amount, $reqType = 'COA', $transType = '05')
    {
        $amount = intval($this->_getHelper()->round($amount, 2) * 100);
        $requestBody = <<<XML
<?xml version="1.0" encoding="UTF-8" ?>
 <paymentService version="1">
   <body merchantId="{$this->getConfig()->getMerchantId()}">
     <transaction refno="{$payment->getOrder()->getIncrementId()}">
       <request>
         <amount>{$amount}</amount>
         <currency>{$payment->getOrder()->getOrderCurrencyCode()}</currency>
         <uppTransactionId>{$payment->getLastTransId()}</uppTransactionId>
         <reqtype>{$reqType}</reqtype>
         <transtype>{$transType}</transtype>
       </request>
     </transaction>
   </body>
 </paymentService>
XML;
        $this->debugData($this->_getHelper()->__('Datatrans %s request. Data:%s', $reqType, $requestBody));
        $config = array('adapter' => 'Zend_Http_Client_Adapter_Socket', 'ssltransport' => 'tls');
        $client = new Zend_Http_Client($this->getConfig()->getPaycompleteBaseURL(), $config);
        $client->setRawData($requestBody);
        $response = $client->request();
        $this->debugData($this->_getHelper()->__('Datatrans %s request. Data:%s', $reqType, $response->getBody()));
        $responseXml = new SimpleXMLElement($response->getBody());
        $status = (string) current($responseXml->xpath('/paymentService/body/transaction/@status'));
        if ($status == 'error' || $responseXml->xpath('//error')) {
            $errorCode = (string) current($responseXml->xpath('//error/errorCode'));
            $errorMessage = (string) current($responseXml->xpath('//error/errorMessage'));
            $errorDetail = (string) current($responseXml->xpath('//error/errorDetail'));
            $message = array($this->_getHelper()->__('Datatrans %s error.', $reqType), $this->_getHelper()->__('Error Code: %s', $errorCode), $this->_getHelper()->__('Error Message: %s', $errorMessage), $this->_getHelper()->__('Error Detail: %s', $errorDetail));
            $message = implode('<br />', $message);
            $payment->setStatus(self::STATUS_ERROR);
            $this->getOrder()->addStatusHistoryComment($message)->save();
            $this->_throwException($message);
        }
        return $responseXml;
    }
开发者ID:voolitels,项目名称:Magento-Datatrans,代码行数:47,代码来源:Abstract.php

示例4: _voidCardTransaction

 /**
  * Void the card transaction through gateway
  *
  * @param Mage_Payment_Model_Info $payment
  * @param Varien_Object $card
  * @return bool|Mage_Sales_Model_Order_Payment_Transaction
  */
 protected function _voidCardTransaction($payment, $card)
 {
     $authTransactionId = $card->getLastTransId();
     $authTransaction = $payment->getTransaction($authTransactionId);
     //$captureTransactionId = $card->getLastCaptureTransId();
     $balance = $card->getProcessedAmount() - $card->getCapturedAmount();
     $realAuthTransactionId = $authTransaction->getAdditionalInformation($this->_realTransactionIdKey);
     $payment->setChasePaymentechTransType(Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_VOID);
     $payment->setTransId($realAuthTransactionId);
     $payment->setAmount($this->_formatAmount($balance));
     //$payment->setTransId($captureTransactionId);
     //$payment->setTransRefIdx($card->getTransRefIdx());
     $result = $this->_postRequest($payment);
     switch ($result->getResponseCode()) {
         case self::RESPONSE_CODE_NEW_ORDER_SUCCESS:
             if ($result->getApprovalCode() == self::RESPONSE_APPROVAL_STATUS) {
                 $voidTransactionId = $result->getTransactionId() . '-void';
                 $card->setLastTransId($voidTransactionId);
                 return $this->_addTransaction($payment, $voidTransactionId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, array('is_transaction_closed' => 1, 'should_close_parent_transaction' => 1, 'parent_transaction_id' => $authTransactionId), array($this->_realTransactionIdKey => $result->getTransactionId()), Mage::helper('paygate')->getTransactionMessage($payment, Mage_Paygate_Model_Authorizenet::REQUEST_TYPE_VOID, $result->getTransactionId(), $card));
             }
             $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText());
             break;
         default:
             $exceptionMessage = $this->_getHelper()->__('Payment voiding error.');
             //Mage::log($result->getResponseReasonText());
             if ($result->getResponseReasonText()) {
                 $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText());
             }
             //Mage::log($exceptionMessage);
             break;
     }
     $exceptionMessage = Mage::helper('paygate')->getTransactionMessage($payment, Mage_Paygate_Model_Authorizenet::REQUEST_TYPE_VOID, $realAuthTransactionId, $card, false, $exceptionMessage);
     Mage::throwException($exceptionMessage);
     return false;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:42,代码来源:Gorilla_ChasePaymentech_Model_Gateway.php

示例5: cancel

 /**
  * rewrited for Mage_Payment_Model_Method_Abstract
  */
 public function cancel(Varien_Object $payment)
 {
     if (!is_null($payment->getCcTransId()) && is_null($payment->getLastTransId())) {
         $transactionId = $payment->getCcTransId();
         $response = $this->getApi()->setStoreId($payment->getOrder()->getStoreId())->cancel($transactionId);
         if ($response->getStatus() == Mage_AmazonPayments_Model_Api_Asp_Fps_Response_Abstract::STATUS_ERROR) {
             Mage::throwException(Mage::helper('amazonpayments')->__('Order was not cancelled. Amazon Simple Pay service error: [%s] %s', $response->getCode(), $response->getMessage()));
         }
         if ($response->getStatus() == Mage_AmazonPayments_Model_Api_Asp_Fps_Response_Abstract::STATUS_CANCELLED) {
             $payment->getOrder()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, Mage::helper('amazonpayments')->__('Payment authorization cancelled with Amazon Simple Pay service.'), $notified = false);
         }
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:17,代码来源:Asp.php

示例6: capture

 /**
  * Capture preatutharized amount
  * @param Varien_Object $payment
  * @param <type> $amount
  */
 public function capture(Varien_Object $payment, $amount)
 {
     if (!$this->canCapture()) {
         return $this;
     }
     if (Mage::app()->getRequest()->getParam('transId')) {
         // Capture is called from response action
         $payment->setStatus(self::STATUS_APPROVED);
         return $this;
     }
     $transactionId = $payment->getLastTransId();
     $params = $this->_prepareAdminRequestParams();
     $params['transId'] = $transactionId;
     $params['authMode'] = '0';
     $params['op'] = 'postAuth-full';
 }
开发者ID:aaron1102,项目名称:ecbank,代码行数:21,代码来源:Ecpay12.php

示例7: Refund

 public function Refund(Varien_Object $payment, $amount)
 {
     try {
         $oPayment = new AllInOne();
         $oPayment->ServiceURL = $this->_getConfigData('test_mode') ? 'http://payment-stage.allpay.com.tw/CreditDetail/DoAction' : 'https://payment.allpay.com.tw/CreditDetail/DoAction';
         $oPayment->HashKey = $this->_getConfigData('hash_key');
         $oPayment->HashIV = $this->_getConfigData('hash_iv');
         $oPayment->MerchantID = $this->_getConfigData('merchant_id');
         $oPayment->Action['MerchantTradeNo'] = ($this->_getConfigData('test_mode') ? $this->_getConfigData('test_order_prefix') : '') . $this->_getOrder()->getRealOrderId();
         $oPayment->Action['TradeNo'] = $payment->getLastTransId();
         $oPayment->Action['Action'] = ActionType::R;
         $oPayment->Action['TotalAmount'] = (int) $amount;
         $arFeedback = $oPayment->DoAction();
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
     return $this;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:18,代码来源:All.php

示例8: refund

 public function refund(Varien_Object $payment, $amount)
 {
     if ($payment->getRefundTransactionId() && $amount > 0) {
         $transId = $payment->getCcTransId();
         //if transaction type was purchase (authorize & capture)
         if (is_null($transId)) {
             $transId = $payment->getLastTransId();
         }
         $txnDetails = array('txn_type' => self::TRANSACTION_TYPE_REFUND, 'refund_transaction_id' => $transId, 'paynz_account_id' => $payment->getFlo2cashAccountId(), 'amount' => sprintf('%.2f', $amount));
     } else {
         AO::throwException(AO::helper('flo2cash')->__('Error in refunding the payment.'));
     }
     $response = $this->_sendRequest($txnDetails);
     if ($response['txn_status'] == self::TRANSACTION_STATUS_DECLINED) {
         AO::throwException(AO::helper('flo2cash')->__('Payment transaction has been declined.'));
     }
     $payment->setLastTransId($response['transaction_id']);
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:19,代码来源:Web.php

示例9: cancel

 /**
  * Cancel payment
  * @param   Varien_Object $payment
  * @return  $this
  */
 public function cancel(Varien_Object $payment)
 {
     Mage::helper('payex/tools')->addToDebug('Action: Cancel');
     if (!$payment->getLastTransId()) {
         Mage::throwException(Mage::helper('paygate')->__('Invalid transaction ID.'));
     }
     // Load transaction Data
     $transactionId = $payment->getLastTransId();
     $transaction = $payment->getTransaction($transactionId);
     if (!$transaction) {
         Mage::throwException(Mage::helper('payex')->__('Can\'t load last transaction.'));
     }
     // Get Transaction Details
     $details = $this->fetchTransactionInfo($payment, $transactionId);
     // Not to execute for Sale transactions
     if ((int) $details['transactionStatus'] !== 3) {
         Mage::throwException(Mage::helper('payex')->__('Unable to execute cancel.'));
     }
     $transactionNumber = $details['transactionNumber'];
     $order_id = $details['orderId'];
     if (!$order_id) {
         $order_id = $payment->getOrder()->getId();
     }
     // Call PXOrder.Cancel2
     $params = array('accountNumber' => '', 'transactionNumber' => $transactionNumber);
     $result = Mage::helper('payex/api')->getPx()->Cancel2($params);
     Mage::helper('payex/tools')->addToDebug('PxOrder.Cancel2:' . $result['description'], $order_id);
     // Check Results
     if ($result['code'] === 'OK' && $result['errorCode'] === 'OK' && $result['description'] === 'OK') {
         // Add Cancel Transaction
         $payment->setStatus(self::STATUS_DECLINED)->setTransactionId($result['transactionNumber'])->setIsTransactionClosed(1);
         // Closed
         // Add Transaction fields
         $payment->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $result);
         return $this;
     }
     // Show Error
     Mage::helper('payex/tools')->throwPayExException($result, 'PxOrder.Cancel2');
     return $this;
 }
开发者ID:AndreKlang,项目名称:Magento-Payex,代码行数:45,代码来源:CC.php

示例10: _getParentTransactionId

 /**
  * Parent transaction id getter
  *
  * @param Varien_Object $payment
  * @return string
  */
 protected function _getParentTransactionId(Varien_Object $payment)
 {
     return $payment->getParentTransactionId() ? $payment->getParentTransactionId() : $payment->getLastTransId();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:10,代码来源:Pro.php

示例11: capture

 /**
  * Capture payment abstract method
  *
  * @param Varien_Object $payment
  * @param float $amount
  *
  * @return CheckoutApi_ChargePayment_Model_Method_Creditcard
  */
 public function capture(Varien_Object $payment, $amount)
 {
     if (!$this->canCapture()) {
         Mage::throwException(Mage::helper('payment')->__('Capture action is not available.'));
     } else {
         if (!$payment->getLastTransId()) {
             $this->_capture($payment, $amount);
         }
     }
     return $this;
 }
开发者ID:abzglobal,项目名称:checkout-magento-plugin,代码行数:19,代码来源:Abstract.php

示例12: _getParentTransactionId

 /**
  * Parent transaction id getter
  *
  * @param Varien_Object $payment
  * @return string
  */
 protected function _getParentTransactionId(Varien_Object $payment)
 {
     return $this->_getLastParentTransactionId($payment->getLastTransId());
 }
开发者ID:kirchbergerknorr,项目名称:iways_paypalplus,代码行数:10,代码来源:Payment.php

示例13: _beforeProcessRequest

 /**
  * Called before the request is processed
  *
  * @param string $request
  * @param mixed $options
  * @param Varien_Object $payment
  */
 protected function _beforeProcessRequest($request, &$options, Varien_Object $payment)
 {
     switch ($request) {
         case 'capture':
             $options['origTrxNumber'] = $payment->getCcTransId() ? $payment->getCcTransId() : $payment->getLastTransId();
             break;
         case 'refund':
             $options['origTrxNumber'] = $payment->getRefundTransactionId();
             break;
     }
 }
开发者ID:hsq,项目名称:Magento-1-1-ipayment,代码行数:18,代码来源:Cc.php

示例14: cancel

 /**
  * Cancel payment
  * @param   Varien_Object $payment
  * @return  $this
  */
 public function cancel(Varien_Object $payment)
 {
     Mage::helper('bankdebit/tools')->addToDebug('Action: Cancel');
     $transactionId = $payment->getLastTransId();
     // Add Cancel Transaction
     $payment->setStatus(self::STATUS_DECLINED)->setTransactionId($transactionId)->setIsTransactionClosed(1);
     // Closed
     // Do nothing
     return $this;
 }
开发者ID:AndreKlang,项目名称:Payex-Modules-Test,代码行数:15,代码来源:Payment.php

示例15: _runCrossReferenceTransaction

 /**
  * Internal CrossReference function for all VOID, REFUND, COLLECTION transaction types
  *
  * @param Varien_Object $payment
  * @param unknown_type $szTransactionType
  * @param unknown_type $amount
  * @return unknown
  */
 private function _runCrossReferenceTransaction(Varien_Object $payment, $szTransactionType, $amount = false)
 {
     $takePaymentInStoreBaseCurrency = $this->getConfigData('takePaymentInStoreBaseCurrency');
     $error = false;
     $boTransactionProcessed = false;
     $PaymentProcessorFullDomain;
     $rgeplRequestGatewayEntryPointList;
     $crtCrossReferenceTransaction;
     $crtrCrossReferenceTransactionResult;
     $todTransactionOutputData;
     $szMerchantID = $this->getConfigData('merchantid');
     $szPassword = $this->getConfigData('password');
     //
     $iclISOCurrencyList = CSV_ISOCurrencies::getISOCurrencyList();
     $szAmount;
     $nAmount;
     $szCurrencyShort;
     $iclISOCurrencyList;
     $power;
     $nDecimalAmount;
     $szNewCrossReference;
     $order = $payment->getOrder();
     $szOrderID = $order->getRealOrderId();
     //$szCrossReference = $payment->getLastTransId();
     $additionalInformation = $payment->getAdditionalInformation();
     $szCrossReference = $additionalInformation["CrossReference"];
     $szCrossReference = $payment->getLastTransId();
     // check the CrossRference and TransactionType parameters
     if (!$szCrossReference) {
         $error = 'Error occurred for ' . $szTransactionType . ': Missing Cross Reference';
     }
     if (!$szTransactionType) {
         $error = 'Error occurred for ' . $szTransactionType . ': Missing Transaction Type';
     }
     if ($error === false) {
         $PaymentProcessorFullDomain = $this->_getPaymentProcessorFullDomain();
         $rgeplRequestGatewayEntryPointList = new CSV_RequestGatewayEntryPointList();
         $rgeplRequestGatewayEntryPointList->add("https://gw1." . $PaymentProcessorFullDomain, 100, 2);
         $rgeplRequestGatewayEntryPointList->add("https://gw2." . $PaymentProcessorFullDomain, 200, 2);
         $rgeplRequestGatewayEntryPointList->add("https://gw3." . $PaymentProcessorFullDomain, 300, 2);
         $crtCrossReferenceTransaction = new CSV_CrossReferenceTransaction($rgeplRequestGatewayEntryPointList);
         $crtCrossReferenceTransaction->getMerchantAuthentication()->setMerchantID($szMerchantID);
         $crtCrossReferenceTransaction->getMerchantAuthentication()->setPassword($szPassword);
         if (!$takePaymentInStoreBaseCurrency) {
             $power = pow(10, $icISOCurrency->getExponent());
             $nAmount = round($order->getGrandTotal() * $power, 0);
         } else {
             $nAmount = $this->_getRoundedAmount($amount, $icISOCurrency->getExponent());
         }
         $szCurrencyShort = $order->getOrderCurrency()->getCurrencyCode();
         if ($szCurrencyShort != '' && $iclISOCurrencyList->getISOCurrency($szCurrencyShort, $icISOCurrency)) {
             $nCurrencyCode = new CSV_NullableInt($icISOCurrency->getISOCode());
             $crtCrossReferenceTransaction->getTransactionDetails()->getCurrencyCode()->setValue($icISOCurrency->getISOCode());
         }
         // round the amount before use
         //$nDecimalAmount = $this->_getRoundedAmount($nAmount, $icISOCurrency->getExponent());
         $crtCrossReferenceTransaction->getTransactionDetails()->setOrderID($szOrderID);
         $crtCrossReferenceTransaction->getTransactionDetails()->getAmount()->setValue($nAmount);
         $crtCrossReferenceTransaction->getTransactionDetails()->getMessageDetails()->setCrossReference($szCrossReference);
         $crtCrossReferenceTransaction->getTransactionDetails()->getMessageDetails()->setTransactionType($szTransactionType);
         try {
             $boTransactionProcessed = $crtCrossReferenceTransaction->processTransaction($crtrCrossReferenceTransactionResult, $todTransactionOutputData);
         } catch (Exception $exc) {
             Mage::log("exception: " . $exc->getMessage());
         }
         if ($boTransactionProcessed == false) {
             // could not communicate with the payment gateway
             $error = "Couldn't complete " . $szTransactionType . " transaction. Details: " . $crtCrossReferenceTransaction->getLastException();
             $szLogMessage = $error;
         } else {
             switch ($crtrCrossReferenceTransactionResult->getStatusCode()) {
                 case 0:
                     $error = false;
                     $szNewCrossReference = $todTransactionOutputData->getCrossReference();
                     $szLogMessage = $szTransactionType . " CrossReference transaction successfully completed. Response object: ";
                     $payment->setTransactionId($szNewCrossReference)->setParentTransactionId($szCrossReference)->setIsTransactionClosed(1);
                     $payment->save();
                     break;
                 default:
                     $szLogMessage = $crtrCrossReferenceTransactionResult->getMessage();
                     if ($crtrCrossReferenceTransactionResult->getErrorMessages()->getCount() > 0) {
                         $szLogMessage = $szLogMessage . ".";
                         for ($LoopIndex = 0; $LoopIndex < $crtrCrossReferenceTransactionResult->getErrorMessages()->getCount(); $LoopIndex++) {
                             $szLogMessage = $szLogMessage . $crtrCrossReferenceTransactionResult->getErrorMessages()->getAt($LoopIndex) . ";";
                         }
                         $szLogMessage = $szLogMessage . " ";
                     }
                     $error = "Couldn't complete " . $szTransactionType . " transaction for CrossReference: " . $szCrossReference . ". Payment Response: " . $szLogMessage;
                     $szLogMessage = $szTransactionType . " CrossReference transaction failed. Response object: ";
                     break;
             }
             $szLogMessage = $szLogMessage . print_r($crtrCrossReferenceTransactionResult, 1);
//.........这里部分代码省略.........
开发者ID:sohagan,项目名称:magento-modules,代码行数:101,代码来源:Direct.php


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