PHP Class Braintree\AddressGateway

An Address belongs to a Customer. It can be associated to a CreditCard as the billing address. It can also be used as the shipping address when creating a Transaction.
Show file Open project: braintree/braintree_php Class Usage Examples

Public Methods

Method Description
__construct ( Gateway $gateway )
create ( array $attribs ) : Braintree\Result\Successful | Error
createNoValidate ( array $attribs ) : self attempts the create operation assuming all data will validate returns a Address object instead of a Result
createSignature ( ) : array creates a full array signature of a valid create request
delete ( mixed $customerOrId = null, string $addressId = null ) delete an address by id
find ( mixed $customerOrId, string $addressId ) : braintree\Address find an address by id
update ( mixed $customerOrId, string $addressId, array $attributes ) : Braintree\Result\Successful | Error updates the address record
updateNoValidate ( $customerOrId, $addressId, $attributes ) : Transaction update an address record, assuming validations will pass
updateSignature ( ) : array creates a full array signature of a valid update request

Private Methods

Method Description
_determineCustomerId ( mixed $customerOrId ) : string determines if a string id or Customer object was passed
_doCreate ( string $subPath, array $params ) : Braintree\Result\Successful | Error sends the create request to the gateway
_validateCustomerId ( string $id = null ) verifies that a valid customer id is being used
_validateId ( string $id = null ) verifies that a valid address id is being used
_verifyGatewayResponse ( array $response ) : Braintree\Result\Successful | Error generic method for validating incoming gateway responses

Method Details

__construct() public method

public __construct ( Gateway $gateway )
$gateway Gateway

create() public method

public create ( array $attribs ) : Braintree\Result\Successful | Error
$attribs array
return Braintree\Result\Successful | Braintree\Result\Error

createNoValidate() public method

attempts the create operation assuming all data will validate returns a Address object instead of a Result
public createNoValidate ( array $attribs ) : self
$attribs array
return self

createSignature() public static method

creates a full array signature of a valid create request
public static createSignature ( ) : array
return array gateway create request format

delete() public method

delete an address by id
public delete ( mixed $customerOrId = null, string $addressId = null )
$customerOrId mixed
$addressId string

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

update() public method

if calling this method in context, customerOrId is the 2nd attribute, addressId 3rd. customerOrId & addressId are not sent in object context.
public update ( mixed $customerOrId, string $addressId, array $attributes ) : Braintree\Result\Successful | Error
$customerOrId mixed (only used in call)
$addressId string (only used in call)
$attributes array
return Braintree\Result\Successful | Braintree\Result\Error

updateNoValidate() public method

if calling this method in context, customerOrId is the 2nd attribute, addressId 3rd. customerOrId & addressId are not sent in object context.
See also: Address::update()
public updateNoValidate ( $customerOrId, $addressId, $attributes ) : Transaction
return Transaction

updateSignature() public static method

creates a full array signature of a valid update request
public static updateSignature ( ) : array
return array gateway update request format