ccrz.ccLogicCartPriceAsync.applyPricing

Loops through the cart items to reprice, and calls the appropriate inner method for setting each cart item's price. This method also ensures that major and minor line items remain associated with each other. This method executes only during the recursive, asynchronous ccrz.ccApiCart.priceAsync method calls.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12

Signature

global virtual Map<String, Object> applyPricing(Map<String, Object>)

Inputs (Required)

This method accepts the Map<String, Object> after the ccrz.ccLogicCartPriceAsync.fetchPricingData method completes.

This method requires the following keys in the working map:

ccrz.ccApiAttribute.ATTRIBUTES
Map<String, Object> that describes ccrz__E_Attribute__c records related to the queried products. The ccrz.ccApiAttribute.fetch method returns this map.
ccrz.ccApiProduct.PRODUCTPRICINGDATA
Map<String, Object> of pricing data for all queried products. This map can contain seller, subscription term, attribute, and standard pricing information for the queried products.
ccrz.ccLogicCartPriceAsync.ITEMS_TO_PRICE
Map<String, ccrz__E_CartItem__c> of the items to price.

Logic Performed

This method completes the following actions:

  1. For each cart item, the method creates an intermediate map and passes it to the ccrz.ccLogicCartPriceAsync.priceItem inner method:
    pricingInputs
    Map<String, Object> that contains the following keys that the ccrz.ccLogicCartPriceAsync.priceItem inner method evaluates for an individual cart item:
    ccrz.ccApiAttribute.ATTRIBUTES
    Map<String, Object> that describes ccrz__E_Attribute__c records related to the queried products.
    ccrz.ccApiProduct.PRODUCTPRICINGDATA
    Map<String, Object> of pricing data for all queried products. This map can contain seller, subscription term, attribute, and standard pricing information for the queried products.
    ccrz.ccLogicCartPriceAsync.PRICE_ITEM_CART_ITEM
    ccrz__E_CartItem__c to evaluate.
    ccrz.ccLogicCartPriceAsync.PRICE_ITEM_PARENT_ITEM
    The parent ccrz__E_CartItem__c of ccrz.ccLogicCartPriceAsync.PRICE_ITEM_CART_ITEM.
  2. For each cart item, the method creates another intermediate map and calls the ccrz.ccLogicCartPriceAsync.checkCartItemValidity inner method.
  3. If the cart item is included in a complex product, the method adds the item and its parent to another intermediate map. A complex product can be a bundle, kit, dynamic kit, assembly product, or a cart item where ccrz__PricingType__c is ATTRGROUP.
    complexCartItems
    Map<String, List<ccrz__E_CartItem__c>>, keyed by parent cart item ID, that describes major cart line items and its associated minor cart line items.
  4. After evaluating all cart items, the method passes the complexCartItems map to the ccrz.ccLogicCartPriceAsync.evaluateComplexProducts inner method.

Outputs

This method returns the working Map<String, Object> after the appropriate inner methods complete, and sets the following keys:

ccrz.ccLogicCartPriceAsync.ITEMS_TO_PRICE
Map<String, ccrz__E_CartItem__c> of the items passed in and updated with the result of the inner methods.

If a cart item's parent is a bundle, the method sets the following fields on the item's ccrz__E_CartItem__c record:

ccrz__E_CartItem__c Field Value
ccrz__Price__c 0.00
ccrz__SubAmount__c 0.00

Note