Beispiel #1
0
def login_via_oauth2(realmId, oauth_verifier):
    """ Store necessary token's to Setup service """

    quickbooks_settings = frappe.get_doc("Quickbooks Settings")

    quickbooks = QuickBooks(
        sandbox=True,
        consumer_key=quickbooks_settings.consumer_key,
        consumer_secret=quickbooks_settings.consumer_secret,
        minorversion=4)

    quickbooks.authorize_url = quickbooks_settings.authorize_url
    quickbooks.request_token = quickbooks_settings.request_token
    quickbooks.request_token_secret = quickbooks_settings.request_token_secret
    quickbooks.set_up_service()

    quickbooks.get_access_tokens(oauth_verifier)

    quickbooks.company_id = realmId

    quickbooks_settings.realm_id = realmId
    quickbooks_settings.access_token = quickbooks.access_token
    quickbooks_settings.access_token_secret = quickbooks.access_token_secret
    quickbooks_settings.save()
    frappe.db.commit()
def login_via_oauth2(realmId, oauth_verifier):
	""" Store necessary token's to Setup service """
	
	quickbooks_settings = frappe.get_doc("Quickbooks Settings")
	 
	quickbooks = QuickBooks(
       sandbox=True,
       consumer_key = quickbooks_settings.consumer_key,
       consumer_secret = quickbooks_settings.consumer_secret,
       minorversion=4
     )

	quickbooks.authorize_url = quickbooks_settings.authorize_url
	quickbooks.request_token = quickbooks_settings.request_token
	quickbooks.request_token_secret = quickbooks_settings.request_token_secret
	quickbooks.set_up_service()

 	quickbooks.get_access_tokens(oauth_verifier)

	quickbooks.company_id = realmId

	quickbooks_settings.realm_id = realmId
	quickbooks_settings.access_token = quickbooks.access_token
	quickbooks_settings.access_token_secret = quickbooks.access_token_secret 
	quickbooks_settings.save()
	frappe.db.commit()
Beispiel #3
0
def sync_quickbooks_data_erp():
	quickbooks_obj = QuickBooks(
        sandbox=True,
        consumer_key=QUICKBOOKS_CLIENT_KEY,
        consumer_secret=QUICKBOOKS_CLIENT_SECRET,
        access_token=access_token,
        access_token_secret=access_token_secret,
        company_id=realm_id,
        minorversion=4
    )
 
	customer_data = sync_customers(quickbooks_obj)
	supplier_data = sync_suppliers(quickbooks_obj)
	Employee_data = create_Employee(quickbooks_obj)
	Item_data = create_Item(quickbooks_obj)
	sync_Account(quickbooks_obj)
	invoice_data = sync_si_orders(quickbooks_obj)
	sync_pi_orders(quickbooks_obj)

	payment_invoice(quickbooks_obj)
	bill_payment(quickbooks_obj)
	sync_entry(quickbooks_obj)
	
	if customer_data and supplier_data and Employee_data and Item_data:
		return "Success"
	else:
		return "failed to update"
def quickbooks_authentication_popup(consumer_key, consumer_secret):
	""" Open new popup window to Connect Quickbooks App to Quickbooks sandbox Account """

	quickbooks_settings = frappe.get_doc("Quickbooks Settings")

	quickbooks = QuickBooks(
           sandbox=True,
           consumer_key = quickbooks_settings.consumer_key,
           consumer_secret = quickbooks_settings.consumer_secret,
           callback_url = 'http://'+ frappe.request.host + '/api/method/erpnext_quickbooks.erpnext_quickbooks.doctype.quickbooks_settings.quickbooks_settings.First_callback'
    )

	quickbooks_settings.authorize_url = quickbooks.get_authorize_url()
	quickbooks_settings.request_token = quickbooks.request_token
	quickbooks_settings.request_token_secret = quickbooks.request_token_secret
	quickbooks_settings.save()
	frappe.db.commit()
	return quickbooks_settings.authorize_url
Beispiel #5
0
def quickbooks_authentication_popup(consumer_key, consumer_secret):
    """ Open new popup window to Connect Quickbooks App to Quickbooks sandbox Account """

    quickbooks_settings = frappe.get_doc("Quickbooks Settings")

    quickbooks = QuickBooks(
        sandbox=True,
        consumer_key=quickbooks_settings.consumer_key,
        consumer_secret=quickbooks_settings.consumer_secret,
        callback_url='http://' + frappe.request.host +
        '/api/method/erpnext_quickbooks.erpnext_quickbooks.doctype.quickbooks_settings.quickbooks_settings.First_callback'
    )

    quickbooks_settings.authorize_url = quickbooks.get_authorize_url()
    quickbooks_settings.request_token = quickbooks.request_token
    quickbooks_settings.request_token_secret = quickbooks.request_token_secret
    quickbooks_settings.save()
    frappe.db.commit()
    return quickbooks_settings.authorize_url
Beispiel #6
0
def login_via_oauth2(realmId, oauth_verifier):
	""" Store necessary token's to Setup service """
	global realm_id
	global access_token
	global access_token_secret
	quickbooks = QuickBooks(
       sandbox=True,
       consumer_key = QUICKBOOKS_CLIENT_KEY,
       consumer_secret = QUICKBOOKS_CLIENT_SECRET,
       minorversion=4
     )
	quickbooks.authorize_url = authorize_url
	quickbooks.request_token = request_token
	quickbooks.request_token_secret = request_token_secret
	quickbooks.company_id = realmId
	quickbooks.set_up_service()
 	quickbooks.get_access_tokens(oauth_verifier)
	realm_id = realmId
	access_token = quickbooks.access_token
	access_token_secret = quickbooks.access_token_secret 
Beispiel #7
0
def quickbooks_authentication_popup(consumer_key, consumer_secret):
	""" Open new popup window to Connect Quickbooks App to Quickbooks sandbox Account """

	global authorize_url
	global request_token
	global request_token_secret
	global QUICKBOOKS_CLIENT_KEY
	global QUICKBOOKS_CLIENT_SECRET

	QUICKBOOKS_CLIENT_KEY = consumer_key
	QUICKBOOKS_CLIENT_SECRET = consumer_secret
	quickbooks = QuickBooks(
           sandbox=True,
           consumer_key = consumer_key,
           consumer_secret = consumer_secret,
           callback_url = 'http://'+ frappe.request.host + '/api/method/erpnext_quickbooks.erpnext_quickbooks.doctype.quickbooks_settings.quickbooks_settings.First_callback'
    )

	authorize_url = quickbooks.get_authorize_url()
	request_token = quickbooks.request_token
	request_token_secret = quickbooks.request_token_secret
	return authorize_url