train-tax-calculator 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6be25d58a16495863debdd71469a9f163ef350e3
4
- data.tar.gz: 2d1419204944bd53465a11b75c93c1116cb06bd1
3
+ metadata.gz: c39135038d3544ae9ca29d0a5dd93bfa0738b40f
4
+ data.tar.gz: dfb5454208487a37552fd4da39c1784ba470ec5b
5
5
  SHA512:
6
- metadata.gz: 3b1176e270784bb87072307719354a3b081c9f01432dc5eb8ab9f0124e4b7d677aed313c6ff51f3038f35582e58b7bf3f1b88d085b564d62f5fdd0b792569fb2
7
- data.tar.gz: d59bb390586d8281ebfd7495bade04be0ab37864925ffa7a5e3b633c2885ecb469bebaad3a93b6f84f101593a065bb0e673eba03ebea8b1448516ee4b56c192a
6
+ metadata.gz: be54a299f92fd4ea5267a1d32035009a5d8dd3cd2afce11205666e10e87c04e8479f0922cbb7abb1d7794828830404ede88166bcd2b00d0426e12798d5db66d8
7
+ data.tar.gz: 24231d7edeaf8daa7cd9563161ee6d9b85674c7f225f62da765715a2c6868438f96afdcc0c49094011aa80ff10776dc8b8d1702773935b7c14162c64325af234
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- train-tax-calculator (2.2.1)
4
+ train-tax-calculator (2.2.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,7 +1,7 @@
1
1
  module Train
2
2
  module Tax
3
3
  module Calculator
4
- VERSION = "2.2.2"
4
+ VERSION = "2.2.4"
5
5
  end
6
6
  end
7
7
  end
@@ -1,3 +1,5 @@
1
+ require 'pry'
2
+
1
3
  module Train::Tax::Calculator
2
4
  module WithholdingTax
3
5
 
@@ -5,7 +7,7 @@ module Train::Tax::Calculator
5
7
  { lowest: 0.00, highest: 20_833.00, base: 0.00, excess: 0.00 },
6
8
  { lowest: 20_833.00, highest: 33_333.00, base: 0.00, excess: 0.20 },
7
9
  { lowest: 33_333.00, highest: 66_667.00, base: 2_500.00, excess: 0.25 },
8
- { lowest: 66_667.000, highest: 166_667.00, base: 10_833.33, excess: 0.30 },
10
+ { lowest: 66_667.00, highest: 166_667.00, base: 10_833.33, excess: 0.30 },
9
11
  { lowest: 166_667.00, highest: 666_667.00, base: 40_833.33, excess: 0.32 },
10
12
  { lowest: 666_667.00, highest: Float::INFINITY, base: 200_833.33, excess: 0.35 },
11
13
  ]
@@ -13,12 +15,17 @@ module Train::Tax::Calculator
13
15
  def self.compute(basic_salary)
14
16
  taxable_income = basic_salary - Deductions.get(basic_salary)
15
17
 
18
+ if basic_salary > 90_000
19
+ monthly_taxable = ((basic_salary - 90_000) / 12.00)
20
+ taxable_income = taxable_income + monthly_taxable
21
+ end
22
+
16
23
  tax_bracket = LOOKUP_TABLE.select do |bracket|
17
24
  taxable_income >= bracket[:lowest] &&
18
25
  taxable_income < bracket[:highest]
19
26
  end.first
20
27
 
21
- withholding_tax = tax_bracket[:base] + ((taxable_income - tax_bracket[:lowest]) * tax_bracket[:excess])
28
+ withholding_tax = ((taxable_income - tax_bracket[:lowest]) * tax_bracket[:excess]) + tax_bracket[:base]
22
29
  withholding_tax.round(2)
23
30
  end
24
31
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train-tax-calculator
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez