function commerce_stripe_load_library in Commerce Stripe 7
Same name and namespace in other branches
- 7.3 commerce_stripe.module \commerce_stripe_load_library()
- 7.2 commerce_stripe.module \commerce_stripe_load_library()
Brings the stripe php client library into scope
7 calls to commerce_stripe_load_library()
- commerce_stripe_cardonfile_charge in ./
commerce_stripe.module - Card on file callback: background charge payment TODO: implement proper return codes per commerce payment
- commerce_stripe_cardonfile_delete in ./
commerce_stripe.module - Card on file callback: deletes the associated customer payment profile.
- commerce_stripe_cardonfile_update in ./
commerce_stripe.module - Card on file callback: updates the associated customer payment profile.
- commerce_stripe_refund_form in includes/
commerce_stripe.admin.inc - Form callback for processing refunds.
- commerce_stripe_refund_form_submit in includes/
commerce_stripe.admin.inc - Submit callback for submitting refunds to Stripe.
File
- ./
commerce_stripe.module, line 1088 - This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.
Code
function commerce_stripe_load_library() {
$library = libraries_load('stripe-php');
if (!$library || empty($library['loaded'])) {
watchdog('commerce_stripe', 'Failure to load Stripe API PHP Client Library.', array(), WATCHDOG_CRITICAL);
return FALSE;
}
else {
$minimum_version = '1.17.1';
$maximum_version = '1.18.0';
$message = "Commerce Stripe is currently tested with stripe-php library versions @minimum_version through @maximum_version. You are using version @installed_version, and you should @upgrade_or_downgrade.";
//check that it's not lower than the minimum required version
if (version_compare($library['version'], $minimum_version, '<')) {
$variables = array(
'@minimum_version' => $minimum_version,
'@maximum_version' => $maximum_version,
'@installed_version' => $library['version'],
'@upgrade_or_downgrade' => 'upgrade',
);
watchdog('commerce_stripe', $message, $variables, WATCHDOG_WARNING);
return FALSE;
}
elseif (version_compare($library['version'], $maximum_version, '>')) {
$variables = array(
'@minimum_version' => $minimum_version,
'@maximum_version' => $maximum_version,
'@installed_version' => $library['version'],
'@upgrade_or_downgrade' => 'downgrade',
);
watchdog('commerce_stripe', $message, $variables, WATCHDOG_WARNING);
return FALSE;
}
return TRUE;
}
}