Added the refraction.
I calculated the refraction using the snell's law. Snell's law is the formula that describes the relationship between angle of incidence and refraction, when a ray of light passes from one material to another. The actual science behind it is explained in below image:
I also added Reflection today.
The ray is reflected from the reflective surface at an angle equal to the angle between the incident ray and the normal to the surface. The reflected direction can be calculated using the formula:
Reflected direction = incident - 2.0 * dot(normal, incident) * normal ;
Fresnel equation is solved using the wikipedia link.