Giter Site home page Giter Site logo

Comments (4)

durs avatar durs commented on July 28, 2024

from node-activex.

Avrohom avatar Avrohom commented on July 28, 2024

Hi Yuri,

Thanks for your feedback.

Here is the code:

`function getQB_info() {
require('winax')

const session_manager = new ActiveXObject('QBFC13.QBSessionManager.1');
const ENOpenMode = Object.freeze({ 'omSingleUser': 0, 'omMultiUser': 1, 'omDontCare': 2 })
const appName = "AmazonConnector"
const appId = ''
function doRequestAndGetResult(reqSet) {
    var responseMsgSet = session_manager.doRequests(reqSet);
    var status = responseMsgSet.ResponseList.GetAt(0);
    var statusCode = status.StatusCode;
    var statusMessage = status.StatusMessage;

    if (statusCode !== 0) {
        var message = 'Quickbooks Error: "' + statusMessage + '"'
        var err = new Error(message)
        err.code = statusCode
        throw err
    }

    return responseMsgSet.ResponseList.GetAt(0).Detail
}

session_manager.OpenConnection(appId, appName)
var result = session_manager.BeginSession('', ENOpenMode.omDontCare)

try {
    var requestSet = session_manager.CreateMsgSetRequest("UK", 12, 0)

    requestSet.ClearRequests();
    var companyQuery = requestSet.AppendCompanyQueryRq()
    var companyRet = doRequestAndGetResult(requestSet)
    console.log(companyRet.CompanyName.GetValue())

    console.log(companyRet.Address.Addr1.GetValue())

    // companyRet.Address.Addr2 == null. or 'undefined' / not declared doesn't exist or whatever. 
    // The following instructions or If hovering on that variable whilst debugging will crash the whole application
    if (typeof companyRet.Address.Addr2 !== 'undefined' && companyRet.Address.Addr2 !== null)
        console.log(companyRet.Address.Addr2)

    if (companyRet.Phone !== null)
        console.log(companyRet.Phone.GetValue())

    if (companyRet.Email)
        console.log(companyRet.Email.GetValue())

    if (companyRet.EIN !== null)
        console.log(companyRet.EIN.GetValue())

    // companyRet.SSN == null. or 'undefined' / not declared doesn't exist or whatever.
    // The following instructions or If hovering on that variable whilst debugging will crash the whole application
    if (typeof companyRet.SSN !== 'undefined' && companyRet.SSN !== null)
        console.log(companyRet.SSN.GetValue())
}
catch (e) {
    alert(e)
}

session_manager.EndSession()
session_manager.CloseConnection()

}`

from node-activex.

durs avatar durs commented on July 28, 2024

I`m fixed null pointers in variants, try [email protected]

from node-activex.

Avrohom avatar Avrohom commented on July 28, 2024

Wow! Excellent staff!!!

I have tried and tested. Works wonderfully. So Great!

Many thanks!!!!

from node-activex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.