It does not do that right now.

update the username and/or email on Drupal.
Save

It does not update in Recurly.

Issue fork recurly-3112853

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.

eojthebrave’s picture

Project: Recurly Roles » Recurly
Category: Feature request » Bug report

I think this is probably the domain of the Recurly module, and not this module. This module doesn't currently do anything other than add/remove roles from a user account. It looks like the Recurly module's \Drupal\recurly\RecurlyEntityOperations::entityUpdate() is triggered (or should be) when a user account is updated. And there's code there that looks like it should be setting the 'username' in Recurly. But I haven't actually tested to confirm that it's working.

I'm going to move this issue to the Recurly module's queue though and we can work on it there.

Can you confirm that the code in \Drupal\recurly\RecurlyEntityOperations::entityUpdate is called when a user entity is saved? I would start there for trying to debug this one.

brunodbo’s picture

Status: Active » Needs review
StatusFileSize
new549 bytes

\Drupal\recurly\RecurlyEntityOperations::entityUpdate does get called. It looks like the issue is with the way the original entity is loaded in that method. It uses $entity->getOriginalId(), which will return NULL for most entity types, since "By default, entities do not support renames and do not have original IDs." (quoting the comment in \Drupal\Core\Entity\EntityBase::getOriginalId).

The attached patch gets the original entity using $entity->original, which gets the original entity, so the original values can be compared to the new ones. I'm not sure if core has an entity method to get the original entity, but it doesn't look like there is.

brunodbo’s picture

Title: Updating username and email should update recurly subscription » Updating username and email should update Recurly account
eojthebrave’s picture

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

eojthebrave’s picture

I created an MR against the 4.x branch that fixes the issue with updates not being pushed to Recurly. Thanks @brunodbo for the tip on how to fix it. I also updated the service definition for the RecurlyEntityOperations service since it was missing the messenger service. And, I wrote tests for the RecurlyEntityOperations::entityUpdate() code.

blakehall’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, this looks good to me. Nice to have this functionality working again.

  • eojthebrave committed 5b2f3697 on 4.x
    Issue #3112853 by eojthebrave, brunodbo, blakehall: Updating username...
eojthebrave’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone.

eojthebrave’s picture

Status: Fixed » Closed (fixed)

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