本文整理汇总了PHP中Braintree_Util类的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Util类的具体用法?PHP Braintree_Util怎么用?PHP Braintree_Util使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Braintree_Util类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: all
public static function all()
{
$response = Braintree_Http::get('/plans');
if (key_exists('plans', $response)) {
$plans = array("plan" => $response['plans']);
} else {
$plans = array("plan" => array());
}
return Braintree_Util::extractAttributeAsArray($plans, 'plan');
}
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:10,代码来源:Plan.php
示例17: _mapPropertyNamesToObjsToReturn
private function _mapPropertyNamesToObjsToReturn($propertyNames, $objsToReturn)
{
if (count($objsToReturn) != count($propertyNames)) {
$propertyNames = array();
foreach ($objsToReturn as $obj) {
array_push($propertyNames, Braintree_Util::cleanClassName(get_class($obj)));
}
}
return array_combine($propertyNames, $objsToReturn);
}
开发者ID:nstungxd,项目名称:F2CA5,代码行数:10,代码来源:Successful.php
示例18: fetch
public function fetch($query, $ids)
{
$criteria = array();
foreach ($query as $term) {
$criteria[$term->name] = $term->toparam();
}
$criteria["ids"] = Braintree_CreditCardVerificationSearch::ids()->in($ids)->toparam();
$path = $this->_config->merchantPath() . '/verifications/advanced_search';
$response = $this->_http->post($path, array('search' => $criteria));
return Braintree_Util::extractattributeasarray($response['creditCardVerifications'], 'verification');
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:CreditCardVerificationGateway.php
示例19: _underscoreCustomField
private static function _underscoreCustomField($groupByCustomField, $records)
{
$updatedRecords = array();
foreach ($records as $record) {
$camelized = Braintree_Util::delimiterToCamelCase($groupByCustomField);
$record[$groupByCustomField] = $record[$camelized];
unset($record[$camelized]);
$updatedRecords[] = $record;
}
return $updatedRecords;
}
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:11,代码来源:SettlementBatchSummary.php
示例20: __construct
/**
* @ignore
* @param string $classToReturn name of class to instantiate
*/
public function __construct($objToReturn = null)
{
if (!empty($objToReturn)) {
// get a lowercase direct name for the property
$property = Braintree_Util::cleanClassName(get_class($objToReturn));
// save the name for indirect access
$this->_returnObjectName = $property;
// create the property!
$this->{$property} = $objToReturn;
}
}
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:15,代码来源:Successful.php
注:本文中的Braintree_Util类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论