Skip to content

Commit

Permalink
chore: get log body
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis authored Dec 20, 2023
1 parent 73e5bc9 commit 2d40692
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions functions/routes/ecom/modules/calculate-shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ exports.post = ({ appSdk }, req, res) => {
},
itens
}
console.log('sending body', JSON.stringify(body))
return axios.post(
`https://api-public.pakman.com.br/pak/v1/ePak/quotations`,
body,
Expand Down Expand Up @@ -177,10 +178,6 @@ exports.post = ({ appSdk }, req, res) => {
flags: ['pakman-ws', 'pakman-transportadora']
}

if (!lowestPriceShipping || lowestPriceShipping.price > price) {
lowestPriceShipping = shippingLine
}

// check for default configured additional/discount price
if (appData.additional_price) {
if (appData.additional_price > 0) {
Expand Down Expand Up @@ -208,19 +205,6 @@ exports.post = ({ appSdk }, req, res) => {
service_code: 'pakman',
shipping_line: shippingLine
})


if (lowestPriceShipping) {
const { price } = lowestPriceShipping
const discount = typeof response.free_shipping_from_value === 'number' &&
response.free_shipping_from_value <= cartSubtotal
? price
: 0
if (discount) {
lowestPriceShipping.total_price = price - discount
lowestPriceShipping.discount = discount
}
}

res.send(response)
} else {
Expand Down

0 comments on commit 2d40692

Please sign in to comment.