public function searchUserInBrainTree($objUser) { echo 'searchUserInBrainTree'; // $braintree_id = '12'; $collection = Braintree_Customer::search([Braintree_CustomerSearch::id()->is($objUser->braintree_id), Braintree_CustomerSearch::addressFirstName()->is($objUser->full_name)]); // $customer = Braintree_Customer::find($objUser->braintree_id); // pr($customer); $arrUser = $collection->_ids; pr($arrUser); }
function test_paypalAccountEmail() { $nonce = Braintree_HttpClientApi::nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'PAYPAL_CONSENT_CODE'))); $customerId = 'UNIQUE_CUSTOMER_ID-' . strval(rand()); $customerResult = Braintree_Customer::create(array('paymentMethodNonce' => $nonce, 'id' => $customerId)); $this->assertTrue($customerResult->success); $customer = $customerResult->customer; $collection = Braintree_Customer::search(array(Braintree_CustomerSearch::id()->is($customer->id), Braintree_CustomerSearch::paypalAccountEmail()->is('*****@*****.**'))); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($customer->id, $collection->firstItem()->id); }
function test_createdAt() { $customer = Braintree_Customer::createNoValidate(); $past = clone $customer->createdAt; $past->modify("-1 hour"); $future = clone $customer->createdAt; $future->modify("+1 hour"); $collection = Braintree_Customer::search(array(Braintree_CustomerSearch::id()->is($customer->id), Braintree_CustomerSearch::createdAt()->between($past, $future))); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($customer->id, $collection->firstItem()->id); $collection = Braintree_Customer::search(array(Braintree_CustomerSearch::id()->is($customer->id), Braintree_CustomerSearch::createdAt()->lessThanOrEqualTo($future))); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($customer->id, $collection->firstItem()->id); $collection = Braintree_Customer::search(array(Braintree_CustomerSearch::id()->is($customer->id), Braintree_CustomerSearch::createdAt()->greaterThanOrEqualTo($past))); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($customer->id, $collection->firstItem()->id); }