Skip to content

Commit 3a10dd5

Browse files
committed
chore: debugging full quote body on unexpected response
1 parent 5b499cc commit 3a10dd5

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

functions/routes/ecom/modules/calculate-shipping.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,17 @@ exports.post = async ({ appSdk, admin }, req, res) => {
261261
}
262262

263263
await Promise.all(enviaCarriers.map(async (carrier) => {
264+
const enviaFinalQuote = {
265+
...enviaQuote,
266+
shipment: {
267+
...enviaQuote.shipment,
268+
carrier
269+
}
270+
}
271+
264272
try {
265273
const enviaApi = new EnviaAPI(appData.api_key, storeId, appData.sandbox)
266-
const enviaResponse = await enviaApi.fetch('/ship/rate/', {
267-
...enviaQuote,
268-
shipment: {
269-
...enviaQuote.shipment,
270-
carrier
271-
}
272-
})
274+
const enviaResponse = await enviaApi.fetch('/ship/rate/', enviaFinalQuote)
273275

274276
if (enviaResponse?.data) {
275277
enviaResponse.data.forEach(rate => {
@@ -393,7 +395,7 @@ exports.post = async ({ appSdk, admin }, req, res) => {
393395
} else {
394396
logger.warn(`#${storeId} unexpected Envia.com response`, {
395397
destinationZip,
396-
enviaQuote,
398+
enviaFinalQuote,
397399
enviaResponse
398400
})
399401
}

0 commit comments

Comments
 (0)