public static function Braintree_Customer::search in Commerce Braintree 7
Returns a ResourceCollection of customers matching the search query.
If <b>query</b> is a string, the search will be a basic search. If <b>query</b> is a hash, the search will be an advanced search. For more detailed information and examples, see {@link http://www.braintreepayments.com/gateway/customer-api#searching http://www.braintreepaymentsolutions.com/gateway/customer-api}
Parameters
mixed $query search query:
array $options options such as page number:
Return value
object Braintree_ResourceCollection
Throws
InvalidArgumentException
5 calls to Braintree_Customer::search()
- Braintree_CustomerAdvancedSearchTest::test_createdAt in braintree_php/
tests/ integration/ CustomerAdvancedSearchTest.php - Braintree_CustomerAdvancedSearchTest::test_findDuplicateCardsGivenPaymentMethodToken in braintree_php/
tests/ integration/ CustomerAdvancedSearchTest.php - Braintree_CustomerAdvancedSearchTest::test_noMatches in braintree_php/
tests/ integration/ CustomerAdvancedSearchTest.php - Braintree_CustomerAdvancedSearchTest::test_noRequestsWhenIterating in braintree_php/
tests/ integration/ CustomerAdvancedSearchTest.php - Braintree_CustomerAdvancedSearchTest::test_searchOnTextFields in braintree_php/
tests/ integration/ CustomerAdvancedSearchTest.php
File
- braintree_php/
lib/ Braintree/ Customer.php, line 298
Class
- Braintree_Customer
- Creates and manages Customers
Code
public static function search($query) {
$criteria = array();
foreach ($query as $term) {
$criteria[$term->name] = $term
->toparam();
}
$response = braintree_http::post('/customers/advanced_search_ids', array(
'search' => $criteria,
));
$pager = array(
'className' => __CLASS__,
'classMethod' => 'fetch',
'methodArgs' => array(
$query,
),
);
return new Braintree_ResourceCollection($response, $pager);
}