本文整理汇总了PHP中Braintree_Customer::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Customer::factory方法的具体用法?PHP Braintree_Customer::factory怎么用?PHP Braintree_Customer::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_Customer
的用法示例。
在下文中一共展示了Braintree_Customer::factory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGet_givesErrorIfInvalidProperty
function testGet_givesErrorIfInvalidProperty()
{
$this->setExpectedException('PHPUnit_Framework_Error', 'Undefined property on Braintree_Customer: foo');
$c = Braintree_Customer::factory(array());
$c->foo;
}
示例2: _verifyGatewayResponse
/**
* 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
* @param array $response gateway response values
* @return object Result_Successful or Result_Error
* @throws Braintree_Exception_Unexpected
*/
private function _verifyGatewayResponse($response)
{
if (isset($response['customer'])) {
// return a populated instance of Braintree_Customer
return new Braintree_Result_Successful(Braintree_Customer::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");
}
}
}