本文整理汇总了PHP中CRM_Financial_BAO_PaymentProcessor::getPayments方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Financial_BAO_PaymentProcessor::getPayments方法的具体用法?PHP CRM_Financial_BAO_PaymentProcessor::getPayments怎么用?PHP CRM_Financial_BAO_PaymentProcessor::getPayments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Financial_BAO_PaymentProcessor
的用法示例。
在下文中一共展示了CRM_Financial_BAO_PaymentProcessor::getPayments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
//.........这里部分代码省略.........
$eventFull = CRM_Event_BAO_Participant::eventFull($this->_eventId, FALSE, CRM_Utils_Array::value('has_waitlist', $this->_values['event']));
$this->_allowWaitlist = $this->_isEventFull = FALSE;
if ($eventFull && !$this->_allowConfirmation) {
$this->_isEventFull = TRUE;
//lets redirecting to info only when to waiting list.
$this->_allowWaitlist = CRM_Utils_Array::value('has_waitlist', $this->_values['event']);
if (!$this->_allowWaitlist) {
CRM_Utils_System::redirect($infoUrl);
}
}
$this->set('isEventFull', $this->_isEventFull);
$this->set('allowWaitlist', $this->_allowWaitlist);
//check for require requires approval.
$this->_requireApproval = FALSE;
if (!empty($this->_values['event']['requires_approval']) && !$this->_allowConfirmation) {
$this->_requireApproval = TRUE;
}
$this->set('requireApproval', $this->_requireApproval);
if (isset($this->_values['event']['default_role_id'])) {
$participant_role = CRM_Core_OptionGroup::values('participant_role');
$this->_values['event']['participant_role'] = $participant_role["{$this->_values['event']['default_role_id']}"];
}
// check for is_monetary status
$isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
$isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
//check for variour combination for paylater, payment
//process with paid event.
if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
$ppID = CRM_Utils_Array::value('payment_processor', $this->_values['event']);
if (!$ppID) {
CRM_Core_Error::statusBounce(ts('A payment processor must be selected for this event registration page, or the event must be configured to give users the option to pay later (contact the site administrator for assistance).'), $infoUrl);
}
$ppIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $ppID);
$this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($ppIds, $this->_mode);
$this->set('paymentProcessors', $this->_paymentProcessors);
//set default payment processor
if (!empty($this->_paymentProcessors) && empty($this->_paymentProcessor)) {
foreach ($this->_paymentProcessors as $ppId => $values) {
if ($values['is_default'] == 1 || count($this->_paymentProcessors) == 1) {
$defaultProcessorId = $ppId;
break;
}
}
}
if (isset($defaultProcessorId)) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($defaultProcessorId, $this->_mode);
}
// make sure we have a valid payment class, else abort
if ($this->_values['event']['is_monetary']) {
if (!CRM_Utils_System::isNull($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $eachPaymentProcessor) {
// check selected payment processor is active
if (!$eachPaymentProcessor) {
CRM_Core_Error::fatal(ts('The site administrator must set a Payment Processor for this event in order to use online registration.'));
}
// ensure that processor has a valid config
$payment = CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this);
$error = $payment->checkConfig();
if (!empty($error)) {
CRM_Core_Error::fatal($error);
}
}
}
}
}
//init event fee.
示例2: preProcess
//.........这里部分代码省略.........
$this->_paymentProcessor = $this->get('paymentProcessor');
$this->_priceSetId = $this->get('priceSetId');
$this->_priceSet = $this->get('priceSet');
if (!$this->_values) {
// get all the values from the dao object
$this->_values = array();
$this->_fields = array();
CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values);
// check if form is active
if (!CRM_Utils_Array::value('is_active', $this->_values)) {
// form is inactive, die a fatal death
CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.'));
}
// also check for billing informatin
// get the billing location type
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array(), 'validate');
// CRM-8108 remove ts around Billing location type
//$this->_bltID = array_search( ts('Billing'), $locationTypes );
$this->_bltID = array_search('Billing', $locationTypes);
if (!$this->_bltID) {
CRM_Core_Error::fatal(ts('Please set a location type of %1', array(1 => 'Billing')));
}
$this->set('bltID', $this->_bltID);
// check for is_monetary status
$isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values);
$isPayLater = CRM_Utils_Array::value('is_pay_later', $this->_values);
//FIXME: to support multiple payment processors
if ($isMonetary && (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values))) {
$ppID = CRM_Utils_Array::value('payment_processor', $this->_values);
if (!$ppID) {
CRM_Core_Error::fatal(ts('A payment processor must be selected for this contribution page (contact the site administrator for assistance).'));
}
$ppIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $ppID);
$this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($ppIds, $this->_mode);
$this->set('paymentProcessors', $this->_paymentProcessors);
//set default payment processor
if (!empty($this->_paymentProcessors) && empty($this->_paymentProcessor)) {
foreach ($this->_paymentProcessors as $ppId => $values) {
if ($values['is_default'] == 1 || count($this->_paymentProcessors) == 1) {
$defaultProcessorId = $ppId;
break;
}
}
}
if (isset($defaultProcessorId)) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($defaultProcessorId, $this->_mode);
$this->assign_by_ref('paymentProcessor', $this->_paymentProcessor);
}
if (!CRM_Utils_System::isNull($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $eachPaymentProcessor) {
// check selected payment processor is active
if (empty($eachPaymentProcessor)) {
CRM_Core_Error::fatal(ts('A payment processor configured for this page might be disabled (contact the site administrator for assistance).'));
}
// ensure that processor has a valid config
$this->_paymentObject =& CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this);
$error = $this->_paymentObject->checkConfig();
if (!empty($error)) {
CRM_Core_Error::fatal($error);
}
}
}
}
// get price info
// CRM-5095
CRM_Price_BAO_PriceSet::initSet($this, $this->_id, 'civicrm_contribution_page');
示例3: simpledonate_civicrm_pageRun
function simpledonate_civicrm_pageRun(&$page)
{
$pageName = $page->getVar('_name');
if ($pageName == 'Civi\\Angular\\Page\\Main' && $page->urlPath[1] == 'simple') {
//Get all contribution page detils and session details to be used in js
$settingVal = simpledonate_getSimpleDonateSetting();
$session = CRM_Core_Session::singleton();
$contactID = $session->get('userID');
if ($settingVal['donatePageID']) {
$extends = CRM_Core_Component::getComponentID('CiviContribute');
$priceSetID = CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $settingVal['donatePageID'], $extends);
$priceField = civicrm_api3('PriceField', 'get', array("price_set_id" => $priceSetID));
//Check for is_quick_config
$isQuickConfig = civicrm_api3('PriceSet', 'getvalue', array('id' => $priceSetID, 'return' => "is_quick_config"));
//Check for Other amount
$otherAmount = FALSE;
foreach ($priceField['values'] as $key => $value) {
if ($value['name'] == 'other_amount') {
$otherAmount = TRUE;
} else {
$priceFieldVal = civicrm_api3('PriceFieldValue', 'get', array('return' => "amount, title, name, is_default", "price_field_id" => $value['id']));
$priceList = $priceFieldVal['values'];
$htmlPriceList[$value['html_type']] = $priceFieldVal['values'];
}
}
//Get donation page details
$donateConfig = $donatePage = civicrm_api3('ContributionPage', 'getsingle', array('id' => $settingVal['donatePageID']));
CRM_Utils_System::setTitle($donateConfig['title']);
// Set the page title
$currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency', $donatePage['currency'], 'symbol', 'name');
$test = !empty($_GET['test']) ? 'test' : 'live';
// Check for test or live donation
//Get payment processor details
if (is_array($donatePage['payment_processor'])) {
$paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($donatePage['payment_processor'], $test);
} else {
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($donatePage['payment_processor'], $test);
$paymentProcessors[$paymentProcessor['id']] = $paymentProcessor;
$paymentProcessors[$paymentProcessor['id']]['hide'] = $donateConfig['is_pay_later'] ? FALSE : TRUE;
}
//set Country and State value
$config = CRM_Core_Config::singleton();
$defaultContactCountry = $config->defaultContactCountry;
$stateProvince = array_flip(CRM_Core_PseudoConstant::stateProvinceForCountry($defaultContactCountry));
$countryList = CRM_Core_PseudoConstant::country();
$stateList = array();
foreach ($countryList as $key => $val) {
$stateList[$key] = CRM_Core_PseudoConstant::stateProvinceForCountry($key);
}
CRM_Core_Resources::singleton()->addSetting(array('simpledonate' => array('sessionContact' => $contactID, 'priceSetID' => $priceSetID, 'ziptasticEnable' => $settingVal['ziptasticEnable'], 'countryList' => CRM_Core_PseudoConstant::country(), 'stateList' => $stateList, 'country' => $defaultContactCountry, 'allStates' => $stateProvince, 'currency' => $currencySymbol, 'config' => $donateConfig, 'paymentProcessor' => $paymentProcessors, 'priceList' => $priceList, 'otherAmount' => $otherAmount, 'isTest' => $test == 'test' ? 1 : 0, 'htmlPriceList' => $htmlPriceList, 'isQuickConfig' => $isQuickConfig)));
//Include bootstrap and custom css files to affect this angular page only
CRM_Core_Resources::singleton()->addStyleFile('com.webaccessglobal.simpledonate', 'css/bootstrap.min.css', 103, 'page-header');
CRM_Core_Resources::singleton()->addStyleFile('com.webaccessglobal.simpledonate', 'css/simpledonate.css', 100, 'page-body');
}
if ($contactID) {
$id = array('id' => $contactID);
$result = civicrm_api3('Contact', 'getSingle', $id);
CRM_Core_Resources::singleton()->addSetting(array('simpledonateVal' => $result));
}
}
}