class ShoppingCartFacadeImpl implements ShoppingCartFacade {

	@Autowired
	private CustomerService customerService;
	
	@Autowired
	private ShoppingCartService shoppingCartService;

	@Autowired
	private com.salesmanager.shop.store.controller.customer.facade.CustomerFacade customerFacade;

	@Autowired
	private com.salesmanager.shop.store.controller.shoppingCart.facade.ShoppingCartFacade shoppingCartFacade; // legacy
																												// facade

	@Override
	public ReadableShoppingCart get(Optional<String> cart, Long customerId, MerchantStore store, Language language) {<FILL_FUNCTION_BODY>}

}


		Validate.notNull(customerId, "Customer id cannot be null");
		Validate.notNull(store, "MerchantStore cannot be null");
		
		try {

			// lookup customer
			Customer customer = customerService.getById(customerId);

			if (customer == null) {
				throw new ResourceNotFoundException("No Customer found for id [" + customerId + "]");
			}
			
			ShoppingCart cartModel = shoppingCartService.getShoppingCart(customer, store);
			
			if(cart.isPresent()) {
				cartModel = customerFacade.mergeCart(customer, cart.get(), store, language);
			}
			
			if(cartModel == null) {
				return null;
			}
			
		   ReadableShoppingCart readableCart = shoppingCartFacade.readableCart(cartModel, store, language);
		   
		   return readableCart;

		} catch (Exception e) {
			
			throw new ServiceRuntimeException(e);

		}

	
<no_super_class>