Expand my Community achievements bar.

Why does AEM ECommerce Hybris integration use Hybris 'guid' as orderId for anonymous orders

Avatar

Level 2

Hi guys,

I am using AEM ECommerce Hybris integration version 6.3.2 (cq-commerce-hybris-impl-6.3.2.jar ) and Hybris version is 6.3.0.2.

When I place an order with a logged in account, the order is created in Hybris and I see an order confirmation page with a nice order number like

Thank You

Your order is being processed

Order number 00000008

We are processing your order and an email confirmation has been sent to your email address. ...

When I place an order without logging in (so as an anonymous customer), the order is created in Hybris with a nice order number too, but with some guest user account like:

Order Nr; Date; User

00002000; 03/28/2018 9:21:26 AM; e63128d7-e3a2-4df9-a701-9d7684b8268a|guest@geometrixx.info

This seems all fine as this is how Hybris works (create such a guest account for anonymous orders).

But why does my order confirmation page in AEM doesn't show a nice order number like above? Instead I get

Thank You

Your order is being processed.

Order number  a8eee72e-4f7d-4c6d-befc-2cbd62ebd0ea

We are processing your order and an email confirmation has been sent to your email address. ...

No customer will ever relate to such a complex order ID. Imagine complaining about your order over the phone with a customer service desk and they ask you for your order number.

This is the GUID of the order in Hybris. I understand this again imay be way of working in Hybris for security reasons, but why does AEM use this in the page displayed to the customer?

I had a quick look at the involved code and it seems to be coded this way on purpose.

com.adobe.cq.commerce.hybris.common.DefaultHybrisSession

public void placeOrder(java.util.Map delta)

        throws com.adobe.cq.commerce.api.CommerceException

    {

        java.lang.String ccv;

        java.lang.String cartCode;

        com.adobe.cq.commerce.hybris.connection.CommandResult result;

        updateOrder(delta);

        ccv = (java.lang.String)delta.get("payment.ccv");

        cartCode = getCartId();

        result = null;

        result = connection.execute(new CheckoutCommand(cartCode, ccv), hybrisService.getBaseStore(), this);

        if (result.success())

        {

            java.util.Map ids = parser.parseIds(result);

            if (isAnonymous())

            {

                if (ids.containsKey("guid"))

                    orderId = (java.lang.String)ids.get("guid");

                else

                    throw new CommerceException("Order guid missing");

            } else

            if (ids.containsKey("code"))

                orderId = (java.lang.String)ids.get("code");

            else

                throw new CommerceException("Order code missing");

        }

...

So I can understand that you may need the 'guid' to get at the order details of an anonymous Hybris order. But even in that case I would display the regular orderNr to the customer and use the guid to construct any URL for requesting order information (if even necessary).

As this is a hybris specific class, it seems strange to not also have a hybris specific 'guid' field in it which you can set in case of an anonymous order. If it is filled you can use it in the communication with Hybris where needed, but always show the proper order number to the customer I would say.

0 Replies