function uc_payment_method_paypal_ec in Ubercart 7.3
Same name and namespace in other branches
- 5 payment/uc_paypal/uc_paypal.module \uc_payment_method_paypal_ec()
- 6.2 payment/uc_paypal/uc_paypal.module \uc_payment_method_paypal_ec()
Handles the Express Checkout payment method.
1 call to uc_payment_method_paypal_ec()
- uc_paypal_wpp_settings_form in payment/
uc_paypal/ uc_paypal.module - Settings for Website Payments Pro on the credit card gateways form.
1 string reference to 'uc_payment_method_paypal_ec'
- uc_paypal_uc_payment_method in payment/
uc_paypal/ uc_paypal.module - Implements hook_uc_payment_method().
File
- payment/
uc_paypal/ uc_paypal.module, line 492 - Integrates various PayPal payment services and Instant Payment Notifications (IPN) with Ubercart!
Code
function uc_payment_method_paypal_ec($op, &$order) {
switch ($op) {
case 'order-view':
$txn_id = db_query("SELECT txn_id FROM {uc_payment_paypal_ipn} WHERE order_id = :id ORDER BY received ASC", array(
':id' => $order->order_id,
))
->fetchField();
if (empty($txn_id)) {
$txn_id = t('Unknown');
}
$build['#markup'] = t('Transaction ID:<br />@txn_id', array(
'@txn_id' => $txn_id,
));
return $build;
case 'settings':
$form['uc_paypal_wps_email'] = array(
'#type' => 'textfield',
'#title' => t('PayPal e-mail address'),
'#description' => t('The e-mail address you use for the PayPal account you want to receive payments.'),
'#default_value' => variable_get('uc_paypal_wps_email', ''),
);
// The DoDirectPayment API call allows fewer currencies than PayPal
// in general.
$form['uc_paypal_wpp_currency'] = array(
'#type' => 'select',
'#title' => t('Currency code'),
'#description' => t('Transactions can only be processed in one of the listed currencies.'),
'#options' => _uc_paypal_currency_array(),
'#default_value' => variable_get('uc_paypal_wpp_currency', 'USD'),
);
$form['uc_paypal_wpp_server'] = array(
'#type' => 'select',
'#title' => t('API server'),
'#description' => t('Sign up for and use a Sandbox account for testing.'),
'#options' => array(
'https://api-3t.sandbox.paypal.com/nvp' => t('Sandbox'),
'https://api-3t.paypal.com/nvp' => t('Live'),
),
'#default_value' => variable_get('uc_paypal_wpp_server', 'https://api-3t.sandbox.paypal.com/nvp'),
);
$form['api'] = array(
'#type' => 'fieldset',
'#title' => t('API credentials'),
'#description' => t('!link for information on obtaining credentials. You need to acquire an API Signature. If you have already requested API credentials, you can review your settings under the API Access section of your PayPal profile.', array(
'!link' => l(t('Click here'), 'https://developer.paypal.com/docs/classic/api/apiCredentials/'),
)),
'#collapsible' => TRUE,
'#collapsed' => variable_get('uc_paypal_api_username', '') != '',
);
$form['api']['uc_paypal_api_username'] = array(
'#type' => 'textfield',
'#title' => t('API username'),
'#default_value' => variable_get('uc_paypal_api_username', ''),
);
$form['api']['uc_paypal_api_password'] = array(
'#type' => 'textfield',
'#title' => t('API password'),
'#default_value' => variable_get('uc_paypal_api_password', ''),
);
$form['api']['uc_paypal_api_signature'] = array(
'#type' => 'textfield',
'#title' => t('Signature'),
'#default_value' => variable_get('uc_paypal_api_signature', ''),
);
$form['ec']['uc_paypal_ec_landingpage_style'] = array(
'#type' => 'radios',
'#title' => t('Default PayPal landing page'),
'#options' => array(
'Billing' => t('Credit card submission form.'),
'Login' => t('Account login form.'),
),
'#default_value' => variable_get('uc_paypal_ec_landingpage_style', 'Billing'),
);
$form['ec']['uc_paypal_ec_rqconfirmed_addr'] = array(
'#type' => 'checkbox',
'#title' => t('Require Express Checkout users to use a PayPal confirmed shipping address.'),
'#default_value' => variable_get('uc_paypal_ec_rqconfirmed_addr', FALSE),
);
$form['ec']['uc_paypal_ec_review_shipping'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the shipping select form on the Review payment page.'),
'#default_value' => variable_get('uc_paypal_ec_review_shipping', TRUE),
);
$form['ec']['uc_paypal_ec_review_company'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the company name box on the Review payment page.'),
'#default_value' => variable_get('uc_paypal_ec_review_company', TRUE),
);
$form['ec']['uc_paypal_ec_review_phone'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the contact phone number box on the Review payment page.'),
'#default_value' => variable_get('uc_paypal_ec_review_phone', TRUE),
);
$form['ec']['uc_paypal_ec_review_comment'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the comment text box on the Review payment page.'),
'#default_value' => variable_get('uc_paypal_ec_review_comment', TRUE),
);
$form['ec']['uc_pg_paypal_wpp_cc_txn_type'] = array(
'#type' => 'radios',
'#title' => t('Payment action'),
'#description' => t('"Complete sale" will authorize and capture the funds at the time the payment is processed.<br>"Authorization" will only reserve funds on the card to be captured later through your PayPal account.'),
'#options' => array(
// The keys here are constants defined in uc_credit,
// but uc_credit is not a dependency.
'auth_capture' => t('Complete sale'),
'authorize' => t('Authorization'),
),
'#default_value' => variable_get('uc_pg_paypal_wpp_cc_txn_type', 'auth_capture'),
);
return $form;
}
}