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


PHP XmlParser::getAttribute方法代码示例

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


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

示例1: processResponse

 /**
  *
  * @param Varien_Object $payment
  * @param DOMDocument $litleResponse
  * @throws Mage_Payment_Model_Info_Exception
  * @return boolean
  */
 public function processResponse(Varien_Object $payment, $litleResponse)
 {
     $this->accountUpdater($payment, $litleResponse);
     $message = XmlParser::getAttribute($litleResponse, 'litleOnlineResponse', 'message');
     if ($message == 'Valid Format') {
         $isSale = $payment->getCcTransId() != null ? false : true;
         if (isset($litleResponse)) {
             $litleResponseCode = XMLParser::getNode($litleResponse, 'response');
             if ($litleResponseCode != '000') {
                 if ($isSale) {
                     if (Mage::getStoreConfig('payment/CreditCard/debug_enable')) {
                         Mage::log("Had an unsuccessful response in an authorization/sale - response code: " . $litleResponseCode, null, "litle.log");
                     }
                     $customerId = $payment->getOrder()->getCustomerId();
                     $orderId = $payment->getOrder()->getId();
                     Mage::helper('creditcard')->writeFailedTransactionToDatabase($customerId, null, $message, $litleResponse, null);
                     //null order id because the order hasn't been created yet
                     Mage::throwException("The order was not approved.  Please try again later or contact us.  For your reference, the transaction id is " . XMLParser::getNode($litleResponse, 'litleTxnId'));
                 } else {
                     $this->handleResponseForNonSuccessfulBackendTransactions($payment, $litleResponse, $litleResponseCode);
                 }
             } else {
                 $payment->setStatus('Approved')->setCcTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setLastTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setTransactionId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setIsTransactionClosed(0)->setTransactionAdditionalInfo('additional_information', XMLParser::getNode($litleResponse, 'message'));
             }
             return true;
         }
     } else {
         Mage::throwException($message);
     }
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:37,代码来源:PaymentLogic.php

示例2: processResponse

 public function processResponse(Varien_Object $payment, $litleResponse)
 {
     $message = XmlParser::getAttribute($litleResponse, 'litleOnlineResponse', 'message');
     if ($message == "Valid Format") {
         if (isset($litleResponse)) {
             $litleResponseCode = XMLParser::getNode($litleResponse, 'response');
             if ($litleResponseCode != "000") {
                 if ($litleResponseCode === "362" && Mage::helper("creditcard")->isStateOfOrderEqualTo($payment->getOrder(), Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE)) {
                     Mage::throwException("The void did not go through.  Do a refund instead.");
                 } else {
                     $payment->setStatus("Rejected")->setCcTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setLastTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setTransactionId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setIsTransactionClosed(0)->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse, 'message'));
                     throw new Mage_Payment_Model_Info_Exception(Mage::helper('core')->__("Transaction was not approved. Contact us or try again later."));
                 }
             } else {
                 $payment->setStatus("Approved")->setCcTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setLastTransId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setTransactionId(XMLParser::getNode($litleResponse, 'litleTxnId'))->setIsTransactionClosed(0)->setTransactionAdditionalInfo("additional_information", XMLParser::getNode($litleResponse, 'message'));
             }
             return $this;
         }
     } else {
         Mage::throwException($message);
     }
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:22,代码来源:PaymentLogic.php

示例3: void

 /**
  * void method
  *
  * @returns message, voidMessage, Response and litleTxnId to database
  */
 public function void($id = null)
 {
     $this->Auth->id = $id;
     if (!$this->Auth->exists()) {
         throw new NotFoundException(__('Invalid auth'));
     }
     if ($this->request->is('post') || $this->request->is('put')) {
         $hash_in = array('litleTxnId' => $this->Auth->field('litleTxnId'));
         $initilaize =& new LitleOnlineRequest();
         @($voidResponse = $initilaize->voidRequest($hash_in));
         $voidMessage = XmlParser::getNode($voidResponse, 'message');
         $voidLitleTxnId = XmlParser::getNode($voidResponse, 'litleTxnId');
         $message = XmlParser::getAttribute($voidResponse, 'litleOnlineResponse', 'message');
         $response = XmlParser::getNode($voidResponse, 'response');
         $this->request->data['Auth']['voidResponse'] = $response;
         $this->request->data['Auth']['message'] = NULL;
         $this->request->data['Auth']['litleTxnId'] = NULL;
         $this->request->data['Auth']['transactionStatus'] = NULL;
         $this->request->data['Auth']['message'] = $message;
         $this->request->data['Auth']['litleTxnId'] = $voidLitleTxnId;
         $this->request->data['Auth']['voidMessage'] = $voidMessage;
         $this->request->data['Auth']['transactionStatus'] = $voidMessage;
         $this->request->data['Auth']['voidLitleTxnId'] = $voidLitleTxnId;
         if ($this->Auth->save($this->request->data)) {
             $this->Session->setFlash(__($voidMessage));
             $this->redirect(array('action' => 'index'));
         } else {
             $this->Session->setFlash(__('The auth could not be saved. Please, try again.'));
         }
     } else {
         $this->request->data = $this->Auth->read(null, $id);
     }
 }
开发者ID:nengineer,项目名称:litle-cakePHP-integration,代码行数:38,代码来源:AuthsController.php

示例4: realpath

<?php

namespace litle\sdk;

require_once realpath(__DIR__) . '/../../../vendor/autoload.php';
#Sale
$sale_info = array('orderId' => '1', 'amount' => '10010', 'orderSource' => 'ecommerce', 'billToAddress' => array('name' => 'John Smith', 'addressLine1' => '1 Main St.', 'city' => 'Burlington', 'state' => 'MA', 'zip' => '01803-3747', 'country' => 'US'), 'card' => array('number' => '5112010000000003', 'expDate' => '0112', 'cardValidationNum' => '349', 'type' => 'MC'));
$initilaize =& new LitleOnlineRequest();
$saleResponse = $initilaize->saleRequest($sale_info);
#display results
echo "Response: " . XmlParser::getNode($saleResponse, 'response') . "<br>";
echo "Message: " . XmlParser::getNode($saleResponse, 'message') . "<br>";
echo "Litle Transaction ID: " . XmlParser::getNode($saleResponse, 'litleTxnId');
echo "All Response :" . XmlParser::getAttribute($saleResponse, 'litleOnlineResponse', 'version');
开发者ID:siscodev93,项目名称:litle-sdk-for-php,代码行数:14,代码来源:SampleDriver.php


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