Added authorization function

and added check to Gratuity object