The purpose of this paper is to develop an alternative theory of deuteron stripping to resonance states based on the surface integral formalism of Kadyrov et al. [Ann. Phys. 324, 1516 (2009)] and continuum-discretized coupled channels (CDCC). First we demonstrate how the surface integral formalism works in the three-body model and then we consider a more realistic problem in which a composite structure of target nuclei is taken via optical potentials. We explore different choices of channel wave functions and transition operators and show that a conventional CDCC volume matrix element can be written in terms of a surface-integral matrix element, which is peripheral, and an auxiliary matrix element, which determines the contribution of the nuclear interior over the variable $r_{nA}$. This auxiliary matrix element appears due to the inconsistency in treating of the $n-A$ potential: this potential should be real in the final state to support bound states or resonance scattering and complex in the initial state to describe $n-A$ scattering. Our main result is formulation of the theory of the stripping to resonance states using the prior form of the surface integral formalism and CDCC method. It is demonstrated that the conventional CDCC volume matrix element coincides with the surface matrix element, which converges for the stripping to the resonance state. Also the surface representation (over the variable $r_{nA}$ of the stripping matrix element enhances the peripheral part of the amplitude although the internal contribution doesnt disappear and increases with increase of the deuteron energy. We present calculations corroborating our findings for both stripping to the bound state and the resonance.