Пример #1
0
    def test_release_milestone_payment(self):
        milestone_data = {
            'milestone_id': 1,
            'amount': 10,
        }

        self.session.session.put = Mock()
        self.session.session.put.return_value = FakeMilestonePaymentReleasePutResponse()
        release_milestone_payment(self.session, **milestone_data)
        self.session.session.put.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/milestones/1/',
            headers=None,
            params={'action': 'release'},
            data=None,
            json={'amount': 10},
            verify=True)
Пример #2
0
def pay(transaction_id):
    milestone_data = {
        'milestone_id': transaction_id,
        'amount': json.loads(request.data)["amount"],
    }
    data = None
    try:
        s = Session(oauth_token=h["Freelancer-OAuth-V1"], url=base_url)
        data = release_milestone_payment(s, **milestone_data)
    except MilestoneNotReleasedException as e:
        print(('Error message: %s' % e.message))
        print(('Server response: %s' % e.error_code))
        return jsonify(data)
    else:
        return jsonify(data)
def sample_release_milestone_payment():
    url = os.environ.get('FLN_URL')
    oauth_token = os.environ.get('FLN_OAUTH_TOKEN')

    session = Session(oauth_token=oauth_token, url=url)
    milestone_data = {
        'milestone_id': 1,
        'amount': 10,
    }
    try:
        m = release_milestone_payment(session, **milestone_data)
    except MilestoneNotReleasedException as e:
        print(('Error message: %s' % e.message))
        print(('Server response: %s' % e.error_code))
        return None
    else:
        return m