Broadleaf Microservices
  • v1.0.0-latest-prod

Cart Provider

Table of Contents

Overview

Provider for interfacing with Carts when operations require persistence or retrieval. The default implementation facilitates HTTP requests against the Cart Services endpoints.

Configuration

ExternalCartProperties defines the properties used to configure ExternalCartProvider, which is the default provider. These include:

  • broadleaf.cartoperation.cartprovider.url: The base url for an external cart service, which handles persistence of lists as well as carts.

  • broadleaf.cartoperation.cartprovider.cartUri: The context path for singular cart retrieval. This is appended to the url property.

  • broadleaf.cartoperation.cartprovider.cartsUri: The context path for CRUD operations on carts. This is appended to the url property.

  • broadleaf.cartoperation.cartprovider.cartItemsUri: The context path for basic CRUD operations on cart items. This is appended after url, cartsUri, and a specific cart’s ID:

Example of building request from properties
UriComponentsBuilder.fromHttpUrl(properties.getUrl())
        .path(properties.getCartsUri())
        .pathSegment(cartId)
        .path(properties.getCartItemsUri())
        .toUriString();