Peterborough United have completed the deal that will see striker Dwight Gayle join the club permanently in January.