public function fetch($query, $ids) { $criteria = []; foreach ($query as $term) { $criteria[$term->name] = $term->toparam(); } $criteria["ids"] = SubscriptionSearch::ids()->in($ids)->toparam(); $path = $this->_config->merchantPath() . '/subscriptions/advanced_search'; $response = $this->_http->post($path, ['search' => $criteria]); return Util::extractAttributeAsArray($response['subscriptions'], 'subscription'); }
public function testExtractAttributeAsArrayReturnsArrayOfObjects() { $attributes = ['verification' => [['status' => 'val1']]]; $expected = new Braintree\CreditCardVerification(['status' => 'val1']); $this->assertEquals([$expected], Braintree\Util::extractAttributeAsArray($attributes, "verification")); }
public function fetchExpiring($startDate, $endDate, $ids) { $queryPath = $this->_config->merchantPath() . '/payment_methods/all/expiring?start=' . date('mY', $startDate) . '&end=' . date('mY', $endDate); $response = $this->_http->post($queryPath, ['search' => ['ids' => $ids]]); return Util::extractAttributeAsArray($response['paymentMethods'], 'creditCard'); }
public function testExtractAttributeAsArrayReturnsEmptyArray() { $attributes = []; $this->assertEquals([], Braintree\Util::extractAttributeAsArray($attributes, "foo")); }