本文整理汇总了PHP中CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor方法的具体用法?PHP CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor怎么用?PHP CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_BAO_ContributionRecur
的用法示例。
在下文中一共展示了CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
/**
* Pre-processing for the form.
*
* @throws \Exception
*/
public function preProcess()
{
$this->setAction(CRM_Core_Action::UPDATE);
$this->contributionRecurID = CRM_Utils_Request::retrieve('crid', 'Integer', $this, FALSE);
if ($this->contributionRecurID) {
$this->_paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($this->contributionRecurID);
if (!$this->_paymentProcessor) {
CRM_Core_Error::statusBounce(ts('There is no valid processor for this subscription so it cannot be edited.'));
}
$this->_paymentProcessorObj = $this->_paymentProcessor['object'];
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->contributionRecurID);
}
$this->_coid = CRM_Utils_Request::retrieve('coid', 'Integer', $this, FALSE);
if ($this->_coid) {
$this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'info');
$this->_paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($this->_coid, 'contribute', 'obj');
$this->_subscriptionDetails = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($this->_coid, 'contribution');
$this->contributionRecurID = $this->_subscriptionDetails->recur_id;
} elseif ($this->contributionRecurID) {
$this->_coid = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $this->contributionRecurID, 'id', 'contribution_recur_id');
}
if (!$this->contributionRecurID || $this->_subscriptionDetails == CRM_Core_DAO::$_nullObject) {
CRM_Core_Error::fatal('Required information missing.');
}
if ($this->_subscriptionDetails->membership_id && $this->_subscriptionDetails->auto_renew) {
CRM_Core_Error::fatal(ts('You cannot update the subscription.'));
}
if (!CRM_Core_Permission::check('edit contributions')) {
$userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE);
if (!CRM_Contact_BAO_Contact_Utils::validChecksum($this->_subscriptionDetails->contact_id, $userChecksum)) {
CRM_Core_Error::fatal(ts('You do not have permission to update subscription.'));
}
$this->_selfService = TRUE;
}
$this->assign('self_service', $this->_selfService);
$this->editableScheduleFields = $this->_paymentProcessorObj->getEditableRecurringScheduleFields();
$changeHelpText = $this->_paymentProcessorObj->getRecurringScheduleUpdateHelpText();
if (!in_array('amount', $this->editableScheduleFields)) {
// Not sure if this is good behaviour - maintaining this existing behaviour for now.
CRM_Core_Session::setStatus($changeHelpText, ts('Warning'), 'alert');
} else {
$this->assign('changeHelpText', $changeHelpText);
}
$alreadyHardCodedFields = array('amount', 'installments');
foreach ($this->editableScheduleFields as $editableScheduleField) {
if (!in_array($editableScheduleField, $alreadyHardCodedFields)) {
$this->addField($editableScheduleField, array('entity' => 'ContributionRecur'));
}
}
$this->assign('editableScheduleFields', array_diff($this->editableScheduleFields, $alreadyHardCodedFields));
$this->assign('paymentProcessor', $this->_paymentProcessor);
$this->assign('frequency_unit', $this->_subscriptionDetails->frequency_unit);
$this->assign('frequency_interval', $this->_subscriptionDetails->frequency_interval);
if ($this->_subscriptionDetails->contact_id) {
list($this->_donorDisplayName, $this->_donorEmail) = CRM_Contact_BAO_Contact::getContactDetails($this->_subscriptionDetails->contact_id);
}
CRM_Utils_System::setTitle(ts('Update Recurring Contribution'));
// Handle context redirection.
CRM_Contribute_BAO_ContributionRecur::setSubscriptionContext();
}
示例2: listContribution
/**
* called when action is browse.
*/
public function listContribution()
{
$controller = new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), NULL, FALSE, FALSE, TRUE, FALSE);
$controller->setEmbedded(TRUE);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
//add honor block
$params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
if (!empty($params)) {
// assign vars to templates
$this->assign('honorRows', $params);
$this->assign('honor', TRUE);
}
$recur = new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
$recur->is_test = 0;
$recur->find();
$config = CRM_Core_Config::singleton();
$recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
$recurRow = array();
$recurIDs = array();
while ($recur->fetch()) {
$mode = $recur->is_test ? 'test' : 'live';
$paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
if (!$paymentProcessor) {
continue;
}
require_once 'api/v3/utils.php';
//@todo calling api functions directly is not supported
_civicrm_api3_object_to_array($recur, $values);
$values['recur_status'] = $recurStatus[$values['contribution_status_id']];
$recurRow[$values['id']] = $values;
$action = array_sum(array_keys(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard')));
$details = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recur->id, 'recur');
$hideUpdate = $details->membership_id & $details->auto_renew;
if ($hideUpdate) {
$action -= CRM_Core_Action::UPDATE;
}
$recurRow[$values['id']]['action'] = CRM_Core_Action::formLink(CRM_Contribute_Page_Tab::recurLinks($recur->id, 'dashboard'), $action, array('cid' => $this->_contactId, 'crid' => $values['id'], 'cxt' => 'contribution'), ts('more'), FALSE, 'contribution.dashboard.recurring', 'Contribution', $values['id']);
$recurIDs[] = $values['id'];
//reset $paymentObject for checking other paymenet processor
//recurring url
$paymentObject = NULL;
}
if (is_array($recurIDs) && !empty($recurIDs)) {
$getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
foreach ($getCount as $key => $val) {
$recurRow[$key]['completed'] = $val;
$recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
}
}
$this->assign('recurRows', $recurRow);
if (!empty($recurRow)) {
$this->assign('recur', TRUE);
} else {
$this->assign('recur', FALSE);
}
}
示例3: listContribution
/**
* This function is called when action is browse
*
* return null
* @access public
*/
function listContribution()
{
$controller =& new CRM_Core_Controller_Simple('CRM_Contribute_Form_Search', ts('Contributions'), null);
$controller->setEmbedded(true);
$controller->reset();
$controller->set('limit', 12);
$controller->set('cid', $this->_contactId);
$controller->set('context', 'user');
$controller->set('force', 1);
$controller->process();
$controller->run();
//add honor block
require_once 'CRM/Contribute/BAO/Contribution.php';
$params = array();
$params = CRM_Contribute_BAO_Contribution::getHonorContacts($this->_contactId);
if (!empty($params)) {
// assign vars to templates
$this->assign('honorRows', $params);
$this->assign('honor', true);
}
require_once 'CRM/Contribute/Form/ContributionBase.php';
require_once 'CRM/Contribute/BAO/ContributionRecur.php';
$recur =& new CRM_Contribute_DAO_ContributionRecur();
$recur->contact_id = $this->_contactId;
$recur->is_test = 0;
$recur->find();
$config =& CRM_Core_Config::singleton();
$recurStatus = CRM_Contribute_PseudoConstant::contributionStatus();
require_once 'CRM/Core/Payment.php';
require_once 'api/v2/utils.php';
$recurRow = array();
$recurIDs = array();
while ($recur->fetch()) {
$mode = $recur->is_test ? 'test' : 'live';
$paymentProcessor = CRM_Contribute_BAO_ContributionRecur::getPaymentProcessor($recur->id, $mode);
if (!$paymentProcessor) {
continue;
}
// note that we are passing a CRM_Core_Page object ($this) as if it were a form here:
$paymentObject =& CRM_Core_Payment::singleton($mode, 'Contribute', $paymentProcessor, $this);
_civicrm_object_to_array($recur, $values);
$values['cancelSubscriptionUrl'] = $paymentObject->cancelSubscriptionURL();
$values['recur_status'] = $recurStatus[$values['contribution_status_id']];
$recurRow[$values['id']] = $values;
$recurIDs[] = $values['id'];
//reset $paymentObject for checking other paymenet processor
//recurring url
$paymentObject = null;
}
if (is_array($recurIDs) && !empty($recurIDs)) {
$getCount = CRM_Contribute_BAO_ContributionRecur::getCount($recurIDs);
foreach ($getCount as $key => $val) {
$recurRow[$key]['completed'] = $val;
$recurRow[$key]['link'] = CRM_Utils_System::url('civicrm/contribute/search', "reset=1&force=1&recur={$key}");
}
}
$this->assign('recurRows', $recurRow);
if (!empty($recurRow)) {
$this->assign('recur', true);
} else {
$this->assign('recur', false);
}
}