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

Property Name:Can not construct instance of java.m specified is unsupported or invalid #39

Closed
brandonros opened this issue Jan 30, 2016 · 2 comments

Comments

@brandonros
Copy link

var item = { Name: 'FOO',
  Sku: 10,
  UnitPrice: 1,
  PurchaseCost: 0.5,
  Type: 'Inventory',
  TrackQtyOnHand: true,
  QtyOnHand: 'Sku',
  InvStartDate: '2016-01-30',
  IncomeAccountRef: { name: 'Sales', value: '1' },
  ExpenseAccountRef: { name: 'Supplies', value: '21' },
  AssetAccountRef: { name: 'Uncategorized Asset', value: '53' } };

var deferred = Q.defer();

var qbo = new QuickBooks(global['quickbooks_key'],
                         global['quickbooks_secret'],
                         token,
                         token_secret,
                         realm_id,
                         false, // don't use the sandbox (i.e. for testing)
                         true); // turn debugging on

qbo.createItem(item, function (err, res) {
    if (err) {
        return deferred.reject(new Error(JSON.stringify(err)));
    }

    deferred.resolve(res);
});

return deferred.promise;
{ request:
   { uri: 'https://quickbooks.api.intuit.com/v3/company/redacted/item?minorversion=4',
     method: 'POST',
     headers:
      { 'User-Agent': 'node-quickbooks: version 2.0.3',
        host: 'quickbooks.api.intuit.com',
        accept: 'application/json',
        'content-type': 'application/json',
        'content-length': 306,
        Authorization: 'OAuth oauth_consumer_key="redacted",oauth_nonce="redacted",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1454182385",oauth_token="redacted",oauth_version="1.0",oauth_signature="redacted"' },
     body: '{"Name":"FOO","Sku":10,"UnitPrice":1,"PurchaseCost":0.5,"Type":"Inventory","TrackQtyOnHand":true,"QtyOnHand":"Sku","InvStartDate":"2016-01-30","IncomeAccountRef":{"name":"Sales","value":"1"},"ExpenseAccountRef":{"name":"Supplies","value":"21"},"AssetAccountRef":{"name":"Uncategorized Asset","value":"53"}}' } }
@mcohen01
Copy link
Owner

The error messages you get back from the actual api sometimes are really poor. I think this should work if you change QtyOnHand to an integer.

@brandonros
Copy link
Author

Thank you for that. I'm sorry I needed a second set of eyes on such a simple mistake!

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

2 participants