mercredi 27 juillet 2016

1 click quick checkout how to design flow in JEE

I have a webshop on which I want to include a quick checkout (i.e. 1-click checkout) and wonder about the best way to design it.

Usually with normal checkout things are pretty easy. The user at some points wants to get to the order overview. That page requires an authenticated user, so when it is opened and no user is logged in, user gets redirected to login, logs in and gets redirected to order overview where I then know the user. He confirms and I start the checkout handling and redirect the user to the order confirmation page.

In the case of 1-click checkout things are bit different. The user invokes the checkout on a page where no authenticaton is required (usually a product page that anyone can browse), so I cannot directly start checkout workflow but need to redirect first to login and then redirect to some page from there and start the processing of checkout after login. Of course I could setup a success page that login redirects to and in the backing bean of that page in @postconstruct of the backing bean execute the checkout and then display an confirmation on the page.

Seems pretty ugly though.

Alternatively I could redesign the login part to not only work on pages with redirect but be able to revert to a method once login is completed. So do a redirect to login and then call a method that I registered with the loginbackingbean before redirecting to login page. Then in that method execute the checkout and refer to a success page. Sound a bit cleaner but also not nice.

Anbody some good ideas?

Cheers Tom

Aucun commentaire:

Enregistrer un commentaire