Skip to content

Commit

Permalink
fix: hard reset pkg dimensions on calculate to fix maximum values
Browse files Browse the repository at this point in the history
  • Loading branch information
leomp12 committed Nov 10, 2023
1 parent e471637 commit c329f2c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions functions/lib/correios-calculate.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@ const calculate = async ({
}
if (!(Number(correiosParams.comprimento) >= 15)) {
correiosParams.comprimento = '15'
} else if (Number(correiosParams.comprimento) > 100) {
correiosParams.comprimento = '100'
}
if (!(Number(correiosParams.altura) >= 2)) {
correiosParams.altura = '2'
} else if (Number(correiosParams.altura) > 100) {
correiosParams.altura = '100'
}
if (!(Number(correiosParams.largura) >= 11)) {
correiosParams.largura = '11'
} else if (Number(correiosParams.largura) > 100) {
correiosParams.largura = '100'
}
const { largura, altura, comprimento } = correiosParams
if (Number(largura) + Number(altura) + Number(comprimento) > 200) {
correiosParams.comprimento = '100'
correiosParams.largura = '84'
correiosParams.altura = '16'
}
if (correiosParams.vlDeclarado) {
const value = Number(correiosParams.vlDeclarado)
Expand Down

0 comments on commit c329f2c

Please sign in to comment.