You are here

function uc_paypal_uc_payment_method in Ubercart 7.3

Implements hook_uc_payment_method().

File

payment/uc_paypal/uc_paypal.module, line 110
Integrates various PayPal payment services and Instant Payment Notifications (IPN) with Ubercart!

Code

function uc_paypal_uc_payment_method() {
  $title1 = '<img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif" alt="PayPal" class="uc-credit-cctype" />' . ' ' . t('PayPal - pay without sharing your financial information.');
  $title2 = '<br /><span id="paypal-includes">' . t('Includes:');
  $cc_types = array(
    'visa' => t('Visa'),
    'mastercard' => t('MasterCard'),
    'discover' => t('Discover'),
    'amex' => t('American Express'),
    'echeck' => t('eCheck'),
  );
  foreach ($cc_types as $type => $label) {
    $title2 .= ' ' . theme('image', array(
      'path' => drupal_get_path('module', 'uc_credit') . '/images/' . $type . '.gif',
      'alt' => $label,
      'attributes' => array(
        'class' => array(
          'uc-credit-cctype',
          'uc-credit-cctype-' . $type,
        ),
      ),
    ));
  }
  $title2 .= ' <img src="https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif" alt="PayPal" class="uc-credit-cctype" /></span>';
  $methods[] = array(
    'id' => 'paypal_wps',
    'name' => t('PayPal Website Payments Standard'),
    'title' => $title1 . $title2,
    'review' => t('PayPal'),
    'desc' => t('Redirect users to submit payments through PayPal.'),
    'callback' => 'uc_payment_method_paypal_wps',
    'redirect' => 'uc_paypal_wps_form',
    'weight' => 1,
    'checkout' => FALSE,
    'no_gateway' => TRUE,
  );
  $methods[] = array(
    'id' => 'paypal_ec',
    'name' => t('PayPal Express Checkout'),
    'title' => $title1,
    'review' => t('PayPal'),
    'desc' => t('Complete orders through PayPal Express Checkout.'),
    'callback' => 'uc_payment_method_paypal_ec',
    'weight' => 1,
    'checkout' => FALSE,
    'no_gateway' => TRUE,
    'express' => 'uc_paypal_ec_form',
  );
  return $methods;
}