You are here

public static function Braintree_SettlementBatchSummary::generate in Commerce Braintree 7

4 calls to Braintree_SettlementBatchSummary::generate()
Braintree_SettlementBatchSummaryTest::testGenerate_canBeGroupedByACustomField in braintree_php/tests/integration/SettlementBatchSummaryTest.php
Braintree_SettlementBatchSummaryTest::testGenerate_returnsAnEmptyCollectionWhenThereIsNoData in braintree_php/tests/integration/SettlementBatchSummaryTest.php
Braintree_SettlementBatchSummaryTest::testGenerate_returnsAnErrorIfTheDateCanNotBeParsed in braintree_php/tests/integration/SettlementBatchSummaryTest.php
Braintree_SettlementBatchSummaryTest::testGenerate_returnsTransactionsSettledOnAGivenDay in braintree_php/tests/integration/SettlementBatchSummaryTest.php

File

braintree_php/lib/Braintree/SettlementBatchSummary.php, line 4

Class

Braintree_SettlementBatchSummary

Code

public static function generate($settlement_date, $groupByCustomField = NULL) {
  $criteria = array(
    'settlement_date' => $settlement_date,
  );
  if (isset($groupByCustomField)) {
    $criteria['group_by_custom_field'] = $groupByCustomField;
  }
  $params = array(
    'settlement_batch_summary' => $criteria,
  );
  $response = Braintree_Http::post('/settlement_batch_summary', $params);
  if (isset($groupByCustomField)) {
    $response['settlementBatchSummary']['records'] = self::_underscoreCustomField($groupByCustomField, $response['settlementBatchSummary']['records']);
  }
  return self::_verifyGatewayResponse($response);
}