Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Project: » Stripe Checkout
Anonymous’s picture

Version: » 8.x-1.x-dev

More details on this now...

We should add a hook_requirements temporarily until #2494073: Prevent modules which have unmet Composer dependencies from being installed closes. This will enable https://www.drupal.org/project/composer_manager to alert users that the requirements are not met.

In the future, users can use https://www.drupal.org/node/2627292.

Working on a patch for this issue is documented here: https://www.drupal.org/node/2405811.

This will make it so "composer install" is NOT required in the module folder.

Anonymous’s picture

Title: Add composer install requirement to INSTALL.txt » Add composer install requirement to INSTALL.txt, add hook_requirements
Status: Active » Needs work
yanniboi’s picture

Yup composer_manager is the way forward. Maybe as part of this we should rewrite the composer.json to conform with drupal packagist standards? Eg:

{
  "name": "drupal/stripe_checkout",
  "type": "drupal-module",
  "description": "Defines a custom field formatter for  Stripe's Simple checkout.",
  "homepage": "http://drupal.org/project/stripe_checkout",
  "license": "GPL-2.0+",
  "require": {
    "stripe/stripe-php": "2.*"
  },
  "minimum-stability": "dev"
}

yanniboi’s picture

Status: Needs work » Needs review
FileSize
2.26 KB

Here is a hook_requirements implementation and I've updated the code to pull from Drupal's vendor and autoload using composer manger rather than running composer install in the module directory.

yanniboi’s picture

I've manually tested this patch and composer_manager finds the dependency and a payment using test api keys works.

jochemvn’s picture

Another problem that's currently there is the fact that trying to install with composer starts checking the info.yml file and stumbles upon the line:

dependencies:
  - stripe_api (>= 8.2)

With stripe_api currently at: 8.x-1.0-alpha1 this won't work. Composer throws:

    - drupal/stripe_checkout 2.0.0-alpha1 requires drupal/stripe_api ^8.2 -> no matching package found.

will the composer.json for this project be updated anytime soon?

by the way. I've tried applying the patch with "cweagans/composer-patches", but that also didn't work.

chertzog’s picture

Here is a patch that removes the version requirement. which should allow this to work with composer.

eiriksm’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, please commit :)

grasmash’s picture

Status: Reviewed & tested by the community » Fixed
grasmash’s picture

Status: Fixed » Needs work

Patch fails to apply against dev.