added if/else for discount type