CRM_Core_Payment_Form
class CRM_Core_Payment_Form
Class for constructing the payment processor block.
Methods
Add payment fields depending on payment processor.
Add general billing fields.
Get the payment fields that apply to this processor.
No description
Get the billing fields that apply to this processor.
No description
No description
No description
No description
No description
Validate the payment instrument values before passing it to the payment processor.
The credit card pseudo constant results only the CC label, not the key ID So we normalize the name to use it as a CSS class.
Make sure that credit card number and cvv are valid.
Map address fields.
Get the credit card expiration month.
Get the credit card expiration year.
Details
at line 58
static
setPaymentFieldsByProcessor(CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main $form, array $processor, int $billing_profile_id = NULL, bool $isBackOffice = FALSE, int $paymentInstrumentID = NULL)
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
at line 88
static protected
setBillingAddressFields(CRM_Core_Form $form, CRM_Core_Payment $processor)
Add general billing fields.
at line 116
static protected
addCommonFields(CRM_Core_Form $form, array $paymentFields)
Add the payment fields to the template.
Generally this is the payment processor fields & the billing fields required for the payment processor. However, this has been complicated by adding pay later billing fields into this mix
We now have the situation where the required fields cannot be set as required on the form level if they are required for the payment processor, as another processor might be selected and the validation will then be incorrect.
However, if they are required for pay later we DO set them on the form level, presumably assuming they will be required whatever happens.
As a side-note this seems to re-enforce the argument for making pay later operate as a payment processor rather than as a 'special thing on its own'.
at line 150
static array
getPaymentFields(array $paymentProcessor)
Get the payment fields that apply to this processor.
at line 159
static array
getPaymentFieldMetadata(array $paymentProcessor)
at line 175
static array
getBillingAddressFields(array $paymentProcessor, int $billingLocationID)
Get the billing fields that apply to this processor.
at line 187
static array
getBillingAddressMetadata(array $paymentProcessor, int $billingLocationID)
at line 200
static string
getPaymentTypeName(array $paymentProcessor)
at line 209
static string
getPaymentTypeLabel(array $paymentProcessor)
at line 232
static bool
buildPaymentForm(CRM_Contribute_Form_AbstractEditPayment|CRM_Contribute_Form_Contribution_Main|CRM_Core_Payment_ProcessorForm|CRM_Contribute_Form_UpdateBilling $form, array $processor, int|string $billing_profile_id, bool $isBackOffice, int $paymentInstrumentID = NULL)
at line 255
static protected
addRules($form, $paymentFields)
at line 280
static
validatePaymentInstrument(int $payment_processor_id, array $values, array $errors, int $billing_profile_id)
Validate the payment instrument values before passing it to the payment processor.
We want this to be able to be overridden by the payment processor, and default to using this object's validCreditCard for credit cards (implemented as the default in the Payment class).
at line 290
static
getCreditCardCSSNames($creditCards = array())
The credit card pseudo constant results only the CC label, not the key ID So we normalize the name to use it as a CSS class.
at line 313
static
setDefaultValues(CRM_Core_Form $form, int $contactID)
Set default values for the form.
at line 339
static
validateCreditCard(array $values, array $errors, int $processorID = NULL)
Make sure that credit card number and cvv are valid.
Called within the scope of a QF formRule function
at line 368
static
mapParams(int $id, array $src, array $dst, bool $reverse = FALSE)
Map address fields.
at line 406
static int
getCreditCardExpirationMonth($src)
Get the credit card expiration month.
The date format for this field should typically be "M Y" (ex: Feb 2011) or "m Y" (02 2011) See CRM-9017
at line 423
static int
getCreditCardExpirationYear($src)
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 consistent with getCreditCardExpirationMonth