created a function verifyAndPostCartop to remove the redundant code
moved the common code to verifyAndPostCartop