_formName = CRM_Utils_Request::retrieve('formName', 'String', $this); $this->_values['custom_pre_id'] = CRM_Utils_Request::retrieve('pre_profile_id', 'Integer', $this); $this->_paymentProcessorID = CRM_Utils_Request::retrieve('processor_id', 'Integer', CRM_Core_DAO::$_nullObject, TRUE); $this->currency = CRM_Utils_Request::retrieve('currency', 'String', CRM_Core_DAO::$_nullObject, TRUE); $this->paymentInstrumentID = CRM_Utils_Request::retrieve('payment_instrument_id', 'Integer'); $this->isBackOffice = CRM_Utils_Request::retrieve('is_back_office', 'Integer'); $this->assignBillingType(); $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($this->_paymentProcessorID); CRM_Core_Payment_ProcessorForm::preProcess($this); self::addCreditCardJs($this->_paymentProcessorID); $this->assign('paymentProcessorID', $this->_paymentProcessorID); $this->assign('currency', $this->currency); $this->assign('suppressForm', TRUE); $this->controller->_generateQFKey = FALSE; } /** * Get currency * * @param array $submittedValues * Required for consistency with other form methods. * * @return string */ public function getCurrency($submittedValues = array()) { return $this->currency; } /** * Build quickForm. */ public function buildQuickForm() { CRM_Core_Payment_ProcessorForm::buildQuickForm($this); } /** * Set default values for the form. */ public function setDefaultValues() { $contactID = $this->getContactID(); CRM_Core_Payment_Form::setDefaultValues($this, $contactID); return $this->_defaults; } /** * Add JS to show icons for the accepted credit cards. * * @param int $paymentProcessorID * @param string $region */ public static function addCreditCardJs($paymentProcessorID = NULL, $region = 'billing-block') { $creditCards = CRM_Financial_BAO_PaymentProcessor::getCreditCards($paymentProcessorID); $creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames($creditCards); CRM_Core_Resources::singleton() // CRM-20516: add BillingBlock script on billing-block region // to support this feature in payment form snippet too. ->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10, $region, FALSE) // workaround for CRM-13634 // ->addSetting(array('config' => array('creditCardTypes' => $creditCardTypes))); ->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';', '-9999', $region); } }