Braintree\TransactionSearch::settledAt PHP Method

settledAt() public static method

public static settledAt ( )
    public static function settledAt()
    {
        return new RangeNode("settledAt");
    }

Usage Example

 public function test_rangeNode_settledAt()
 {
     $transaction = Braintree\Transaction::saleNoValidate(['amount' => '1000.00', 'creditCard' => ['number' => '4111111111111111', 'expirationDate' => '05/12'], 'options' => ['submitForSettlement' => true]]);
     $http = new Braintree\Http(Braintree\Configuration::$global);
     $path = Braintree\Configuration::$global->merchantPath() . '/transactions/' . $transaction->id . '/settle';
     $http->put($path);
     $transaction = Braintree\Transaction::find($transaction->id);
     $twenty_min_ago = date_create("now -20 minutes", new DateTimeZone("UTC"));
     $ten_min_ago = date_create("now -10 minutes", new DateTimeZone("UTC"));
     $ten_min_from_now = date_create("now +10 minutes", new DateTimeZone("UTC"));
     $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::settledAt()->between($twenty_min_ago, $ten_min_ago)]);
     $this->assertEquals(0, $collection->maximumCount());
     $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::settledAt()->between($ten_min_ago, $ten_min_from_now)]);
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($transaction->id, $collection->firstItem()->id);
 }