Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persist username from JWT or order #143

Merged
merged 1 commit into from
Oct 25, 2018

Conversation

mraerino
Copy link
Member

Fixes #120

- Summary

When a order is made while a user is logged in (JWT passed along) and it is their first order, a new user object will be created in gocommerce.

This PR introduces a new field for the user object: name
It will be set only on creation of the user.

In order to determine the user's name, the following fields are considered in this order:

  • UserMetadata["full_name"] from JWT claims (this is what the Identity Widget uses)
  • BillingAddress.Name from order
  • ShippingAddress.Name from order

- Test plan

I created a test suite covering the creation of a user on their first order.
It also verifies the name field in the different cases.

- Description for the changelog

Persist user's name from JWT or order on their first order

@mraerino mraerino force-pushed the feature/persist-username branch 2 times, most recently from e5946f7 to 4602afb Compare October 19, 2018 21:24
In order to determine the user's name, the following fields are
considered in this order:
- UserMetadata["full_name"] from JWT claims
- BillingAddress.Name from order
- ShippingAddress.Name from order
Copy link
Contributor

@bcomnes bcomnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@bcomnes
Copy link
Contributor

bcomnes commented Oct 25, 2018

Just to confirm, this will help solve our canonical user name question we had right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants