mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update qbo_controller.rb
This commit is contained in:
@@ -34,7 +34,6 @@ class QboController < ApplicationController
|
|||||||
def authenticate
|
def authenticate
|
||||||
callback = qbo_oauth_callback_url
|
callback = qbo_oauth_callback_url
|
||||||
token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)
|
token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)
|
||||||
#session[:qb_request_token] = token
|
|
||||||
session[:qb_request_token] = Marshal.dump(token)
|
session[:qb_request_token] = Marshal.dump(token)
|
||||||
redirect_to("https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}") and return
|
redirect_to("https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}") and return
|
||||||
end
|
end
|
||||||
@@ -43,8 +42,6 @@ class QboController < ApplicationController
|
|||||||
# Called by QBO after authentication has been processed
|
# Called by QBO after authentication has been processed
|
||||||
#
|
#
|
||||||
def oauth_callback
|
def oauth_callback
|
||||||
#at = session[:qb_request_token].get_access_token(:oauth_verifier => params[:oauth_verifier])
|
|
||||||
# If Rails >= 4.1 you need to do this =>
|
|
||||||
at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])
|
at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])
|
||||||
|
|
||||||
#There can only be one...
|
#There can only be one...
|
||||||
@@ -62,7 +59,6 @@ class QboController < ApplicationController
|
|||||||
else
|
else
|
||||||
redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => "Error" }
|
redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => "Error" }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Quickbooks Webhook Callback
|
# Quickbooks Webhook Callback
|
||||||
@@ -93,12 +89,12 @@ class QboController < ApplicationController
|
|||||||
if entity['name'].eql? "Employee"
|
if entity['name'].eql? "Employee"
|
||||||
QboEmployee.sync_by_id(entity['id'].to_i)
|
QboEmployee.sync_by_id(entity['id'].to_i)
|
||||||
end
|
end
|
||||||
|
|
||||||
Qbo.update_time_stamp
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# The webhook doesn't require a response but let's make sure
|
# Record that last time we updated
|
||||||
# we don't send anything
|
Qbo.update_time_stamp
|
||||||
|
|
||||||
|
# The webhook doesn't require a response but let's make sure we don't send anything
|
||||||
render :nothing => true
|
render :nothing => true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -112,7 +108,6 @@ class QboController < ApplicationController
|
|||||||
QboEmployee.sync
|
QboEmployee.sync
|
||||||
QboEstimate.sync
|
QboEstimate.sync
|
||||||
QboInvoice.sync
|
QboInvoice.sync
|
||||||
#QboPurchase.sync
|
|
||||||
|
|
||||||
# Record the last sync time
|
# Record the last sync time
|
||||||
Qbo.update_time_stamp
|
Qbo.update_time_stamp
|
||||||
|
|||||||
Reference in New Issue
Block a user