当前位置: 首页>>代码示例>>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;未经允许,请勿转载。