From dd06077705d9fcabbe016bd993d373f2a4ade7dd Mon Sep 17 00:00:00 2001 From: Thomas dugue Date: Wed, 22 May 2019 09:08:56 +0200 Subject: [PATCH 1/4] fix sku array to string paramters --- lib/stock.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stock.js b/lib/stock.js index 8cd3e95..5d05a62 100644 --- a/lib/stock.js +++ b/lib/stock.js @@ -8,8 +8,8 @@ module.exports = function (restClient) { } return false; } - module.check = (sku) => { - url += `check?sku=${sku}`; + module.check = (stock) => { + url += `check?sku=${stock.sku}&stockId=${stock.stockId}`; return restClient.get(url).then((data)=> { return getResponse(data); }); From 1a3c8a4ff6b2338f2034c690e97b47714da1caae Mon Sep 17 00:00:00 2001 From: Thomas dugue Date: Wed, 13 May 2020 13:25:04 +0200 Subject: [PATCH 2/4] make the change as requested to keep backward compatibility --- lib/stock.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/stock.js b/lib/stock.js index 5d05a62..d92e01f 100644 --- a/lib/stock.js +++ b/lib/stock.js @@ -8,8 +8,8 @@ module.exports = function (restClient) { } return false; } - module.check = (stock) => { - url += `check?sku=${stock.sku}&stockId=${stock.stockId}`; + module.check = (sku, stockId) => { + url += `check?sku=${sku}&stockId=${stockId}`; return restClient.get(url).then((data)=> { return getResponse(data); }); From 17926fff077fafad2ca5078ce5b40018dc0c2131 Mon Sep 17 00:00:00 2001 From: Thomas dugue Date: Wed, 13 May 2020 14:37:56 +0200 Subject: [PATCH 3/4] check is stockId is defined --- lib/stock.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/stock.js b/lib/stock.js index d92e01f..5fde0dd 100644 --- a/lib/stock.js +++ b/lib/stock.js @@ -9,7 +9,10 @@ module.exports = function (restClient) { return false; } module.check = (sku, stockId) => { - url += `check?sku=${sku}&stockId=${stockId}`; + url += `check?sku=${sku}}`; + if (stockId) { + url += `&stockId=${stockId}`; + } return restClient.get(url).then((data)=> { return getResponse(data); }); From 5ac06c817956c998c1e67d30f6966049d36c8d71 Mon Sep 17 00:00:00 2001 From: Thomas dugue Date: Mon, 22 Jun 2020 12:46:44 +0200 Subject: [PATCH 4/4] revert code and reuse of the stock object --- lib/stock.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/stock.js b/lib/stock.js index 5fde0dd..4a0fab2 100644 --- a/lib/stock.js +++ b/lib/stock.js @@ -8,10 +8,10 @@ module.exports = function (restClient) { } return false; } - module.check = (sku, stockId) => { - url += `check?sku=${sku}}`; - if (stockId) { - url += `&stockId=${stockId}`; + module.check = (stock) => { + url += `check?sku=${stock.sku}}`; + if (stock.stockId) { + url += `&stockId=${stock.stockId}`; } return restClient.get(url).then((data)=> { return getResponse(data);