public function handleSalesRuleValidatorProcess(Varien_Event_Observer $observer)
    {
        /** @var Varien_Event $event */
        $event = $observer->getEvent();
        /** @var Mage_SalesRule_Model_Rule $rule */
        $rule = $event->getRule();
        /** @var Mage_Sales_Model_Quote $quote */
        $quote = $event->getQuote();
        /** @var Mage_Core_Model_Store $store */
        $store = $quote->getStore();
        /** @var Mage_Sales_Model_Quote_Item $item */
        $item = $event->getItem();
        /** @var Varien_Object */
        $result = $event->getResult();
        $data = (array) $item->getEbayEnterpriseOrderDiscountData();
        $ruleId = $rule->getId();
        // Use the rule id to prevent duplicates.
        $data[$ruleId] = [
            'amount' => $this->calculateDiscountAmount($item, $result, $data),
            'applied_count' => $event->getQty(),
            'code' => $this->helper->getQuoteCouponCode($quote, $rule),
            'description' => $rule->getStoreLabel($store) ?: $rule->getName(),
            'effect_type' => $rule->getSimpleAction(),
            'id' => $ruleId,
        ];
	if( $item instanceof Mage_Sales_Model_Quote_Address_Item )
	{
		$item->setEbayEnterpriseOrderDiscountData($data);

		foreach( $quote->getAllItems() as $quoteItem )
		{
			if( $quoteItem->getId() === $item->getQuoteItemId())
			{
				$quoteItem->setData('ebayenterprise_order_discount_data', serialize($data));
                		$quoteItem->save();
				break;
			}
		}
	} else {
		$item->setEbayEnterpriseOrderDiscountData($data);
		$item->setData('ebayenterprise_order_discount_data', serialize($data));
		$item->save();
	}
    }
public function handleSalesRuleValidatorProcess(Varien_Event_Observer $observer)
    {
        /** @var Varien_Event $event */
        $event = $observer->getEvent();
        /** @var Mage_SalesRule_Model_Rule $rule */
        $rule = $event->getRule();
        /** @var Mage_Sales_Model_Quote $quote */
        $quote = $event->getQuote();
        /** @var Mage_Core_Model_Store $store */
        $store = $quote->getStore();
        /** @var Mage_Sales_Model_Quote_Item $item */
        $item = $event->getItem();
        /** @var Varien_Object */
        $result = $event->getResult();
        $data = (array) $item->getEbayEnterpriseOrderDiscountData();
        $ruleId = $rule->getId();
        // Use the rule id to prevent duplicates.
        $data[$ruleId] = [
            'amount' => $this->calculateDiscountAmount($item, $result, $data),
            'applied_count' => $event->getQty(),
            'code' => $this->helper->getQuoteCouponCode($quote, $rule),
            'description' => $rule->getStoreLabel($store) ?: $rule->getName(),
            'effect_type' => $rule->getSimpleAction(),
            'id' => $ruleId,
        ];
	if( $item instanceof Mage_Sales_Model_Quote_Address_Item )
	{
		$item->setEbayEnterpriseOrderDiscountData($data);

		foreach( $quote->getAllItems() as $quoteItem )
		{
			if( $quoteItem->getId() === $item->getQuoteItemId())
			{
				$quoteItem->setData('ebayenterprise_order_discount_data', serialize($data));
                		$quoteItem->save();
				break;
			}
		}
	} else {
		$item->setEbayEnterpriseOrderDiscountData($data);
		$item->setData('ebayenterprise_order_discount_data', serialize($data));
		$item->save();
	}
    }
public function handleSalesRuleValidatorProcess ( Varien_Event_Observer $ observer ) { /** @var Varien_Event $event */ $ event = $ observer -> getEvent ( ) ; /** @var Mage_SalesRule_Model_Rule $rule */ $ rule = $ event -> getRule ( ) ; /** @var Mage_Sales_Model_Quote $quote */ $ quote = $ event -> getQuote ( ) ; /** @var Mage_Core_Model_Store $store */ $ store = $ quote -> getStore ( ) ; /** @var Mage_Sales_Model_Quote_Item $item */ $ item = $ event -> getItem ( ) ; /** @var Varien_Object */ $ result = $ event -> getResult ( ) ; $ data = ( array ) $ item -> getEbayEnterpriseOrderDiscountData ( ) ; $ ruleId = $ rule -> getId ( ) ; // Use the rule id to prevent duplicates. $ data [ $ ruleId ] = [ 'amount' => $ this -> calculateDiscountAmount ( $ item , $ result , $ data ) , 'applied_count' => $ event -> getQty ( ) , 'code' => $ this -> helper -> getQuoteCouponCode ( $ quote , $ rule ) , 'description' => $ rule -> getStoreLabel ( $ store ) ? : $ rule -> getName ( ) , 'effect_type' => $ rule -> getSimpleAction ( ) , 'id' => $ ruleId , ] ; if ( $ item instanceof Mage_Sales_Model_Quote_Address_Item ) { $ item -> setEbayEnterpriseOrderDiscountData ( $ data ) ; foreach ( $ quote -> getAllItems ( ) as $ quoteItem ) { if ( $ quoteItem -> getId ( ) === $ item -> getQuoteItemId ( ) ) { $ quoteItem -> setData ( 'ebayenterprise_order_discount_data' , serialize ( $ data ) ) ; $ quoteItem -> save ( ) ; break ; } } } else { $ item -> setEbayEnterpriseOrderDiscountData ( $ data ) ; $ item -> setData ( 'ebayenterprise_order_discount_data' , serialize ( $ data ) ) ; $ item -> save ( ) ; } }
Account for discounts in order create request.

@see self::handleSalesConvertQuoteItemToOrderItem
@see Mage_SalesRule_Model_Validator::process
@see Order-Datatypes-Common-1.0.xsd:PromoDiscountSet
@param Varien_Event_Observer
@return void
Account for discounts in order create request .