Fix /invoice http handler: remove global vars, handle err from mongo