From e469e545026cbc8017bf54949aa4104289eb1c1d Mon Sep 17 00:00:00 2001 From: Benedikt Wedenik Date: Sun, 19 Jul 2020 15:46:35 +0200 Subject: [PATCH 1/2] Fixed broken config update, due to change in API response --- src/index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 93e53ff..fff330d 100644 --- a/src/index.js +++ b/src/index.js @@ -268,12 +268,12 @@ const create = ({ }) .then(res => res.json()) .then(res => { - urls.paUrl = res.paUrl; - urls.productSearchUrl = res.productSearchUrl; - urls.productTypesUrl = res.productTypesUrl; - urls.reportingUrl = res.reportingUrl; - urls.tradingUrl = res.tradingUrl; - urls.vwdQuotecastServiceUrl = res.vwdQuotecastServiceUrl; + urls.paUrl = res.data.paUrl; + urls.productSearchUrl = res.data.productSearchUrl; + urls.productTypesUrl = res.data.productTypesUrl; + urls.reportingUrl = res.data.reportingUrl; + urls.tradingUrl = res.data.tradingUrl; + urls.vwdQuotecastServiceUrl = res.data.vwdQuotecastServiceUrl; }); /** From 64ac913448084e53634c23cd155395ffbbe125f3 Mon Sep 17 00:00:00 2001 From: Benedikt Wedenik Date: Mon, 20 Jul 2020 17:24:51 +0200 Subject: [PATCH 2/2] Fixed ordering feature (API change) --- src/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/index.js b/src/index.js index fff330d..829236d 100644 --- a/src/index.js +++ b/src/index.js @@ -37,10 +37,11 @@ const create = ({ }; const checkSuccess = res => { - if (res.status !== 0) { - throw Error(res.message); + if ((typeof res.data.confirmationId !== 'undefined' && res.data.confirmationId !== null && res.data.confirmationId !== '') + || (typeof res.data.orderId !== 'undefined' && res.data.orderId !== null && res.data.orderId !== '')) { + return res; } - return res; + throw Error(res.message); }; /** @@ -419,7 +420,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({order, confirmationId: json.confirmationId})); + .then(json => ({order, confirmationId: json.data.confirmationId})); }; /** @@ -443,7 +444,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({orderId: json.orderId})); + .then(json => ({orderId: json.data.orderId})); }; /**