Esempio n. 1
0
 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);
 }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
 public function put($path, $params = null)
 {
     $body = http_build_query(Braintree_Util::camelCaseToDelimiterArray($params, '_'));
     $response = $this->_doRequest('PUT', $path, $body);
     $responseCode = $response['status'];
     if ($responseCode === 200 || $responseCode === 201 || $responseCode === 422 || $responseCode === 400) {
         return Braintree_Util::delimiterToCamelCaseArray(json_decode($response['body'], true), '_');
     } else {
         Braintree_Util::throwStatusCodeException($responseCode);
     }
 }
Esempio n. 4
0
 /**
  * arrays passed to this method should have a single root element
  * with an array as its value
  * @param array $aData the array of data
  * @return var XML string
  */
 public static function arrayToXml($aData)
 {
     $aData = Braintree_Util::camelCaseToDelimiterArray($aData, '-');
     // set up the XMLWriter
     $writer = new XMLWriter();
     $writer->openMemory();
     $writer->setIndent(true);
     $writer->setIndentString(' ');
     $writer->startDocument('1.0', 'UTF-8');
     // get the root element name
     $aKeys = array_keys($aData);
     $rootElementName = $aKeys[0];
     // open the root element
     $writer->startElement($rootElementName);
     // create the body
     self::_createElementsFromArray($writer, $aData[$rootElementName], $rootElementName);
     // close the root element and document
     $writer->endElement();
     $writer->endDocument();
     // send the output as string
     return $writer->outputMemory();
 }