You are here

public static function Braintree_Address::find in Commerce Braintree 7

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

Parameters

mixed $customerOrId:

string $addressId:

Return value

object Braintree_Address

Throws

Braintree_Exception_NotFound

7 calls to Braintree_Address::find()
Braintree_AddressTest::testDelete in braintree_php/tests/integration/AddressTest.php
Braintree_AddressTest::testFind in braintree_php/tests/integration/AddressTest.php
Braintree_AddressTest::testFindErrorsOnBlankAddressId in braintree_php/tests/unit/AddressTest.php
Braintree_AddressTest::testFindErrorsOnBlankCustomerId in braintree_php/tests/unit/AddressTest.php
Braintree_AddressTest::testFindErrorsOnWhitespaceOnlyCustomerId in braintree_php/tests/unit/AddressTest.php

... See full list

File

braintree_php/lib/Braintree/Address.php, line 105

Class

Braintree_Address
Creates and manages Braintree Addresses

Code

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.');
  }
}