From 6ac11c64b2483144a65ce57b9d1331be66db3eef Mon Sep 17 00:00:00 2001 From: "ubuntu (Corentin Barbu)" Date: Mon, 24 Jun 2019 18:04:33 +0200 Subject: [PATCH] fix issue Error Placing Order #64 --- src/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index 93e53ff..0cb5e02 100644 --- a/src/index.js +++ b/src/index.js @@ -37,8 +37,8 @@ const create = ({ }; const checkSuccess = res => { - if (res.status !== 0) { - throw Error(res.message); + if (res.errors !== undefined && res.errors !== null) { + throw Error(res.errors[0].text); } return res; }; @@ -419,7 +419,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({order, confirmationId: json.confirmationId})); + .then(json => ({order, confirmationId: json.data.confirmationId})); }; /** @@ -443,7 +443,7 @@ const create = ({ ) .then(res => res.json()) .then(checkSuccess) - .then(json => ({orderId: json.orderId})); + .then(json => ({orderId: json.data.orderId})); }; /**