When calculate tax amounts, consider case when no document lines exist.
Payment service