Readplace

:red_circle: Add condition for $5001.00 loan amount · FagnerMartinsBrack/jack-the-moneylender@1182ac6

GitHub 1 min read
View original
  • current

This article is too short to summarise.

Original file line numberDiff line numberDiff line change

@@ -11,11 +11,17 @@

1111

const END_OF_FIRST_RANGE = Money('$2000.00');

1212

const CENTS_FOR_FIRST_RANGE = Money('$0.00');

1313

const CENTS_FOR_SECOND_RANGE = Money('$0.09');

14+
1415

if (loanAmount.greaterThan(END_OF_FIRST_RANGE) && loanAmount.lessThan(Money('$5001.00'))) {

1516

const dollarsAboveThreshold = loanAmount.minus(END_OF_FIRST_RANGE);

1617

const interestAmount = CENTS_FOR_SECOND_RANGE.multipliedBy(dollarsAboveThreshold);

1718

return interestAmount;

1819

}

20+
21+

if (loanAmount.equalsTo(Money('$5001.00'))) {

22+

return interestAmount;

23+

}

24+
1925

return CENTS_FOR_FIRST_RANGE;

2026

};

2127