/** * @return MultipleValueNode */ public function type() { return TransactionSearch::type(); }
public function test_multipleValueNode_type_withRefund() { $customer = Braintree\Customer::createNoValidate(); $creditCard = Braintree\CreditCard::create(['customerId' => $customer->id, 'cardholderName' => 'Joe Everyman' . rand(), 'number' => '5105105105105100', 'expirationDate' => '05/12'])->creditCard; $sale = Braintree\Transaction::saleNoValidate(['amount' => Braintree\Test\TransactionAmounts::$authorize, 'paymentMethodToken' => $creditCard->token, 'options' => ['submitForSettlement' => true]]); $http = new Braintree\Http(Braintree\Configuration::$global); $path = Braintree\Configuration::$global->merchantPath() . '/transactions/' . $sale->id . '/settle'; $http->put($path); $refund = Braintree\Transaction::refund($sale->id)->transaction; $credit = Braintree\Transaction::creditNoValidate(['amount' => '100.00', 'paymentMethodToken' => $creditCard->token]); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::creditCardCardholderName()->is($creditCard->cardholderName), Braintree\TransactionSearch::type()->is($credit->type), Braintree\TransactionSearch::refund()->is(True)]); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($refund->id, $collection->firstItem()->id); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::creditCardCardholderName()->is($creditCard->cardholderName), Braintree\TransactionSearch::type()->is($credit->type), Braintree\TransactionSearch::refund()->is(False)]); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($credit->id, $collection->firstItem()->id); }