Pricing

How pricing works :

  • Invoke pricing Engine from business logic such as priceItem Servlet Or from Pricing Tools.
  • Pricing Engine Calls precalculator to get the base priceItem (List price Or Sale Price)
  • Pricing Engine use getPricingModels method to extract active Promotion from profile. (activePromotion property from profile)
  • Pricing Engine retrieve all the global promotion (Price Engine Schedular use globalPromotionQuery to promotion repository.)
  • Pricing Engine the sort the promotion based on priority
  • Each promotion has a pricingCalculatorService property. Promotion calculator check the qualifier service (findQualifyingItems, findQualifyingOrder, or findQualifyingShipping) to get the qualified objects. Calculator then apply the promotion.
  • Pricing Engine call post calculator and modify priceInfo object of the objects being discounted.

Repricing Orders

  • CartModifierFormHandler & ExpressCheckoutFormHandler have handle method to reprice order.
  • Externaly, we can call /atg/commerce/order/purchase/RepriceOrderDroplet servlet bean. It is configured to invoke the repriceAndUpdateOrder pipeline, Which calls reprice order pipeline and OrderManager.updateOrder(). Only required parameter that must be supplied is the pricing operation to execute.
  ORDER_TOTAL
ORDER_SUBTOTAL
ORDER_SUBTOTAL_SHIPPING
ORDER_SUBTOTAL_TAX
ITEMS
SHIPPING
ORDER
TAX
NO_REPRICE

OOTB RepriceOrderDroplet.properties :


           $class=atg.commerce.order.purchase.RepriceOrder
$scope=request
defaultPipelineManager=/atg/commerce/PipelineManager
defaultChainId=repriceAndUpdateOrder
order^=/atg/commerce/ShoppingCart.current
profile=/atg/userprofiling/Profile
orderManager=/atg/commerce/order/OrderManager
userPricingModels=/atg/commerce/pricing/UserPricingModels

Example :
<dsp:droplet name="RepriceOrderDroplet">
                <dsp:param value="ORDER_SUBTOTAL" name="pricingOp"/>
          </dsp:droplet>

Create a new Payment Method :

  • Create New Payment Group
NewPaymentGroup extends PaymentGroupImpl
  • Create New Repository item in orderrepository.xml-
          <item-descriptor name="NewPaymentGroup" super-type="paymentGroup" sub-type-value="NewPaymentGroup" cache-mode="simple" display-name-resource="itemDescriptorPO" item-cache-timeout="180000" xml-combine="append">

  • Add Item to OrderTools Maps
Add new item to beanNameToItemDescriptorMap of OrderTools
Add the new class to the paymentTypeClassMap of OrderTools
  • Implement Processor for new payementGroup
Payment pipelines are composed of two processors.
First gets all the required info and create Info bean.
Second perform the operation of authorize, Credit and debit.
Ex : creditCardProcessorChain pipeline having
1.CreateCreditCardInfo
2.ProcessCreditCard

  • Define Pipeline to process Authorize,Debit and Credit
Create Pipeline Processors
  • Integrate with payment pipeline Manager
Create paymentpipeline.xml at /atg/commerce/payment/paymentpipeline.xml.
Pipeline process will be createNewPayemntPipelineInfo and ProcessNewPayemntMethod
  • Extend Order validation to support new payment method
Add entry to PaymentManager.paymentGroupToChainNameMap (/atg/commerce/payment/PaymentManager)

Pricing Engine Classes :

  • ItemPricingEngineImpl
  • OrderPricingEngineImpl
  • ShippingPricingEngineImpl
  • TaxPricingEngineImpl

Static Pricing :

<dsp:droplet name="/atg/dynamo/droplet/Switch">
  <dsp:param param="sku.onSale" name="value"/>
  <dsp:oparam name="false">
           List price of <dsp:valueof param="sku.listPrice" converter="currency"/>
  </dsp:oparam>
  <dsp:oparam name="true">
           List price of <dsp:valueof param="sku.listPrice" converter="currency"/>
           on sale for <dsp:valueof param="sku.salePrice" converter="currency"/>!
  </dsp:oparam>
</dsp:droplet>


=============================================================

Split pricing - Click here to Learn more


Adding Payment Groups to an Order - Click here to Learn More


========================================================================

No comments :