# Retail Discount Concurrency Control – Compete Within Priority and Compound Across

To enable retailer to control the ordering of how to apply compounded discounts, we can have the following,

1. Define priority for all discounts
2. Within the same priority, every discount competes against each other. In other words, 2 compounded discounts of the same priority would compete against each other.
3. Compound across priority. For exclusive discounts, mark so and they won’t compound with any other ones.

For example,

 Priority Discount Comment 99 10% off for product A Vendor sponsored 77 20% off for product A Retail corporate 77 \$10 for product A if quantity > 2 Retail store specific

If we have 4xA in the checkout transaction, then we apply first vendor sponsored discount of highest priority 99. After that, we have a competition between 2 retailer sponsored discounts and apply the better one.

Now, if we throw another vendor discount of priority 99 and it’s exclusive, then it competes with the 10%-off vendor sponsored discount. If the new exclusive wins, we won’t compound on top of it any of retailer sponsored discount, even if compounding vendor sponsored and retail sponsored discounts would render the better deal.

In summary, if you focus primarily on how to compound and less on competition for best deal, this would work great. In fact, technically, it’s a much simpler model in that we don’t have to deal with multiple compounded discounts compounded together competing with non-compounded discounts.

Update: it's not trivial mixing in exclusive discounts. Say we apply a compounded discount C9 in the top priority 9, and in the next priority 7, we have an exclusive discount E7 and a compounded discount C7. When we decide between E7 and C7, E7 can not compound on top of C9, while C7 can. In other words, C7 has more product quantities to work with than E7. This would make any knapsack algorithm more complicated. To make it simple, it's better to eliminate competition between exclusive discounts and compounded ones. We have two options.

1. Within each priority, evaluate exclusive discounts first, then compounded ones.
2. Evaluate all exclusive discounts first, honoring the priorities. Then compounded ones. In other words, priority becomes second tier behind exclusivenesss.

Update 2: The following will be released soon in AX7. Compete within priority and compound across is the second option.

Tags