You are here

function uc_stripe_requirements in Ubercart Stripe 6.2

Same name and namespace in other branches
  1. 8.3 uc_stripe.install \uc_stripe_requirements()
  2. 8.2 uc_stripe.install \uc_stripe_requirements()
  3. 6 uc_stripe.install \uc_stripe_requirements()
  4. 7.3 uc_stripe.install \uc_stripe_requirements()
  5. 7 uc_stripe.install \uc_stripe_requirements()
  6. 7.2 uc_stripe.install \uc_stripe_requirements()

Implements hook_requirements().

File

./uc_stripe.install, line 11
Installation file for the uc_stripe module.

Code

function uc_stripe_requirements($phase) {
  $t = get_t();
  $has_curl = function_exists('curl_init');
  $requirements['uc_stripe_curl'] = array(
    'title' => $t('cURL'),
    'value' => $has_curl ? $t('Enabled') : $t('Not found'),
  );
  if (!$has_curl) {
    $requirements['uc_stripe_curl']['severity'] = REQUIREMENT_ERROR;
    $requirements['uc_stripe_curl']['description'] = $t("The Stripe API requires the PHP <a href='!curl_url'>cURL</a> library.", array(
      '!curl_url' => 'http://php.net/manual/en/curl.setup.php',
    ));
  }
  if (!_uc_stripe_load_api()) {
    $requirements['uc_stripe_api']['title'] = $t('Stripe PHP API');
    $requirements['uc_stripe_api']['value'] = $t('Not Installed');
    $requirements['uc_stripe_api']['severity'] = REQUIREMENT_ERROR;
    $requirements['uc_stripe_api']['description'] = $t('The Stripe PHP API is not installed or cannot be loaded.');
  }
  if ($phase == 'runtime' && !_uc_stripe_check_api_keys()) {
    $requirements['uc_stripe_keys']['title'] = $t('Stripe API Keys.');
    $requirements['uc_stripe_keys']['value'] = $t('Not configured');
    $requirements['uc_stripe_keys']['severity'] = REQUIREMENT_ERROR;
    $requirements['uc_stripe_keys']['description'] = $t('The Stripe API keys are not fully configured.');
  }
  if ($phase == 'runtime' && (!variable_get('uc_checkout_skip_review', FALSE) || !module_exists('uc_optional_checkout_review') || variable_get('uc_credit_validate_numbers', FALSE))) {
    $requirements['uc_stripe_config']['title'] = $t('Ubercart Configuration for Stripe.');
    $requirements['uc_stripe_config']['value'] = $t('Incorrect');
    $requirements['uc_stripe_config']['severity'] = REQUIREMENT_ERROR;
    $requirements['uc_stripe_config']['description'] = $t('For PCI-DSS compliance, Ubercart Checkout Skip Review must be enabled and uc_credit credit card number validation must be disabled.');
  }
  return $requirements;
}