Problem/Motivation

There is an "Update billing information" link/subtab displayed before the user has signed up or provided billing information.

Upon clicking on it, a Drupal error is displayed:

Unable to retrieve billing information.

recurly pic

Proposed resolution

Only show this "Update billing information" link to users who have previously provided billing info to Recurly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Camster created an issue. See original summary.

No Sssweat’s picture

Issue summary: View changes
No Sssweat’s picture

Issue summary: View changes
No Sssweat’s picture

Title: Remove/hide Update Billing Info link for people who have not signed up yet. » Remove/hide Update Billing Info link/subtab for people who have not signed up yet.
No Sssweat’s picture

Issue summary: View changes
No Sssweat’s picture

Issue summary: View changes
markdorison’s picture

Status: Active » Closed (outdated)
markdorison’s picture

Issue summary: View changes
Priority: Normal » Minor
Status: Closed (outdated) » Active
FileSize
43.67 KB
markdorison’s picture

Category: Bug report » Task
Issue summary: View changes
markdorison’s picture

Title: Remove/hide Update Billing Info link/subtab for people who have not signed up yet. » Remove "Update Billing Information" link/subtab for users who have not provided billing information
adamzimmermann’s picture

Assigned: Unassigned » adamzimmermann
adamzimmermann’s picture

Assigned: adamzimmermann » Unassigned
Status: Active » Needs review
FileSize
2.38 KB

This seems like it should fix the issue. However, when I create a new Drupal user and subscribe to some plans, they no longer appear at /user/1/subscription. And when I try to signup for them again, I get "Please correct the following issues: You already have a subscription to this plan..". So I see the "Update Billing" tab for user 1 who previously had some plans, but I don't see it for other users, as evidently a Recurly account isn't being created, so my code denies access to this tab. So we are closer on this issue, but perhaps I'm testing this incorrectly?

I'm also unsure if simply checking for an account is enough to determine that this tab should appear. I added a check for active subscriptions as a potential solution in the access callback.

If I just uncovered a bigger problem I'm happy to file a new issue.

markdorison’s picture

Status: Needs review » Needs work

@adamzimmermann Your changes were made only on the recurly_hosted sub-module, but this is an issue even with recurlyjs.

  1. +++ b/modules/recurly_hosted/src/Controller/RecurlyHostedAccountRedirectController.php
    @@ -13,6 +14,27 @@
    +    if (!recurly_account_has_active_subscriptions($recurly_account->account_code)) {
    

    I don't think the check should be active subscriptions. I think it should just be that they have a Recurly account.

  2. +++ b/modules/recurly_hosted/src/Routing/RecurlyHostedRouteSubscriber.php
    @@ -28,6 +28,7 @@ protected function alterRoutes(RouteCollection $collection) {
    +          '_custom_access' => '\Drupal\recurly_hosted\Controller\RecurlyHostedAccountRedirectController::access',
    

    In the main module, we implemented Access services to handle all of this type of checking.

    Currently some of them are tied (more or less) to the needs of specific controllers, but some, are more generic and functional like RecurlyAccessLocalAccount. Do you think this might be better as a service like RecurlyAccessHasBillingInfo (or whatever we decide the requirement is)? Maybe just using RecurlyAccessLocalAccount is sufficient here?

adamzimmermann’s picture

Ah, ok. There is a tab with the exact same title in recurly_hosted, so that threw me off.

Should we add this access check to it also? I attached a patch that just fixes recurlyjs, and one that adds the check in both modules.

markdorison’s picture

Status: Needs review » Fixed

@adamzimmermann I've committed your second patch that makes the change in both places.

While testing this patch, I discovered a new minor issue: #2875434: Billing tab is inconsistently named

Status: Fixed » Closed (fixed)

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