class Braintree_SettlementBatchSummary in Commerce Braintree 7
Hierarchy
- class \Braintree
Expanded class hierarchy of Braintree_SettlementBatchSummary
File
- braintree_php/
lib/ Braintree/ SettlementBatchSummary.php, line 2
View source
class Braintree_SettlementBatchSummary extends Braintree {
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);
}
private static function _underscoreCustomField($groupByCustomField, $records) {
$updatedRecords = array();
foreach ($records as $record) {
$camelized = Braintree_Util::delimiterToCamelCase($groupByCustomField);
$record[$groupByCustomField] = $record[$camelized];
unset($record[$camelized]);
$updatedRecords[] = $record;
}
return $updatedRecords;
}
private static function _verifyGatewayResponse($response) {
if (isset($response['settlementBatchSummary'])) {
return new Braintree_Result_Successful(self::factory($response['settlementBatchSummary']));
}
else {
if (isset($response['apiErrorResponse'])) {
return new Braintree_Result_Error($response['apiErrorResponse']);
}
else {
throw new Braintree_Exception_Unexpected("Expected settlementBatchSummary or apiErrorResponse");
}
}
}
public static function factory($attributes) {
$instance = new self();
$instance
->_initialize($attributes);
return $instance;
}
/**
* @ignore
*/
protected function _initialize($attributes) {
$this->_attributes = $attributes;
}
public function records() {
return $this->_attributes['records'];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Braintree:: |
public static | function | ||
Braintree:: |
public | function | ||
Braintree:: |
protected | function | @ignore don't permit cloning the instances (like $x = clone $v) | |
Braintree:: |
protected | function | @ignore don't permit an explicit call of the constructor! (like $t = new Braintree_Transaction()) | 1 |
Braintree:: |
public | function | returns private/nonexistent instance properties @ignore @access public | |
Braintree:: |
public | function | used by isset() and empty() @access public | |
Braintree_SettlementBatchSummary:: |
public static | function | ||
Braintree_SettlementBatchSummary:: |
public static | function | ||
Braintree_SettlementBatchSummary:: |
public | function | ||
Braintree_SettlementBatchSummary:: |
protected | function | @ignore | |
Braintree_SettlementBatchSummary:: |
private static | function | ||
Braintree_SettlementBatchSummary:: |
private static | function |