Skip to content

Commit

Permalink
chore: set warehouse address
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgnreis authored Jul 21, 2024
1 parent 7943835 commit 7fcfd29
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions functions/routes/ecom/modules/calculate-shipping.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ exports.post = ({ appSdk }, req, res) => {
return true
}
let postingDeadline = appData.posting_deadline
let from = appData.from || {}
let isWareHouse = false
if (params.from) {
originZip = params.from.zip
Expand All @@ -66,6 +67,13 @@ exports.post = ({ appSdk }, req, res) => {
if (warehouse.doc) {
docNumber = warehouse.doc
}
if (warehouse && warehouse.street) {
;['zip', 'street', 'number', 'complement', 'borough', 'city', 'province_code'].forEach(prop => {
if (warehouse[prop]) {
from[prop] = warehouse[prop]
}
})
}
warehouseCode = code
}
}
Expand Down Expand Up @@ -246,6 +254,7 @@ exports.post = ({ appSdk }, req, res) => {
const shippingLine = {
from: {
...params.from,
...from,
zip: originZip
},
to: params.to,
Expand Down

0 comments on commit 7fcfd29

Please sign in to comment.