當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_Payment_Form::getCreditCardCSSNames方法代碼示例

本文整理匯總了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');
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:12,代碼來源:PaymentProcessorTest.php

示例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) . ';');
 }
開發者ID:FundingWorks,項目名稱:civicrm-core,代碼行數:8,代碼來源:Payment.php

示例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);
 }
開發者ID:archcidburnziso,項目名稱:civicrm-core,代碼行數:47,代碼來源:Main.php

示例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) . ';');
 }
開發者ID:nielosz,項目名稱:civicrm-core,代碼行數:10,代碼來源:Payment.php


注:本文中的CRM_Core_Payment_Form::getCreditCardCSSNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。