Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Show Page Sections

download

Related Pricing Callback Interface

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 Signature

Description

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);        
        }
    }
}