diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..8f40e95
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,26 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_size = 4
+indent_style = space
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[vcbuild.bat]
+end_of_line = crlf
+
+[Makefile]
+indent_size = 8
+indent_style = tab
+
+[{deps}/**]
+charset = unset
+end_of_line = unset
+indent_size = unset
+indent_style = unset
+trim_trailing_whitespace = unset
+
+[{test/fixtures,deps,tools/node_modules,tools/gyp,tools/icu,tools/msvs}/**]
+insert_final_newline = false
diff --git a/README.md b/README.md
index 4c2982e..3c64ffc 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,12 @@ export DEBUG=MWS:*
```bash
export AWS_ACCESS_KEY_ID=KEY
export AWS_SECRET_ACCESS_KEY=SECRET
+
+#optional MWS Token
+export MWS_AUTH_TOKEN=TOKEN
+
+#optional proxy
+export MARKETPLACE_PROXY=http://your.proxy.domain
```
## Configuration Using JavaScript
@@ -174,9 +180,47 @@ Originally by [Bhushankumar L](mailto:bhushankumar.lilapara@gmail.com).
});
```
-#### Submit Feed
+#### Get Feed Submission Result as Stream
+```
+ /**
+ * Use __STREAM__ to get the request in response;
+ */
+ var FeedSubmissionId = '10101010XXX';
+ amazonMws.feeds.search({
+ 'Version': '2009-01-01',
+ 'Action': 'GetFeedSubmissionResult',
+ 'SellerId': 'SELLER_ID',
+ 'MWSAuthToken': 'MWS_AUTH_TOKEN',
+ 'FeedSubmissionId': FeedSubmissionId,
+ __STREAM__: true
+ }, function (error, response) {
+ if (error) {
+ console.log('error ', error);
+ return;
+ }
+ response
+ .pipe(iconv.decodeStream('ISO-8859-1'))
+ .pipe(
+ csv.parse({
+ delimiter: '\t',
+ headers: true,
+ discardUnmappedColumns: true,
+ quote: null,
+ ignoreEmpty: true,
+ trim: true
+ })
+ )
+ .on('data', row => {
+ processRow(row);
+ })
+ .on('error', error => { console.error(error); })
+ .on('end', rowCount => { console.log(`Processed rows ${rowCount}`); });
+ });
+```
+
+#### Submit Feed [more feed xml demo](https://github.com/bhushankumarl/amazon-mws/tree/master/examples/javascript/feeds). or see https://images-cn.ssl-images-amazon.com/images/G/28/rainier/help/XML_Documentation_Intl._V158771171_.pdf
```
- var FeedContent = fse.readFileSync('./file.txt', 'UTF-8');
+ var FeedContent = fse.readFileSync('./good.xml', 'UTF-8');
console.log('FeedContent ', FeedContent);
amazonMws.feeds.submit({
diff --git a/examples/javaScript/feeds/file.txt b/examples/javaScript/feeds/file.txt
deleted file mode 100644
index bf669e8..0000000
--- a/examples/javaScript/feeds/file.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-Inventory
-
-1
-Update
-
-TestProduct_Do_Not_Order_Pin
-4
-1
-
-
-
\ No newline at end of file
diff --git a/examples/javaScript/feeds/good.xml b/examples/javaScript/feeds/good.xml
new file mode 100644
index 0000000..c7c2d2b
--- /dev/null
+++ b/examples/javaScript/feeds/good.xml
@@ -0,0 +1,43 @@
+
+
+
+ Product
+ false
+
+ 1
+ Update
+
+ xxx-9527
+
+ EAN
+ xxxxx
+
+ A_GEN_NOTAX
+
+ Example Product Title
+ Example Product Brand
+ This is an example product description.
+ Example Bullet Point 1
+ Example Bullet Point 2
+ 55.55
+ Example Product Manufacturer
+ yaodian1
+ yaodian2
+ example-item-type
+
+
+
+
+
+ Example Ingredients
+ Example Directions
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/javaScript/feeds/image.xml b/examples/javaScript/feeds/image.xml
new file mode 100644
index 0000000..780bcb9
--- /dev/null
+++ b/examples/javaScript/feeds/image.xml
@@ -0,0 +1,17 @@
+
+
+
+ ProductImage
+
+ 1
+ Update
+
+ sku
+ Swatch
+ http://images.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg
+
+
+
diff --git a/examples/javaScript/feeds/inventory.xml b/examples/javaScript/feeds/inventory.xml
new file mode 100644
index 0000000..7e22583
--- /dev/null
+++ b/examples/javaScript/feeds/inventory.xml
@@ -0,0 +1,17 @@
+
+
+
+ Inventory
+
+ 1
+ Update
+
+ SKU
+ 9527
+ 1
+
+
+
\ No newline at end of file
diff --git a/examples/javaScript/feeds/price.xml b/examples/javaScript/feeds/price.xml
new file mode 100644
index 0000000..72d3fd6
--- /dev/null
+++ b/examples/javaScript/feeds/price.xml
@@ -0,0 +1,15 @@
+
+
+
+ Price
+
+ 1
+
+ SKU
+ 99.99
+
+
+
\ No newline at end of file
diff --git a/examples/javaScript/feeds/relation.xml b/examples/javaScript/feeds/relation.xml
new file mode 100644
index 0000000..31d7b4f
--- /dev/null
+++ b/examples/javaScript/feeds/relation.xml
@@ -0,0 +1,19 @@
+
+
+
+ Relationship
+
+ 1
+ Update
+
+ paret-sku
+
+ child-sku
+ Variation
+
+
+
+
\ No newline at end of file
diff --git a/examples/javaScript/feeds/submitFeed.js b/examples/javaScript/feeds/submitFeed.js
index a9c1a1e..21b5f53 100644
--- a/examples/javaScript/feeds/submitFeed.js
+++ b/examples/javaScript/feeds/submitFeed.js
@@ -7,7 +7,7 @@ var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret);
var fse = require('fs-extra');
var feedRequest = function () {
- var FeedContent = fse.readFileSync('./file.txt', 'UTF-8');
+var FeedContent = fse.readFileSync('./good.xml', 'UTF-8');
console.log('FeedContent ', FeedContent);
amazonMws.feeds.submit({
@@ -26,4 +26,4 @@ var feedRequest = function () {
});
};
-feedRequest();
\ No newline at end of file
+feedRequest();
diff --git a/examples/javaScript/feeds/variation-good.xml b/examples/javaScript/feeds/variation-good.xml
new file mode 100644
index 0000000..d31bdf5
--- /dev/null
+++ b/examples/javaScript/feeds/variation-good.xml
@@ -0,0 +1,50 @@
+
+
+
+ Product
+ false
+
+ 1
+ Update
+
+ SKU
+
+ EAN
+ XXX
+
+ A_GEN_NOTAX
+
+ Example Parent
+ Example Product Brand
+ This is an example product description.
+ Example Bullet Point 1
+ Example Bullet Point 2
+ 55.55
+ Example Product Manufacturer
+ yaodian1
+ yaodian2
+ example-item-type
+ 4284945031
+
+
+
+
+
+
+ variation-parent
+
+ Size-Color
+ XXL
+ RED
+
+ cotton
+ 500
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/javaScript/sample/getReportAsReadableStram.js b/examples/javaScript/sample/getReportAsReadableStram.js
new file mode 100644
index 0000000..f6c291e
--- /dev/null
+++ b/examples/javaScript/sample/getReportAsReadableStram.js
@@ -0,0 +1,75 @@
+'use strict';
+
+var accessKey = process.env.AWS_ACCESS_KEY_ID || 'YOUR_KEY';
+var accessSecret = process.env.AWS_SECRET_ACCESS_KEY || 'YOUR_SECRET';
+
+var amazonMws = require('../../../lib/amazon-mws')(accessKey, accessSecret);
+
+var csv = require('fast-csv');
+var iconv = require('iconv-lite');
+
+var reportRequest = function () {
+ /**
+ * This will not provide you Throttling details in Header.
+ * Amazon MWS itself not providing Throttling detail in GetReport call.
+ */
+ amazonMws.setHost('YOUR HOST');
+ amazonMws.reports.search({
+ 'Version': '2009-01-01',
+ 'Action': 'GetReport',
+ 'SellerId': 'SELLER_ID',
+ 'MWSAuthToken': 'MWS_AUTH_TOKEN',
+ 'ReportId': 'REPORT_ID',
+ '__STREAM__': true
+ }, function (error, response) {
+ if (error) {
+ console.log('error ', error);
+ return;
+ }
+
+ var rows = [];
+ function processRowsInBatches(row, end, callback) {
+ if (typeof end === 'undefined') {
+ end = false;
+ }
+ if (row) {
+ rows.push(row);
+ }
+ if (rows.length >= 5000 || (end && rows.length)) {
+ sendToDB(rows.splice(0, 0), callback);
+ rows = [];
+ }
+ }
+
+ function sendToDB(data, callback) {
+ // Send your data to the db
+ console.log(data.length);
+ callback();
+ }
+
+ var decodeStream = iconv.decodeStream('ISO-8859-1');
+ response.pipe(decodeStream);
+ var csvStream = csv.parse({
+ delimiter: '\t',
+ headers: true,
+ discardUnmappedColumns: true,
+ ignoreEmpty: true,
+ trim: true
+ });
+ decodeStream.pipe(csvStream);
+ csvStream.transform(function (data, cb) {
+ processRowsInBatches(data, false, cb);
+ });
+ csvStream
+ .on('error', function (error) { console.error(error); })
+ .on('finish', function () {
+ console.log('Finished proccessing stream');
+ // Call processRowsInBatches to proccess remaining rows
+ processRowsInBatches(undefined, true, function () {
+ console.log('Saved last rows in the db');
+ });
+ });
+ });
+};
+
+reportRequest();
\ No newline at end of file
diff --git a/lib/AmazonMwsMethod.js b/lib/AmazonMwsMethod.js
index 3e8121f..c39cfb9 100644
--- a/lib/AmazonMwsMethod.js
+++ b/lib/AmazonMwsMethod.js
@@ -72,7 +72,12 @@ function amazonMwsMethod(spec) {
function requestCallback(err, response) {
if (err) {
- reject(err);
+ //Sometimes errors coming back are not true errors, just objects.
+ if(!(err instanceof Error)){
+ reject(new Error(err));
+ }else{
+ reject(err);
+ }
} else {
resolve(
spec.transformResponseData ?
diff --git a/lib/AmazonMwsResource.js b/lib/AmazonMwsResource.js
index d4f6f6a..72d0f52 100644
--- a/lib/AmazonMwsResource.js
+++ b/lib/AmazonMwsResource.js
@@ -11,7 +11,7 @@ var _ = require('lodash');
var qs = require('qs');
var csv = require('fast-csv');
var iconv = require('iconv-lite');
-
+var HttpsProxyAgent = require('https-proxy-agent');
var utils = require('./utils');
var Error = require('./Error');
@@ -26,6 +26,15 @@ AmazonMwsResource.extend = utils.protoExtend;
AmazonMwsResource.method = require('./AmazonMwsMethod');
AmazonMwsResource.BASIC_METHODS = require('./AmazonMwsMethod.basic.js');
+var proxy = process.env.MARKETPLACE_PROXY || '';
+
+if (proxy) {
+ console.log('using proxy server %j', proxy);
+}
+else {
+ console.warn('no proxy set (HTTP_PROXY)');
+}
+
/**
* Encapsulates request logic for a AmazonMws Resource
*/
@@ -66,10 +75,10 @@ AmazonMwsResource.prototype = {
createFullPath: function (commandPath, urlData) {
return path.join(
- this.basePath(urlData),
- this.path(urlData),
- typeof commandPath === 'function' ?
- commandPath(urlData) : commandPath
+ this.basePath(urlData),
+ this.path(urlData),
+ typeof commandPath === 'function' ?
+ commandPath(urlData) : commandPath
).replace(/\\/g, '/'); // ugly workaround for Windows
},
@@ -159,19 +168,24 @@ AmazonMwsResource.prototype = {
ignoreEmpty: true,
trim: true
};
+
+ if (responseString.includes('\n\n')) {
+ responseString = responseString.split('\n\n')[1];
+ }
+
csv.fromString(responseString, options)
- .on('data', function (value) {
- data.push(value);
- })
- .on('end', function () {
- var items = {};
- items.data = data;
- return callback(null, items);
- })
- .on('error', function (error) {
- debug('error ', error);
- return callback(error);
- });
+ .on('data', function (value) {
+ data.push(value);
+ })
+ .on('end', function () {
+ var items = {};
+ items.data = data;
+ return callback(null, items);
+ })
+ .on('error', function (error) {
+ debug('error ', error);
+ return callback(error);
+ });
}
function processResponseType(res, responseString, callback) {
@@ -254,6 +268,10 @@ AmazonMwsResource.prototype = {
'date': res.headers['date'] || 'unknown'
};
+ if (userOptions.userStream) {
+ return callback.call(self, null, res);
+ }
+
res.on('data', function (chunk) {
dbgResponseBuffer.push(chunk);
});
@@ -298,7 +316,11 @@ AmazonMwsResource.prototype = {
}
try {
- var errorResponse = {};
+ var errorResponse = new Error.AmazonMwsAPIError({
+ message: 'Error occurred from AmazonMws API',
+ StatusCode: 'unknown'
+ });
+
if (statusCode > 499 && !responseString) {
errorResponse.message = res.statusMessage || 'unknown';
errorResponse.Headers = ResponseHeaders;
@@ -308,7 +330,10 @@ AmazonMwsResource.prototype = {
processResponseType(res, responseString, function (error, response) {
if (response.ErrorResponse) {
debug('It is ErrorResponse');
- errorResponse = response.ErrorResponse.Error;
+ errorResponse = new Error.AmazonMwsAPIError({
+ message: response.ErrorResponse.Error.Message
+ });
+ errorResponse.OriginalError = response.ErrorResponse.Error;
errorResponse.Headers = ResponseHeaders;
errorResponse.StatusCode = statusCode || 'unknown';
errorResponse.RequestId = response.ErrorResponse.RequestID || response.ErrorResponse.RequestId || 'unknown';
@@ -389,10 +414,14 @@ AmazonMwsResource.prototype = {
},
_request: function (method, path, data, auth, options, callback) {
+
+
+
var self = this;
self.body = '';
var userRaw = '';
+ var userStream = false;
var userCharset = '';
var responseType = '';
/**
@@ -402,6 +431,11 @@ AmazonMwsResource.prototype = {
userRaw = data.__RAW__;
delete data.__RAW__;
}
+
+ if (data.__STREAM__) {
+ userStream = data.__STREAM__;
+ delete data.__STREAM__;
+ }
if (data.__CHARSET__) {
userCharset = data.__CHARSET__;
delete data.__CHARSET__;
@@ -412,16 +446,19 @@ AmazonMwsResource.prototype = {
self.requestParams = data;
if (!self.requestParams.Version) {
+
return callback.call(self, new Error.AmazonMwsAPIError({
message: 'Please specify the Amazon MWS API Version',
StatusCode: '404'
}), null);
} else if (!self._AmazonMws.getApiField('key')) {
+
return callback.call(self, new Error.AmazonMwsAPIError({
message: 'Please specify the AWS_ACCESS_KEY_ID',
StatusCode: '404'
}), null);
} else if (!self._AmazonMws.getApiField('secret')) {
+
return callback.call(self, new Error.AmazonMwsAPIError({
message: 'Please specify the AWS_SECRET_ACCESS_KEY',
StatusCode: '404'
@@ -442,7 +479,8 @@ AmazonMwsResource.prototype = {
self.requestParams.ContentMD5Value = crypto.createHash('md5').update(self.body).digest('base64');
delete self.requestParams.FeedContent;
}
- //debug(' self.body %o ', self.body);
+
+ debug(' self.body %o ', self.body);
self.requestParams.AWSAccessKeyId = this._AmazonMws.getApiField('key');
self.requestParams.Timestamp = new Date();
self.requestParams.SignatureVersion = '2';
@@ -469,6 +507,7 @@ AmazonMwsResource.prototype = {
'Content-MD5': crypto.createHash('md5').update(self.requestParams).digest('base64')
};
+
if (self.requestParamsJSON.Action === 'SubmitFeed') {
headers['Content-Type'] = 'x-www-form-urlencoded';
headers['Content-MD5'] = self.requestParamsJSON.ContentMD5Value;
@@ -486,18 +525,26 @@ AmazonMwsResource.prototype = {
headers['Content-Type'] = self._AmazonMws.getApiField('contentType');
}
+
// Make a deep copy of the request params, assign to block scoped variable
var requestParamsCopy = JSON.parse(JSON.stringify(self.requestParams));
var requestParamsJSONCopy = JSON.parse(JSON.stringify(self.requestParamsJSON));
+
+
+
// Grab client-user-agent before making the request:
this._AmazonMws.getClientUserAgent(function () {
+
+
if (options.headers) {
objectAssign(headers, options.headers);
}
+
makeRequest(requestParamsCopy);
});
function makeRequest(requestParamsCopy) {
+
var timeout = self._AmazonMws.getApiField('timeout');
var isInsecureConnection = self._AmazonMws.getApiField('protocol') === 'http';
@@ -513,6 +560,13 @@ AmazonMwsResource.prototype = {
params.path = params.path + '?' + requestParamsCopy;
}
+
+
+ if (proxy) {
+ var agent = new HttpsProxyAgent(proxy);
+ params.agent = agent;
+ }
+
debug('params %o ', params);
debug('self.body %o ', self.body);
var req = (isInsecureConnection ? http : https).request(params);
@@ -521,17 +575,22 @@ AmazonMwsResource.prototype = {
var userOptions = {
userCharset: userCharset,
userRaw: userRaw,
- responseType: responseType
+ responseType: responseType,
+ userStream: userStream
};
+
req.on('response', self._responseHandler(requestParamsJSONCopy, req, userOptions, callback));
req.on('error', self._errorHandler(req, callback));
+
req.on('socket', function (socket) {
socket.on((isInsecureConnection ? 'connect' : 'secureConnect'), function () {
+
// Send payload; we're safe:
/*
* Use Feed Content without modify it as querystring for the SubmitFeed API
*/
+
req.write(self.body);
req.end();
});
diff --git a/lib/amazon-mws.js b/lib/amazon-mws.js
index c20a17a..67a15d1 100644
--- a/lib/amazon-mws.js
+++ b/lib/amazon-mws.js
@@ -144,7 +144,9 @@ AmazonMws.prototype = {
_prepResources: function () {
for (var name in resources) {
- this[name[0].toLowerCase() + name.substring(1)] = new resources[name](this);
+ if (resources.hasOwnProperty(name)) {
+ this[name[0].toLowerCase() + name.substring(1)] = new resources[name](this);
+ }
}
},
diff --git a/package.json b/package.json
index 8f1c7ba..c52a4b6 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,8 @@
"mocha": "^5.2.0",
"object-assign": "^4.1.0",
"qs": "^6.5.1",
- "xml2js": "^0.4.19"
+ "xml2js": "^0.4.19",
+ "https-proxy-agent": "^2.2.2"
},
"license": "MIT",
"scripts": {
diff --git a/test/intialize/config.js b/test/intialize/config.js
index 149915c..e5149bc 100644
--- a/test/intialize/config.js
+++ b/test/intialize/config.js
@@ -1,10 +1,11 @@
-'use strict';
-module.exports = {
- accessKey: process.env.AWS_ACCESS_KEY_ID,
- accessSecret: process.env.AWS_SECRET_ACCESS_KEY,
- SellerId: process.env.SELLER_ID,
- MWSAuthToken: process.env.MWS_AUTH_TOKEN,
- MarketplaceId: process.env.MARKETPLACE_ID,
- ASIN: process.env.ASIN,
- SKU: process.env.SKU
+'use strict';
+module.exports = {
+ accessKey: process.env.AWS_ACCESS_KEY_ID,
+ accessSecret: process.env.AWS_SECRET_ACCESS_KEY,
+ SellerId: process.env.SELLER_ID,
+ MWSAuthToken: process.env.MWS_AUTH_TOKEN,
+ MarketplaceId: process.env.MARKETPLACE_ID,
+ Host: process.env.HOST,
+ ASIN: process.env.ASIN,
+ SKU: process.env.SKU
};
\ No newline at end of file
diff --git a/test/specs/feeds.spec.js b/test/specs/feeds.spec.js
index 6c0378b..86abe4c 100644
--- a/test/specs/feeds.spec.js
+++ b/test/specs/feeds.spec.js
@@ -1,41 +1,39 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Feeds', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get Feed Submission list using GetFeedSubmissionList Action', async function () {
- var options = {
- 'Version': '2009-01-01',
- 'Action': 'GetFeedSubmissionList',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken
- };
-
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
-
- var response = await amazonMws.feeds.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('FeedSubmissionInfo').to.be.a('array');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Feeds', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get Feed Submission list using GetFeedSubmissionList Action', async function () {
+ var options = {
+ 'Version': '2009-01-01',
+ 'Action': 'GetFeedSubmissionList',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+
+ var response = await amazonMws.feeds.search(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('FeedSubmissionInfo').to.be.a('array');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/finances.spec.js b/test/specs/finances.spec.js
index 37d77f3..62b23d8 100644
--- a/test/specs/finances.spec.js
+++ b/test/specs/finances.spec.js
@@ -1,42 +1,42 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Finances', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get list of Financial Event Groups using ListFinancialEventGroups Action', async function () {
- var options = {
- 'Version': '2015-05-01',
- 'Action': 'ListFinancialEventGroups',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'FinancialEventGroupStartedAfter': new Date(13, 12, 2016)
- };
-
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
-
- var response = await amazonMws.finances.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('FinancialEventGroupList').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Finances', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get list of Financial Event Groups using ListFinancialEventGroups Action', async function () {
+ var options = {
+ 'Version': '2015-05-01',
+ 'Action': 'ListFinancialEventGroups',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'FinancialEventGroupStartedAfter': new Date(13, 12, 2016)
+ };
+
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+
+ var response = await amazonMws.finances.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('FinancialEventGroupList').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/fulfillmentInboundShipment.spec.js b/test/specs/fulfillmentInboundShipment.spec.js
index c497ca4..6352ca8 100644
--- a/test/specs/fulfillmentInboundShipment.spec.js
+++ b/test/specs/fulfillmentInboundShipment.spec.js
@@ -1,46 +1,46 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Fulfillment Inbound Shipment', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get Inbound Guidance For SKU using GetInboundGuidanceForSKU Action', async function () {
- var options = {
- 'Version': '2010-10-01',
- 'Action': 'GetInboundGuidanceForSKU',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'SellerSKUList.Id.1': config.SKU
- };
-
- console.log('options ', options);
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
- expect(options['SellerSKUList.Id.1']).to.be.a('string');
-
- var response = await amazonMws.fulfillmentInboundShipment.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('SKUInboundGuidanceList').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Fulfillment Inbound Shipment', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get Inbound Guidance For SKU using GetInboundGuidanceForSKU Action', async function () {
+ var options = {
+ 'Version': '2010-10-01',
+ 'Action': 'GetInboundGuidanceForSKU',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'SellerSKUList.Id.1': config.SKU
+ };
+
+ console.log('options ', options);
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+ expect(options['SellerSKUList.Id.1']).to.be.a('string');
+
+ var response = await amazonMws.fulfillmentInboundShipment.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('SKUInboundGuidanceList').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/fulfillmentInventory.spec.js b/test/specs/fulfillmentInventory.spec.js
index 61cb6c7..d630422 100644
--- a/test/specs/fulfillmentInventory.spec.js
+++ b/test/specs/fulfillmentInventory.spec.js
@@ -1,43 +1,43 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Fulfillment Inventory', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get list of Inventory Supply using ListInventorySupply Action', async function () {
- var options = {
- 'Version': '2010-10-01',
- 'Action': 'ListInventorySupply',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'QueryStartDateTime': new Date(13, 12, 2016)
- };
-
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
-
- var response = await amazonMws.fulfillmentInventory.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('InventorySupplyList').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Fulfillment Inventory', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get list of Inventory Supply using ListInventorySupply Action', async function () {
+ var options = {
+ 'Version': '2010-10-01',
+ 'Action': 'ListInventorySupply',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'QueryStartDateTime': new Date(13, 12, 2016)
+ };
+
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+
+ var response = await amazonMws.fulfillmentInventory.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('InventorySupplyList').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/fulfillmentOutboundShipment.spec.js b/test/specs/fulfillmentOutboundShipment.spec.js
index cff5804..c990d0c 100644
--- a/test/specs/fulfillmentOutboundShipment.spec.js
+++ b/test/specs/fulfillmentOutboundShipment.spec.js
@@ -1,42 +1,42 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Fulfillment Outbound Shipment', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get list of Fulfillment Orders using ListAllFulfillmentOrders Action', async function () {
- var options = {
- 'Version': '2010-10-01',
- 'Action': 'ListAllFulfillmentOrders',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'QueryStartDateTime': new Date(13, 12, 2016)
- };
-
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
-
- var response = await amazonMws.fulfillmentOutboundShipment.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('FulfillmentOrders').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Fulfillment Outbound Shipment', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get list of Fulfillment Orders using ListAllFulfillmentOrders Action', async function () {
+ var options = {
+ 'Version': '2010-10-01',
+ 'Action': 'ListAllFulfillmentOrders',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'QueryStartDateTime': new Date(13, 12, 2016)
+ };
+
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+
+ var response = await amazonMws.fulfillmentOutboundShipment.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('FulfillmentOrders').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/orders.spec.js b/test/specs/orders.spec.js
index 5f5710d..e47f764 100644
--- a/test/specs/orders.spec.js
+++ b/test/specs/orders.spec.js
@@ -1,43 +1,43 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Orders', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get list of orders using ListOrders Action', async function () {
- var options = {
- 'Version': '2013-09-01',
- 'Action': 'ListOrders',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId.Id.1': config.MarketplaceId,
- 'LastUpdatedAfter': new Date(13, 12, 2016)
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options['MarketplaceId.Id.1']).to.be.a('string');
-
- var response = await amazonMws.orders.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('Orders').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Orders', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get list of orders using ListOrders Action', async function () {
+ var options = {
+ 'Version': '2013-09-01',
+ 'Action': 'ListOrders',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId.Id.1': config.MarketplaceId,
+ 'LastUpdatedAfter': new Date(13, 12, 2016)
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options['MarketplaceId.Id.1']).to.be.a('string');
+
+ var response = await amazonMws.orders.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('Orders').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/products.spec.js b/test/specs/products.spec.js
index df8d512..71aab49 100644
--- a/test/specs/products.spec.js
+++ b/test/specs/products.spec.js
@@ -1,191 +1,191 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Products', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get offers using GetLowestPricedOffersForASIN Action', async function () {
- var options = {
- 'Version': '2011-10-01',
- 'Action': 'ListMatchingProducts',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'Query': 'k'
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
-
- var response = await amazonMws.products.searchFor(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('Products').to.be.a('object');
- expect(response).to.have.property('Products').to.have.property('Product');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
-
- it('It should get offers using GetLowestPricedOffersForASIN Action', async function () {
- var options = {
- 'Version': '2011-10-01',
- 'Action': 'GetLowestPricedOffersForASIN',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'ASIN': config.ASIN,
- 'ItemCondition': 'New'
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
- expect(options.ASIN).to.be.a('string');
-
- var response = await amazonMws.products.searchFor(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('status').to.be.a('string');
- expect(response).to.have.property('Summary').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
-
- it('It should get my price for ASIN using getMyPriceForASIN Action', async function () {
- var options = {
- 'Version': '2011-10-01',
- 'Action': 'GetMyPriceForASIN',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'ASINList.ASIN.1': config.ASIN
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
- expect(options['ASINList.ASIN.1']).to.be.a('string');
-
- try {
- var response = await amazonMws.products.searchFor(options);
- expect(response).to.be.a('object');
- expect(response).to.have.property('ASIN').to.be.a('string');
- expect(response).to.have.property('status').to.be.a('string');
- expect(response).to.have.property('Product').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- } catch (error) {
- console.log('error ', error);
- expect(error).to.be.undefined;
- }
- });
-
- it('It should NOT get my price for INVALID ASIN using GetMyPriceForASIN Action', async function () {
- var options = {
- 'Version': '2011-10-01',
- 'Action': 'GetMyPriceForASIN',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'ASINList.ASIN.1': undefined
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
-
- try {
- var response = await amazonMws.products.searchFor(options);
- expect(response).to.be.a('object');
- expect(response).to.have.property('ASIN').to.be.a('string');
- expect(response).to.have.property('status').to.be.a('string');
- expect(response).to.have.property('Product').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- } catch (error) {
- console.log('error ', error);
- expect(error).to.be.a('object');
- expect(error).to.have.property('Type').to.be.a('string');
- expect(error).to.have.property('Message').to.be.a('string');
- // expect(error).to.have.property('Detail').to.be.a('object');
- expect(error).to.have.property('StatusCode').to.be.a('number');
- expect(error).to.have.property('RequestId').to.be.a('string');
- expect(error).to.have.property('Headers').to.be.a('object');
- expect(error).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(error).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(error).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(error).to.have.property('Headers').to.have.property('x-mws-timestamp');
- }
-
- });
-
-
- it('It should get my price for ASIN using GetCompetitivePricingForASIN Action', async function () {
- var options = {
- 'Version': '2011-10-01',
- 'Action': 'GetCompetitivePricingForASIN',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'ASINList.ASIN.1': config.ASIN
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
- expect(options['ASINList.ASIN.1']).to.be.a('string');
-
- try {
- var response = await amazonMws.products.searchFor(options);
- expect(response).to.be.a('object');
- expect(response).to.have.property('ASIN').to.be.a('string');
- expect(response).to.have.property('status').to.be.a('string');
- expect(response).to.have.property('Product').to.be.a('object');
- expect(response).to.have.property('Product').to.have.property('CompetitivePricing');
- if (response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount) {
- expect(response).to.have.property('Product').to.have.property('CompetitivePricing').to.have.property('NumberOfOfferListings');
- expect(response).to.have.property('Product').to.have.property('CompetitivePricing').to.have.property('NumberOfOfferListings').to.have.property('OfferListingCount').to.be.a('array');
- expect(response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount[0]).to.have.property('condition');
- expect(response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount[0]).to.have.property('Value');
- }
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- } catch (error) {
- console.log('error ', error);
- expect(error).to.be.undefined;
- }
- });
-
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Products', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get offers using GetLowestPricedOffersForASIN Action', async function () {
+ var options = {
+ 'Version': '2011-10-01',
+ 'Action': 'ListMatchingProducts',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'Query': 'k'
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+
+ var response = await amazonMws.products.searchFor(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('Products').to.be.a('object');
+ expect(response).to.have.property('Products').to.have.property('Product');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
+
+ it('It should get offers using GetLowestPricedOffersForASIN Action', async function () {
+ var options = {
+ 'Version': '2011-10-01',
+ 'Action': 'GetLowestPricedOffersForASIN',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'ASIN': config.ASIN,
+ 'ItemCondition': 'New'
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+ expect(options.ASIN).to.be.a('string');
+
+ var response = await amazonMws.products.searchFor(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('status').to.be.a('string');
+ expect(response).to.have.property('Summary').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
+
+ it('It should get my price for ASIN using getMyPriceForASIN Action', async function () {
+ var options = {
+ 'Version': '2011-10-01',
+ 'Action': 'GetMyPriceForASIN',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'ASINList.ASIN.1': config.ASIN
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+ expect(options['ASINList.ASIN.1']).to.be.a('string');
+
+ try {
+ var response = await amazonMws.products.searchFor(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ASIN').to.be.a('string');
+ expect(response).to.have.property('status').to.be.a('string');
+ expect(response).to.have.property('Product').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ } catch (error) {
+ console.log('error ', error);
+ expect(error).to.be.undefined;
+ }
+ });
+
+ it('It should NOT get my price for INVALID ASIN using GetMyPriceForASIN Action', async function () {
+ var options = {
+ 'Version': '2011-10-01',
+ 'Action': 'GetMyPriceForASIN',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'ASINList.ASIN.1': undefined
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+
+ try {
+ var response = await amazonMws.products.searchFor(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ASIN').to.be.a('string');
+ expect(response).to.have.property('status').to.be.a('string');
+ expect(response).to.have.property('Product').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ } catch (error) {
+ console.log('error ', error);
+ expect(error).to.be.a('object');
+ expect(error).to.have.property('Type').to.be.a('string');
+ expect(error).to.have.property('Message').to.be.a('string');
+ // expect(error).to.have.property('Detail').to.be.a('object');
+ expect(error).to.have.property('StatusCode').to.be.a('number');
+ expect(error).to.have.property('RequestId').to.be.a('string');
+ expect(error).to.have.property('Headers').to.be.a('object');
+ expect(error).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(error).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(error).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(error).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ }
+
+ });
+
+
+ it('It should get my price for ASIN using GetCompetitivePricingForASIN Action', async function () {
+ var options = {
+ 'Version': '2011-10-01',
+ 'Action': 'GetCompetitivePricingForASIN',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'ASINList.ASIN.1': config.ASIN
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+ expect(options['ASINList.ASIN.1']).to.be.a('string');
+
+ try {
+ var response = await amazonMws.products.searchFor(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ASIN').to.be.a('string');
+ expect(response).to.have.property('status').to.be.a('string');
+ expect(response).to.have.property('Product').to.be.a('object');
+ expect(response).to.have.property('Product').to.have.property('CompetitivePricing');
+ if (response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount) {
+ expect(response).to.have.property('Product').to.have.property('CompetitivePricing').to.have.property('NumberOfOfferListings');
+ expect(response).to.have.property('Product').to.have.property('CompetitivePricing').to.have.property('NumberOfOfferListings').to.have.property('OfferListingCount').to.be.a('array');
+ expect(response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount[0]).to.have.property('condition');
+ expect(response.Product.CompetitivePricing.NumberOfOfferListings.OfferListingCount[0]).to.have.property('Value');
+ }
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ } catch (error) {
+ console.log('error ', error);
+ expect(error).to.be.undefined;
+ }
+ });
+
});
\ No newline at end of file
diff --git a/test/specs/recommendations.spec.js b/test/specs/recommendations.spec.js
index 811f907..f9d5ecb 100644
--- a/test/specs/recommendations.spec.js
+++ b/test/specs/recommendations.spec.js
@@ -1,49 +1,49 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Recommendations', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should list of recommendations using ListRecommendations Action', async function () {
- var options = {
- 'Version': '2013-04-01',
- 'Action': 'ListRecommendations',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId,
- 'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1': 'QualitySet=Defect',
- 'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.2': 'ListingStatus=Active',
- 'CategoryQueryList.CategoryQuery.1.RecommendationCategory': 'ListingQuality'
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
-
- try {
- var response = await amazonMws.recommendations.searchFor(options);
- expect(response).to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- } catch (error) {
- console.log('error ', error);
- expect(error).to.be.undefined;
- }
- });
-
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Recommendations', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should list of recommendations using ListRecommendations Action', async function () {
+ var options = {
+ 'Version': '2013-04-01',
+ 'Action': 'ListRecommendations',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId,
+ 'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.1': 'QualitySet=Defect',
+ 'CategoryQueryList.CategoryQuery.1.FilterOptions.FilterOption.2': 'ListingStatus=Active',
+ 'CategoryQueryList.CategoryQuery.1.RecommendationCategory': 'ListingQuality'
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+
+ try {
+ var response = await amazonMws.recommendations.searchFor(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ } catch (error) {
+ console.log('error ', error);
+ expect(error).to.be.undefined;
+ }
+ });
+
});
\ No newline at end of file
diff --git a/test/specs/reports.spec.js b/test/specs/reports.spec.js
index edb018f..510d90c 100644
--- a/test/specs/reports.spec.js
+++ b/test/specs/reports.spec.js
@@ -1,39 +1,39 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Reports', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get report list using GetReportList Action', async function () {
- var options = {
- 'Version': '2009-01-01',
- 'Action': 'GetReportList',
- 'SellerId': config.SellerId
- };
-
- expect(options.SellerId).to.be.a('string');
-
- var response = await amazonMws.reports.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('ReportInfo').to.be.a('array');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Reports', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get report list using GetReportList Action', async function () {
+ var options = {
+ 'Version': '2009-01-01',
+ 'Action': 'GetReportList',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken
+ };
+
+ expect(options.SellerId).to.be.a('string');
+
+ var response = await amazonMws.reports.search(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ReportInfo').to.be.a('array');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/sellers.spec.js b/test/specs/sellers.spec.js
index 6ac6e99..dc19169 100644
--- a/test/specs/sellers.spec.js
+++ b/test/specs/sellers.spec.js
@@ -1,42 +1,42 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Sellers', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should get List of Marketplace Participations using ListMarketplaceParticipations Action', async function () {
- var options = {
- 'Version': '2011-07-01',
- 'Action': 'ListMarketplaceParticipations',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken
- };
-
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
-
- var response = await amazonMws.sellers.search(options);
-
- expect(response).to.be.a('object');
- expect(response).to.have.property('ListParticipations').to.be.a('object');
- expect(response).to.have.property('ListParticipations').to.have.property('Participation');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- });
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Sellers', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should get List of Marketplace Participations using ListMarketplaceParticipations Action', async function () {
+ var options = {
+ 'Version': '2011-07-01',
+ 'Action': 'ListMarketplaceParticipations',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken
+ };
+
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+
+ var response = await amazonMws.sellers.search(options);
+
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ListParticipations').to.be.a('object');
+ expect(response).to.have.property('ListParticipations').to.have.property('Participation');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ });
});
\ No newline at end of file
diff --git a/test/specs/subscriptions.spec.js b/test/specs/subscriptions.spec.js
index 59eda45..ab38ef8 100644
--- a/test/specs/subscriptions.spec.js
+++ b/test/specs/subscriptions.spec.js
@@ -1,46 +1,46 @@
-'use strict';
-var config = require('../intialize/config');
-var accessKey = config.accessKey;
-var accessSecret = config.accessSecret;
-
-var chai = require('chai');
-var expect = chai.expect;
-
-var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
-
-describe('Subscriptions', function () {
-
- before(function () {
- expect(accessKey).to.be.a('string');
- expect(accessSecret).to.be.a('string');
- });
-
- it('It should list of subscriptions using ListSubscriptions Action', async function () {
- var options = {
- 'Version': '2013-07-01',
- 'Action': 'ListSubscriptions',
- 'SellerId': config.SellerId,
- 'MWSAuthToken': config.MWSAuthToken,
- 'MarketplaceId': config.MarketplaceId
- };
- expect(options.SellerId).to.be.a('string');
- expect(options.MWSAuthToken).to.be.a('string');
- expect(options.MarketplaceId).to.be.a('string');
-
- try {
- var response = await amazonMws.subscriptions.searchFor(options);
- expect(response).to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.be.a('object');
- expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
- expect(response).to.have.property('Headers').to.be.a('object');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
- expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
- expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
- } catch (error) {
- console.log('error ', error);
- expect(error).to.be.undefined;
- }
- });
-
+'use strict';
+var config = require('../intialize/config');
+var accessKey = config.accessKey;
+var accessSecret = config.accessSecret;
+
+var chai = require('chai');
+var expect = chai.expect;
+
+var amazonMws = require('../../lib/amazon-mws')(accessKey, accessSecret);
+amazonMws.setHost(config.Host);
+describe('Subscriptions', function () {
+
+ before(function () {
+ expect(accessKey).to.be.a('string');
+ expect(accessSecret).to.be.a('string');
+ });
+
+ it('It should list of subscriptions using ListSubscriptions Action', async function () {
+ var options = {
+ 'Version': '2013-07-01',
+ 'Action': 'ListSubscriptions',
+ 'SellerId': config.SellerId,
+ 'MWSAuthToken': config.MWSAuthToken,
+ 'MarketplaceId': config.MarketplaceId
+ };
+ expect(options.SellerId).to.be.a('string');
+ expect(options.MWSAuthToken).to.be.a('string');
+ expect(options.MarketplaceId).to.be.a('string');
+
+ try {
+ var response = await amazonMws.subscriptions.searchFor(options);
+ expect(response).to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.be.a('object');
+ expect(response).to.have.property('ResponseMetadata').to.have.property('RequestId');
+ expect(response).to.have.property('Headers').to.be.a('object');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-max');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-remaining');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-quota-resetson');
+ expect(response).to.have.property('Headers').to.have.property('x-mws-timestamp');
+ } catch (error) {
+ console.log('error ', error);
+ expect(error).to.be.undefined;
+ }
+ });
+
});
\ No newline at end of file