public class

QuickBooksWindowsModule

extends Object
java.lang.Object
   ↳ org.mule.modules.quickbooks.windows.QuickBooksWindowsModule
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

QuickBooks software provides an interface that allows you to use forms such as checks, deposit slips and invoices, making the accounting process more comfortable for the average business owner or manager. By using the built-in functions that pertain to your business, you are able to perform your company accounting by simply recording your vendor activities, customer activities, banking transactions, payroll checks and taxes. QuickBooks handles the accounting portion of each transaction behind the scenes. Read more: QuickBooks Accounting Tutorial | eHow.com http://www.ehow.com/way_5462311_quickbooks-accounting-tutorial.html#ixzz1csaydwxl

Summary

Fields
private String accessTokenIdentifierPrefix Prefix used for storing credentials in ObjectStore.
private String baseUri The base uri of the quickbooks endpoint, used to fetch the company uri.
private QuickBooksWindowsClient client Quick-Books client.
private String consumerKey API Key
private String consumerSecret API Secret
private final MapObjectMapper mom
private QuickBooksOAuthClient oAuthClient Intuit OAuthClient
private ObjectStore objectStore Object store reference
private ObjectStoreHelper objectStoreHelper Object store helper
private DefaultOpenIDClient openIDClient Intuit OpenID client
private boolean verifyOpenIdResponse Specifies if the OpenID response will be verified.
Public Constructors
QuickBooksWindowsModule()
Public Methods
String authUser(String requestTokenUrl, String accessTokenUrl, String authorizationUrl, String callbackUrl, String requestTokenId, Map<String, Object> headers)
Authorize an user using OAuth1.0a
Object blueDotMenu(String accessTokenId)
Retrieves Blue Dot App Menu from Intuit.
Object create(String accessTokenId, WindowsEntityType type, Object entityObject, Boolean draft, Boolean fullResponse)
Creates.
void delete(String accessTokenId, WindowsEntityType type, Object entityObject)
Deletes an object.
boolean disconnect(String accessTokenId)
Invalidates the OAuth access token in the request, thereby disconnecting the user from QuickBooks for this app.
Iterable findObjects(String accessTokenId, WindowsEntityType type, Map<String, Object> query)
Lazily retrieves Objects For details on how to generate a query see: Retrieve Especification
String generateANewRequestId()
Generate a new GUID for the requestId
OAuthCredentials getAccessToken(String apiUrl, String verifier, String requestTokenId, String userIdentifier)
Extract accessToken
String getAccessTokenIdentifierPrefix()
String getBaseUri()
QuickBooksWindowsClient getClient()
Object getCompanyMetadata(String accessTokenId)
Returns company metadata information.
String getConsumerKey()
String getConsumerSecret()
UserInformation getCurrentUser(String accessTokenId)
Returns current user information such as first name, last name, and email address.
Object getObject(String accessTokenId, WindowsEntityType type, Object idType)
Retrieve objects by ID.
ObjectStore getObjectStore()
ObjectStoreHelper getObjectStoreHelper()
DefaultOpenIDClient getOpenIDClient()
boolean getVerifyOpenIdResponse()
QuickBooksOAuthClient getoAuthClient()
void init()
post construct
String openIdInitialize(String providerUrl, String callbackUrl, Map<String, Object> headers)
Initializes OpenID process
void reconnect(String accessTokenId)
Generates a new OAuth access token and invalidates the OAuth access token used in the request, thereby extending the life span by six months.
void revert(String accessTokenId, WindowsEntityType type, Object entityObject)
Revert objects by ID.
void setAccessTokenIdentifierPrefix(String accessTokenIdentifierPrefix)
void setBaseUri(String baseUri)
void setClient(QuickBooksWindowsClient client)
void setConsumerKey(String consumerKey)
void setConsumerSecret(String consumerSecret)
void setObjectStore(ObjectStore objectStore)
void setObjectStoreHelper(ObjectStoreHelper objectStoreHelper)
void setOpenIDClient(DefaultOpenIDClient openIDClient)
void setVerifyOpenIdResponse(boolean verifyOpenIdResponse)
void setoAuthClient(QuickBooksOAuthClient oAuthClient)
List<SyncStatusResponse> status(String accessTokenId, SyncStatusRequest syncStatusRequest)
Retrieve the Status

Retrieves information about the sync status of Quickbooks entities.

List<SyncActivityResponse> syncActivity(String accessTokenId, Map<String, Object> syncActivityRequest)
Retrieve the SyncActivities

The SyncActivity object contains information about Quickbooks for Windows synchronizations.

Object update(String accessTokenId, WindowsEntityType type, Object entityObject, Boolean draft, Boolean fullResponse)
Updates.
OpenIDCredentials verifyOpenId(MuleMessage muleMessage, String receivingUrl, Map<String, String> responseParameters)
Verify response from Intuit
[Expand]
Inherited Methods
From class java.lang.Object

Fields

private String accessTokenIdentifierPrefix

Prefix used for storing credentials in ObjectStore. It will be concatenated to the access token identifier.

E.g. prefix: "qb_", user identifier (realmId): "12345", key for object store "qb_12345"

private String baseUri

The base uri of the quickbooks endpoint, used to fetch the company uri. Quickbooks connector will first use this uri and the realmId to get a second uri, called company uri, which is the actual quickbooks endpoint for the connector

private QuickBooksWindowsClient client

Quick-Books client. By default uses DefaultQuickBooksWindowsClient class.

private String consumerKey

API Key

private String consumerSecret

API Secret

private final MapObjectMapper mom

private QuickBooksOAuthClient oAuthClient

Intuit OAuthClient

private ObjectStore objectStore

Object store reference

private ObjectStoreHelper objectStoreHelper

Object store helper

private DefaultOpenIDClient openIDClient

Intuit OpenID client

private boolean verifyOpenIdResponse

Specifies if the OpenID response will be verified. By default it is true.

Public Constructors

public QuickBooksWindowsModule ()

Public Methods

public String authUser (String requestTokenUrl, String accessTokenUrl, String authorizationUrl, String callbackUrl, String requestTokenId, Map<String, Object> headers)

Authorize an user using OAuth1.0a

Parameters
requestTokenUrl RequestTokenUrl
accessTokenUrl AccessTokenUrl
authorizationUrl AuthorizationUrl
callbackUrl CallbackUrl for OAuth service
requestTokenId Optional value for identifying the requestToken. If it is not passed the client will use a UUID
headers Outbound headers
Returns
  • Authorize Url
Throws
ObjectStoreException from the Object Store instance
OAuthCommunicationException requesting to OAuth provider
OAuthExpectationFailedException requesting to OAuth provider
OAuthNotAuthorizedException requesting to OAuth provider
OAuthMessageSignerException requesting to OAuth provider

public Object blueDotMenu (String accessTokenId)

Retrieves Blue Dot App Menu from Intuit.

Parameters
accessTokenId Credentials identifier for the user information to be requested
Returns
  • Object containing the HTML and javascript for displaying the menu

public Object create (String accessTokenId, WindowsEntityType type, Object entityObject, Boolean draft, Boolean fullResponse)

Creates. For details of the supported objects and its fields: Supported Objects and Operations

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
entityObject Represents the object to be created.
draft Boolean draft

Saving an IDS object in a draft state prevents it from being synchronized with Quickbooks. Your app might want to save an object in a draft state if the user has not finished entering data, or for some other reason the user does not want to commit the object for synchronization. You may save an object in draft state during a create or update operation by specifying the draft="true" attribute. By default, the Draft attribute is false, which means that the saved object will be synchronized with Quickbooks.

fullResponse Boolean fullResponse. If this flag is true, it will return the created object, otherwise, it will return an ObjectRef.
Returns
  • The created Object or an ObjectRef if the fullResponse flag was null of false.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public void delete (String accessTokenId, WindowsEntityType type, Object entityObject)

Deletes an object.

Most objects cannot be deleted by calling Data Services.

If the obj map do not have the MetaData field or the SyncToken, internally, will retrieve the object at first, to delete it. So be careful, because it will need two request instead of one, which could make it slower.

For details of the supported objects and its fields: Supported Objects and Operations

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
entityObject Represents the object to be deleted.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public boolean disconnect (String accessTokenId)

Invalidates the OAuth access token in the request, thereby disconnecting the user from QuickBooks for this app.

Parameters
accessTokenId Credentials identifier for the user information to be requested
Returns
  • true if the user was disconnect from QBW

public Iterable findObjects (String accessTokenId, WindowsEntityType type, Map<String, Object> query)

Lazily retrieves Objects For details on how to generate a query see: Retrieve Especification

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
query Map that represents every filter and sort for the objects retrieved. Each type of object to be retrieved, has a TheObjectQuery class that has the attributes for which it can be filtered

(To know which attributes are accepted in every ObjectQuery, you could follow the link in the documentation of the WindowsEntityType that you require, or you can follow the link changing the word OBJECT for the object that you required, for example Account:

https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/ 0500_QuickBooks_Windows/0600_Object_Reference/OBJECT

).

Do not complete the fields chunkSize and startPage, because are need it for the "lazily retrieve".

If query is null, it will retrieve all the objects of that WindowsEntityType.
Returns
  • Iterable of the objects to be retrieved.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public String generateANewRequestId ()

Generate a new GUID for the requestId

Returns
  • a GUID for the requestId

public OAuthCredentials getAccessToken (String apiUrl, String verifier, String requestTokenId, String userIdentifier)

Extract accessToken

Parameters
apiUrl API URL
verifier OAuth verifier. It comes within the callback. The default value is "#[header:inbound:oauth_verifier]"
requestTokenId Id used for identifying the authorized request token. It comes within the callback. By default the query string parameter is userId
userIdentifier Id used for store the accessToken in the Object Store. By default the value is the realmId
Returns
  • credentials user credentials
Throws
ObjectStoreException from the object store instance
OAuthCommunicationException requesting to OAuth provider
OAuthExpectationFailedException requesting to OAuth provider
OAuthNotAuthorizedException requesting to OAuth provider
OAuthMessageSignerException requesting to OAuth provider

public String getAccessTokenIdentifierPrefix ()

public String getBaseUri ()

public QuickBooksWindowsClient getClient ()

public Object getCompanyMetadata (String accessTokenId)

Returns company metadata information.

Parameters
accessTokenId Identifier for QuickBooks credentials.
Returns
  • company metadata

public String getConsumerKey ()

public String getConsumerSecret ()

public UserInformation getCurrentUser (String accessTokenId)

Returns current user information such as first name, last name, and email address. For details see: CurrentUserAPI

Parameters
accessTokenId Identifier for QuickBooks credentials.
Returns
  • current user information

public Object getObject (String accessTokenId, WindowsEntityType type, Object idType)

Retrieve objects by ID. For details of the supported objects: Supported Objects and Operations

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
idType Id IdType which is assigned by Data Services when the object is created.
Returns
  • The object.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public ObjectStore getObjectStore ()

public ObjectStoreHelper getObjectStoreHelper ()

public DefaultOpenIDClient getOpenIDClient ()

public boolean getVerifyOpenIdResponse ()

public QuickBooksOAuthClient getoAuthClient ()

public void init ()

post construct

public String openIdInitialize (String providerUrl, String callbackUrl, Map<String, Object> headers)

Initializes OpenID process

Parameters
providerUrl OpenID provider url
callbackUrl OpenID callbackUrl. It has to point to an endpoint callback to process the response
headers OpenId response headers
Returns
  • url to redirect the user
Throws
ObjectStoreException if the operation cannot store the OpenIDManagers

public void reconnect (String accessTokenId)

Generates a new OAuth access token and invalidates the OAuth access token used in the request, thereby extending the life span by six months. Because accessing QuickBooks data requires a valid access token, when the OAuth access token is renewed, your app can continue to access the user's QuickBooks company data.

Parameters
accessTokenId Credentials identifier for the user information to be requested
Throws
ObjectStoreException if the credentials store failed

public void revert (String accessTokenId, WindowsEntityType type, Object entityObject)

Revert objects by ID. For details of the supported objects: Supported Objects and Operations

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
entityObject Represents the object to be reverted.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public void setAccessTokenIdentifierPrefix (String accessTokenIdentifierPrefix)

Parameters
accessTokenIdentifierPrefix

public void setBaseUri (String baseUri)

Parameters
baseUri

public void setClient (QuickBooksWindowsClient client)

Parameters
client

public void setConsumerKey (String consumerKey)

Parameters
consumerKey

public void setConsumerSecret (String consumerSecret)

Parameters
consumerSecret

public void setObjectStore (ObjectStore objectStore)

Parameters
objectStore

public void setObjectStoreHelper (ObjectStoreHelper objectStoreHelper)

Parameters
objectStoreHelper

public void setOpenIDClient (DefaultOpenIDClient openIDClient)

Parameters
openIDClient

public void setVerifyOpenIdResponse (boolean verifyOpenIdResponse)

Parameters
verifyOpenIdResponse

public void setoAuthClient (QuickBooksOAuthClient oAuthClient)

Parameters
oAuthClient

public List<SyncStatusResponse> status (String accessTokenId, SyncStatusRequest syncStatusRequest)

Retrieve the Status

Retrieves information about the sync status of Quickbooks entities. You can also query specific entity types for either synchronized or unsynchronized objects with filters. You can get information on recent synchronizations using the syncActivity operation.

Note: Sync status information will be maintained for all operations in the cloud up to 30 days old. Of those operations older than 30 days, only the last operation's synch status will be maintained.

Parameters
accessTokenId Identifier for QuickBooks credentials.
syncStatusRequest It has the specifications of the syncStatuses to be retrieved. (like a filter)
Returns

public List<SyncActivityResponse> syncActivity (String accessTokenId, Map<String, Object> syncActivityRequest)

Retrieve the SyncActivities

The SyncActivity object contains information about Quickbooks for Windows synchronizations. To get the sync status of another type of object, for example, a customer, use the status operation. To filter a query based on whether or not an object is synchronized, use a filter.

Note: Sync status information will be maintained for all operations in the cloud up to 30 days old. Of those operations older than 30 days, only the last operation's synch status will be maintained.

Parameters
accessTokenId Identifier for QuickBooks credentials.
syncActivityRequest Map that represents a SyncActivityRequest object. It has the specifications of the SyncActivities to be retrieved. (like a filter)
Returns

public Object update (String accessTokenId, WindowsEntityType type, Object entityObject, Boolean draft, Boolean fullResponse)

Updates.

Specify all the parameters for the object, not just the new or changed elements. If you omit an element, it is removed from the object by the update operation.

For details of the supported objects and its fields: Supported Objects and Operations

When updating transaction objects (such as Estimate or Invoice), note the following:

* To retain existing line items, specify them in the request XML body and do not change their order.

* To remove a line item, omit it.

* To add a new line item, insert a new one in the list.

Parameters
accessTokenId Identifier for QuickBooks credentials.
type WindowsEntityType of the object.
entityObject Represents the object to be updated.
draft Boolean draft

Saving an IDS object in a draft state prevents it from being synchronized with Quickbooks. Your app might want to save an object in a draft state if the user has not finished entering data, or for some other reason the user does not want to commit the object for synchronization. You may save an object in draft state during a create or update operation by specifying the draft="true" attribute. By default, the Draft attribute is false, which means that the saved object will be synchronized with Quickbooks.

fullResponse Boolean fullResponse. If this flag is true, it will return the created object, otherwise, it will return an ObjectRef.
Returns
  • The updated Object or an ObjectRef if the fullResponse flag was null of false.
Throws
QuickBooksRuntimeException when there is a problem with the server. It has a code and a message provided by quickbooks about the error.

public OpenIDCredentials verifyOpenId (MuleMessage muleMessage, String receivingUrl, Map<String, String> responseParameters)

Verify response from Intuit

Parameters
muleMessage Injected MuleMessage
receivingUrl Url from OpenID provider.

If it is not provided the processor will extract it from the Mule message

responseParameters Response parameters from Intuit. It process a map with all the OpenID attributes sent from Intuit.
Returns
  • OpenID credentials for the authenticated user
Throws
MessageException from OpenID manager
ObjectStoreException if the operation cannot retrieve OpenID managers from ObjectStore