rework discount calculation, #20613, #19173, #19354