This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathindex.js
69 lines (62 loc) · 1.54 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* This file is part of quickbooks-js
* https://github.com/RappidDevelopment/quickbooks-js
*
* Based on qbws: https://github.com/johnballantyne/qbws
*
* (c) 2015 johnballantyne
* (c) 2016 Rappid Development LLC
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
var data2xml = require('data2xml');
var convert = data2xml({
xmlHeader: '<?xml version="1.0" encoding="utf-8"?>\n<?qbxml version="13.0"?>\n'
});
// Public
module.exports = {
/**
* Builds an array of qbXML commands
* to be run by QBWC.
*
* @param callback(err, requestArray)
*/
fetchRequests: function(callback) {
buildRequests(callback);
},
/**
* Called when a qbXML response
* is returned from QBWC.
*
* @param response - qbXML response
*/
handleResponse: function(response) {
console.log(response);
},
/**
* Called when there is an error
* returned processing qbXML from QBWC.
*
* @param error - qbXML error response
*/
didReceiveError: function(error) {
console.log(error);
}
};
function buildRequests(callback) {
var requests = new Array();
var xml = convert(
'QBXML',
{
QBXMLMsgsRq : {
_attr : { onError : 'stopOnError' },
ItemInventoryQueryRq : {
MaxReturned: 1000,
},
},
}
);
requests.push(xml);
return callback(null, requests);
}