From 2a78916d7a8695d2f6752c796060fc9f05e8907d Mon Sep 17 00:00:00 2001 From: Wisley Alves Date: Fri, 27 Sep 2024 12:50:25 -0300 Subject: [PATCH] fix(installments): fix tax in installments --- functions/lib/payments/add-installments.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/functions/lib/payments/add-installments.js b/functions/lib/payments/add-installments.js index 8198a91..962d340 100644 --- a/functions/lib/payments/add-installments.js +++ b/functions/lib/payments/add-installments.js @@ -1,9 +1,10 @@ module.exports = (amount, installments = {}, gateway = {}, response) => { + const interestFreeMinAmount = installments.interest_free_min_amount || 5 const maxInterestFree = installments.max_interest_free const minInstallment = installments.min_installment || 5 const qtyPosssibleInstallment = Math.floor((amount.total / minInstallment)) let maxInstallments = installments.max_number || 12 - if(qtyPosssibleInstallment < maxInstallments){ + if (qtyPosssibleInstallment < maxInstallments) { maxInstallments = qtyPosssibleInstallment } @@ -18,7 +19,7 @@ module.exports = (amount, installments = {}, gateway = {}, response) => { } } - const isInterestFreeMinAmount = installments.interest_free_min_amount && amount.total >= (installments.interest_free_min_amount) + const isInterestFreeMinAmount = interestFreeMinAmount && amount.total >= interestFreeMinAmount // list installment options gateway.installment_options = []