*/
class CRM_Core_Payment_Form {
- /**
- * Add payment fields are depending on payment type
- * @deprecated - use the setPaymentFieldsByPaymentType which leverages the processor to determine the fields
- * @param int $type eg CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT
- * @param CRM_Core_Form $form
- */
- static public function setPaymentFieldsByType($type, &$form) {
- if ($type & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
- CRM_Core_Payment_Form::setDirectDebitFields($form);
- }
- else {
- CRM_Core_Payment_Form::setCreditCardFields($form);
- }
- }
-
/**
- * Add payment fields are depending on payment type
+ * Add payment fields are depending on payment processor
*
- * @param CRM_Core_Form $form
+ * @param CRM_Contribute_Form_Contribution| CRM_Contribute_Form_Contribution_Main $form
+ * @todo - add other forms specifically to the definition - since we don't have for $form - since we aren't adding the property to
+ * CRM_Core_Form (don't suppose we should?)
* @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
*/
static public function setPaymentFieldsByProcessor(&$form, $processor) {
$form->billingFieldSets = array();
$paymentFields = self::getPaymentFields($processor);
- dpm($paymentFields);
$paymentTypeName = self::getPaymentTypeName($processor);
$paymentTypeLabel = self::getPaymentTypeLabel($processor);
//@todo if we switch to iterating through the fieldsets we won't need to assign these directly
$form->assign('paymentFields', $paymentFields);
if ($processor['billing_mode'] != 4) {
//@todo setPaymentFields defines the billing fields - this should be moved to the processor class & renamed getBillingFields
+ // currently we just add the standard lot unless it's an off-site processor (& then add none)
//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. For not the billingFieldSets param is used to determine whether to show the billing pane
CRM_Core_Payment_Form::_setPaymentFields($form);
$form->billingFieldSets['billing_name_address-group']['fields'] = array();
}
}
+
/**
- * create all common fields needed for a credit card or direct debit transaction
+ * add general billing fields
+ * @todo set these like processor fields & let payment processors alter them
+ *
*
* @param $form
*
/**
* create all fields needed for a credit card transaction
- * @deprecated - use the setPaymentFieldsByPaymentType which leverages the processor to determine the fields
+ * @deprecated - use the setPaymentFieldsByProcessor which leverages the processor to determine the fields
* @param CRM_Core_Form $form
*
* @return void
* @param bool $useRequired
* @param array $paymentFields
*/
- static function addCommonFields(&$form, $useRequired, $paymentFields) {
+ protected static function addCommonFields(&$form, $useRequired, $paymentFields) {
foreach ($paymentFields as $name => $field) {
if (!empty($field['cc_field'])) {
if ($field['htmlType'] == 'chainSelect') {
/**
* create all fields needed for direct debit transaction
- * @deprecated - use the setPaymentFieldsByPaymentType which leverages the processor to determine the fields
+ * @deprecated - use the setPaymentFieldsByProcessor which leverages the processor to determine the fields
* @param $form
*
* @return void
}
/**
- * @param CRM_Core_Form $form
+ * @param CRM_Contribute_Form_Contribution| CRM_Contribute_Form_Contribution_Main|CRM_Member_Form_Membership $form
* @param array $processor array of properties including 'object' as loaded from CRM_Financial_BAO_PaymentProcessor::getPaymentProcessors
* @param bool $isBillingDataOptional
*
* @param $paymentFields
*/
- static function addRules(&$form, $paymentFields) {
+ protected static function addRules(&$form, $paymentFields) {
foreach ($paymentFields as $paymentField => $fieldSpecs) {
if (!empty($fieldSpecs['rules'])) {
foreach ($fieldSpecs['rules'] as $rule) {
*
* @param $form
*/
- static function addPaypalExpressCode(&$form) {
+ protected static function addPaypalExpressCode(&$form) {
if ($form->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) {
$form->_expressButtonName = $form->getButtonName('upload', 'express');
$form->assign('expressButtonName', $form->_expressButtonName);
/**
* Function to add all the direct debit fields
+ * @deprecated use buildPaymentForm
*
* @param $form
* @param bool $useRequired
/**
* function to get the credit card expiration year
* The date format for this field should typically be "M Y" (ex: Feb 2011) or "m Y" (02 2011)
- * This function exists only to make it consistant with getCreditCardExpirationMonth
+ * This function exists only to make it consistent with getCreditCardExpirationMonth
*
* @param $src
*