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


PHP XMLParser::getNode方法代码示例

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


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

示例1: saveCustomerInsight

 /**
  *
  * @param Mage_Payment_Model_Abstract $payment
  * @param unknown_type $litleResponse
  */
 public function saveCustomerInsight($payment, $litleResponse)
 {
     preg_match('/.*(\\d\\d\\d\\d)/', $payment->getCcNumber(), $matches);
     $last4 = $matches[1];
     $data = array('customer_id' => $payment->getOrder()->getCustomerId(), 'order_number' => XMLParser::getNode($litleResponse, 'orderId'), 'order_id' => $payment->getOrder()->getId(), 'affluence' => self::formatAffluence(XMLParser::getNode($litleResponse, 'affluence')), 'last' => $last4, 'order_amount' => self::formatAvailableBalance($payment->getAmountAuthorized()), 'affluence' => self::formatAffluence(XMLParser::getNode($litleResponse, 'affluence')), 'issuing_country' => XMLParser::getNode($litleResponse, 'issuerCountry'), 'prepaid_card_type' => self::formatPrepaidCardType(XMLParser::getNode($litleResponse, 'prepaidCardType')), 'funding_source' => self::formatFundingSource(XMLParser::getNode($litleResponse, 'type')), 'available_balance' => self::formatAvailableBalance(XMLParser::getNode($litleResponse, 'availableBalance')), 'reloadable' => self::formatReloadable(XMLParser::getNode($litleResponse, 'reloadable')));
     Mage::getModel('palorus/insight')->setData($data)->save();
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:12,代码来源:Data.php

示例2: __construct

 /**
  * Create a Response
  *
  * When creating a transaction response, the constructor will look 
  * for the appropriate fields in the raw response XML and then parse
  * them out into the corresponding members of this class.
  */
 public function __construct($raw_response_data, $node_name, $mode = 'sandbox')
 {
     $this->xml_node_name = $node_name;
     $this->setCode(\XMLParser::getNode($raw_response_data, 'response'));
     $this->order_id = \XMLParser::getAttribute($raw_response_data, $this->xml_node_name, 'id');
     $this->litle_txn_id = \XMLParser::getNode($raw_response_data, 'litleTxnId');
     $this->time = (new \DateTime(\XMLParser::getNode($raw_response_data, 'responseTime')))->format('Y-m-d H:i:s');
     $this->debug = $raw_response_data;
     $this->mode = $mode;
 }
开发者ID:petflow,项目名称:litle,代码行数:17,代码来源:TransactionResponse.php

示例3: __construct

 /**
  * Constructor Overrides
  */
 public function __construct($raw_response, $mode = 'sandbox')
 {
     parent::__construct($raw_response, 'registerTokenResponse', $mode);
     $this->litleToken = trim(\XMLParser::getNode($raw_response, 'litleToken'));
     $this->bin = trim(\XMLParser::getNode($raw_response, 'bin'));
     $this->type = trim(\XMLParser::getNode($raw_response, 'type'));
     // ugh, because sometimes order_id is mirroed in the id attribute, but
     // othertimes its not.
     $this->order_id = trim(\XMLParser::getNode($raw_response, 'orderId'));
 }
开发者ID:petflow,项目名称:litle,代码行数:13,代码来源:RegisterTokenResponse.php

示例4: handleResponseForNonSuccessfulBackendTransactions

 public function handleResponseForNonSuccessfulBackendTransactions(Varien_Object $payment, $litleResponse, $litleResponseCode)
 {
     $order = $payment->getOrder();
     $litleMessage = XMLParser::getNode($litleResponse, 'message');
     $litleTxnId = XMLParser::getNode($litleResponse, 'litleTxnId');
     $customerId = $order->getData('customer_id');
     $orderId = $order->getId();
     if ($litleResponseCode === '306') {
         $this->setOrderStatusAndCommentsForFailedTransaction($payment, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID, Mage_Sales_Model_Order::STATE_CANCELED, Mage_Payment_Model_Method_Abstract::STATUS_VOID, "Authorization has expired - no need to reverse.  The original Authorization is no longer valid, because it has expired.  You can not perform an Authorization Reversal for an expired Authorization.", true);
     } elseif ($litleResponseCode === '311') {
         $this->setOrderStatusAndCommentsForFailedTransaction($payment, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, Mage_Sales_Model_Order::STATE_COMPLETE, Mage_Payment_Model_Method_Abstract::STATUS_APPROVED, "Deposit is already referenced by a chargeback.  The deposit is already referenced by a chargeback; therefore, a refund cannot be processed against the original transaction.", true);
     } elseif ($litleResponseCode === '316') {
         $this->setOrderStatusAndCommentsForFailedTransaction($payment, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND, Mage_Sales_Model_Order::STATE_COMPLETE, Mage_Payment_Model_Method_Abstract::STATUS_APPROVED, "Automatic refund already issued.  This refund transaction is a duplicate for one already processed automatically by the Litle Fraud Chargeback Prevention Service.", true);
     } elseif ($litleResponseCode === '335') {
         $descriptiveMessage = "This method of payment does not support authorization reversals.  You can not perform an Authorization Reversal transaction for this payment type.";
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
     } elseif ($litleResponseCode === '336') {
         $descriptiveMessage = "Reversal amount does not match Authorization amount.  For a merchant initiated reversal against an American Express authorization, the reversal amount must match the authorization amount exactly.";
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
     } elseif ($litleResponseCode === '361') {
         $descriptiveMessage = "The order #" . $order->getIncrementId() . " can not be captured.  Authorization no longer available.  The authorization for this transaction is no longer available;  the authorization has already been consumed by another capture.";
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE);
     } elseif ($litleResponseCode === '362') {
         $descriptiveMessage = "Transaction Not Voided - Already Settled.  This transaction cannot be voided; it has already been delivered to the card networks.  You may want to try a refund instead.";
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_VOID);
     } elseif ($litleResponseCode === '365') {
         $descriptiveMessage = "Total credit amount exceeds capture amouont.  The amount of the credit is greater than the capture, or the amount of this credit plus other credits already referencing this capture are greater than the capture amount.";
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_REFUND);
     } elseif ($litleResponseCode === '370') {
         $descriptiveMessage = "Internal System Error - Call Litle.  There is a problem with the Litle System.  Contact support@litle.com and provide the following transaction id: " . $litleTxnId;
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT);
     } else {
         $descriptiveMessage = "Transaction was not approved and Litle's Magento extension can not tell why. Contact Litle at support@litle.com and provide the following transaction id: " . $litleTxnId;
         $this->showErrorForFailedTransaction($customerId, $orderId, $litleMessage, $litleResponse, $descriptiveMessage, $litleTxnId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_PAYMENT);
     }
 }
开发者ID:Rodrifer,项目名称:candyclub,代码行数:36,代码来源:PaymentLogic.php

示例5: writeFailedTransactionToDatabase

 public function writeFailedTransactionToDatabase($customerId, $orderId, $message, $xmlDocument, $txnType)
 {
     $orderNumber = 0;
     $isOrderIdNull = $orderId === null ? true : false;
     if ($orderId === null) {
         $orderId = 0;
     } else {
         $order = Mage::getModel("sales/order")->load($orderId);
         $orderNumber = $order->getData("increment_id");
     }
     if ($customerId === null) {
         $customerId = 0;
     }
     $config = Mage::getResourceModel("sales/order")->getReadConnection()->getConfig();
     $host = $config['host'];
     $username = $config['username'];
     $password = $config['password'];
     $dbname = $config['dbname'];
     $con = mysql_connect($host, $username, $password);
     $fullXml = $xmlDocument->saveXML();
     if (!$con) {
         Mage::log("Failed to write failed transaction to database.  Transaction details: " . $fullXml, null, "litle_failed_transactions.log");
     } else {
         $selectedDb = mysql_select_db($dbname, $con);
         if (!$selectedDb) {
             Mage::log("Can't use selected database " . $dbname, null, "litle.log");
         }
         $fullXml = mysql_real_escape_string($fullXml);
         $litleTxnId = XMLParser::getNode($xmlDocument, 'litleTxnId');
         $sql = "insert into litle_failed_transactions (customer_id, order_id, message, full_xml, litle_txn_id, active, transaction_timestamp, order_num) values (" . $customerId . ", " . $orderId . ", '" . $message . "', '" . $fullXml . "', '" . $litleTxnId . "', true, now()," . $orderNumber . ")";
         Mage::log("Sql to execute is: " . $sql, null, "litle.log");
         $result = mysql_query($sql);
         if (!$result) {
             Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
             Mage::log("Query executed: " . $sql, null, "litle.log");
         }
         if (!$isOrderIdNull) {
             $sql = "select * from sales_payment_transaction where order_id = " . $orderId . " order by created_at asc";
             $result = mysql_query($sql);
             Mage::log("Executed sql: " . $sql, null, "litle.log");
             Mage::log($result, null, "litle.log");
             while ($row = mysql_fetch_assoc($result)) {
                 Mage::log($row['transaction_id'], null, "litle.log");
                 $sql = "insert into sales_payment_transaction (parent_id, order_id, payment_id, txn_id, parent_txn_id, txn_type, is_closed, created_at, additional_information) values (" . $row['transaction_id'] . ", " . $orderId . ", " . $orderId . ", " . $litleTxnId . ", " . $row['txn_id'] . ", '" . $txnType . "', 0,now(),'" . serialize(array('message' => message)) . "')";
             }
             Mage::log("Sql to execute is: " . $sql, null, "litle.log");
             $result = mysql_query($sql);
             if (!$result) {
                 Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
                 Mage::log("Query executed: " . $sql, null, "litle.log");
             }
             $sql = "insert into sales_flat_order_status_history (parent_id, is_customer_notified, is_visible_on_front, comment, status, created_at, entity_name) values (" . $orderId . ", 2, 0,'" . $message . ". Transaction ID: " . $litleTxnId . "','processing',now(),'" . $txnType . "')";
             Mage::log("Sql to execute is: " . $sql, null, "litle.log");
             $result = mysql_query($sql);
             if (!$result) {
                 Mage::log("Insert failed with error message: " . mysql_error(), null, "litle.log");
                 Mage::log("Query executed: " . $sql, null, "litle.log");
             }
         }
         mysql_close($con);
     }
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:62,代码来源:Data.php

示例6: test_63

 function test_63()
 {
     $token_hash = array('id' => 'id', 'orderId' => '63', 'amount' => '15000', 'orderSource' => 'ecommerce', 'billToAddress' => array('firstName' => 'Tom', 'lastName' => 'Black'), 'echeck' => array('accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'));
     $initilaize = new LitleOnlineRequest();
     $registerTokenResponse = $initilaize->echeckSaleRequest($token_hash);
     $this->assertEquals('801', XMLParser::getNode($registerTokenResponse, 'tokenResponseCode'));
     $this->assertEquals('Account number was successfully registered', XMLParser::getNode($registerTokenResponse, 'tokenMessage'));
     $this->assertEquals('EC', XMLParser::getNode($registerTokenResponse, 'type'));
     $this->assertEquals('999', XMLParser::getNode($registerTokenResponse, 'eCheckAccountSuffix'));
     $this->assertEquals('111922223333555999', XMLParser::getNode($registerTokenResponse, 'litleToken'));
 }
开发者ID:siscodev93,项目名称:litle-sdk-for-php,代码行数:11,代码来源:CertTokenTest.php

示例7: 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

示例8: test_49

 public function test_49()
 {
     $echeck_hash = array('litleTxnId' => '2', 'id' => 'id');
     $initilaize = new LitleOnlineRequest();
     $echeckCreditResponse = $initilaize->echeckCreditRequest($echeck_hash);
     $this->assertEquals('001', XMLParser::getNode($echeckCreditResponse, 'response'));
     $this->assertEquals('Transaction Received', XMLParser::getNode($echeckCreditResponse, 'message'));
 }
开发者ID:siscodev93,项目名称:litle-sdk-for-php,代码行数:8,代码来源:CertEcheckTest.php

示例9: __construct

 /**
  * Constructor Overrides
  */
 public function __construct($raw_response, $mode = 'sandbox')
 {
     parent::__construct($raw_response, 'captureResponse', $mode);
     $this->post_date = (new \DateTime(\XMLParser::getNode($raw_response, 'postDate')))->format('Y-m-d H:i:s');
 }
开发者ID:petflow,项目名称:litle,代码行数:8,代码来源:CaptureResponse.php

示例10: test_49

 public function test_49()
 {
     $echeck_hash = array('litleTxnId' => '2');
     $initilaize = new LitleOnlineRequest();
     $echeckCreditResponse = $initilaize->echeckCreditRequest($echeck_hash);
     $this->assertEquals('360', XMLParser::getNode($echeckCreditResponse, 'response'));
     $this->assertEquals('No transaction found with specified litleTxnId', XMLParser::getNode($echeckCreditResponse, 'message'));
 }
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:CertEcheckTest.php


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