The README explains that there are a couple of required code libraries. We should have hook_requirements that checks to see if they exist and include information on the status report.

- Download the Recurly PHP library from
https://github.com/recurly/recurly-client-php and place it in
sites/all/libraries so that "recurly.php" is located at
sites/all/libraries/recurly/lib/recurly.php.
- If using the Recurly.js module, also download the Recurly.js library from
https://github.com/recurly/recurly-js and place it in libraries so that
"recurly.js" is located at sites/all/libraries/recurly-js/build/recurly.js.

Comments

quicksketch’s picture

Yep, this would be a good idea. Additionally, I think we should prevent Recurly.js and Recurly Hosted Pages from being enabled at the same time, since they're alternatives to each other.

eojthebrave’s picture

Status: Active » Needs review
StatusFileSize
new2.97 KB

Here's a patch that adds a requirements check to both the recurly module the recurlyjs module for their respective libraries.

quicksketch’s picture

StatusFileSize
new3.89 KB

Thanks, I added an extra check into Recurly Hosted to report an error if it's turned on the same time as Recurly.js also.

quicksketch’s picture

Status: Needs review » Fixed

Committed and pushed.

blasthaus’s picture

The Recurly SDK requires cURL, we could also push this in (and I'll take it out of commerce_recurly) since it would actually be better in the core module. Since you just committed #3, I didn't roll a patch. Let me know if you want one.

<?php
function commerce_recurly_requirements($phase) {
  // Skip the requirements check if SimpleTest is installed to avoid multiple
  // cURL rows.
  if (module_exists('simpletest')) {
    return;
  }

  $t = get_t();

  $has_curl = function_exists('curl_init');

  $requirements['commerce_recurly_requirements'] = array(
    'title' => $t('cURL'),
    'value' => $has_curl ? $t('Enabled') : $t('Not found'),
  );

  if (!$has_curl) {
    $requirements['commerce_recurly_requirements'] += array(
      'severity' => REQUIREMENT_ERROR,
      'description' => $t("Commerce Recurly requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')),
    );
  }

  return $requirements;
}
?>
quicksketch’s picture

Status: Fixed » Needs work

Thanks, another good suggestion. :)

I'll put it in when I'm at a stopping point today.

quicksketch’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.