It's not legal. Neither can you do this under the Factories Act or the Industrial Employment Standing Orders. Additionally, this would be a violation of the Shops and Establishment Act. You could also get into trouble for violating the agreed terms of the contract. So, do not engage in such practices without properly compensating the employee and obtaining his or her consent.