<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP commerce cloud post order recalculation for refun... in CRM and CX Q&amp;A</title>
    <link>https://community.sap.com/t5/crm-and-cx-q-a/sap-commerce-cloud-post-order-recalculation-for-refund-amount-with/qaa-p/14012507#M453512</link>
    <description>&lt;P&gt;Promotion apportioning is not implemented by default in SAP Commerce. If you need to determine the apportioned amount per order entry, you must implement custom logic. Where you place this method execution depends on what you aim to achieve with the implementation.&lt;/P&gt;&lt;P&gt;For example, if you want to display the apportioned amounts in the cart, you can implement &lt;STRONG&gt;CommerceCartCalculationMethodHook&lt;/STRONG&gt;. In the &lt;STRONG&gt;beforeCalculate&lt;/STRONG&gt; method, you can delete existing promotion-apportioned amount records and then recreate them in the &lt;STRONG&gt;afterCalculate&lt;/STRONG&gt; method, ensuring that all promotions are evaluated and calculated.&lt;/P&gt;&lt;P&gt;If you need the apportioned amounts after the order is placed (e.g., to send the information to an ERP or invoicing system for refund amount calculations), you can use &lt;STRONG&gt;CommercePlaceOrderMethodHook&lt;/STRONG&gt;. In the &lt;STRONG&gt;afterPlaceOrder&lt;/STRONG&gt; method, you can calculate the apportioned amounts accordingly.&lt;/P&gt;&lt;P&gt;Additionally, in calculation of RefundEntry's amount value, the following method is used in&amp;nbsp;&lt;STRONG&gt;DefaultOmsReturnFacade:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;protected BigDecimal calculateRefundEntryAmount(final AbstractOrderEntryModel orderEntryModel, final Long expectedQuantity,
		final boolean completeReturn)
{
	final BigDecimal entryAmount;
	if (completeReturn)
	{
		entryAmount = BigDecimal.valueOf(orderEntryModel.getTotalPrice());
	}
	else if (CollectionUtils.isEmpty(orderEntryModel.getDiscountValues()))
	{
		entryAmount = BigDecimal.valueOf(orderEntryModel.getBasePrice() * expectedQuantity);
	}
	else
	{
		entryAmount = BigDecimal.ZERO;
	}
	return entryAmount;
}&lt;/LI-CODE&gt;&lt;P&gt;So, you need to overwrite this calculation logic for entries with discount (promotion or regular discount). And in the case of order-level discounts refund amount would be calculated wrongly since this code does not take into account a discount applied on order-level.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Feb 2025 10:04:24 GMT</pubDate>
    <dc:creator>mansurarisoy</dc:creator>
    <dc:date>2025-02-10T10:04:24Z</dc:date>
    <item>
      <title>SAP commerce cloud  post order recalculation  for refund amount with  promotion apportion</title>
      <link>https://community.sap.com/t5/crm-and-cx-q-a/sap-commerce-cloud-post-order-recalculation-for-refund-amount-with/qaq-p/14009995</link>
      <description>&lt;P&gt;hello All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;In context to&amp;nbsp; handling the post order cancellation , returns and refunds&amp;nbsp; on computing the apportion of the promotion amount at line item level , please suggest best practices followed in CCV2 , should it be custom logic completely or any other approach , deinfing refund rules in promotion engine to generate pro-rated discounts ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nivedita&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Feb 2025 07:31:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/crm-and-cx-q-a/sap-commerce-cloud-post-order-recalculation-for-refund-amount-with/qaq-p/14009995</guid>
      <dc:creator>NiveditaDixit</dc:creator>
      <dc:date>2025-02-07T07:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAP commerce cloud post order recalculation for refun...</title>
      <link>https://community.sap.com/t5/crm-and-cx-q-a/sap-commerce-cloud-post-order-recalculation-for-refund-amount-with/qaa-p/14012507#M453512</link>
      <description>&lt;P&gt;Promotion apportioning is not implemented by default in SAP Commerce. If you need to determine the apportioned amount per order entry, you must implement custom logic. Where you place this method execution depends on what you aim to achieve with the implementation.&lt;/P&gt;&lt;P&gt;For example, if you want to display the apportioned amounts in the cart, you can implement &lt;STRONG&gt;CommerceCartCalculationMethodHook&lt;/STRONG&gt;. In the &lt;STRONG&gt;beforeCalculate&lt;/STRONG&gt; method, you can delete existing promotion-apportioned amount records and then recreate them in the &lt;STRONG&gt;afterCalculate&lt;/STRONG&gt; method, ensuring that all promotions are evaluated and calculated.&lt;/P&gt;&lt;P&gt;If you need the apportioned amounts after the order is placed (e.g., to send the information to an ERP or invoicing system for refund amount calculations), you can use &lt;STRONG&gt;CommercePlaceOrderMethodHook&lt;/STRONG&gt;. In the &lt;STRONG&gt;afterPlaceOrder&lt;/STRONG&gt; method, you can calculate the apportioned amounts accordingly.&lt;/P&gt;&lt;P&gt;Additionally, in calculation of RefundEntry's amount value, the following method is used in&amp;nbsp;&lt;STRONG&gt;DefaultOmsReturnFacade:&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;protected BigDecimal calculateRefundEntryAmount(final AbstractOrderEntryModel orderEntryModel, final Long expectedQuantity,
		final boolean completeReturn)
{
	final BigDecimal entryAmount;
	if (completeReturn)
	{
		entryAmount = BigDecimal.valueOf(orderEntryModel.getTotalPrice());
	}
	else if (CollectionUtils.isEmpty(orderEntryModel.getDiscountValues()))
	{
		entryAmount = BigDecimal.valueOf(orderEntryModel.getBasePrice() * expectedQuantity);
	}
	else
	{
		entryAmount = BigDecimal.ZERO;
	}
	return entryAmount;
}&lt;/LI-CODE&gt;&lt;P&gt;So, you need to overwrite this calculation logic for entries with discount (promotion or regular discount). And in the case of order-level discounts refund amount would be calculated wrongly since this code does not take into account a discount applied on order-level.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Feb 2025 10:04:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/crm-and-cx-q-a/sap-commerce-cloud-post-order-recalculation-for-refund-amount-with/qaa-p/14012507#M453512</guid>
      <dc:creator>mansurarisoy</dc:creator>
      <dc:date>2025-02-10T10:04:24Z</dc:date>
    </item>
  </channel>
</rss>

