Cart Wrapper and CartItem Wrapper for Custom Pricing Plan
Cart wrapper and CartItemWrapper interface provides minimum viable functionalities to operate on cart and cart items. Use these interfaces to add your own custom steps in the pricing plan steps.
CartItemWrapper Interface:
-
To work with the Cart Wrapper interface:
-
Get the cart wrapper instance for CpqCart or CpqCartDocument using the method:
Do not use the same instance of CpqCartDocument for every pricing step. For each step, get the instance using the method mentioned below.
-
Call the Item wrapper APIs using the wrapper.call(methodName, args).
The Below table lists the supported methods for CpqCart
Method Name Arguments Description CpqConstants.GET_CART_FIELD CpqConstants.FIELD Method to get the fields of the order. CpqConstants.SET_CART_FIELD CpqConstants.FIELD, CpqConstants.VALUE Method to set the order field value. CpqConstants.GET_SOBJECT_TYPE Method to get the SObjectType of the underlying cart. CpqConstants.GET_ITEM_IDS Method to get the item ids. CpqConstants.GET_ALL_ITEMS CpqConstants.HIERARCHY_LEVEL(optional: -1 full hierachy) Method to get all the line items. CpqConstants.GET_CHILD_ITEMS CpqConstants.ITEM_ID Method to get all the child line items. CpqConstants.DELETE_LINE_ITEM CpqConstants.ITEM_ID Method to delete a line item.
-
-
To work with the the CartItem Wrapper interface:
-
The line items present in the basket can be accessed using the wrapper class of CpqCartDocumentItem or CpqCartItem. Get the cart wrapper instance for CpqCart or CpqCartDocument using the method:
-
Call the wrapper APIs using the wrapper.call(methodName, args).
the below table lists the supported methods for CpqCart:
Method Name Arguments Description CpqConstants.GET_ITEM_FIELD CpqConstants.FIELD Method to get an item field, or a field from the item's related SObjects. CpqConstants.SET_ITEM_FIELD CpqConstants.FIELD, CpqConstants.VALUE Method to set the value of an item field. CpqConstants.GET_SOBJECT_TYPE Method to get the SObjectType of the underlying cartitem. CpqConstants.GET_ITEM_FIELDS CpqConstants.FIELDS Method to get multiple item fields. CpqConstants.SET_ITEM_FIELDS CpqConstants.FIELD_VALUE_MAP Method to set multiple item fields. CpqConstants.GET_ITEM_ATTRIBUTES CpqConstants.FLATTENED_ATTRIBUTE_VALUES), CpqConstants.USE_DISPLAY_TEXT_FOR_VALUES Method to get the attribute node of the item. There are 2 parameters according to which the attribute nodes are returned. CpqConstants.SET_ITEM_ATTRIBUTES CpqConstants.ATTRIBUTE_CODE_TO_VALUE_MAP Method to set the item attributes. CpqConstants.GET_CHILD_ITEM_IDS Method to get the child item ids.
Sample Code
- The cart wrapper would internally call the V2 APIs for Digital Commerce or CPQ APIs.
- The cart wrapper would call the V3 APIs for Standard Digital Commerce APIs.
-