Dynamic Price Discrimination and Quality Provision Based on Purchase History