function commerce_paypal_wpp_settings_form in Commerce PayPal 7
Same name and namespace in other branches
- 7.2 modules/wpp/commerce_paypal_wpp.module \commerce_paypal_wpp_settings_form()
Payment method callback: settings form.
File
- modules/
wpp/ commerce_paypal_wpp.module, line 98 - Implements PayPal Website Payments Pro in Drupal Commerce checkout.
Code
function commerce_paypal_wpp_settings_form($settings = array()) {
module_load_include('inc', 'commerce_payment', 'includes/commerce_payment.credit_card');
$form = array();
// Merge default settings into the stored settings array.
$settings = (array) $settings + commerce_paypal_wpp_default_settings();
$form['api_username'] = array(
'#type' => 'textfield',
'#title' => t('API username'),
'#default_value' => $settings['api_username'],
);
$form['api_password'] = array(
'#type' => 'textfield',
'#title' => t('API password'),
'#default_value' => $settings['api_password'],
);
$form['api_signature'] = array(
'#type' => 'textfield',
'#title' => t('Signature'),
'#default_value' => $settings['api_signature'],
);
$form['server'] = array(
'#type' => 'radios',
'#title' => t('PayPal server'),
'#options' => array(
'sandbox' => 'Sandbox - use for testing, requires a PayPal Sandbox account',
'live' => 'Live - use for processing real transactions',
),
'#default_value' => $settings['server'],
);
$form['card_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Limit accepted credit cards to the following types'),
'#description' => t('American Express is not available in the UK. Only MasterCard and Visa are available in Canada. If you enable Maestro or Solo, you must use GBP as your currency code.'),
'#options' => array_intersect_key(commerce_payment_credit_card_types(), drupal_map_assoc(array(
'visa',
'mastercard',
'amex',
'discover',
'maestro',
'solo',
))),
'#default_value' => $settings['card_types'],
'#required' => TRUE,
);
$form['code'] = array(
'#type' => 'checkbox',
'#title' => t('Require the card security code (i.e. CVV) to process credit card transactions.'),
'#description' => t('This should match the similar setting in your PayPal account.'),
'#default_value' => $settings['code'],
);
$form['currency_code'] = array(
'#type' => 'select',
'#title' => t('Default currency'),
'#description' => t('Transactions in other currencies will be converted to this currency, so multi-currency sites must be configured to use appropriate conversion rates.'),
'#options' => commerce_paypal_wpp_currencies(),
'#default_value' => $settings['currency_code'],
);
$form['allow_supported_currencies'] = array(
'#type' => 'checkbox',
'#title' => t('Allow transactions to use any currency in the options list above.'),
'#description' => t('Transactions in unsupported currencies will still be converted into the default currency.'),
'#default_value' => $settings['allow_supported_currencies'],
);
$form['txn_type'] = array(
'#type' => 'radios',
'#title' => t('Default credit card transaction type'),
'#description' => t('The default will be used to process transactions during checkout.'),
'#options' => array(
COMMERCE_CREDIT_AUTH_CAPTURE => t('Authorization and capture'),
COMMERCE_CREDIT_AUTH_ONLY => t('Authorization only (requires manual or automated capture after checkout)'),
),
'#default_value' => $settings['txn_type'],
);
$form['log'] = array(
'#type' => 'checkboxes',
'#title' => t('Log the following messages for debugging'),
'#options' => array(
'request' => t('API request messages'),
'response' => t('API response messages'),
),
'#default_value' => $settings['log'],
);
return $form;
}