1.0.3 • Published 5 years ago

quickbooks-module-prodio v1.0.3

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

quickbooks-module-prodio

quickbooks-module-prodio is NodeJS client for the quickbooks-services-prodio API.

Prerequisite (Things to do before installing this module):

  • Clone its dependency repository first on your server git clone https://github.com/ProdioDesignWorks/quickbooks-services-prodio.git
  • Navigate to your repo cd quickbooks-services-prodio
  • Install dependencies npm install
  • Start service node . or npm start or node server/server.js
  • Open http://localhost:3040/explorer/ in your browser
  • If you've pm2 installed then use this pm2 start server/server.js --name="QB_SERVICE"
  • When you install quickbooks-module-prodio, it will ask question for the BASE_URL of this QB_SERVICE - eventually.

Features!

Functions

  • Add/Edit/Get Account

  • Add/Edit/Get/Delete Client

  • Add/Edit/Get/Delete Employees

  • Add/Edit/Get/Delete Invoices

  • Add/Edit/Get/Delete Payments

  • Add/Edit/Get/Delete Vendors

Installation

$ npm install quickbooks-module-prodio@latest --save

FIRST STEP

The QBO has Oauth2.0 Authentication process. So it requires to verify our app FOR THE VERY FIRST TIME MANUALLY, with the QB App created to get app access token, then from next time the code will auto create the refresh token, before the expiration of the current token.

  1. You will need to login into QuickBooks developer account.

  2. You will have to create a app ( sometimes there is already default app created ).

  3. You will have to insert your API Callback URL in the app settings page.

  4. You will have to copy clientId and clientSecret keys from the app settings, and put inside the QBConfig.json file.

  5. You can make different different apps for diff diff environments.

  6. After you the APIs on the host and its running -- use this URL to verify once.

http://{DOMAIN}:3040/api/Oauth2Data/connectQuickBooks

  1. Note that, this is One Time Process, which has to be done prior using the APIs.

  2. After successful connection, you will see a JSON displayed on the browser. You will have to ignore that.

Initialization

Require the quickbooks-module-prodio module and initialize the quickbooks npm module client.

 const qbClass = require('quickbooks-module-prodio');
 const qbObj = new qbClass(BASE_URL); //BASE_URL => is the url where its loopback apis are running. eg. (http://localhost:3040/api/)

Method

1. ADD BUSINESS ACCOUNT:

This will create new business account.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_ACCOUNTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

Example

	const payload = {
	    "action": "CREATE_ACCOUNT",
	    "meta": SAMPLE_META_INFO
	};
	//create business in appointment module
	qbObj.execute(payload, function(response) {
	    if (typeof response == "string" || typeof response === "string") {
	        response = JSON.parse(response);
	    }

	    if (!isNull(response.data)) {
	        let serverResponse = response["data"];
	        if (typeof serverResponse == "string" || typeof serverResponse === "string") {
	            serverResponse = JSON.parse(response["data"]);
	        }

	        if (!isNull(serverResponse.error)) {
	            //Error Response
	            return cb(new HttpErrors.InternalServerError(response.data.error.message, {
	                expose: false
	            }));
	        } else {
	            // HTTP : 200 , Success Response , Merchant Successfully Created!!
	            return cb(null, response.data);
	        }
	    } else {
	        if (!isNull(response["response"])) {
	            let serverResponse = response["response"]["data"];
	            if (typeof serverResponse == "string" || typeof serverResponse === "string") {
	                serverResponse = JSON.parse(response["response"]["data"]);
	            }

	            let serverResponseError = serverResponse["error"];
	            if (typeof serverResponseError == "string" || typeof serverResponseError === "string") {
	                serverResponseError = JSON.parse(serverResponseError["error"]);
	            }

	            let _msg = isNull(serverResponseError["message"]) ? 'Internal Server Error' : serverResponseError["message"];

	            //Error Response
	            return cb(new HttpErrors.InternalServerError(_msg, {
	                expose: false
	            }));
	        } else {
	            let _msg = isNull(response["data"]["message"]) ? 'Internal Server Error' : response["data"]["message"];

	            //Error Response
	            return cb(new HttpErrors.InternalServerError(_msg, {
	                expose: false
	            }));
	        }
	    }
	});

2. EDIT BUSINESS ACCOUNT:

This will edit the business account.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_ACCOUNTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

3. GET BUSINESS ACCOUNT:

This will get account information from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_ACCOUNTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

4. CREATE CUSTOMER :

This will create customer account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_CUSTOMERkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

5. EDIT CUSTOMER :

This will edit customer account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_CUSTOMERkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

6. GET CUSTOMER :

This will get customer account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_CUSTOMERkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

7. DELETE CUSTOMER :

This will delete customer account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringDELETE_CUSTOMERkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

7. GET ALL CUSTOMERS :

This will list all customers account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGETALL_CUSTOMERSkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

8. CREATE EMPLOYEE :

This will create EMPLOYEE account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_EMPLOYEEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

5. EDIT EMPLOYEE :

This will edit EMPLOYEE account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_EMPLOYEEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

6. GET EMPLOYEE :

This will get EMPLOYEE account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_EMPLOYEEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

7. DELETE EMPLOYEE :

This will delete EMPLOYEE account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringDELETE_EMPLOYEEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

8. GET ALL EMPLOYEEs :

This will list all EMPLOYEEs account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGETALL_EMPLOYEESkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

9. CREATE INVOICE :

This will create invoice.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_INVOICEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

10. EDIT INVOICE :

This will edit given invoice.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_INVOICEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

11. DELETE INVOICE :

This will delete INVOICE from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringDELETE_INVOICEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

12. GET ALL INVOICES :

This will list all INVOICES from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGETALL_INVOICESkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

13. VOID INVOICE :

This will VOID INVOICE from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringVOID_INVOICEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

14. EMAIL INVOICE :

This will send invoice to given email id.

Payload

KeyTypeValueDescriptionRequired
actionstringEMAIL_INVOICEkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

15. GET INVOICE PDF :

This will get invoice as pdf.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_INVOICE_PDFkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

16. CREATE PAYMENT TRANSACTION :

This will create PAYMENT TRANSACTION in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_PAYMENTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

17. EDIT PAYMENT TRANSACTION :

This will edit PAYMENT TRANSACTION in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_PAYMENTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

18. GET PAYMENT TRANSACTION :

This will get PAYMENT TRANSACTION from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_PAYMENTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

19. DELETE PAYMENT TRANSACTION :

This will delete PAYMENT TRANSACTION from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringDELETE_PAYMENTkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

20. GET ALL PAYMENT TRANSACTION :

This will list all PAYMENT TRANSACTION from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGETALL_PAYMENTSkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

21. CREATE VENDOR :

This will create VENDOR account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringCREATE_VENDORkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

22. EDIT VENDOR :

This will edit VENDOR account in QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringEDIT_VENDORkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

23. GET VENDOR :

This will get VENDOR account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGET_VENDORkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

24. DELETE VENDOR :

This will delete VENDOR account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringDELETE_VENDORkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES

25. GET ALL VENDORS :

This will list all VENDORS account from QBO.

Payload

KeyTypeValueDescriptionRequired
actionstringGETALL_VENDORSkey which defines the type of action to be performedYES
metajsonSAMPLE_META_INFOJson having business details.YES
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago