  We analyze GRB 151027A within the binary-driven hypernova (BdHN) approach,
with progenitor a carbon-oxygen core on the verge of a supernova (SN) explosion
and a binary companion neutron star (NS). The hypercritical accretion of the SN
ejecta onto the NS leads to its gravitational collapse into a black hole (BH),
to the emission of the GRB and to a copious $e^+e^-$ plasma. The impact of this
$e^+e^-$ plasma on the SN ejecta explains {the} early soft X-ray flare observed
in long GRBs. We here apply this approach to the UPE and to the hard X-ray
flares. We use GRB 151027A as a prototype. From the time-integrated and the
time-resolved analysis we identify a double component in the UPE and confirm
its ultra-relativistic nature. We confirm the mildly-relativistic nature of the
soft X-ray flare, of the hard X-ray flare and of the ETE. We show that the ETE
identifies the transition from a SN to the HN. We then address the theoretical
justification of these observations by integrating the hydrodynamical
propagation equations of the $e^+ e^-$ into the SN ejecta, the latter
independently obtained from 3D smoothed-particle-hydrodynamics simulations. We
conclude that the UPE, the hard X-ray flare and the soft X-ray flare do not
form a causally connected sequence: Within our model they are the manifestation
of \textbf{the same} physical process of the BH formation as seen through
different viewing angles, implied by the morphology and the $\sim 300$~s
rotation period of the HN ejecta.
