You are here

public static function Braintree_Subscription::fetch in Commerce Braintree 7

File

braintree_php/lib/Braintree/Subscription.php, line 71

Class

Braintree_Subscription
Braintree Subscription module

Code

public static function fetch($query, $ids) {
  $criteria = array();
  foreach ($query as $term) {
    $criteria[$term->name] = $term
      ->toparam();
  }
  $criteria["ids"] = Braintree_SubscriptionSearch::ids()
    ->in($ids)
    ->toparam();
  $response = Braintree_Http::post('/subscriptions/advanced_search', array(
    'search' => $criteria,
  ));
  return Braintree_Util::extractAttributeAsArray($response['subscriptions'], 'subscription');
}