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]);
 }
 function testRefund_multiplePartialWithPayPal()
 {
     $nonce = Braintree_Test_Nonces::$paypalOneTimePayment;
     $transactionResult = Braintree_Transaction::sale(array('amount' => Braintree_Test_TransactionAmounts::$authorize, 'paymentMethodNonce' => $nonce, 'options' => array('submitForSettlement' => true)));
     $this->assertTrue($transactionResult->success);
     $originalTransaction = $transactionResult->transaction;
     Braintree_TestHelper::settle($originalTransaction->id);
     $firstRefund = Braintree_Transaction::refund($transactionResult->transaction->id, $transactionResult->transaction->amount / 2);
     $this->assertTrue($firstRefund->success);
     $firstRefundTransaction = $firstRefund->transaction;
     $secondRefund = Braintree_Transaction::refund($transactionResult->transaction->id, $transactionResult->transaction->amount / 2);
     $this->assertTrue($secondRefund->success);
     $secondRefundTransaction = $secondRefund->transaction;
     $updatedOriginalTransaction = Braintree_Transaction::find($originalTransaction->id);
     $expectedRefundIds = array($secondRefundTransaction->id, $firstRefundTransaction->id);
     $updatedRefundIds = $updatedOriginalTransaction->refundIds;
     $this->assertTrue(in_array($expectedRefundIds[0], $updatedRefundIds));
     $this->assertTrue(in_array($expectedRefundIds[1], $updatedRefundIds));
 }
Пример #3
0
 function createTransactionToRefund()
 {
     $transaction = Braintree_Transaction::saleNoValidate(array('amount' => '100.00', 'creditCard' => array('number' => '5105105105105100', 'expirationDate' => '05/12'), 'options' => array('submitForSettlement' => true)));
     Braintree_TestHelper::settle($transaction->id);
     return $transaction;
 }