income-tax 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 718d9ae66f9ea72ad57e8bbe963587fbb056b6eb
4
- data.tar.gz: 6a77baa4ff918dc60e318951fb0137805b1278da
3
+ metadata.gz: ca8c930d2bfb251a1e03a6f51920008f6952bcd6
4
+ data.tar.gz: b8c9ee09d3564038a777e45deb5890b1dcbed778
5
5
  SHA512:
6
- metadata.gz: 49eccb866d3732ae54f5814ede21fcf0568319c57958e9638ae27b287e3286700796f94489313137487998c13dd5f8e736934816e561ceb95ed57dd07f26f6ce
7
- data.tar.gz: 6909cd075ae35332f3670864f955a9fddf8897df2b51c61496d06577e91bc733dcef04c7be3ce4e54405257afaffbdaf58d9c046340017df08887351cf687db1
6
+ metadata.gz: c6c87405c8526020703d49855875f29f6ee786c7cbf344b4dc2fd41f1644b38adcc34ebceb35bb5ec4ff372d437110d22126d80caf4e0d49bbb7ce82bb03fd47
7
+ data.tar.gz: 5456b7c26fbf3f3ef1e1371dd108091fdb6c3a29658b4e7bfc69e3f0a6b7d5610b57d91684924b19acd5c2c556cbe326e2459168beabe25e068e2c88203e8e14
@@ -18,9 +18,11 @@ module IncomeTax
18
18
  SOLIDARITY = Rate("5.5%")
19
19
 
20
20
  def net_taxes(income, lower, upper, lower_taxes, lower_rate, upper_rate, upper_taxes)
21
- step = (upper_rate - lower_rate) / (upper_taxes - lower_taxes + 1)
22
- steps = income - lower_taxes
23
- rate = lower_rate + Rate(step * steps)
21
+ lower_income = lower - lower_taxes
22
+ upper_income = upper - upper_taxes
23
+ step = (upper_rate - lower_rate) / (upper_income - lower_income)
24
+ steps = income - lower_income
25
+ rate = lower_rate + Rate(step * steps)
24
26
  rate.net_taxes(steps).to_i + lower_taxes
25
27
  end
26
28
 
@@ -1,3 +1,3 @@
1
1
  module IncomeTax
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/readme.md CHANGED
@@ -54,7 +54,7 @@ Things not considered separate countries:
54
54
 
55
55
  * Sovereign entities without any actual territory (The Holy See, Sovereign Military Order of Malta).
56
56
  * States with very limited recognition (like Northern Cyprus, South Ossetia).
57
- * Scotland, Wales, England and Northern Island (they are collectively treated as one country).
57
+ * Scotland, Wales, England and Northern Ireland (they are collectively treated as one country).
58
58
  * Unclaimed or heavily disputed territories.
59
59
  * Antartica.
60
60
 
@@ -63,27 +63,27 @@ describe IncomeTax::Countries::Germany do
63
63
  describe "from net income of 10000" do
64
64
  let(:type) { :net }
65
65
  let(:income) { 10000 }
66
- its(:rate) { should be == Rational(96, 143) }
67
- its(:gross_income) { should be == "30425.010582010582".to_d }
66
+ its(:rate) { should be == Rational(69, 862) }
67
+ its(:gross_income) { should be == "10870.010582010582".to_d }
68
68
  its(:net_income) { should be == 10000 }
69
- its(:taxes) { should be == "20425.010582010582".to_d }
69
+ its(:taxes) { should be == "870.010582010582".to_d }
70
70
  end
71
71
 
72
72
  describe "from net income of 100000" do
73
73
  let(:type) { :net }
74
74
  let(:income) { 100000 }
75
- its(:rate) { should be == Rational(142, 315) }
76
- its(:gross_income) { should be == "182081.10582010582".to_d }
75
+ its(:rate) { should be == Rational(199, 510) }
76
+ its(:gross_income) { should be == "163989.10582010582".to_d }
77
77
  its(:net_income) { should be == 100000 }
78
- its(:taxes) { should be == "82081.10582010582".to_d }
78
+ its(:taxes) { should be == "63989.10582010582".to_d }
79
79
  end
80
80
 
81
81
  describe "from net income of 100000000" do
82
82
  let(:type) { :net }
83
83
  let(:income) { 100000000 }
84
- its(:rate) { should be == Rational(71, 152) }
85
- its(:gross_income) { should be == "187655931.82010582".to_d }
84
+ its(:rate) { should be == Rational(99, 212) }
85
+ its(:gross_income) { should be == "187609588.82010582".to_d }
86
86
  its(:net_income) { should be == 100000000 }
87
- its(:taxes) { should be == "87655931.82010582".to_d }
87
+ its(:taxes) { should be == "87609588.82010582".to_d }
88
88
  end
89
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: income-tax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2015-10-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Estimate Income Tax for different Countries
14
14
  email: income-tax-gem@rkh.im