Calculate discount refactoring