21
Omni Commerce: From Buzzword to Technology Jürgen Albertsen Enterprise Architect hybris

Occ tech for commerce

Embed Size (px)

Citation preview

Page 1: Occ   tech for commerce

Omni Commerce: From Buzzword to Technology Jürgen Albertsen Enterprise Architect hybris

Page 2: Occ   tech for commerce

Commerce is Everywhere

TV

Console

Web

POS

Mobile

Call Center

Social

Print

Digital Ads Marketplace

Mobile Native

Page 3: Occ   tech for commerce

A Few Examples

TV Mobile + + = Live stream, shop as you

watch

Mobile

+ = Want this, alert me when near shop

Product

Product

Checkout

Location

POS + = Not available in store,

deliver to home Product Checkout

Page 4: Occ   tech for commerce

We call it Multi Channel

Page 5: Occ   tech for commerce

No, Omni Channel

Page 6: Occ   tech for commerce

No, Omni Commerce

Page 7: Occ   tech for commerce

Nice word but: How to do it?

Page 8: Occ   tech for commerce

The solution: Web Services of course

Page 9: Occ   tech for commerce

The Problem: hybris is pretty old mature

Page 10: Occ   tech for commerce

Core Services

Core / Jalo

Over the Years We Stacked up Quite a Stack

Commerce Services

Commerce Façades

Accelerator (Web Storefront) OCC (Web Services)

Page 11: Occ   tech for commerce

Let’s Zoom In

Controller

Converter

Service

Façade

DTO

Model

Populator

Page 12: Occ   tech for commerce

A DTO

public class CartData implements Serializable { ! private String code; private boolean net; private PriceData totalPrice; //... public String getCode() { return code; } public void setCode(String code) { this.code = code; } ! //... }

Page 13: Occ   tech for commerce

A Descriptor for DTOs

<bean class="de.hybris.platform.commercefacades.order.CartData"> <property name="code" type="String"/> <property name="net" type="boolean"/> <property name="totalPrice" type="de.hybris.platform.commercefacades.product.PriceData"/> <!-- ... --> </bean>

Page 14: Occ   tech for commerce

A Façade

public interface CartFacade { ! CartData getSessionCart(); ! CartData getMiniCart(); ! CartModificationData addToCart(String code, long quantity) throws CommerceCartModificationException; ! // ... !}

Page 15: Occ   tech for commerce

A Controller for the Storefront

@Controller public class AddToCartController extends AbstractController { @Resource(name = "cartFacade") private CartFacade cartFacade; ! @RequestMapping(value = "/cart/add", method = RequestMethod.POST) public String addToCart(@RequestParam("productCodePost") String code, Model model, @Valid AddToCartForm form, BindingResult bindingErrors) { // ... CartModificationData cartModification = cartFacade.addToCart(code, qty); if (cartModification.getQuantityAdded() == 0L) { model.addAttribute(ERROR_MSG_TYPE, "basket.information.quantity.noItemsAdded." + cartModification.getStatusCode()); } else if (cartModification.getQuantityAdded() < qty) { model.addAttribute(ERROR_MSG_TYPE, "basket.information.quantity.reducedNumberOfItemsAdded." + cartModification.getStatusCode()); } // .. } }

Page 16: Occ   tech for commerce

Spring MVC doesn’t care if it’s HTML, XML, JSON, or whatever

Page 17: Occ   tech for commerce

Another Controller — this Time for a Web Service

@Controller public class CartController extends BaseController { @Resource(name = "cartFacade") private CartFacade cartFacade; ! @RequestMapping(value = "/entry", method = RequestMethod.POST) @ResponseBody public CartModificationData addToCart(@RequestParam(required = true) String code, @RequestParam(required = false, defaultValue = "1") long qty) throws CommerceCartModificationException { return cartFacade.addToCart(code, qty); } !}

Page 18: Occ   tech for commerce

Marshal Response DTOs to XML/JSON

<!-- from springmvc-servlet.xml --> !<mvc:annotation-driven> <mvc:message-converters register-defaults="false"> <bean parent="resolverXStreamJSONConverter"/> <bean parent="resolverXStreamXmlConverter"/> </mvc:message-converters> </mvc:annotation-driven>

Page 19: Occ   tech for commerce

We expose commerce logic and data model 1:1

Page 20: Occ   tech for commerce

What Else?

REST-like

ETag

OAuth 2.0 & HTTPS

Template

Shipped as source

Page 21: Occ   tech for commerce

Questions? Beer?