Magnetospheric effects on high-energy solar particles during the 2012 May 17th event measured with the PAMELA experiment