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


PHP CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn方法代码示例

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


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

示例1: _checkFinancialRecords

 /**
  * @param array $params
  * @param $context
  */
 public function _checkFinancialRecords($params, $context)
 {
     $entityParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
     $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $params['id']));
     $this->assertEquals($contribution['total_amount'] - $contribution['fee_amount'], $contribution['net_amount']);
     if ($context == 'pending') {
         $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams);
         $this->assertNull($trxn, 'No Trxn to be created until IPN callback');
         return;
     }
     $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $trxnParams = array('id' => $trxn['financial_trxn_id']);
     if ($context != 'online' && $context != 'payLater') {
         $compareParams = array('to_financial_account_id' => 6, 'total_amount' => 100, 'status_id' => 1);
     }
     if ($context == 'feeAmount') {
         $compareParams['fee_amount'] = 50;
     } elseif ($context == 'online') {
         $compareParams = array('to_financial_account_id' => 12, 'total_amount' => 100, 'status_id' => 1);
     } elseif ($context == 'payLater') {
         $compareParams = array('to_financial_account_id' => 7, 'total_amount' => 100, 'status_id' => 2);
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
     $entityParams = array('financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item');
     $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $fitemParams = array('id' => $entityTrxn['entity_id']);
     $compareParams = array('amount' => 100, 'status_id' => 1, 'financial_account_id' => 1);
     if ($context == 'payLater') {
         $compareParams = array('amount' => 100, 'status_id' => 3, 'financial_account_id' => 1);
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
     if ($context == 'feeAmount') {
         $maxParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
         $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE));
         $trxnParams = array('id' => $maxTrxn['financial_trxn_id']);
         $compareParams = array('to_financial_account_id' => 5, 'from_financial_account_id' => 6, 'total_amount' => 50, 'status_id' => 1);
         $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC');
         $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
         $fitemParams = array('entity_id' => $trxnId['financialTrxnId'], 'entity_table' => 'civicrm_financial_trxn');
         $compareParams = array('amount' => 50, 'status_id' => 1, 'financial_account_id' => 5);
         $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
     }
 }
开发者ID:sdekok,项目名称:civicrm-core,代码行数:47,代码来源:ContributionTest.php

示例2: _checkFinancialRecords

 /**
  * @param array $params
  * @param $context
  */
 public function _checkFinancialRecords($params, $context)
 {
     $entityParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
     if ($context == 'pending') {
         $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams);
         $this->assertNull($trxn, 'No Trxn to be created until IPN callback');
         return;
     }
     $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $trxnParams = array('id' => $trxn['financial_trxn_id']);
     if ($context != 'online' && $context != 'payLater') {
         $compareParams = array('to_financial_account_id' => 6, 'total_amount' => 120, 'status_id' => 1);
     }
     if ($context == 'online') {
         $compareParams = array('to_financial_account_id' => 12, 'total_amount' => 120, 'status_id' => 1);
     } elseif ($context == 'payLater') {
         $compareParams = array('to_financial_account_id' => 7, 'total_amount' => 120, 'status_id' => 2);
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
     $entityParams = array('financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item');
     $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $fitemParams = array('id' => $entityTrxn['entity_id']);
     $compareParams = array('amount' => 100, 'status_id' => 1, 'financial_account_id' => $this->_getFinancialAccountId($this->financialtypeID));
     if ($context == 'payLater') {
         $compareParams = array('amount' => 100, 'status_id' => 3, 'financial_account_id' => $this->_getFinancialAccountId($this->financialtypeID));
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:32,代码来源:TaxContributionPageTest.php

示例3: _checkFinancialRecords

 /**
  * @param array $params
  * @param $context
  */
 public function _checkFinancialRecords($params, $context)
 {
     $entityParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
     $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $params['id']));
     $this->assertEquals($contribution['total_amount'] - $contribution['fee_amount'], $contribution['net_amount']);
     if ($context == 'pending') {
         $trxn = CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams);
         $this->assertNull($trxn, 'No Trxn to be created until IPN callback');
         return;
     }
     $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $trxnParams = array('id' => $trxn['financial_trxn_id']);
     if ($context != 'online' && $context != 'payLater') {
         $compareParams = array('to_financial_account_id' => 6, 'total_amount' => CRM_Utils_Array::value('total_amount', $params, 100), 'status_id' => 1);
     }
     if ($context == 'feeAmount') {
         $compareParams['fee_amount'] = 50;
     } elseif ($context == 'online') {
         $compareParams = array('to_financial_account_id' => 12, 'total_amount' => CRM_Utils_Array::value('total_amount', $params, 100), 'status_id' => 1, 'payment_instrument_id' => 1);
     } elseif ($context == 'payLater') {
         $compareParams = array('to_financial_account_id' => 7, 'total_amount' => CRM_Utils_Array::value('total_amount', $params, 100), 'status_id' => 2);
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
     $entityParams = array('financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item');
     $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $fitemParams = array('id' => $entityTrxn['entity_id']);
     $compareParams = array('amount' => CRM_Utils_Array::value('total_amount', $params, 100), 'status_id' => 1, 'financial_account_id' => CRM_Utils_Array::value('financial_account_id', $params, 1));
     if ($context == 'payLater') {
         $compareParams = array('amount' => CRM_Utils_Array::value('total_amount', $params, 100), 'status_id' => 3, 'financial_account_id' => CRM_Utils_Array::value('financial_account_id', $params, 1));
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
     if ($context == 'feeAmount') {
         $maxParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
         $maxTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($maxParams, TRUE));
         $trxnParams = array('id' => $maxTrxn['financial_trxn_id']);
         $compareParams = array('to_financial_account_id' => 5, 'from_financial_account_id' => 6, 'total_amount' => 50, 'status_id' => 1);
         $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['id'], 'DESC');
         $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
         $fitemParams = array('entity_id' => $trxnId['financialTrxnId'], 'entity_table' => 'civicrm_financial_trxn');
         $compareParams = array('amount' => 50, 'status_id' => 1, 'financial_account_id' => 5);
         $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
     }
     // This checks that empty Sales tax rows are not being created. If for any reason it needs to be removed the
     // line should be copied into all the functions that call this function & evaluated there
     // Be really careful not to remove or bypass this without ensuring stray rows do not re-appear
     // when calling completeTransaction or repeatTransaction.
     $this->callAPISuccessGetCount('FinancialItem', array('description' => 'Sales Tax', 'amount' => 0), 0);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:52,代码来源:CiviUnitTestCase.php

示例4: _checkFinancialRecords

 function _checkFinancialRecords($params, $context)
 {
     $entityParams = array('entity_id' => $params['id'], 'entity_table' => 'civicrm_contribution');
     $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $trxnParams = array('id' => $trxn['financial_trxn_id']);
     switch ($context) {
         case 'online':
             $compareParams = array('to_financial_account_id' => 12, 'total_amount' => 100, 'status_id' => 1);
             break;
         case 'offline':
             $compareParams = array('to_financial_account_id' => 6, 'total_amount' => 100, 'status_id' => 1);
             break;
         case 'payLater':
             $compareParams = array('to_financial_account_id' => 7, 'total_amount' => 100, 'status_id' => 2);
             break;
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams, $compareParams);
     $entityParams = array('financial_trxn_id' => $trxn['financial_trxn_id'], 'entity_table' => 'civicrm_financial_item');
     $entityTrxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
     $fitemParams = array('id' => $entityTrxn['entity_id']);
     if ($context == 'offline' || $context == 'online') {
         $compareParams = array('amount' => 100, 'status_id' => 1, 'financial_account_id' => 1);
     } elseif ($context == 'payLater') {
         $compareParams = array('amount' => 100, 'status_id' => 3, 'financial_account_id' => 1);
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialItem', $fitemParams, $compareParams);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:27,代码来源:ParticipantPaymentTest.php

示例5: testRetrieveEntityFinancialTrxn

 /**
  * check method retrieveEntityFinancialTrxn()
  */
 function testRetrieveEntityFinancialTrxn()
 {
     $entityTrxn = self::testCreateEntityTrxn();
     $params = array('entity_table' => 'civicrm_contribution', 'entity_id' => 1, 'financial_trxn_id' => $entityTrxn->financial_trxn_id, 'amount' => $entityTrxn->amount);
     CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($params);
     $entityResult = $this->assertDBNotNull('CRM_Financial_DAO_EntityFinancialTrxn', $entityTrxn->financial_trxn_id, 'amount', 'financial_trxn_id', 'Database check on added entity financial trxn record.');
     $this->assertEquals($entityResult, $entityTrxn->amount, 'Verify Amount for Financial Item');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:11,代码来源:FinancialItemTest.php

示例6: _checkFinancialTrxn

 /**
  * Check financial transaction.
  *
  * @todo break this down into sensible functions - most calls to it only use a few lines out of the big if.
  *
  * @param array $contribution
  * @param string $context
  * @param int $instrumentId
  * @param array $extraParams
  */
 public function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL, $extraParams = array())
 {
     $trxnParams = array('entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution');
     $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($trxnParams, TRUE));
     $params = array('id' => $trxn['financial_trxn_id']);
     if ($context == 'payLater') {
         $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
         $compareParams = array('status_id' => 1, 'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId));
     } elseif ($context == 'refund') {
         $compareParams = array('to_financial_account_id' => 6, 'total_amount' => -100, 'status_id' => 7, 'trxn_date' => '2015-01-01 09:00:00', 'trxn_id' => 'the refund');
     } elseif ($context == 'cancelPending') {
         $compareParams = array('to_financial_account_id' => 7, 'total_amount' => -100, 'status_id' => 3);
     } elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') {
         $entityParams = array('entity_id' => $contribution['id'], 'entity_table' => 'civicrm_contribution', 'amount' => -100);
         $trxn = current(CRM_Financial_BAO_FinancialItem::retrieveEntityFinancialTrxn($entityParams));
         $trxnParams1 = array('id' => $trxn['financial_trxn_id']);
         if (empty($extraParams)) {
             $compareParams = array('total_amount' => -100, 'status_id' => 1);
         } else {
             $compareParams = array('total_amount' => 100, 'status_id' => 1);
         }
         if ($context == 'paymentInstrument') {
             $compareParams += array('to_financial_account_id' => CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(4), 'payment_instrument_id' => 4);
         } else {
             $compareParams['to_financial_account_id'] = 12;
         }
         $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, array_merge($compareParams, $extraParams));
         $compareParams['total_amount'] = 100;
         if ($context == 'paymentInstrument') {
             $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId);
             $compareParams['payment_instrument_id'] = $instrumentId;
         } else {
             $compareParams['to_financial_account_id'] = 12;
         }
     }
     $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, array_merge($compareParams, $extraParams));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:47,代码来源:ContributionTest.php


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