  There are two main reasons for absence of the practical theory of stripping
to resonance states which could be used by experimental groups: numerical
problem of the convergence of the DWBA matrix element when the full transition
operator is included and it is unclear what spectroscopic information can be
extracted from the analysis of transfer reactions populating the resonance
states. The purpose of this paper is to address both questions. The theory of
the deuteron stripping is developed, which is based on the post continuum
discretized coupled channels (CDCC) formalism going beyond of the DWBA and
surface integral formulation of the reaction theory [A. S. Kadyrov et al., Ann.
Phys. {\bf 324}, 1516 (2009)]. First, the formalism is developed for the DWBA
and then extended to the CDCC formalism, which is ultimate goal of this work.
The CDCC wave function takes into account not only the initial elastic $d+ A$
channel but also its coupling to the deuteron breakup channel $p + n + A$
missing in the DWBA. Stripping to both bound states and resonances are
included. The convergence problem for stripping to resonance states is solved
in the post CDCC formalism. The reaction amplitude is parametrized in terms of
the reduced width amplitudes (ANCs), inverse level matrix, boundary condition
and channel radius, that is the same parameters which are used in the
conventional $R$-matrix method. For stripping to resonance states many-level,
one and two-channel cases are considered. The theory provides a consistent tool
to analyze both binary resonant reactions and deuteron stripping in terms of
the same parameters.
