We develop a wavefunction approach to describe the scattering of two photons on a quantum emitter embedded in a one-dimensional waveguide. Our method allows us to calculate the exact dynamics of the complete system at all times, as well as the transmission properties of the emitter. We show that the non-linearity of the emitter with respect to incoming photons depends strongly on the emitter excitation and the spectral shape of the incoming pulses, resulting in transmission of the photons which depends crucially on their separation and width. In addition, for counter-propagating pulses, we analyze the induced level of quantum correlations in the scattered state, and we show that the emitter behaves as a non-linear beam-splitter when the spectral width of the photon pulses is similar to the emitter decay rate.