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

Actual payoff amount can be different when calling makePayment() with different amounts #249

Open
wisdant opened this issue Oct 17, 2022 · 0 comments

Comments

@wisdant
Copy link
Contributor

wisdant commented Oct 17, 2022

Scenario:

  1. User borrows 1_000_000. With annual apr 12.17%. First bill is generated with 10_002 interest.
  2. User pays 900_000 immediately. Payment is applied to 10_002 interest first, then principal. After the payment, the user has a correction of -8902, and principal balance 110_002.
  3. The user makes another payment immediately to payoff the account. It turned out the system allows the user to pay off.
    makePayment parameter / actual amount collected for payoff
    101100 / 100089
    100700 / 10093
    100500 / 1005

This is because we try to calculate the correction amount for the final payment using the amount used in the makePayment call. We should have calculated the payoff correction using the entire principal due. In this way, we will achieve exactly the same payoff amount. For this particular case, the payoff amount should be 100_000. The user borrowed 1_000_000, since the user paid back immediately in two batches, there should be no interest generated, 100_000 makes perfect sense.

wisdant added a commit that referenced this issue Oct 17, 2022
* Make payoff amount consistent

* Fix default logic

* Cleanup, add comments
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

No branches or pull requests

1 participant