Beispiel #1
0
def webhooksNotify(request):
    try:
        name = request.POST.get('name', None)
        object_id = request.POST.get('object_id', None)
        system = request.POST.get('system', None)
        user_id = request.POST.get('user_id', None)
        verifier = request.POST.get('verifier', None)
        freshbooks.setup(itsr_url,
                         itsr_fb_token,
                         user_agent_name=itsr_unique_ua)
        if verifier is None:
            call_back_create = freshbooks.call_api('payment.get',
                                                   {'payment_id': object_id})
            print "webhooks check", call_back_create
            if call_back_create.success:
                """ call back success """
                return HttpResponse(json.dumps({'result': True}))
            else:
                print "There is an error while payment.get"
                return HttpResponse(status=500)
        else:
            call_back_create = freshbooks.call_api(
                'callback.verify',
                {'callback': {
                    'callback_id': object_id,
                    'verifier': verifier
                }})
            if call_back_create.success:
                return HttpResponse(json.dumps({'result': True}))
            return HttpResponse(status=500)
    except Exception, e:
        print str(e)
        return HttpResponse(status=500)
def webhooksNotify(request):
    try:
        name = request.POST.get('name', None)
        object_id = request.POST.get('object_id', None)
        system = request.POST.get('system', None)
        user_id = request.POST.get('user_id', None)
        verifier = request.POST.get('verifier', None)
        freshbooks.setup(itsr_url, itsr_fb_token,
                         user_agent_name=itsr_unique_ua)
        if verifier is None:
            call_back_create = freshbooks.call_api('payment.get',
                                {'payment_id': object_id})
            print "webhooks check", call_back_create
            if call_back_create.success:
                """ call back success """
		return HttpResponse(json.dumps({'result': True}))
            else:
                print "There is an error while payment.get"
                return HttpResponse(status=500)
        else:
            call_back_create = freshbooks.call_api('callback.verify',
                                {'callback': {'callback_id': object_id,
                                              'verifier': verifier
                                              }
                                 })
            if call_back_create.success:
                return HttpResponse(json.dumps({'result': True}))
            return HttpResponse(status=500)
    except Exception, e:
        print str(e)
        return HttpResponse(status=500)
Beispiel #3
0
def get_invoices(request):
    freshbooks.setup(itsr_url, itsr_fb_token, user_agent_name=itsr_unique_ua)
    call_back_create = freshbooks.call_api('invoice.get',
                                           {'invoice_id': 767234})
    if call_back_create.success:
        invoice_id = call_back_create.get_invoice_id
        print call_back_create.get_invoice_id
    return HttpResponse(json.dumps({'invoice': invoice_id}))
def get_invoices(request):
    freshbooks.setup(itsr_url, itsr_fb_token,
                         user_agent_name=itsr_unique_ua)
    call_back_create = freshbooks.call_api('invoice.get',
                        {'invoice_id': 767234})
    if call_back_create.success:
        invoice_id = call_back_create.get_invoice_id
        print call_back_create.get_invoice_id
    return HttpResponse(json.dumps({'invoice': invoice_id}))
def webhookcallback(request):
    try:
        freshbooks.setup(itsr_url, itsr_fb_token,
                         user_agent_name=itsr_unique_ua)
        call_back_create = freshbooks.call_api('callback.create',
                    {'callback': {'event': 'payment.create',
                        'uri': 'url to handle request'}
                    })
        if call_back_create.success:
            #call_back_id = call_back_create.callback_id
            return HttpResponse(json.dumps({"result": True}))
        return HttpResponse(json.dumps({'result': False}))
    except Exception, e:
        return HttpResponse(json.dumps({'result': str(e)}))
Beispiel #6
0
def webhookcallback(request):
    try:
        freshbooks.setup(itsr_url,
                         itsr_fb_token,
                         user_agent_name=itsr_unique_ua)
        call_back_create = freshbooks.call_api(
            'callback.create', {
                'callback': {
                    'event': 'payment.create',
                    'uri': 'url to handle request'
                }
            })
        if call_back_create.success:
            #call_back_id = call_back_create.callback_id
            return HttpResponse(json.dumps({"result": True}))
        return HttpResponse(json.dumps({'result': False}))
    except Exception, e:
        return HttpResponse(json.dumps({'result': str(e)}))
Beispiel #7
0
def setup(account, token, user_agent=None):
    if user_agent:
        freshbooks.setup(account, token, user_agent_name=user_agent)
    else:
        freshbooks.setup(account, token)
Beispiel #8
0
import freshbooks

# get data
freshbooks.setup('cwbsolutionspteltd.freshbooks.com',
                 '08bf24f443a1882de4f109d791209c3a',
                 user_agent_name='cwbsolutionspteltd')
clients = freshbooks.Client.list()
# client_names = [clients.first_name]
print 'Name', '\t\t', 'Organization'
for client in clients:
    print client.first_name, client.last_name, '\t\t', client.organization
#print clients[0].first_name
# client_1 = freshbooks.Client.get(<client_id>)

# # update data
# changed_client = freshbooks.Client()
# changed_client.client_id = client_1.client_id
# changed_client.first_name = u'Jane'
# r = freshbooks.call_api('client.update', changed_client)
# assert(r.success)
Beispiel #9
0
import freshbooks
# get data
freshbooks.setup('sumosoftware.freshbooks.com','4668d90e024786abce6feed39e7de0fa') 
clients = freshbooks.Client.list()
client_1 = freshbooks.Client.get(0)

# update data
# changed_client = freshbooks.Client()
# changed_client.client_id = client_1.client_id
# changed_client.first_name = u'Jane'
# r = freshbooks.call_api('client.update', changed_client)
# assert(r.success)