Skip to content

Commit

Permalink
fix: ensure minimum calculate values for dimensions and weight (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis authored Jul 6, 2024
1 parent ac62c07 commit 162c2d0
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions functions/routes/ecom/modules/calculate-shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down

0 comments on commit 162c2d0

Please sign in to comment.