The interface provides you the capability to define custom logic for calculating the pricing for related product line items. The prices in the related product line items are dependant on the price of other line items.

The following method is available in the IRelatedPricingCallback interface:

Method SignatureDescription
Task<List<IRelatedPricingBatchResponse>> ComputeBasePriceBatchAsync(IRelatedPricingBatchRequest relatedPricingBatchRequest);

You can use this method to define custom logic that must be executed to specify a new base price for the related line item. 

Example Code

The below code snippet is for reference purposes only.

namespace Apttus.Lightsaber.Customer.RelatedPricing 
{
    public class RelatedPricingCallback : CodeExtensibility, IRelatedPricingCallback 
    {               
		public async Task<List<IRelatedPricingBatchResponse>> ComputeBasePriceBatchAsync(IRelatedPricingBatchRequest relatedPricingBatchRequest)
        {
			List<IRelatedPricingBatchResponse> relatedPricingBatchResponseResult = new List<IRelatedPricingBatchResponse>();
						
			List<ILineItemModel> relatedLineItems = relatedPricingBatchRequest.GetRelatedLineItems();
			
			foreach(var relatedLineItem in relatedLineItems) {				
				
				var priceBreakupRecords = relatedLineItem.GetPriceBreakupRecords();				
				
				foreach(var priceBreakup in priceBreakupRecords) {
					if(priceBreakup.BreakupType == "Total" && relatedLineItem.GetEntity().RelatedAdjustmentAmount > 5000) {
						IRelatedPricingBatchResponse relatedPricingResponse = relatedPricingBatchRequest.CreateRelatedPricingBatchResponse(relatedLineItem);
						relatedPricingResponse.BasePrice = 500;
						relatedPricingBatchResponseResult.Add(relatedPricingResponse);						
					}
				}													
			}		
			return await Task.FromResult(relatedPricingBatchResponseResult);        
        }
    }
}
CODE