rewrite PurchaseController