/** * * @return Braintree_AddOn[] */ 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'); }
public static function find($merchant_account_id) { try { $response = Braintree_Http::get('/merchant_accounts/' . $merchant_account_id); return self::factory($response['merchantAccount']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('merchant account with id ' . $merchant_account_id . ' not found'); } }
public static function find($id) { try { $response = Braintree_Http::get('/subscriptions/' . $id); return self::factory($response['subscription']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('subscription with id ' . $id . ' not found'); } }
/** * find a paypalAccount by token * * @access public * @param string $token paypal accountunique id * @return object Braintree_PayPalAccount * @throws Braintree_Exception_NotFound */ public static function find($token) { self::_validateId($token); try { $response = Braintree_Http::get('/payment_methods/paypal_account/' . $token); return self::factory($response['paypalAccount']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('paypal account with token ' . $token . ' not found'); } }
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'); }
function testSandboxSSL() { try { Braintree_Configuration::environment('sandbox'); $this->setExpectedException('Braintree_Exception_Authentication'); Braintree_Http::get('/'); } catch (Exception $e) { Braintree_Configuration::environment('development'); throw $e; } Braintree_Configuration::environment('development'); }
/** * find an address by id * * Finds the address with the given <b>addressId</b> that is associated * to the given <b>customerOrId</b>. * If the address cannot be found, a NotFound exception will be thrown. * * * @access public * @param mixed $customerOrId * @param string $addressId * @return object Braintree_Address * @throws Braintree_Exception_NotFound */ public function find($customerOrId, $addressId) { $customerId = $this->_determineCustomerId($customerOrId); $this->_validateId($addressId); try { $path = $this->_config->merchantPath() . '/customers/' . $customerId . '/addresses/' . $addressId; $response = $this->_http->get($path); return Braintree_Address::factory($response['address']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('address for customer ' . $customerId . ' with id ' . $addressId . ' not found.'); } }
/** * find a PaymentMethod by token * * @access public * @param string $token payment method unique id * @return object Braintree_CreditCard or Braintree_PayPalAccount * @throws Braintree_Exception_NotFound */ public static function find($token) { self::_validateId($token); try { $response = Braintree_Http::get('/payment_methods/any/' . $token); if (isset($response['creditCard'])) { return Braintree_CreditCard::factory($response['creditCard']); } else { if (isset($response['paypalAccount'])) { return Braintree_PayPalAccount::factory($response['paypalAccount']); } else { if (is_array($response)) { return Braintree_UnknownPaymentMethod::factory($response); } } } } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('payment method with token ' . $token . ' not found'); } }
/** * @access public * */ public static function find($id) { self::_validateId($id); try { $response = Braintree_Http::get('/transactions/' . $id); return self::factory($response['transaction']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('transaction with id ' . $id . ' not found'); } }
/** * Convert a payment method nonce to a credit card * * @access public * @param string $nonce payment method nonce * @return object Braintree_CreditCard * @throws Braintree_Exception_NotFound */ public static function fromNonce($nonce) { self::_validateId($nonce, "nonce"); try { $response = Braintree_Http::get('/payment_methods/from_nonce/' . $nonce); return self::factory($response['creditCard']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('credit card with nonce ' . $nonce . ' locked, consumed or not found'); } }
public static function all() { $response = Braintree_Http::get('/add_ons'); $addOns = array("addOn" => $response['addOns']); return Braintree_Util::extractAttributeAsArray($addOns, 'addOn'); }
/** * find an address by id * * Finds the address with the given <b>addressId</b> that is associated * to the given <b>customerOrId</b>. * If the address cannot be found, a NotFound exception will be thrown. * * * @access public * @param mixed $customerOrId * @param string $addressId * @return object Braintree_Address * @throws Braintree_Exception_NotFound */ public static function find($customerOrId, $addressId) { $customerId = self::_determineCustomerId($customerOrId); self::_validateId($addressId); try { $response = Braintree_Http::get('/customers/' . $customerId . '/addresses/' . $addressId); return self::factory($response['address']); } catch (Braintree_Exception_NotFound $e) { throw new Braintree_Exception_NotFound('address for customer ' . $customerId . ' with id ' . $addressId . ' not found.'); } }
public static function all() { $response = Braintree_Http::get('/discounts'); $discounts = array("discount" => $response['discounts']); return Braintree_Util::extractAttributeAsArray($discounts, 'discount'); }
public static function all() { $response = Braintree_Http::get('/plans'); $plans = array("plan" => $response['plans']); return Braintree_Util::extractAttributeAsArray($plans, 'plan'); }