Recurly PHP library is not installed with Composer

Created on 18 October 2022, about 2 years ago
Updated 21 March 2023, almost 2 years ago

Problem/Motivation

After install with Composer, the Recurly PHP library does not installed

Steps to reproduce

Install the Recurly module with Composer : composer require 'drupal/recurly:^4.0@alpha'

Proposed resolution

Add a "composer.libraries.json" file in the project.

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡«πŸ‡·France bessonweb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

    @Bessonweb is the module working and just complaining about the missing library? Or not working? To test, could you go to the Reucrly module's settings page, and then to the tab that lists the plans configured for your Recurly account. That page should fail in a pretty obvious way if for some reason the PHP library is not being loaded.

  • πŸ‡«πŸ‡·France bessonweb

    Hi,

    when I fill my Recurly keys I have many "deprecated function" errors, and when I go to subsciption plans I get this :

    The website encountered an unexpected error. Please try again later.
    Error: Call to undefined function Drupal\recurly\commerce_currency_format() in Drupal\recurly\RecurlyFormatManager->formatCurrency() (line 142 of modules/contrib/recurly/src/RecurlyFormatManager.php).

    Drupal\recurly\RecurlyFormatManager->formatCurrency() (Line: 99)
    Drupal\recurly\Form\RecurlySubscriptionPlansForm->buildForm()
    call_user_func_array() (Line: 531)
    Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 278)
    Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
    Stack\StackedHttpKernel->handle() (Line: 709)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

  • πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

    Are the deprecated function errors about libxml? If so, that's due to the fact that Recurly PHP SDK v2 isn't 100% compatible with PHP8+. It works, but throws deprecation notices. There's an issue to move to the newer version of the SDK here ✨ Compatibility with PHP Library 2.10 and above Postponed: needs info . It should be safe to use Drupal's error logging settings to suppress those errors. Not ideal, but until either the SDK is updated, or the module moves to a newer version of the SDK, it's the only option.

    The other error looks to be related to having the commerce module installed. And then trying to call the function commerce_currency_format() but it looks like current versions of the commerce module no longer have the function. It's features have been moved to a service in the commerce_price module. If you don't need the commerce module you could uninstall it. Or, if you're using it maybe try changing this if statement in `RecurlyFormatManager` so that it just bypasses the commerce module for now?

        if ($this->moduleHandler->moduleExists('commerce')) {
          $formatted = commerce_currency_format($price_in_cents, $currency, NULL, TRUE);
        }
    

    I think long term it's probably best to remove that use of the commerce module formatter but I haven't really looked into it yet.

  • πŸ‡«πŸ‡·France bessonweb

    Thank you for your help @eojthebrave !

    It will be a good things to create another ticket of support to investigate on this bug with commerce no?

    I will try to apply what you say! Thank you :-)

    Have a great day!

  • πŸ‡«πŸ‡·France bessonweb

    When I comment the following condition :

        if ($this->moduleHandler->moduleExists('commerce')) {
          $formatted = commerce_currency_format($price_in_cents, $currency, NULL, TRUE);
        }
    

    It remove the error and display the plans with many "Deprecated function" errors.

    So it seem the "Recurly PHP library is not installed" message in the status report is an error.

  • πŸ‡ΊπŸ‡ΈUnited States eojthebrave Minneapolis, MN

    And those deprecation errors are related to Recurly Library's V2 client not being compatible with PHP8.1. The most recent related issue for that is here https://github.com/recurly/recurly-client-php/pull/749, though it's been a known issue for quite a while and the Recurly team doesn't seem to be working on fixing it. You can suppress the warnings and it all works, but it's not ideal.

    I think the long term solution is to move to a newer major version of the PHP SDK but that's a big under taking so hasn't happened yet.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update about 1 year ago
    53 pass
  • @eojthebrave opened merge request.
Production build 0.71.5 2024