Problem/Motivation

I have not signed up for any accounts.
On user/xx/subscription/signup
I get the list of the plans that I enable with a “sign up” Text
When I click on the text I get the following error

Recurly_UnauthorizedError: "Your API Key is not authorized to connect to Recurly." at Drupal/vendor/recurly/recurly-client/lib/recurly/util/http_validations.php line 21,

I can access the admin/config/services/recurly/subscription-plans page just fine.

So the api is working there but not on the user page

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork recurly-3241695

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

SocialNicheGuru created an issue. See original summary.

socialnicheguru’s picture

Here is the signup_url from modules/contrib/recurly/src/RecurlyPreprocess.php

the only issue that I can see is that there is no value for currency.
I did enable this to delete commerce_currency_format as i was given errors.
https://www.drupal.org/project/recurly/issues/2895261

[signup_url] => stdClass Object
        (
            [__CLASS__] => Drupal\Core\Url
            [urlGenerator:protected] => 
            [urlAssembler:protected] => 
            [accessManager:protected] => 
            [routeName:protected] => entity.user.recurlyjs_signup
            [routeParameters:protected] => Array
                (
                    [user] => 6
                    [plan_code] => testannual
                    [currency] => 
                )

            [options:protected] => Array
                (
                )

            [external:protected] => 
            [unrouted:protected] => 
            [uri:protected] => 
            [internalPath:protected] => 
            [_serviceIds:protected] => Array
                (
                )

            [_entityStorages:protected] => Array
                (
                )

        )

    [change_url] => 
    [selected] => 
)

sultancillo made their first commit to this issue’s fork.

sultancillo’s picture

I'm sure i broke all kinds of protocols here but this merge request solves this issue:

https://git.drupalcode.org/project/recurly/-/merge_requests/5

Also solves the problems with RecurlyJS not using the correct address requirements in the settings and payment form..

Seems like the recurlyjs module got left behind when the change was made from using RecurlyClient to RecurlyClientFactory

colan’s picture

Status: Active » Needs review
loze’s picture

Confirming that this fixes the issue with recurlyjs causing unauthorized api errors.

loze’s picture

StatusFileSize
new10.38 KB

After further testing I found that it was also failing on the subscription change/cancel forms due to the move from RecurlyClient to RecurlyClientFactory

This is a patch with the changes in #4 and a few small updates to get it working on those form pages.

j_ten_man’s picture

Status: Needs review » Reviewed & tested by the community

This is working for me.

j_ten_man’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new11.17 KB

Apparently another place that's not working - the push/webhook listener. Updated the patch to include the change.

rakesh.drupal’s picture

StatusFileSize
new505 bytes

After testing, I found that recurly client is missing, and after initializing the client that is working for me.

eojthebrave made their first commit to this issue’s fork.

eojthebrave’s picture

It looks like much of this issue was fixed in #3061322: Port support for recurly.Pricing() from D7 to D8. Mainly injecting the Recurly client object into the \Recurly_Billing calls. I opened a new MR to fix the one remaining issue with \Recurly_Billing (it was just easier to start a new one than to try and rebase the old one). And incorporated the fixes from above. I also added tests for the billing info update form to hopefully help ensure we don't have this issue again.

In adding tests I also cleaned up a few other things:

  • Remove dependency on the deprecated jQuery.once library
  • Fix the code that pre-populates the billing info update form with data from Recurly, it was there but not working because the data structure from Recurly didn't match that of the form
  • Add tests
blakehall’s picture

Status: Needs review » Reviewed & tested by the community

After a review, this looks good to me. Marking RTBC

  • eojthebrave committed 3e24ff96 on 4.x
    Issue #3241695 by eojthebrave, sultancillo, j_ten_man, loze, rakesh....
eojthebrave’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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