本文整理汇总了PHP中CRM_Core_Payment_Form::getCreditCardCSSNames方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Payment_Form::getCreditCardCSSNames方法的具体用法?PHP CRM_Core_Payment_Form::getCreditCardCSSNames怎么用?PHP CRM_Core_Payment_Form::getCreditCardCSSNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Payment_Form
的用法示例。
在下文中一共展示了CRM_Core_Payment_Form::getCreditCardCSSNames方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCreditCardCSSName
public function testCreditCardCSSName()
{
$params = array('name' => 'API_Test_PP_Type', 'title' => 'API Test Payment Processor Type', 'class_name' => 'CRM_Core_Payment_APITest', 'billing_mode' => 'form', 'payment_processor_type_id' => 1, 'is_recur' => 0, 'domain_id' => 1, 'accepted_credit_cards' => json_encode(array('Visa' => 'Visa', 'Mastercard' => 'Mastercard', 'Amex' => 'Amex')));
$paymentProcessor = CRM_Financial_BAO_PaymentProcessor::create($params);
$cards = CRM_Financial_BAO_PaymentProcessor::getCreditCards($paymentProcessor->id);
$CSSCards = CRM_Core_Payment_Form::getCreditCardCSSNames($cards);
$expectedCSSCards = array('visa' => 'Visa', 'mastercard' => 'Mastercard', 'amex' => 'Amex');
$this->assertEquals($CSSCards, $expectedCSSCards, 'Verify correct credit card types are returned');
$CSSCards2 = CRM_Core_Payment_Form::getCreditCardCSSNames(array());
$allCards = array('visa' => 'Visa', 'mastercard' => 'MasterCard', 'amex' => 'Amex', 'discover' => 'Discover');
$this->assertEquals($CSSCards2, $allCards, 'Verify correct credit card types are returned');
}
示例2: addCreditCardJs
/**
* Add JS to show icons for the accepted credit cards.
*/
public static function addCreditCardJs()
{
$creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames();
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10)->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';');
}
示例3: preProcessPaymentOptions
/**
* Handle Payment Processor switching
* For contribution and event registration forms
*/
static function preProcessPaymentOptions(&$form, $noFees = FALSE)
{
$form->_snippet = CRM_Utils_Array::value('snippet', $_GET);
$form->assign('snippet', $form->_snippet);
$form->_paymentProcessors = $noFees ? array() : $form->get('paymentProcessors');
$form->_ppType = NULL;
if ($form->_paymentProcessors) {
// Fetch type during ajax request
if (isset($_GET['type']) && $form->_snippet) {
$form->_ppType = $_GET['type'];
} elseif (!empty($form->_submitValues)) {
$form->_ppType = CRM_Utils_Array::value('payment_processor', $form->_submitValues);
$form->_paymentProcessor = CRM_Utils_Array::value($form->_ppType, $form->_paymentProcessors);
$form->set('type', $form->_ppType);
$form->set('mode', $form->_mode);
$form->set('paymentProcessor', $form->_paymentProcessor);
} else {
foreach ($form->_paymentProcessors as $values) {
if (!empty($values['is_default']) || count($form->_paymentProcessors) == 1) {
$form->_ppType = $values['id'];
break;
}
}
}
if ($form->_ppType) {
CRM_Core_Payment_ProcessorForm::preProcess($form);
}
//get payPal express id and make it available to template
foreach ($form->_paymentProcessors as $ppId => $values) {
$payPalExpressId = $values['payment_processor_type'] == 'PayPal_Express' ? $values['id'] : 0;
$form->assign('payPalExpressId', $payPalExpressId);
if ($payPalExpressId) {
break;
}
}
if (!$form->_snippet) {
// Add JS to show icons for the accepted credit cards
$creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames();
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10)->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';');
}
}
$form->assign('ppType', $form->_ppType);
}
示例4: addCreditCardJs
/**
* Add JS to show icons for the accepted credit cards.
*/
public static function addCreditCardJs($paymentProcessorID = NULL)
{
$creditCards = array();
$creditCards = CRM_Financial_BAO_PaymentProcessor::getCreditCards($paymentProcessorID);
$creditCardTypes = CRM_Core_Payment_Form::getCreditCardCSSNames($creditCards);
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Core/BillingBlock.js', 10)->addScript('CRM.config.creditCardTypes = ' . json_encode($creditCardTypes) . ';');
}