From 27115c4dd261bdb31faaef769cb5459f93b594b4 Mon Sep 17 00:00:00 2001 From: Wisley Alves Date: Mon, 16 Sep 2024 12:58:37 -0300 Subject: [PATCH] fix(export-order): check if there is a transaction before check bling --- functions/lib/integration/export-order.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/lib/integration/export-order.js b/functions/lib/integration/export-order.js index 7acf5ba..1885edb 100644 --- a/functions/lib/integration/export-order.js +++ b/functions/lib/integration/export-order.js @@ -71,10 +71,10 @@ module.exports = ({ appSdk, storeId, auth }, blingStore, _blingDeposit, queueEnt const params = new url.URLSearchParams(urlParams) const bling = new Bling(clientId, clientSecret, storeId) const endpoint = `/pedidos/vendas${hasCreatedBlingOrder ? `/${blingOrderId}` : `?${params.toString()}`}` - const [paymentTypeId, allStatusBling] = await Promise.all([ - getPaymentBling(bling, transaction, appData.parse_payment), - getStatusBling(bling) - ]) + + const paymentTypeId = transaction ? await getPaymentBling(bling, transaction, appData.parse_payment) : null + const allStatusBling = await getStatusBling(bling) + const job = bling.get(endpoint) .catch(err => { if (err.response && err.response.status === 404) {