-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(list-payments): add interest free min amount for each installment #167
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Também tem que confirmar se config.installments
não é utilizado (especialmente bypassado) em outro lugar que poderia dar um erro de schema
if (number >= 2) { | ||
const value = amount.total / number | ||
if (value >= minInstallment) { | ||
gateway.installment_options.push({ | ||
number, | ||
value: interest > 0 ? value + value * interest / 100 : value, | ||
value: interest > 0 && (!interest_free_min_amount || interest_free_min_amount < amount.total) ? value + value * interest / 100 : value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Legibilidade ruim nesse ternário, e tem variável nomeada com snake_case então você não tá usando linter aqui...
if (number >= 2) { | ||
const value = amount.total / number | ||
if (value >= minInstallment) { | ||
gateway.installment_options.push({ | ||
number, | ||
value: interest > 0 ? value + value * interest / 100 : value, | ||
value: interest > 0 && (!interest_free_min_amount || interest_free_min_amount < amount.total) ? value + value * interest / 100 : value, | ||
tax: Boolean(interest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tinha que mudar o tax
aqui também
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Especialmente por isso acho que faz mais sentido você setar um booleano numa variável em vez de aumentar o ternário na linha anterior
Isso também fica um pouco estranho porque em geral isso poderia ser controlado pelo |
O mercado pago agora tem uma configuração que o lojista consegue colocar valor mínimo por parcelamento sem juro:
Então a ideia é o cara que quer fazer esse tipo de situação, configura o % de parcelamento em 2x por exemplo e também configura o minimo pra parcelamento sem juros.Se passar do valor mínimo, parcelamento sem juros, se não tiver, com juros.. como no checkout após colocar 6 dígitos busca o que vem do mp, então, precisa ter essa "sincronia"