本文整理汇总了PHP中Braintree_Customer::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Customer::search方法的具体用法?PHP Braintree_Customer::search怎么用?PHP Braintree_Customer::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Braintree_Customer
的用法示例。
在下文中一共展示了Braintree_Customer::search方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchUserInBrainTree
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);
}
示例2: test_createdAt
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);
}
示例3: test_throwsIfNoOperatorNodeGiven
function test_throwsIfNoOperatorNodeGiven()
{
$this->setExpectedException('InvalidArgumentException', 'Operator must be provided');
Braintree_Customer::search(array(Braintree_CustomerSearch::creditCardExpirationDate()));
}
示例4: _selectBulk
/**
* Selects bulk of customers to process
*
* @param Datetime $startDate
* @param Datetime $endDate
*/
protected function _selectBulk($startDate, $endDate = null)
{
if (is_null($endDate)) {
$endDate = new Datetime();
}
try {
$customers = Braintree_Customer::search(array(Braintree_CustomerSearch::createdAt()->between($startDate, $endDate)));
} catch (Exception $e) {
Mage::logException($e);
$customers = false;
}
if ($customers) {
if ($customers->maximumCount() == 0) {
return;
} else {
if ($customers->maximumCount() >= self::BULK_MAX_SIZE) {
$this->_output('There are more than ' . self::BULK_MAX_SIZE . ' customers in interval between ' . $startDate->format('Y-m-d') . ' and ' . $endDate->format('Y-m-d') . '. Selecting smaller periods');
$customers = false;
}
}
}
if ($customers === false) {
$median = clone $startDate;
$interval = new DateInterval('P' . ceil($endDate->diff($startDate)->days / 2) . 'D');
$median->add($interval);
$this->_selectBulk($startDate, $median);
$this->_selectBulk($median, $endDate);
} else {
$this->_processBulk($customers);
}
}
示例5: DateTime
if (isset($_GET['action']) && $_GET['action'] == 'generateNewCustomer') {
$faker = Faker\Factory::create();
$firstName = $faker->firstName;
$lastName = $faker->lastName;
$createCustomer = Braintree_Customer::create(['firstName' => $firstName, 'lastName' => $lastName, 'company' => $faker->company, 'email' => $firstName . "." . $lastName . "@dummy.com", 'phone' => $faker->phoneNumber, 'fax' => $faker->phoneNumber]);
if ($createCustomer->success) {
echo '<div class="alert alert-success" role="alert">Customer "' . $firstName . " " . $lastName . '" is generated.</div>';
} else {
echo "<div class='alert alert-danger' role='alert'>{$createCustomer->message}</div>";
}
}
// continue loading customers page
$now = new DateTime();
$past = clone $now;
$past = $past->modify("-5 month");
$customerCollection = Braintree_Customer::search([Braintree_CustomerSearch::createdAt()->between($past, $now)]);
?>
<div class="page-header">
<h1>Customers <small>click payment method to charge</small></h1>
</div>
<a href="./customers.php?action=generateNewCustomer" class="btn btn-primary">Generate new customer</a>
<br/><br/>
<table class="table table-striped">
<thead>
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>