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

Updating a customer without a birthday sets the birthday to the current dat #544

Closed
niklasnatter opened this issue Sep 17, 2019 · 1 comment · Fixed by #548
Closed

Updating a customer without a birthday sets the birthday to the current dat #544

niklasnatter opened this issue Sep 17, 2019 · 1 comment · Fixed by #548
Labels

Comments

@niklasnatter
Copy link
Contributor

When the birthday property is omitted (or not set) on a PUT request to the /me endpoint, the birthday of the current customer is set to the current date.

The UpdateCustomerRequest class declares the birthday class-property as nullable, therefore I assume that it should be possible to omit the birthday property from this request (eg. if the customer does not want to specify his birthday).
https://github.com/Sylius/ShopApiPlugin/blob/master/src/Request/Customer/UpdateCustomerRequest.php#L25

This behaviour happens because the UpdateCustomerHandler constructs a new DateTimeImmutable object with the birthday property of the UpdateCustomerRequest. If this property is null, the constructed DateTimeImmutable object will contain the current date.
https://github.com/Sylius/ShopApiPlugin/blob/master/src/Handler/Customer/UpdateCustomerHandler.php#L31

@mamazu mamazu added the Bug label Sep 17, 2019
@mamazu
Copy link
Member

mamazu commented Sep 17, 2019

This looks like a bug. Besides the fact that the request class doesn't return a datetime immutable anyways. This looks like a missing typecheck on the command.

lchrusciel added a commit that referenced this issue Sep 21, 2019
This PR was merged into the 1.0-dev branch.

Discussion
----------

Fixes #544 
Fixing the customer birthday

Commits
-------

f010636 Fixing the customer birthday
aebff63 Moving DatetimeCreation to request class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants