From 162c2d09308ed6180a83ff374b2647eb0ac04c6b Mon Sep 17 00:00:00 2001 From: Matheus Reis <35343551+matheusgnreis@users.noreply.github.com> Date: Fri, 5 Jul 2024 23:23:27 -0300 Subject: [PATCH] fix: ensure minimum calculate values for dimensions and weight (#28) --- .../routes/ecom/modules/calculate-shipping.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/functions/routes/ecom/modules/calculate-shipping.js b/functions/routes/ecom/modules/calculate-shipping.js index 97ad879..c78ceaa 100644 --- a/functions/routes/ecom/modules/calculate-shipping.js +++ b/functions/routes/ecom/modules/calculate-shipping.js @@ -178,25 +178,15 @@ exports.post = async ({ appSdk }, req, res) => { }) let correiosResult - if (storeId == 51466) { - console.log('send item', JSON.stringify({ - psObjeto: pkg.weight.value, - comprimento: pkg.dimensions.length.value, - altura: pkg.dimensions.height.value, - largura: pkg.dimensions.width.value, - vlDeclarado, - servicosAdicionais - })) - } try { const { data } = await calculate({ correiosParams: { cepOrigem, cepDestino, - psObjeto: pkg.weight.value, - comprimento: pkg.dimensions.length.value, - altura: pkg.dimensions.height.value, - largura: pkg.dimensions.width.value, + psObjeto: pkg.weight.value || 500, + comprimento: pkg.dimensions.length.value || 16, + altura: pkg.dimensions.height.value || 2, + largura: pkg.dimensions.width.value || 11, vlDeclarado, servicosAdicionais },