Skip to content

Commit

Permalink
fix(installments): fix tax in installments
Browse files Browse the repository at this point in the history
  • Loading branch information
wisley7l committed Sep 27, 2024
1 parent fe774f8 commit 2a78916
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions functions/lib/payments/add-installments.js
Original file line number Diff line number Diff line change
@@ -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
}

Expand All @@ -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 = []
Expand Down

0 comments on commit 2a78916

Please sign in to comment.