private static function Braintree_Customer::_verifyGatewayResponse in Commerce Braintree 7
generic method for validating incoming gateway responses
creates a new Braintree_Customer object and encapsulates it inside a Braintree_Result_Successful object, or encapsulates a Braintree_Errors object inside a Result_Error alternatively, throws an Unexpected exception if the response is invalid.
@ignore
Parameters
array $response gateway response values:
Return value
object Result_Successful or Result_Error
Throws
Braintree_Exception_Unexpected
2 calls to Braintree_Customer::_verifyGatewayResponse()
- Braintree_Customer::_doCreate in braintree_php/
lib/ Braintree/ Customer.php - sends the create request to the gateway
- Braintree_Customer::_doUpdate in braintree_php/
lib/ Braintree/ Customer.php - sends the update request to the gateway
File
- braintree_php/
lib/ Braintree/ Customer.php, line 532
Class
- Braintree_Customer
- Creates and manages Customers
Code
private static function _verifyGatewayResponse($response) {
if (isset($response['customer'])) {
// return a populated instance of Braintree_Customer
return new Braintree_Result_Successful(self::factory($response['customer']));
}
else {
if (isset($response['apiErrorResponse'])) {
return new Braintree_Result_Error($response['apiErrorResponse']);
}
else {
throw new Braintree_Exception_Unexpected("Expected customer or apiErrorResponse");
}
}
}