Re-factor receive_payment code to allow some re-use for our proposed 'confirm-order' workflow.
added core_functions confirm_order() function, further re-factors for code reuse.