Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't include invoiceLink when querying an invoice #163

Open
jakewatton95 opened this issue Sep 1, 2020 · 2 comments
Open

Can't include invoiceLink when querying an invoice #163

jakewatton95 opened this issue Sep 1, 2020 · 2 comments

Comments

@jakewatton95
Copy link

I'm having a very similar issue to the link posted below. When querying an invoice, I am unable to use the "include=invoiceLink" parameter. Any help would be appreciated!

https://help.developer.intuit.com/s/question/0D54R00006tj1K5/how-to-use-the-invoicelink-in-the-query-to-get-invoicelink-valueim-using-the-following-query-and-minor-version-is-36select-from-invoice-where-includeinvoicelinkim-not-getting-any-results-on-my-above-request

@felzix
Copy link

felzix commented Feb 19, 2023

I forked with a dumb hack. Unfortunately I can't verify if it fully works until I have production access in Intuit. At the very least, it doesn't break any of these APIs: findCustomers, createCustomer, findInvoices, createInvoice. I need to wait an hour to verify that it doesn't break refreshTokenAccess.

https://github.com/NomadHouse/node-quickbooks

(I suppose I'm necro'ing an old thread :/ but if it helps someone then 🤷.)

@charlie-s
Copy link

charlie-s commented Jul 11, 2023

The code is structured in such a way that you can't directly modify options (or more specifically options.qs) that are passed into the request() call. This is a bummer. There are a couple of instances where query parameters are added already:

  if (entity && entity.allowDuplicateDocNum) {
    delete entity.allowDuplicateDocNum;
    opts.qs.include = 'allowduplicatedocnum';
  }

  if (entity && entity.requestId) {
    opts.qs.requestid = entity.requestId;
    delete entity.requestId;
  }

It would be nice to be able to hook into this. I was going to add an addtl options argument to the getInvoice method, but callback really needs to be the last parameter and I don't want to change the order and break anything. So, I just added a new method that doesn't interfere with the existing logic:

/**
 * Retrieves the payment link for an Invoice.
 *
 * @param  {string} id - The invoice ID.
 * @param  {function} callback - Callback function which is called with any error and the invoice.
 */
QuickBooks.prototype.getInvoiceLink = function(id, callback) {
  const options = {
    url: `/invoice/${id}`
    qs: { include: 'invoiceLink' }
  }
  module.request(this, 'get', options, null, module.unwrap(callback, 'Invoice'))
}

Here's my fork: https://github.com/charlie-s/node-quickbooks

You can install this via npm i git+https://github.com/charlie-s/node-quickbooks.git

Make sure you use the minimum version number of 36 to get access to the invoice link! e.g.:

const qbo = new QuickBooksAPI(qbAppId, qbAppSecret, accessToken, false, realmId, true, false, 36, '2.0', refreshToken)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants