“Once Imam Hassan (as) saw an African servant who had a loaf of bread eating a piece himself and giving one to a dog each time until he finished. Imam (as) asked him: What made you give a piece to the dog each time after eating a piece yourself? The man replied: I was ashamed of seeing worry in the eyes of the animal. Imam (as) said: Whose servant are you? He said: I am Aban ibn Uthman’s. Imam (as) asked: Whose garden is it? He answered: It is Aban ibn Uthman’s. Then Imam (as) told him: Please stay here until I’m back. He bought the servant and the garden, came back and said: I bought you. The servant stood up and said: I listen to and obey God, the prophet (as) and you my master. Imam (as) replied: I bought the garden also and I free you for the sake of God and grant you the garden.
This is how he thanked a person’s beneficence toward an animal and he made the servant reach freedom and wealth.”
The Prophets Fragrant Flower, Imam Hassan al-Mujtaba by Ayatollah Sheikh Wahid Khorasani page 17
https://www.yasinpublications.com/product-page/the-prophet-s-fragrant-flower-imam-hassan-as