當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Braintree_Util類代碼示例

本文整理匯總了PHP中Braintree_Util的典型用法代碼示例。如果您正苦於以下問題:PHP Braintree_Util類的具體用法?PHP Braintree_Util怎麽用?PHP Braintree_Util使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Braintree_Util類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: all

 public function all()
 {
     $path = $this->_config->merchantPath() . '/discounts';
     $response = $this->_http->get($path);
     $discounts = array("discount" => $response['discounts']);
     return Braintree_Util::extractAttributeAsArray($discounts, 'discount');
 }
開發者ID:portchris,項目名稱:NaturalRemedyCompany,代碼行數:7,代碼來源:DiscountGateway.php

示例2: _initializeFromArray

 /**
  * initializes instance properties from the keys/values of an array
  * @ignore
  * @access protected
  * @param array $attributes array of properties to set - single level
  * @return none
  */
 private function _initializeFromArray($attributes)
 {
     foreach ($attributes as $name => $value) {
         $varName = "_{$name}";
         $this->{$varName} = Braintree_Util::delimiterToCamelCase($value, '_');
     }
 }
開發者ID:kingsolmn,項目名稱:CakePHP-Braintree-Plugin,代碼行數:14,代碼來源:Validation.php

示例3: all

 public function all()
 {
     $path = $this->_config->merchantPath() . '/add_ons';
     $response = $this->_http->get($path);
     $addOns = array("addOn" => $response['addOns']);
     return Braintree_Util::extractAttributeAsArray($addOns, 'addOn');
 }
開發者ID:Flesh192,項目名稱:magento,代碼行數:7,代碼來源:AddOnGateway.php

示例4: _createElementsFromArray

 /**
  * Construct XML elements with attributes from an associative array.
  *
  * @access protected
  * @static
  * @param object $writer XMLWriter object
  * @param array $aData contains attributes and values
  * @return none
  */
 private static function _createElementsFromArray(&$writer, $aData)
 {
     if (!is_array($aData)) {
         $writer->text($aData);
         return;
     }
     foreach ($aData as $index => $element) {
         // convert the style back to gateway format
         $elementName = Braintree_Util::camelCaseToDelimiter($index, '-');
         // handle child elements
         $writer->startElement($elementName);
         if (is_array($element)) {
             if (array_key_exists(0, $element) || empty($element)) {
                 $writer->writeAttribute('type', 'array');
                 foreach ($element as $ignored => $itemInArray) {
                     $writer->startElement('item');
                     self::_createElementsFromArray($writer, $itemInArray);
                     $writer->endElement();
                 }
             } else {
                 self::_createElementsFromArray($writer, $element);
             }
         } else {
             // generate attributes as needed
             $attribute = self::_generateXmlAttribute($element);
             if (is_array($attribute)) {
                 $writer->writeAttribute($attribute[0], $attribute[1]);
                 $element = $attribute[2];
             }
             $writer->text($element);
         }
         $writer->endElement();
     }
 }
開發者ID:kingsolmn,項目名稱:CakePHP-Braintree-Plugin,代碼行數:43,代碼來源:Generator.php

示例5: arrayFromXml

 /**
  * Converts an XML string into a multidimensional array
  *
  * @param string $xml
  * @return array
  */
 public static function arrayFromXml($xml)
 {
     $document = new DOMDocument('1.0', 'UTF-8');
     $document->loadXML($xml);
     $root = $document->documentElement->nodeName;
     return Braintree_Util::delimiterToCamelCaseArray(array($root => self::_nodeToValue($document->childNodes->item(0))));
 }
開發者ID:buga1234,項目名稱:buga_segforours,代碼行數:13,代碼來源:Parser.php

示例6: update

 public function update($subscriptionId, $attributes)
 {
     Braintree_Util::verifyKeys(self::_updateSignature(), $attributes);
     $path = $this->_config->merchantPath() . '/subscriptions/' . $subscriptionId;
     $response = $this->_http->put($path, array('subscription' => $attributes));
     return $this->_verifyGatewayResponse($response);
 }
開發者ID:portchris,項目名稱:NaturalRemedyCompany,代碼行數:7,代碼來源:SubscriptionGateway.php

示例7: connectUrl

 public function connectUrl($params = array())
 {
     $query = Braintree_Util::camelCaseToDelimiterArray($params, '_');
     $query['client_id'] = $this->_config->getClientId();
     $url = $this->_config->baseUrl() . '/oauth/connect?' . http_build_query($query);
     return $this->signUrl($url);
 }
開發者ID:nstungxd,項目名稱:F2CA5,代碼行數:7,代碼來源:OAuthGateway.php

示例8: conditionallyVerifyKeys

 public function conditionallyVerifyKeys($params)
 {
     if (array_key_exists("customerId", $params)) {
         Braintree_Util::verifyKeys($this->generateWithCustomerIdSignature(), $params);
     } else {
         Braintree_Util::verifyKeys($this->generateWithoutCustomerIdSignature(), $params);
     }
 }
開發者ID:beevo,項目名稱:disruptivestrong,代碼行數:8,代碼來源:ClientTokenGateway.php

示例9: connectUrl

 public function connectUrl($params = array())
 {
     $query = Braintree_Util::camelCaseToDelimiterArray($params, '_');
     $query['client_id'] = $this->_config->getClientId();
     $queryString = preg_replace('/\\%5B\\d+\\%5D/', '%5B%5D', http_build_query($query));
     $url = $this->_config->baseUrl() . '/oauth/connect?' . $queryString;
     return $this->signUrl($url);
 }
開發者ID:buga1234,項目名稱:buga_segforours,代碼行數:8,代碼來源:OAuthGateway.php

示例10: _iteratorToArray

 /**
  * processes SimpleXMLIterator objects recursively
  *
  * @access protected
  * @param object $iterator
  * @return array xml converted to array
  */
 private static function _iteratorToArray($iterator)
 {
     $xmlArray = array();
     $value = null;
     // rewind the iterator and check if the position is valid
     // if not, return the string it contains
     $iterator->rewind();
     if (!$iterator->valid()) {
         return self::_typecastXmlValue($iterator);
     }
     for ($iterator->rewind(); $iterator->valid(); $iterator->next()) {
         $tmpArray = null;
         $value = null;
         // get the attribute type string for use in conditions below
         $attributeType = $iterator->attributes()->type;
         // extract the parent element via xpath query
         $parentElement = $iterator->xpath($iterator->key() . '/..');
         if ($parentElement[0] instanceof SimpleXMLIterator) {
             $parentElement = $parentElement[0];
             $parentKey = Braintree_Util::delimiterToCamelCase($parentElement->getName());
         } else {
             $parentElement = null;
         }
         if ($parentKey == "customFields") {
             $key = Braintree_Util::delimiterToUnderscore($iterator->key());
         } else {
             $key = Braintree_Util::delimiterToCamelCase($iterator->key());
         }
         // process children recursively
         if ($iterator->hasChildren()) {
             // return the child elements
             $value = self::_iteratorToArray($iterator->current());
             // if the element is an array type,
             // use numeric keys to allow multiple values
             if ($attributeType != 'array') {
                 $tmpArray[$key] = $value;
             }
         } else {
             // cast values according to attributes
             $tmpArray[$key] = self::_typecastXmlValue($iterator->current());
         }
         // set the output string
         $output = isset($value) ? $value : $tmpArray[$key];
         // determine if there are multiple tags of this name at the same level
         if (isset($parentElement) && $parentElement->attributes()->type == 'collection' && $iterator->hasChildren()) {
             $xmlArray[$key][] = $output;
             continue;
         }
         // if the element was an array type, output to a numbered key
         // otherwise, use the element name
         if ($attributeType == 'array') {
             $xmlArray[] = $output;
         } else {
             $xmlArray[$key] = $output;
         }
     }
     return $xmlArray;
 }
開發者ID:danielcoats,項目名稱:schoolpress,代碼行數:65,代碼來源:Parser.php

示例11: __toString

 public function __toString()
 {
     $display = array('amount', 'reason', 'status', 'replyByDate', 'receivedDate', 'currencyIsoCode');
     $displayAttributes = array();
     foreach ($display as $attrib) {
         $displayAttributes[$attrib] = $this->{$attrib};
     }
     return __CLASS__ . '[' . Braintree_Util::attributesToString($displayAttributes) . ']';
 }
開發者ID:beevo,項目名稱:disruptivestrong,代碼行數:9,代碼來源:Dispute.php

示例12: __toString

 public function __toString()
 {
     $display = array('id', 'merchantAccountDetails', 'exceptionMessage', 'amount', 'disbursementDate', 'followUpAction', 'retry', 'success', 'transactionIds');
     $displayAttributes = array();
     foreach ($display as $attrib) {
         $displayAttributes[$attrib] = $this->{$attrib};
     }
     return __CLASS__ . '[' . Braintree_Util::attributesToString($displayAttributes) . ']';
 }
開發者ID:buga1234,項目名稱:buga_segforours,代碼行數:9,代碼來源:Disbursement.php

示例13: returnObjectOrThrowException

 /**
  *
  * @param string $className
  * @param object $resultObj
  * @return object returns the passed object if successful
  * @throws Braintree_Exception_ValidationsFailed
  */
 public static function returnObjectOrThrowException($className, $resultObj)
 {
     $resultObjName = Braintree_Util::cleanClassName($className);
     if ($resultObj->success) {
         return $resultObj->{$resultObjName};
     } else {
         throw new Braintree_Exception_ValidationsFailed();
     }
 }
開發者ID:anmolview,項目名稱:yiidemos,代碼行數:16,代碼來源:Braintree.php

示例14: fetch

 public static function fetch($query, $ids)
 {
     $criteria = array();
     foreach ($query as $term) {
         $criteria[$term->name] = $term->toparam();
     }
     $criteria["ids"] = Braintree_CreditCardVerificationSearch::ids()->in($ids)->toparam();
     $response = Braintree_Http::post('/verifications/advanced_search', array('search' => $criteria));
     return Braintree_Util::extractattributeasarray($response['creditCardVerifications'], 'verification');
 }
開發者ID:othreed,項目名稱:osCommerce-234-bootstrap-wADDONS,代碼行數:10,代碼來源:CreditCardVerification.php

示例15: put

 public static function put($path, $params = null)
 {
     $response = self::_doRequest('PUT', $path, self::_buildXml($params));
     $responseCode = $response['status'];
     if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422) {
         return Braintree_Xml::buildArrayFromXml($response['body']);
     } else {
         Braintree_Util::throwStatusCodeException($responseCode);
     }
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:10,代碼來源:Http.php


注:本文中的Braintree_Util類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。