function commerce_payflow_link_settings_form in Commerce PayPal 7.2
Payment method callback: settings form.
1 call to commerce_payflow_link_settings_form()
- commerce_paypal_ppa_settings_form in modules/
payflow/ commerce_payflow.module - Payment method callback: settings form.
File
- modules/
payflow/ commerce_payflow.module, line 319 - Implements PayPal Payments Advanced (U.S. only) and Payflow Link Hosted Checkout pages and Transparent Redirect.
Code
function commerce_payflow_link_settings_form($settings = array(), $payment_method = NULL) {
$form = array();
// Default to the Payflow Link payment method if none is passed in.
if (empty($payment_method)) {
$payment_method = commerce_payment_method_load('payflow_link');
}
// Merge default settings into the stored settings array.
$settings = (array) $settings + commerce_payflow_link_default_settings();
$form['service_description'] = array(
'#markup' => '<div>' . commerce_payflow_service_description($payment_method['method_id']) . ' ' . t('Your PayPal Manager login information should be used to configure these first four textfields.') . '<br /><br />' . t('<strong>Important:</strong> Refer to the <a href="!url" target="_blank">module documentation</a> to ensure your PayPal Manager service settings are configured properly.', array(
'!url' => 'http://drupal.org/node/1902734',
)) . '</div>',
);
// Add the Payflow account form fields.
$form['partner'] = array(
'#type' => 'textfield',
'#title' => t('Partner'),
'#description' => t('Either PayPal or the name of the reseller who registered your @title account.', array(
'@title' => $payment_method['title'],
)),
'#default_value' => $settings['partner'],
'#required' => TRUE,
);
$form['vendor'] = array(
'#type' => 'textfield',
'#title' => t('Merchant login'),
'#description' => t('The merchant login ID you chose when you created your @title account.', array(
'@title' => $payment_method['title'],
)),
'#default_value' => $settings['vendor'],
'#required' => TRUE,
);
$form['user'] = array(
'#type' => 'textfield',
'#title' => t('User'),
'#description' => t('The name of the user on the account you want to use to process transactions or the merchant login if you have not created users.'),
'#default_value' => $settings['user'],
'#required' => TRUE,
);
$form['password'] = array(
'#type' => 'password',
'#title' => t('Password'),
'#description' => t('The password created for the user specified in the previous textfield.'),
'#default_value' => $settings['password'],
'#required' => TRUE,
);
$form['mode'] = array(
'#type' => 'radios',
'#title' => t('Processing mode'),
'#description' => t('Either mode requires a @title account with Hosted Checkout Pages. "Enable Secure Token" must be set to "Yes" in the PayPal Manager service settings.', array(
'@title' => $payment_method['title'],
)),
'#options' => array(
'test' => 'Test - process test transactions to an account in test mode',
'live' => 'Live - process real transactions to a live account',
),
'#default_value' => $settings['mode'],
);
// Add the checkout and transaction option form elements.
$form['trxtype'] = array(
'#type' => 'radios',
'#title' => t('Default transaction type'),
'#options' => array(
'S' => t('Sale - authorize and capture the funds at the time the payment is processed'),
'A' => t('Authorization - reserve funds on the card to be captured later through your PayPal account'),
),
'#default_value' => $settings['trxtype'],
);
$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.') . '<br />' . t('Note: valid currencies will differ depending on your country and processor. Check before selecting a different currency.'),
'#options' => commerce_paypal_currencies($payment_method['method_id']),
'#default_value' => $settings['currency_code'],
);
$form['allow_supported_currencies'] = array(
'#type' => 'checkbox',
'#title' => t('Allow Express Checkout transactions to use any currency in the options list above.'),
'#description' => t('Transactions in unsupported currencies will still be converted into the default currency.') . '<br />' . t('In most cases, a single currency balance is the only option, so this should be tested thoroughly before being enabled on a live site.'),
'#default_value' => $settings['allow_supported_currencies'],
);
$form['payment_icons'] = array(
'#type' => 'checkboxes',
'#title' => t('Payment option icons to show on the checkout form'),
'#description' => t('Your payment processor and @title account settings may limit which of these payment options are actually available on the payment form.', array(
'@title' => $payment_method['title'],
)),
'#options' => array_diff_key(commerce_paypal_payment_methods(), array(
'echeck' => '',
)),
'#default_value' => $settings['payment_icons'],
);
$form['redirect_mode'] = array(
'#type' => 'radios',
'#title' => t('Checkout redirect mode'),
'#options' => array(
'iframe' => t('Stay on this site using an iframe to embed the hosted checkout page'),
'post' => t('Redirect to the hosted checkout page via POST through an automatically submitted form'),
'get' => t('Redirect to the hosted checkout page immediately with a GET request'),
),
'#default_value' => $settings['redirect_mode'],
);
$form['cancel_link'] = array(
'#type' => 'checkbox',
'#title' => t('Display a cancel link beneath the iframe of an embedded hosted checkout page.'),
'#default_value' => $settings['cancel_link'],
);
// Prepare a list of PayPal Express Checkout payment method rule options.
if (module_exists('commerce_paypal_ec')) {
$options = commerce_paypal_ec_enabled_rules();
}
else {
$options = array();
}
$form['paypal_ec_instance'] = array(
'#type' => 'select',
'#title' => t('PayPal Express Checkout payment method rule'),
'#description' => t('Specify the payment method rule that contains your corresponding PayPal Express Checkout configuration for this @title instance.', array(
'@title' => $payment_method['title'],
)) . '<br />' . t('If none is selected, you must disable Express Checkout in your Hosted Checkout Pages service settings in the PayPal Manager.'),
'#options' => $options,
'#default_value' => $settings['paypal_ec_instance'],
'#empty_value' => '',
);
$form['paypal_ec_disable'] = array(
'#type' => 'checkbox',
'#title' => t('Disable the selected PayPal Express Checkout payment method rule on the checkout form so customers just see the option on the hosted checkout page.'),
'#default_value' => $settings['paypal_ec_disable'],
);
$form['reference_transactions'] = array(
'#type' => 'checkbox',
'#title' => t('Enable reference transactions for payments captured through this @title account.', array(
'@title' => $payment_method['title'],
)),
'#description' => t('Contact PayPal if you are unsure if this option is available to you.'),
'#default_value' => $settings['reference_transactions'],
);
$form['ba_desc'] = array(
'#type' => 'textfield',
'#title' => t('Express Checkout billing agreement description'),
'#description' => t('If you have a PayPal account that supports reference transactions and need them for Express Checkout payments captured through @title, you must specify a billing agreement description.', array(
'@title' => $payment_method['title'],
)),
'#default_value' => $settings['ba_desc'],
);
$form['show_payment_instructions'] = array(
'#type' => 'checkbox',
'#title' => t('Show a message on the checkout form when @title is selected telling the customer to "Continue with checkout to complete payment via PayPal."', array(
'@title' => $payment_method['title'],
)),
'#default_value' => $settings['show_payment_instructions'],
);
$form['emailcustomer'] = array(
'#type' => 'checkbox',
'#title' => t('Instruct PayPal to e-mail payment receipts to your customers upon payment.'),
'#default_value' => $settings['emailcustomer'],
);
// Add the logging configuration form elements.
$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'],
);
/**
* @todo Uncomment this setting when Silent POST is integrated.
*
$form['silent_post_logging'] = array(
'#type' => 'radios',
'#title' => t('Silent POST logging'),
'#options' => array(
'notification' => t('Log notifications during validation and processing.'),
'full_post' => t('Log notifications with the full API request / response during validation and processing (used for debugging).'),
),
'#default_value' => $settings['silent_post_logging'],
);
*/
return $form;
}