Resonant third-order optical nonlinearity in the layered perovskite-type material (C6H13NH3)2PbI4