[Factory] Fixed factory on classes that extend Modification

Hi, I found an issue on the factory method of the Modifcation class, because I invoke the static function `factory` on Discount class, I have back an instance of Modification and not an instance of Discount.