ruckus on v0.6.6
* Implemented minorversion supp… (compare)
ruckus on 389-oauth2
Allow to use any patch version … (compare)
ruckus on master
log response headers. Most in… (compare)
ruckus on master
Update HISTORY.md (#457) updat… (compare)
Quickbooks.sandbox_mode = true
client_id = "xxxxx"
client_secret = "xxxx"
oauth_params = {
:site => "https://sandbox-quickbooks.api.intuit.com/connect/oauth2",
:authorize_url => "https://sandbox-quickbooks.api.intuit.com/connect/oauth2",
:token_url => "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
:connection_opts => {
:proxy => "http://127.0.0.1:8888"
}
}
::QB_OAUTH2_CONSUMER = OAuth2::Client.new(client_id, client_secret, oauth_params)
# Single Company initializes Quickbooks connection upon Rails initialization
# This file is not needed for a multi-instance
# Create config/initializers/quickeebooks.rb
QB_KEY = "<copy from developer.intuit.com>"
QB_SECRET = "<copy from developer.intuit.com>"
$qb_oauth_consumer = OAuth::Consumer.new(QB_KEY, QB_SECRET, {
:site => "https://oauth.intuit.com",
:request_token_path => "/oauth/v1/get_request_token",
:authorize_url => "https://appcenter.intuit.com/Connect/Begin",
:access_token_path => "/oauth/v1/get_access_token"
})
# Multi-Company initialize the Quickbooks connection when the model is needed
# Best to wrap the QBO related functions in a module
# Example Rails Model
OAUTH_CONSUMER_KEY = "OAUTH_CONSUMER_KEY"
OAUTH_CONSUMER_SECRET = "OAUTH_CONSUMER_SECRET"
class Company < ActiveRecord::Base
# Fields
# qbo_id
# token_key
# token_secret
def qbo_consumer
OAuth::Consumer.new(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, {
:site => "https://oauth.intuit.com",
:request_token_path => "/oauth/v1/get_request_token",
:authorize_url => "https://appcenter.intuit.com/Connect/Begin",
:access_token_path => "/oauth/v1/get_access_token"
})
end
def qbo_access_token
access_token = OAuth::AccessToken.new(qbo_consumer, token_key, token_secret)
end
end
def oauth_callback
if params[:state]
redirect_uri = quickbooks_oauth_callback_url
if resp = ::QB_OAUTH2_CONSUMER.auth_code.get_token(params[:code], :redirect_uri => redirect_uri)
# save your tokens here. For example:
quickbooks_credentials.update_attributes(access_token: resp.token, refresh_token: resp.refresh_token, realm_id: params[:realmId])
end
end
end
And i received a error:
Completed 500 Internal Server Error in 9665ms (ActiveRecord: 0.0ms)
NameError (undefined local variable or method `quickbooks_credentials' for #<QuickbooksController:0x0000563b50d69390>
Did you mean? quickbooks_authenticate_url):
How i can repair that? I should create a new table in my database or how to fix that? P.S I want to export clients from my Rails App to Quickbooks :)
Sorry for your time, my English and such silly questions. Thanks for the help in advance :)
salesreceipt = ::Quickbooks::Model::SalesReceipt.new({
id: 1, #RefNumber
customer_id: 62, #Customer need define ID in customer_create
txn_date: "2014-09-14", #TxnDate Дата транзакции
deposit_to_account_ref: "Undeposited Funds", #BankAccount
payment_method_ref: "Credit Card", #PaymentMethod
payment_ref_number: "2014-09-14", #PaymentRefNumber дата самого пеймента, который обычно совпадает с днем транзакции
bill_email: "NeedToSend" #ToBeEmailed
})
salesreceipt.auto_doc_number! #allows Intuit to auto-generate the transaction number
line_item = ::Quickbooks::Model::Line.new
line_item.description = "PLC DESC STUFF" #LineDesc
line_item.sales_item! do |detail|
detail.unit_price = 50 #LineUnitPrice
detail.quantity = 1 # LineQty
detail.item_id = 500 # Item (Product/Service) ID here
end
And i received errors in few rows:
bill_email: "NeedToSend"
deposit_to_account_ref: "Undeposited Funds"
And another. I add if i'll find
site
and a authorize_url
hello, good day guys.
am try implementation quickbook
with oauth2
, but when i send auth_code.get_token
returned the next error Faraday::ConnectionFailed (Failed to open TCP connection to oauth.splatform.intuit.com:443 (getaddrinfo: Name or service not known)):
my code:
def authenticate
redirect_uri = quick_books_oauth_callback_url
grant_url = ::QB_OAUTH2_CONSUMER.auth_code.authorize_url(redirect_uri: redirect_uri, response_type: 'code', state: SecureRandom.hex(12), scope: 'com.intuit.quickbooks.accounting')
redirect_to grant_url
end
def oauth_callback
return unless params[:state]
redirect_uri = quick_books_oauth_callback_url
resp = ::QB_OAUTH2_CONSUMER.auth_code.get_token(params[:code],
redirect_uri: redirect_uri)
return unless resp
QuickbooksCredential.new_credentials(
access_token: resp.token,
refresh_token: resp.refresh_token,
realm_id: params[:realmId]
)
end
request' for #<IntuitOAuth::Client error, here's my code
access_token = OAuth2::AccessToken.new($oauth2_client, access_token, :refresh_token => refresh_token)access_token = OAuth2::AccessToken.new($oauth2_client, access_token, :refresh_token => refresh_token)
service = Quickbooks::Service::Preferences.new
service.company_id = realm_id
service.access_token = access_token
preferences = service.query("Select * from Preferences")