Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matheusgnreis
Copy link
Member

@matheusgnreis matheusgnreis commented Apr 25, 2023

O mercado pago agora tem uma configuração que o lojista consegue colocar valor mínimo por parcelamento sem juro:

image

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"

@matheusgnreis matheusgnreis linked an issue May 12, 2023 that may be closed by this pull request
Copy link
Member

@leomp12 leomp12 left a 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,
Copy link
Member

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)
Copy link
Member

@leomp12 leomp12 May 23, 2023

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

Copy link
Member

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

@leomp12
Copy link
Member

leomp12 commented May 23, 2023

Isso também fica um pouco estranho porque em geral isso poderia ser controlado pelo min_installment , meio que vai duplicar a configuração.
Quer dizer, ele pode oferecer até 6x com até 3x sem juros e parcela mínima R$ 50,00, nesse caso o parcelamento é sem juros pra 2x com pagamento mínimo R$ 100,00, 3x com mínimo R$ 150,00, a partir daí sempre com juros.
Entendo que essa opção a mais possibilita 2x sem juros a partir de R$ 100,00 e 2x com juros abaixo de R$ 100,00 "ao mesmo tempo", mas eu nunca vi isso em lugar nenhum, inclusive fica difícil de explicar pro consumidor (2x é com juros ou não ?). É necessário isso mesmo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Valor mínimo para parcelamento sem juros
2 participants