You are here

function uc_payment_method_2checkout in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_2checkout/uc_2checkout.module \uc_payment_method_2checkout()
  2. 7.3 payment/uc_2checkout/uc_2checkout.module \uc_payment_method_2checkout()

Callback for 2Checkout payment method settings.

1 string reference to 'uc_payment_method_2checkout'
uc_2checkout_payment_method in payment/uc_2checkout/uc_2checkout.module
Implementation of hook_payment_method().

File

payment/uc_2checkout/uc_2checkout.module, line 91
Integrates 2Checkout.com's redirected payment service.

Code

function uc_payment_method_2checkout($op, &$arg1) {
  switch ($op) {
    case 'cart-details':
      if (variable_get('uc_2checkout_check', FALSE)) {
        if ($_SESSION['pay_method'] == 'CK') {
          $sel[2] = ' selected="selected"';
        }
        else {
          $sel[1] = ' selected="selected"';
        }
        unset($_SESSION['pay_method']);
        $details = '<div class="form-item"><b>' . t('Select your payment type:') . '</b> <select name="pay_method" class="form-select" id="edit-pay-method">' . '<option value="CC"' . $sel[1] . '>' . t('Credit card') . '</option>' . '<option value="CK"' . $sel[2] . '>' . t('Online check') . '</option></select></div>';
      }
      return $details;
    case 'cart-process':
      $_SESSION['pay_method'] = $_POST['pay_method'];
      return;
    case 'settings':
      $form['uc_2checkout_sid'] = array(
        '#type' => 'textfield',
        '#title' => t('Vendor account number'),
        '#description' => t('Your 2Checkout vendor account number.'),
        '#default_value' => variable_get('uc_2checkout_sid', ''),
        '#size' => 16,
      );
      $form['uc_2checkout_secret_word'] = array(
        '#type' => 'textfield',
        '#title' => t('Secret word for order verification'),
        '#description' => t('The secret word entered in your 2Checkout account Look and Feel settings.'),
        '#default_value' => variable_get('uc_2checkout_secret_word', 'tango'),
        '#size' => 16,
      );
      $form['uc_2checkout_demo'] = array(
        '#type' => 'checkbox',
        '#title' => t('Enable demo mode, allowing you to process fake orders for testing purposes.'),
        '#default_value' => variable_get('uc_2checkout_demo', TRUE),
      );
      $form['uc_2checkout_language'] = array(
        '#type' => 'select',
        '#title' => t('Language preference'),
        '#description' => t('Adjust language on 2Checkout pages.'),
        '#options' => array(
          'en' => t('English'),
          'sp' => t('Spanish'),
        ),
        '#default_value' => variable_get('uc_2checkout_language', 'en'),
      );
      $form['uc_2checkout_check'] = array(
        '#type' => 'checkbox',
        '#title' => t('Allow customers to choose to pay by credit card or online check.'),
        '#default_value' => variable_get('uc_2checkout_check', FALSE),
      );
      $form['uc_2checkout_method_title'] = array(
        '#type' => 'textfield',
        '#title' => t('Payment method title'),
        '#default_value' => variable_get('uc_2checkout_method_title', t('Credit card on a secure server:')),
      );
      $form['uc_2checkout_method_title_icons'] = array(
        '#type' => 'checkbox',
        '#title' => t('Show credit card icons beside the payment method title.'),
        '#default_value' => variable_get('uc_2checkout_method_title_icons', TRUE),
      );
      $form['uc_2checkout_checkout_button'] = array(
        '#type' => 'textfield',
        '#title' => t('Order review submit button text'),
        '#description' => t('Provide 2Checkout specific text for the submit button on the order review page.'),
        '#default_value' => variable_get('uc_2checkout_checkout_button', t('Submit Order')),
      );
      $form['uc_2checkout_checkout_type'] = array(
        '#type' => 'select',
        '#title' => t('2Checkout.com checkout type'),
        '#description' => t('Single page checkout only works for stores selling intangible products using credit card payments.'),
        '#options' => array(
          'multi' => t('Multi-page checkout'),
          'single' => t('Single page checkout'),
        ),
        '#default_value' => variable_get('uc_2checkout_checkout_type', 'multi'),
      );
      return $form;
  }
}