Transverse momentum and rapidity dependence of collective flow harmonics of protons and deuterons in Au + Au reactions at 1.23 AGeV