本文整理汇总了PHP中CRM_Core_Payment_Form::setBillingDetailsFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Payment_Form::setBillingDetailsFields方法的具体用法?PHP CRM_Core_Payment_Form::setBillingDetailsFields怎么用?PHP CRM_Core_Payment_Form::setBillingDetailsFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Payment_Form
的用法示例。
在下文中一共展示了CRM_Core_Payment_Form::setBillingDetailsFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setPaymentFieldsByProcessor
/**
* Add payment fields depending on payment processor. The payment processor can implement the following functions to override the built in fields.
*
* - getPaymentFormFields()
* - getPaymentFormFieldsMetadata()
* (planned - getBillingDetailsFormFields(), getBillingDetailsFormFieldsMetadata()
*
* Note that this code is written to accommodate the possibility CiviCRM will switch to implementing pay later as a manual processor in future
*
* @param CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main $form
* @param array $processor
* Array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors.
* @param bool $forceBillingFieldsForPayLater
* Display billing fields even for pay later.
*/
public static function setPaymentFieldsByProcessor(&$form, $processor, $forceBillingFieldsForPayLater = FALSE)
{
$form->billingFieldSets = array();
if ($processor != NULL) {
// ie it is pay later
$paymentFields = self::getPaymentFields($processor);
$paymentTypeName = self::getPaymentTypeName($processor);
$paymentTypeLabel = self::getPaymentTypeLabel($processor);
//@todo if we switch to iterating through $form->billingFieldSets we won't need to assign these directly
$form->assign('paymentTypeName', $paymentTypeName);
$form->assign('paymentTypeLabel', $paymentTypeLabel);
$form->billingFieldSets[$paymentTypeName]['fields'] = $form->_paymentFields = array_intersect_key(self::getPaymentFieldMetadata($processor), array_flip($paymentFields));
$form->billingPane = array($paymentTypeName => $paymentTypeLabel);
$form->assign('paymentFields', $paymentFields);
}
// @todo - replace this section with one similar to above per discussion - probably use a manual processor shell class to stand in for that capability
//return without adding billing fields if billing_mode = 4 (@todo - more the ability to set that to the payment processor)
// or payment processor is NULL (pay later)
if ($processor == NULL && !$forceBillingFieldsForPayLater || CRM_Utils_Array::value('billing_mode', $processor) == 4) {
return;
}
//@todo setPaymentFields defines the billing fields - this should be moved to the processor class & renamed getBillingFields
// potentially pay later would also be a payment processor
//also set the billingFieldSet to hold all the details required to render the fieldset so we can iterate through the fieldset - making
// it easier to re-order in hooks etc. The billingFieldSets param is used to determine whether to show the billing pane
CRM_Core_Payment_Form::setBillingDetailsFields($form);
$form->billingFieldSets['billing_name_address-group']['fields'] = array();
}
示例2: hackyHandlePayLaterInPaymentProcessorFunction
/**
* Set billing fields for pay later.
*
* This is considered hacky because pay later has basically been cludged onto the payment processor form.
*
* See notes on the deprecated function as to how this could be restructured. Alternatively this pay later
* handling could be moved out of the payment processor form all together.
*
* @param CRM_Core_Form $form
* @param int $forceBillingFieldsForPayLater
*/
protected static function hackyHandlePayLaterInPaymentProcessorFunction(&$form, $forceBillingFieldsForPayLater)
{
if ($forceBillingFieldsForPayLater) {
CRM_Core_Payment_Form::setBillingDetailsFields($form);
$form->billingFieldSets['billing_name_address-group']['fields'] = array();
}
}