You are here

public static function Braintree_Transaction::search in Commerce Braintree 7

Returns a ResourceCollection of transactions 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/transaction-api#searching http://www.braintreepaymentsolutions.com/gateway/transaction-api}

Parameters

mixed $query search query:

array $options options such as page number:

Return value

object Braintree_ResourceCollection

Throws

InvalidArgumentException

40 calls to Braintree_Transaction::search()
Braintree_TransactionAdvancedSearchTest::testContains in braintree_php/tests/integration/TransactionAdvancedSearchTest.php
Braintree_TransactionAdvancedSearchTest::testEndsWith in braintree_php/tests/integration/TransactionAdvancedSearchTest.php
Braintree_TransactionAdvancedSearchTest::testIs in braintree_php/tests/integration/TransactionAdvancedSearchTest.php
Braintree_TransactionAdvancedSearchTest::testIsNot in braintree_php/tests/integration/TransactionAdvancedSearchTest.php
Braintree_TransactionAdvancedSearchTest::testNoMatches in braintree_php/tests/integration/TransactionAdvancedSearchTest.php

... See full list

File

braintree_php/lib/Braintree/Transaction.php, line 390

Class

Braintree_Transaction
Creates and manages transactions

Code

public static function search($query) {
  $criteria = array();
  foreach ($query as $term) {
    $criteria[$term->name] = $term
      ->toparam();
  }
  $response = braintree_http::post('/transactions/advanced_search_ids', array(
    'search' => $criteria,
  ));
  $pager = array(
    'className' => __CLASS__,
    'classMethod' => 'fetch',
    'methodArgs' => array(
      $query,
    ),
  );
  return new Braintree_ResourceCollection($response, $pager);
}