VirtoCommerce/vc-module-order

Remove hard-coded 'Contact' member type to type taken from the real member object

tatarincev opened this issue · 7 comments

yecli commented

Released in v2.17.22.

yecli commented

@artem-dudarev As you can see, it was hardcoded type 'Contact' for all members in line 37.
Now, if we have real member with given id - Contact, Organization, etc. for the order owner - we use its type. It is the case where we could get and removed hardcoded type.
Otherwise (means there is no corresponding member, so there is no possibility to get memberType from member) - we are using default 'Contact' type and get user from security accounts API.

The problem is that you never load the real member. Order.CustomerId is a UserId and members.get({ id: blade.customerOrder.customerId } on line 53 will never find any member.
You should load an account, like on line 55, and AFTER that load a member by account.memberId.

yecli commented

I see.
It worked when I checked because for the users defined in sample database User.id == member.id.
image
Will rework this task.