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

Fixes the problem when sum of split's amounts is not equal to the order total amount #170

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

Conversation

douglasfanucchi
Copy link

@douglasfanucchi douglasfanucchi commented Dec 15, 2024

Questions Answers
Issue https://mundipagg.atlassian.net/browse/CONECT-{ISSUE-NUMBER}
What? Describe in an objective way what has been done.
Why? I am using the woocommerce plugin and i had a problem when splitting the order with intereset on installments. The AbstractPayment recalculates the split amount before sending the request to Pagar.me and sometimes those new values did not sum up correctly because of the round function. It always miss calculate by 1 centavo.
How? I just calculate the sellers commission first and then subtract it from the total amount of the payment.

📦 Attachments (if appropriate)

In a order of 100 centavos total with 1.15% interest, my wordpress plugins sends this to AbstractPayment:

[{"marketplaceCommission":50,"commission":50,"pagarmeId":"re_pagarme_id"}]

And this is what is sent to pagar.me

  {
    "type": "flat",
    "amount": 58,
    "recipient_id": "re_pagarme_id",
    "options": {
      "liable": true,
      "charge_processing_fee": true,
      "charge_remainder_fee": true
    },
    "split_rule_id": null
  },
  [
    {
      "type": "flat",
      "amount": 58,
      "recipient_id": "re_pagarme_id",
      "options": {
        "liable": true,
        "charge_processing_fee": false,
        "charge_remainder_fee": false
      },
      "split_rule_id": null
    }
  ]
]```

Notice that with 1.15 intereset on an 100 centavos order, the total should be 115 but the split data sums up to 116

Copy link

⚠️ Este repositório ainda não está catalogado no Backstage. ⚠️

Por favor, catalogue-o seguindo as instruções nesta documentação. [Via VPN].

💁 Qualquer problema ou dúvida, estamos no Slack, basta abrir um ticket no canal #help-foundation-platform.

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.

1 participant