Braintree\AddressGateway::find PHP Method

find() public method

Finds the address with the given addressId that is associated to the given customerOrId. If the address cannot be found, a NotFound exception will be thrown.
public find ( mixed $customerOrId, string $addressId ) : braintree\Address
$customerOrId mixed
$addressId string
return braintree\Address
    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 Address::factory($response['address']);
        } catch (Exception\NotFound $e) {
            throw new Exception\NotFound('address for customer ' . $customerId . ' with id ' . $addressId . ' not found.');
        }
    }