ccrz.ccLogicCartPriceAsync.updateCartHeader

Sets fields on the ccrz__E_Cart__c record to reference the asynchronous Apex job ID, update the cat's status, and set the repriced date. This method executes for every ccrz.ccApiCart.priceAsync call, regardless of whether it's the initial or a recursive call.

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> updateCartHeader(Map<String, Object>)

Inputs (Required)

This method accepts the working Map<String, Object> after the appropriate method completes:

Initial synchronous call
After ccrz.ccLogicCartPriceAsync.enqueuePricing
Recursive, asynchronous calls
After ccrz.ccLogicCartPriceAsync.enqueueNext

This method requires the following key in the working map:

ccrz.ccLogicCartPriceAsync.CART_TO_PRICE
ccrz__E_Cart__c record that represents the cart to price.

Inputs (Optional)

If the working map includes the following keys, this method evaluates them:

ccrz.ccApiCart.CONTINUE_ASYNC_PLACE_AFTER_PRICING
Boolean
Value Usage
true This method is executing as part of the ccrz.ccApiCart.placeAsync method. When this method completes, it calls ccrz.ccApiCart.placeAsync recursively to continue the order placement process.
false (default) This method is executing outside of the ccrz.ccApiCart.placeAsync method.
ccrz.ccApiCart.NEXT_PRICING_JOB_ENQUEUED
Boolean
Value Usage
true Another asynchronous Apex job is enqueued for continuing the pricing process.
false The current asynchronous Apex Job is the final job for the pricing process.
ccrz.ccApiCart.PRICE_ASYNC_FINISH
Boolean
Value Usage
true The current method execution is a recursive, asynchronous call that continues the cart pricing after the initial call.
false (default) The current method execution is the synchronous portion of the initial call that begins the cart pricing process.
ccrz.ccApiCart.PRICE_ASYNC_JOB_ID
ID of the AsyncApexJob that represents the asynchronous Apex job that the System.enqueueJob method returned.

Logic Performed

This method evaluates Evaluates ccrz.ccApiCart.PRICE_ASYNC_FINISH, and performs different actions depending on whether the current method execution is the initial or a recursive call:

Initial synchronous call
  1. Sets up a new ccrz__E_Cart__c record with the following values:
    Field Value
    ccrz__AsynchronousJobID__c The ID that ccrz.ccApiCart.PRICE_ASYNC_JOB_ID specifies
    ccrz__CartStatus__c Repricing
    ccrz__RepricedDate__c The current date and time
  2. Evaluates whether the ccrz.ccApiCart.CONTINUE_ASYNC_PLACE_AFTER_PRICING input is true. If so, this method adjusts ccrz__CartStatus__c to Processing.
Recursive, asynchronous calls
  1. Evaluates whether the ccrz.ccApiCart.NEXT_PRICING_JOB_ENQUEUED input is true:
    • If true, the method sets up a new ccrz__E_Cart__c record with the following values:
      Field Value
      ccrz__AsynchronousJobID__c The ID that ccrz.ccApiCart.PRICE_ASYNC_JOB_ID specifies
    • Otherwise, the method sets up a new ccrz__E_Cart__c record with the following values:
      Field Value
      ccrz__AsynchronousJobID__c The ID that ccrz.ccApiCart.PRICE_ASYNC_JOB_ID specifies
      ccrz__CartStatus__c Open
    • Evaluates whether the ccrz.ccApiCart.CONTINUE_ASYNC_PLACE_AFTER_PRICING input is true. If so, this method adjusts ccrz__CartStatus__c to Processing.

Outputs

This method returns the working Map<String, Object>, and sets the following key:

ccrz.ccLogicCartPriceAsync.CART_TO_UPDATE
ccrz__E_Cart__c record that represents the new cart record, with the same ID as the source ccrz__E_Cart__c record that the ccrz.ccLogicCartPriceAsync.CART_TO_PRICE input specified. This new cart record has the appropriate fields set, and is ready to insert.

Creating a separate ccrz__E_Cart__c record avoids accidental changes to the source ccrz__E_Cart__c record that the ccrz.ccLogicCartPriceAsync.CART_TO_PRICE input specified.

Note