emartech / magento2-extension

Emarsys Magento2 Extension
MIT License
11 stars 9 forks source link

Missing data in customer object after update to 1.7.0 #14

Closed adamkarnowka closed 5 years ago

adamkarnowka commented 5 years ago

Hello, after upgrade from version from 1.6.4 to 1.7.0 JSON for event type customer_password_reset_confirmation is different, please compare following JSONs:

1.6.4 - correct

{"customer":{"password_hash":null,"rp_token":"luogpBMyA5P0l2Eoa20wcK15CyHQYLdC","rp_token_created_at":"2019-10-16 13:54:11","deleteable":true,"failures_num":"0","first_failure":null,"lock_expires":null,"id":4,"group_id":1,"default_billing":"0","default_shipping":"0","created_at":"2019-10-16 13:33:12","updated_at":"2019-10-16 13:53:15","created_in":"Germany","email":"spaceboy83@gmail.com","firstname":"Robert","lastname":"Lewandowski","prefix":"Bayern Munich","suffix":"Lewandowski","gender":0,"store_id":1,"website_id":1,"addresses":[],"disable_auto_group_change":0,"custom_attributes":[{"attribute_code":"reward_update_notification","value":"0"}]},"store":{"store_id":"1","code":"de_de","website_id":"1","group_id":"1","name":"Germany","sort_order":"0","is_active":"1","hreflang_code":"de-DE"}}

1.7.0 - wrong

{"customer":{"id":"4","billing_address":{"firstname":null,"suffix":null,"middlename":null,"lastname":null,"prefix":null,"city":null,"company":null,"country_id":null,"fax":null,"postcode":null,"region":null,"street":null,"telephone":null},"shipping_address":{"firstname":null,"suffix":null,"middlename":null,"lastname":null,"prefix":null,"city":null,"company":null,"country_id":null,"fax":null,"postcode":null,"region":null,"street":null,"telephone":null},"website_id":"1","store_id":"1","email":"spaceboy83@gmail.com","group_id":"1","is_active":"1","prefix":"Bayern Munich","lastname":"Lewandowski","middlename":null,"firstname":"Robert","suffix":"Lewandowski","dob":null,"taxvat":null,"gender":"0","accepts_marketing":"1","created_at":"2019-10-16 13:33:12","updated_at":"2019-10-16 13:34:33"},"store":{"store_id":"1","code":"de_de","website_id":"1","group_id":"1","name":"Germany","sort_order":"0","is_active":"1","hreflang_code":"de-DE"}}

As you can see, in latest version rp_token is missing - and as a result password reset e-mail don't have data required to work properly (no hash in URL).

I think that new method of fetching customerdata - getOneCustomer() doesn't include fields from customer_entity table. Can they be added?

Thank you in advance, Adam Karnowka.

iben12 commented 5 years ago

Thank you for reporting this issue, we will look into this as soon as possible.

Will update this issue.

adamkarnowka commented 5 years ago

Thank you, I tried to push hotfix on branch, but I don't have permission to do so. As hotfix, it is enough to add these two lines in Helper/Customer.php in buildCustomerObject() method:

->setRpToken($customer->getRpToken())
->setRpTokenCreatedAt($customer->getRpTokenCreatedAt())
iben12 commented 5 years ago

We are always open for Pull Requests ;)

adamkarnowka commented 5 years ago

All right, here it is: https://github.com/emartech/magento2-extension/pull/15

iben12 commented 5 years ago

Thank you for the contribution.

I have merged your Pull Request, written some tests for it and will release a patch version possibly today.

iben12 commented 5 years ago

Fixed in v1.7.1 release.

Kudos for the contribution of @adamkarnowka.