Skip to content

Commit 9581ee0

Browse files
(feat): no partial withdraws (#8)
* (feat): no partial withdraws * Apply suggestions from code review Co-authored-by: Julia Possamai <jpossamai@coderockr.com> Co-authored-by: Julia Possamai <jpossamai@coderockr.com>
1 parent b505bf4 commit 9581ee0

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,28 @@ In this challenge you should build an API for an application that stores and man
99
1. __Creation__ of an investment with an owner, a creation date and an amount.
1010
1. The creation date of an investment can be today or a date in the past.
1111
2. An investment should not be or become negative.
12-
2. __View__ of an investment with its withdrawals and current balance.
13-
1. Current balance should be the sum of the invested amount, the [gains] and withdrawals.
14-
3. Partial or total __withdrawal__ of the investment amount.
15-
1. Should not be able to withdraw more than the available balance.
16-
2. Withdrawals in the past can be created, but can't happen before the investment creation or previously created withdrawals.
17-
3. Should show the amount paid on [taxes].
12+
2. __View__ of an investment with its initial amount and expected balance.
13+
1. Expected balance should be the sum of the invested amount and the [gains][].
14+
3. __Withdrawal__ of a investment.
15+
1. The withdraw will always be the sum of the initial amount and its gains,
16+
partial withdrawn is not supported.
17+
2. Withdrawals can happen in the past or today, but can't happen before the investment creation or the future.
18+
3. [Taxes][taxes] need to be applied to the withdrawals before showing the
19+
final value.
1820
4. __List__ of a person's investments
1921
1. This list should have pagination.
2022

2123
__NOTE:__ the implementation of an interface will not be evaluated.
2224

2325
### Gain Calculation
2426

25-
The investment will pay 0.52% every month in the same day of the investment creation, if a withdrawal is made then in that month nothing will be paid.
27+
The investment will pay 0.52% every month in the same day of the investment creation.
2628

27-
Given that the gain is paid every month, it should be treated as as [compound gain], which means that gain that is not withdrawn will become part of the investment balance for the next payment.
29+
Given that the gain is paid every month, it should be treated as [compound gain][], which means that every new period (month) the amount gained will become part of the investment balance for the next payment.
2830

2931
### Taxation
3032

31-
When money is withdrawn, tax is triggered. Taxes apply only to the profit/gain portion of the money withdrawn. For example, if the initial investment was 1000.00, the current balance is 1200.00, and you withdraw 150.00, then the taxes will be applied to 16.67% = (200/1200) of the amount withdrawn. Meaning that you should apply tax on 25.00 (150 x 16,67%).
33+
When money is withdrawn, tax is triggered. Taxes apply only to the profit/gain portion of the money withdrawn. For example, if the initial investment was 1000.00, the current balance is 1200.00, then the taxes will be applied to 16.67% = (200/1200) of the balance. Meaning that you should apply tax on 33.34 (200 x 16,67%).
3234

3335
The tax percentage changes according to the age of the investment:
3436
* If it is less than one year old, the percentage will be 22.5%
@@ -49,8 +51,8 @@ The project source code and dependencies should be made available in GitHub. Her
4951
- Special build instructions, if any
5052
- List of third-party libraries used and short description of why/how they were used
5153
- A link to the API documentation.
52-
4. Once the work is complete, create a pull request from "development" into "master" and send us the link.
53-
5. Avoid using huge commits hiding your progress. Feel free to work on a branch and use rebase to adjust your commits before submitting the final version.
54+
4. Once the work is complete, create a pull request from "development" into "main" and send us the link.
55+
5. Avoid using huge commits hiding your progress. Feel free to work on a branch and use `git rebase` to adjust your commits before submitting the final version.
5456

5557
## Coding Standards
5658
When working on the project be as clean and consistent as possible.
@@ -80,6 +82,7 @@ Use the following checklist to ensure high quality of the project.
8082

8183
This coding challenge was inspired on [kinvoapp/kinvo-back-end-test](https://github.com/kinvoapp/kinvo-back-end-test/blob/2f17d713de739e309d17a1a74a82c3fd0e66d128/README.md)
8284

85+
[gains]: #gain-calculation
8386
[taxes]: #taxation
8487
[interest]: #interest-calculation
8588
[compound gain]: https://www.investopedia.com/terms/g/gain.asp

0 commit comments

Comments
 (0)