shopizer-ecommerce / shopizer

Shopizer java e-commerce software
http://www.shopizer.com
Apache License 2.0
3.58k stars 3k forks source link

[Question] Setting nick to email values leads to unexpected behaviour #632

Open spacedepartment opened 3 years ago

spacedepartment commented 3 years ago

Dear team, I have question regarding the line https://github.com/shopizer-ecommerce/shopizer/blob/83fd1ee277db0bf7783b610d91c48ff1c2eb7c87/sm-shop/src/main/java/com/salesmanager/shop/store/controller/order/facade/OrderFacadeImpl.java#L572

Value of customer nick is set to email. The line leads to exception (breaking DB unique constraint customer_nick and merchant_id) in case anonymous user with the same email creates multiple orders. Only first order is successful, second and the following will be failed.

My question is. Is it a bug?

guymoyo commented 3 years ago

Hi, yes I had the same problem, I wondered how other people deal with this.

To make it works but not sure if it is a good way, I have to add

if(auth instanceof AnonymousAuthenticationToken) { modelCustomer.setAnonymous(true); }

in ShoppingOrderController line 562. I am using the jsp version.

I did that because it was false even when the user is anonymous and somewhere the nickName is set with email on a base if the user is anonymous or not.

hope that helps.

spacedepartment commented 3 years ago

I changed it to getNick instead of getEmailAddress and changed the condition. So far so good. Will see what bugs it causes.

RaniEnugandhula commented 9 months ago

Hi @spacedepartment As mentioned in the above issue I would to contribute and help to resolve and close the issue. I have done some changes according to the suggestions from the comments and myself. But I am unable to find the specific API in the swagger to test the output. Can you guide me to show which API to check.