function testGenerate_canBeGroupedByACustomField() { $transaction = Braintree_Transaction::saleNoValidate(array('amount' => '100.00', 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12'), 'customFields' => array('store_me' => 'custom value'), 'options' => array('submitForSettlement' => true))); Braintree_TestHelper::settle($transaction->id); $today = new Datetime(); $result = Braintree_SettlementBatchSummary::generate(Braintree_TestHelper::nowInEastern(), 'store_me'); $this->assertTrue($result->success); $this->assertTrue(count($result->settlementBatchSummary->records) > 0); $this->assertArrayHasKey('store_me', $result->settlementBatchSummary->records[0]); }
/** * * @param array $response * @return \Braintree_Result_Successful|\Braintree_Result_Error * @throws Braintree_Exception_Unexpected */ private function _verifyGatewayResponse($response) { if (isset($response['settlementBatchSummary'])) { return new Braintree_Result_Successful(Braintree_SettlementBatchSummary::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 function test() { $today = new Datetime(); $result = Braintree_SettlementBatchSummary::generate($today->format("Y-m-d")); echo '<pre>'; print_r($result); }