当前位置: 首页>>代码示例>>PHP>>正文


PHP Braintree_Transaction::search方法代码示例

本文整理汇总了PHP中Braintree_Transaction::search方法的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Transaction::search方法的具体用法?PHP Braintree_Transaction::search怎么用?PHP Braintree_Transaction::search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Braintree_Transaction的用法示例。


在下文中一共展示了Braintree_Transaction::search方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: searchTransactions

 public function searchTransactions()
 {
     $transactions = Braintree_Transaction::search($data);
     if ($transactions) {
         return $transactions;
     } else {
         return false;
     }
 }
开发者ID:pmward,项目名称:Codeigniter-Braintree-v.zero-test-harness,代码行数:9,代码来源:braintree_model.php

示例2: _prepareCollection

 /**
  * Prepare the collection for the report
  *
  * @return $this|Mage_Adminhtml_Block_Widget_Grid
  */
 protected function _prepareCollection()
 {
     // Add in a new collection
     $collection = new Varien_Data_Collection();
     // Init the wrapper
     $wrapper = Mage::getModel('gene_braintree/wrapper_braintree');
     // Validate the credentials
     if ($wrapper->validateCredentials()) {
         // Grab all transactions
         $transactions = Braintree_Transaction::search($this->_prepareBraintreeSearchQuery());
         // Retrieve the order IDs
         $orderIds = array();
         /* @var $transaction Braintree_Transaction */
         foreach ($transactions as $transaction) {
             $orderIds[] = $transaction->orderId;
         }
         // Retrieve all of the orders from a collection
         $orders = Mage::getResourceModel('sales/order_collection')->addAttributeToFilter('increment_id', array('in' => $orderIds));
         /* @var $transaction Braintree_Transaction */
         foreach ($transactions as $transaction) {
             // Create a new varien object
             $transactionItem = new Varien_Object();
             $transactionItem->setData((array) $transaction->_attributes);
             // Grab the Magento order from the previously built collection
             /* @var $magentoOrder Mage_Sales_Model_Order */
             $magentoOrder = $orders->getItemByColumnValue('increment_id', $transaction->orderId);
             // Set the Magento Order ID into the collection
             // Not all transactions maybe coming from Magento
             if ($magentoOrder && $magentoOrder->getId()) {
                 $transactionItem->setMagentoOrderId($magentoOrder->getId());
                 $transactionItem->setOrderStatus($magentoOrder->getStatus());
             } else {
                 $transactionItem->setOrderStatus('<em>Unknown</em>');
             }
             // Add the item into the collection
             $collection->addItem($transactionItem);
         }
     } else {
         // If the Braintree details aren't valid take them to the configuration page
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('gene_braintree')->__('You must enter valid details into the Braintree v.zero - Configuration payment method before viewing transactions.'));
         // Send the users on their way
         Mage::app()->getResponse()->setRedirect(Mage::helper('adminhtml')->getUrl('/system_config/edit/section/payment') . '#payment_gene_braintree-head');
         Mage::app()->getResponse()->sendResponse();
         // Stop processing this method
         return false;
     }
     $this->setCollection($collection);
     parent::_prepareCollection();
     return $this;
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:55,代码来源:Grid.php

示例3: subscriptions

 public function subscriptions()
 {
     /*
     //test for members operate after subscription change
     $this->BillingSubscription->Behaviors->load('Billing.Limitable', array(
     	'remoteModel' => 'GroupLimit',
     	'remoteField' => 'members_limit',
     	'scope' => 'owner_id',
     ));
     $this->BillingSubscription->membersOperate(71);
     exit();
     */
     $this->layout = 'profile_new';
     $this->BillingSubscription->recursive = -1;
     $subscriptions = $this->BillingSubscription->find('all', array('conditions' => array('BillingSubscription.user_id' => $this->currUser['User']['id'], 'BillingSubscription.active' => true)));
     //maybe buggy
     foreach ($subscriptions as $key => $subscription) {
         if (isset($subscription['BraintreeSubscription']->status) && $subscription['BraintreeSubscription']->status == 'Canceled') {
             unset($subscriptions[$key]);
             $sameGroupCount = Hash::extract($subscriptions, "{n}.BillingSubscription[group_id=" . $subscription['BillingSubscription']['group_id'] . "]");
             if (count($sameGroupCount) > 0) {
                 $this->BillingSubscription->cancel($subscription['BillingSubscription']['id']);
             }
         } else {
             $this->BillingGroup->recursive = -1;
             $this->BillingGroup->unbindTranslations();
             $subscriptions[$key] = Hash::merge($subscriptions[$key], $this->BillingGroup->find('first', array('conditions' => array('BillingGroup.id' => $subscription['BillingSubscription']['group_id']), 'callbacks' => false)));
             $this->BillingPlan->recursive = -1;
             $this->BillingPlan->unbindTranslations();
             $billingPlans = $this->BillingPlan->find('first', array('conditions' => array('BillingPlan.id' => $subscription['BillingSubscription']['plan_id'])));
             unset($billingPlans['BraintreePlan']);
             $subscriptions[$key] = Hash::merge($subscriptions[$key], $billingPlans);
         }
     }
     $this->BillingPlan->recursive = 0;
     $plans = $this->BillingPlan->find('all');
     foreach ($plans as $plan) {
         $subscribedInGroup = Hash::extract($subscriptions, "{n}.BillingSubscription[group_id=" . $plan['BillingPlan']['group_id'] . "]");
         if ($plan['BillingPlan']['free'] == true && empty($subscribedInGroup)) {
             $subscriptions[] = Hash::merge(array('BillingSubscription' => array('group_id' => $plan['BillingPlan']['group_id'], 'plan_id' => $plan['BillingPlan']['id'], 'user_id' => $this->currUser['User']['id'], 'remote_subscription_id' => null, 'remote_plan_id' => null, 'limit_value' => $plan['BillingPlan']['limit_value'], 'active' => true, 'status' => 'Active', 'expires' => null, 'created' => $this->currUser['User']['created'], 'modified' => $this->currUser['User']['modified'])), $plan);
         }
     }
     $subscriptions = Hash::sort($subscriptions, '{n}.BillingSubscription.group_id', 'asc');
     $transactions = Braintree_Transaction::search([Braintree_TransactionSearch::customerId()->is('konstruktor-' . $this->currUser['User']['id'])]);
     $this->set(compact('subscriptions', 'transactions', 'plans'));
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:46,代码来源:BillingUserController.php

示例4: date_default_timezone_set

<?php

date_default_timezone_set('America/Chicago');
require_once 'lib/Braintree.php';
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('5xwqxqd7pkqwxfjs');
Braintree_Configuration::publicKey('8pfkt34wzyvrnnwy');
Braintree_Configuration::privateKey('8b63a0ae59085a11912527848633b848');
$output = fopen('transaction_report.csv', 'w');
fputcsv($output, ['id', 'type', 'amount', 'status', 'created_at', 'service_fee_amount', 'merchant_account_id']);
$now = new DateTime();
$yesterday = $now->modify('-365 day');
$transactions = Braintree_Transaction::search([Braintree_TransactionSearch::settledAt()->greaterThanOrEqualTo($yesterday)]);
foreach ($transactions as $transaction) {
    $id = $transaction->id;
    $type = $transaction->type;
    $amount = $transaction->amount;
    $status = $transaction->status;
    $createdAt = $transaction->createdAt->format('d/m/Y H:i:s');
    $serviceFeeAmount = $transaction->serviceFeeAmount;
    $merchantAccountId = $transaction->merchantAccountId;
    $csvrow = [$id, $type, $amount, $status, $createdAt, $serviceFeeAmount, $merchantAccountId];
    fputcsv($output, $csvrow);
}
echo "Download the CSV file <a href='transaction_report.csv'>Download</a>";
开发者ID:KLBombaStick,项目名称:BrainTree,代码行数:25,代码来源:report.php

示例5: test_advancedSearchGivesIterableResult

 function test_advancedSearchGivesIterableResult()
 {
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::creditCardNumber()->startsWith("411111")));
     $this->assertTrue($collection->maximumCount() > 100);
     $arr = array();
     foreach ($collection as $transaction) {
         array_push($arr, $transaction->id);
     }
     $unique_transaction_ids = array_unique(array_values($arr));
     $this->assertEquals($collection->maximumCount(), count($unique_transaction_ids));
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:11,代码来源:TransactionAdvancedSearchTest.php

示例6: get_transactions

 public function get_transactions()
 {
     return Braintree_Transaction::search(array());
 }
开发者ID:sahartak,项目名称:storage,代码行数:4,代码来源:Braintree_lib.php

示例7: index

 /**
  * Provides statistic reports
  * @param $id - project id
  */
 public function index($id)
 {
     $this->loadModel('FinanceAccount');
     $this->loadModel('Group');
     $this->loadModel('Project');
     $accounts = $this->FinanceAccount->search((int) $id);
     $fromMonth = $this->request->query('fromMonth');
     $accountId = $this->request->query('accountId');
     $groupProjectId = $this->request->query('groupProjectId');
     if ($groupProjectId == 'none') {
         $groupProjectId = null;
     }
     if ($groupProjectId) {
         $project = $this->Project->findById($this->request->query('groupProjectId'));
         $accountId = Hash::get($project, 'Project.finance_account_id');
         $categoryId = Hash::get($project, 'Project.finance_category_id');
     } else {
         if (!$fromMonth) {
             $fromMonth = date('Y-m');
         }
         if (!$accountId && !empty($accounts['aFinanceAccount'])) {
             $currAccount = current($accounts['aFinanceAccount']);
             $accountId = $currAccount['FinanceAccount']['id'];
         }
         $categoryId = null;
     }
     $this->loadModel('FinanceProject');
     $project = $this->FinanceProject->getProject((int) $id, true);
     $this->loadModel('FinanceCategory');
     $this->loadModel('FinanceBudget');
     $budget = $this->FinanceBudget->search((int) $id, $accountId, null, $categoryId);
     $currency = @$accounts['aFinanceAccount'][$accountId]['FinanceAccount']['currency'];
     $month1 = date('Y-m', strtotime($fromMonth));
     $month2 = date('Y-m', strtotime('+1 month', strtotime($fromMonth)));
     $month3 = date('Y-m', strtotime('+2 month', strtotime($fromMonth)));
     $month4 = date('Y-m', strtotime('+3 month', strtotime($fromMonth)));
     $report = $this->FinanceCategory->getBudget((int) $id, $accountId, $month1, $month2, $month3, $month4, $categoryId);
     $this->set($budget + $report + $project + $accounts + compact('id', 'accountId', 'groupProjectId', 'currency', 'month1', 'month2', 'month3', 'month4', 'fromMonth'));
     //для фильтров по проектам
     $conditions = array('Group.finance_project_id' => $id);
     $group = $this->Group->find('first', compact('conditions'));
     $this->set('group', $group);
     $conditions = array('Project.group_id' => Hash::get($group, 'Group.id'), 'NOT' => array('Project.finance_account_id' => null, 'Project.finance_category_id' => null));
     $aProjectOptions = $this->Project->find('all', compact('conditions'));
     $aProjectOptions = Hash::combine($aProjectOptions, '{n}.Project.id', '{n}.Project.title');
     $this->set('aProjectOptions', $aProjectOptions);
     $conditions = array('Project.group_id' => Hash::get($group, 'Group.id'), 'NOT' => array('Project.finance_category_id' => null));
     //TODO ФИнансовый отчет
     $this->loadModel('Task');
     $this->loadModel('Subproject');
     $this->loadModel('FinanceOperation');
     $this->loadModel('CrmTask');
     $this->loadModel('InvestProject');
     //$this->loadModel('BillingPlan');
     //$this->loadModel('BillingSubscription');
     $projectsFull = $this->Project->find('all', compact('conditions'));
     $projectsFull = Hash::combine($projectsFull, '{n}.Project.id', '{n}');
     $conditions = array('Subproject.project_id' => Hash::extract($projectsFull, '{n}.Project.id'));
     $subprojectsFull = $this->Subproject->find('all', compact('conditions'));
     $subprojectsFull = Hash::combine($subprojectsFull, '{n}.Subproject.id', '{n}');
     $conditions = array('Task.subproject_id' => Hash::extract($subprojectsFull, '{n}.Subproject.id'));
     $taskFull = $this->Task->find('all', compact('conditions'));
     $taskFull = Hash::combine($taskFull, '{n}.Task.id', '{n}');
     //		$conditions = array(
     //			'FinanceOperation.account_id' => Hash::extract($taskFull, '{n}.Task.id'),
     //		);
     //		$finOperationFull = $this->FinanceOperation->find('all',compact('conditions'));
     //		$finOperationFull = Hash::combine($finOperationFull, '{n}.FinanceOperation.id', '{n}');
     $conditions = array('CrmTask.task_id' => Hash::extract($taskFull, '{n}.Task.id'));
     $crmTaskFull = $this->CrmTask->find('all', compact('conditions'));
     $crmTaskFull = Hash::combine($crmTaskFull, '{n}.CrmTask.task_id', '{n}');
     //		$conditions = array(
     //			'FinanceAccount.project_id' => $id,
     //		);
     //$financeAccountFull = $this->FinanceAccount->find('all',compact('conditions'));
     //$financeAccountFull = Hash::combine($financeAccountFull, '{n}.FinanceAccount.id', '{n}');
     //echo strtotime('+1 month', strtotime($fromMonth));
     foreach ($taskFull as $key => $item) {
         $taskFull[$key]['Task']['fullExpense_m1'] = $this->FinanceAccount->fullExpense($item['CrmTask']['account_id'], strtotime($fromMonth), null, strtotime('+1 month', strtotime($fromMonth)));
         $taskFull[$key]['Task']['fullIncome_m1'] = $this->FinanceAccount->fullIncome($item['CrmTask']['account_id'], strtotime($fromMonth), null, strtotime('+1 month', strtotime($fromMonth)));
         $taskFull[$key]['Task']['fullExpense_m2'] = $this->FinanceAccount->fullExpense($item['CrmTask']['account_id'], strtotime('+1 month', strtotime($fromMonth)), null, strtotime('+2 month', strtotime($fromMonth)));
         $taskFull[$key]['Task']['fullIncome_m2'] = $this->FinanceAccount->fullIncome($item['CrmTask']['account_id'], strtotime('+1 month', strtotime($fromMonth)), null, strtotime('+2 month', strtotime($fromMonth)));
     }
     $transactions = Braintree_Transaction::search([Braintree_TransactionSearch::customerId()->is('konstruktor-' . $this->currUser['User']['id'])]);
     $transact = array();
     $transact['month1'] = 0;
     $transact['month2'] = 0;
     foreach ($transactions as $transaction) {
         $trans_stamp = $transaction->updatedAt->getTimestamp();
         if ($trans_stamp >= strtotime($fromMonth) && $trans_stamp < strtotime('+1 month', strtotime($fromMonth))) {
             $transact['month1'] += $transaction->amount;
         }
         if ($trans_stamp >= strtotime('+1 month', strtotime($fromMonth)) && $trans_stamp < strtotime('+2 month', strtotime($fromMonth))) {
             $transact['month2'] += $transaction->amount;
         }
         //echo $transaction->amount.' '.$transaction->currencyIsoCode." - ".$transaction->updatedAt->format('Y-m-d H:i:s');
//.........这里部分代码省略.........
开发者ID:nilBora,项目名称:konstruktor,代码行数:101,代码来源:FinanceBudgetController.php

示例8: testHandlesPayPalAccounts

 function testHandlesPayPalAccounts()
 {
     $http = new Braintree_HttpClientApi(Braintree_Configuration::$global);
     $nonce = $http->nonceForPayPalAccount(array('paypal_account' => array('access_token' => 'PAYPAL_ACCESS_TOKEN')));
     $result = Braintree_Transaction::sale(array('amount' => Braintree_Test_TransactionAmounts::$authorize, 'paymentMethodNonce' => $nonce));
     $this->assertTrue($result->success);
     $paypalDetails = $result->transaction->paypalDetails;
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::paypalPaymentId()->is($paypalDetails->paymentId), Braintree_TransactionSearch::paypalAuthorizationId()->is($paypalDetails->authorizationId), Braintree_TransactionSearch::paypalPayerEmail()->is($paypalDetails->payerEmail)));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($result->transaction->id, $collection->firstItem()->id);
 }
开发者ID:Flesh192,项目名称:magento,代码行数:11,代码来源:TransactionAdvancedSearchTest.php

示例9: transactions

 public function transactions()
 {
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::ids()->in($this->transactionIds)));
     return $collection;
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:5,代码来源:Disbursement.php

示例10: test_handles_search_timeout

 function test_handles_search_timeout()
 {
     $this->setExpectedException('Braintree_Exception_DownForMaintenance');
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::amount()->is('-5')));
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:5,代码来源:TransactionAdvancedSearchTest.php


注:本文中的Braintree_Transaction::search方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。