def create_milestone_payment(session, project_id, amount, bidder_id, description, reason): """ Create a milestone payment """ milestone_data = { 'project_id': project_id, 'bidder_id': bidder_id, 'description': description, 'amount': amount, 'reason': reason, } session.session.headers[ 'X-Freelancer-Time-V1'] = session.session.headers.get( 'X-Freelancer-Time-V1', int(time.time())) # POST /api/projects/0.1/milestones/ response = make_post_request(session, 'milestones', json_data=milestone_data) json_data = response.json() if response.status_code == 200: milestone_data = json_data['result'] return Milestone(milestone_data) else: raise MilestoneNotCreatedException( message=json_data['message'], error_code=json_data['error_code'], )
def create_milestone_payment(session, project_id, bidder_id, amount, reason, description): """ Create a milestone payment """ milestone_data = { 'project_id': project_id, 'bidder_id': bidder_id, 'amount': amount, 'reason': reason, 'description': description } # POST /api/projects/0.1/milestones/ response = make_post_request(session, 'milestones', json_data=milestone_data) json_data = response.json() if response.status_code == 200: milestone_data = json_data['result'] return Milestone(milestone_data) else: raise MilestoneNotCreatedException(message=json_data['message'], error_code=json_data['error_code'])