Skip to content

Commit

Permalink
fix(order-to-horus): add skip if without total
Browse files Browse the repository at this point in the history
  • Loading branch information
wisley7l committed Aug 13, 2024
1 parent 03e886c commit e29eb59
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion functions/lib/integration/exports/orders-to-horus.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ module.exports = async ({ appSdk, storeId, auth }, orderId, opts = {}) => {
isImportItem = true
}

isAllImportedItems = item?.quantity > 0
// isAllImportedItems = item?.quantity > 0
// console.log(`QTD_PEDIDA: ${body?.QTD_PEDIDA} itemHorus ${itemHorus?.QTD_PEDIDA} itemOrder: ${item?.quantity}`)

if (isImportItem) {
Expand Down Expand Up @@ -293,6 +293,11 @@ module.exports = async ({ appSdk, storeId, auth }, orderId, opts = {}) => {
throw new Error(skipCreate)
}

if (order.amount && !order.amount.total) {
console.log(`${logHead} skipped, order without total`)
throw new Error(skipCreate)
}

return {
order,
saleCodeHorus,
Expand Down

0 comments on commit e29eb59

Please sign in to comment.