You are here

function uc_stripe_settings_form in Ubercart Stripe 7.3

Same name and namespace in other branches
  1. 6.2 uc_stripe.module \uc_stripe_settings_form()
  2. 6 uc_stripe.module \uc_stripe_settings_form()
  3. 7 uc_stripe.module \uc_stripe_settings_form()
  4. 7.2 uc_stripe.module \uc_stripe_settings_form()

Provide configuration form for uc_stripe

Return value

mixed

1 string reference to 'uc_stripe_settings_form'
uc_stripe_uc_payment_gateway in ./uc_stripe.module
Implements hook_payment_gateway to register this payment gateway

File

./uc_stripe.module, line 403
A stripe.js PCI-compliant payment gateway Forked from Bitcookie's work (thanks!) which was posted at http://bitcookie.com/blog/pci-compliant-ubercart-and-stripe-js from discussion in the uc_stripe issue queue, https://www.drupal.org/node/1467886

Code

function uc_stripe_settings_form() {
  $form['uc_stripe_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Stripe settings'),
  );
  $form['uc_stripe_settings']['uc_stripe_api_key_test_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Test Secret Key'),
    '#default_value' => variable_get('uc_stripe_api_key_test_secret', ''),
    '#description' => t('Your Development Stripe API Key. Must be the "secret" key, not the "publishable" one.'),
  );
  $form['uc_stripe_settings']['uc_stripe_api_key_test_publishable'] = array(
    '#type' => 'textfield',
    '#title' => t('Test Publishable Key'),
    '#default_value' => variable_get('uc_stripe_api_key_test_publishable', ''),
    '#description' => t('Your Development Stripe API Key. Must be the "publishable" key, not the "secret" one.'),
  );
  $form['uc_stripe_settings']['uc_stripe_api_key_live_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Live Secret Key'),
    '#default_value' => variable_get('uc_stripe_api_key_live_secret', ''),
    '#description' => t('Your Live Stripe API Key. Must be the "secret" key, not the "publishable" one.'),
  );
  $form['uc_stripe_settings']['uc_stripe_api_key_live_publishable'] = array(
    '#type' => 'textfield',
    '#title' => t('Live Publishable Key'),
    '#default_value' => variable_get('uc_stripe_api_key_live_publishable', ''),
    '#description' => t('Your Live Stripe API Key. Must be the "publishable" key, not the "secret" one.'),
  );
  $form['uc_stripe_settings']['uc_stripe_element_styles_mode'] = array(
    '#type' => 'radios',
    '#title' => t('Basic / Advanced Stripe Card Element Styling'),
    '#options' => array(
      UC_STRIPE_BASIC_STYLES => t('Basic'),
      UC_STRIPE_ADVANCED_STYLES => t('Advanced'),
    ),
    '#default_value' => variable_get('uc_stripe_element_styles_mode', UC_STRIPE_BASIC_STYLES),
    '#description' => t('Basic styling allows simple modifications while advanced allows greater customization.'),
  );
  $form['uc_stripe_settings']['uc_stripe_element_styles'] = array(
    '#type' => 'textfield',
    '#title' => t('Style Settings for Stripe Card Element (Basic)'),
    '#description' => t('Enter your style settings as a simple comma-separated list (no quoted commas or pseudo-elements allowed). Example: fontSize: 16px, color: black, iconColor: blue (These styles modify the Stripe "base" styles, see <a target="_blank" href="@stripe-documentation">Stripe documentation</a>)', array(
      '@stripe-documentation' => 'https://stripe.com/docs/js/appendix/style',
    )),
    '#default_value' => variable_get('uc_stripe_element_styles', 'fontSize: 16px, color: black, iconColor: blue'),
    '#states' => array(
      'visible' => array(
        ':input[name="uc_stripe_element_styles_mode"]' => array(
          'value' => UC_STRIPE_BASIC_STYLES,
        ),
      ),
    ),
  );
  $form['uc_stripe_settings']['uc_stripe_element_styles_json'] = array(
    '#type' => 'textarea',
    '#title' => t('Style Settings for Stripe Card Element (Advanced)'),
    '#description' => t('Enter a value for the "style" element as a valid JSON-encoded string. Example: {"base":{"fontFamily":"Roboto, Open Sans, Segoe UI, sans-serif","fontSize":"16px","color":"#333333","iconColor":"blue","::placeholder":{"color":"#333333"}}}. Newlines and whitespace are allowed. See <a target="_blank" href="@stripe-documentation">Stripe documentation</a> for all variants.', array(
      '@stripe-documentation' => 'https://stripe.com/docs/js/appendix/style',
    )),
    '#default_value' => variable_get('uc_stripe_element_styles_json', '{}'),
    '#states' => array(
      'visible' => array(
        ':input[name="uc_stripe_element_styles_mode"]' => array(
          'value' => UC_STRIPE_ADVANCED_STYLES,
        ),
      ),
    ),
  );
  $email_text = _uc_stripe_get_authentication_required_email_text();
  $form['uc_stripe_settings']['uc_stripe_authentication_required_email'] = array(
    '#type' => 'textarea',
    '#title' => t('Email for Recurring payment authentication'),
    '#default_value' => variable_get('uc_stripe_authentication_required_email', $email_text),
    '#description' => t('If your site uses recurring payments, some transactions will require the customer to return to the site and authenticate before the subscrption payment can be processed.'),
  );
  $form['uc_stripe_settings']['uc_stripe_testmode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Test mode'),
    '#description' => 'Testing Mode: Stripe will use the development API key to process the transaction so the card will not actually be charged.',
    '#default_value' => variable_get('uc_stripe_testmode', TRUE),
  );
  $form['uc_stripe_settings']['uc_stripe_poweredby'] = array(
    '#type' => 'checkbox',
    '#title' => t('Powered by Stripe'),
    '#description' => 'Show "powered by Stripe" in checkout.',
    '#default_value' => variable_get('uc_stripe_poweredby', FALSE),
  );
  $form['uc_stripe_settings']['uc_stripe_metadata_titles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Metadata: Title'),
    '#description' => t('Include order item title(s) in Stripe metadata.'),
    '#default_value' => variable_get('uc_stripe_metadata_titles', FALSE),
  );
  $form['uc_stripe_settings']['uc_stripe_metadata_models'] = array(
    '#type' => 'checkbox',
    '#title' => t('Metadata: Model'),
    '#description' => t('Include item model(s) (SKU(s)) in Stripe metadata.'),
    '#default_value' => variable_get('uc_stripe_metadata_models', FALSE),
  );
  return $form;
}