singapore_cpf_calculator 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/singapore_cpf_calculator.rb +2 -0
  4. data/lib/singapore_cpf_calculator/age_group.rb +34 -11
  5. data/lib/singapore_cpf_calculator/base_calculator.rb +1 -0
  6. data/lib/singapore_cpf_calculator/requirements.rb +1 -0
  7. data/lib/singapore_cpf_calculator/requirements/group_55_years_and_below.rb +13 -0
  8. data/lib/singapore_cpf_calculator/version.rb +1 -1
  9. data/lib/singapore_cpf_calculator/year_2015.rb +1 -1
  10. data/lib/singapore_cpf_calculator/year_2016.rb +38 -0
  11. data/lib/singapore_cpf_calculator/year_2016/base.rb +17 -0
  12. data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3.rb +33 -0
  13. data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator.rb +32 -0
  14. data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  15. data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  16. data/lib/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator.rb +32 -0
  17. data/lib/singapore_cpf_calculator/year_2016/spr_1_fg.rb +35 -0
  18. data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator.rb +32 -0
  19. data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  20. data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  21. data/lib/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator.rb +32 -0
  22. data/lib/singapore_cpf_calculator/year_2016/spr_1_gg.rb +34 -0
  23. data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator.rb +32 -0
  24. data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator.rb +14 -0
  25. data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator.rb +32 -0
  26. data/lib/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
  27. data/lib/singapore_cpf_calculator/year_2016/spr_2_fg.rb +34 -0
  28. data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator.rb +32 -0
  29. data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  30. data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  31. data/lib/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator.rb +32 -0
  32. data/lib/singapore_cpf_calculator/year_2016/spr_2_gg.rb +34 -0
  33. data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator.rb +32 -0
  34. data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator.rb +32 -0
  35. data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator.rb +32 -0
  36. data/lib/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator.rb +32 -0
  37. data/spec/singapore_cpf_calculator/year_2015/citizen_or_spr_3_spec.rb +10 -10
  38. data/spec/singapore_cpf_calculator/year_2015/spr_1_fg_spec.rb +10 -10
  39. data/spec/singapore_cpf_calculator/year_2015/spr_1_gg_spec.rb +11 -11
  40. data/spec/singapore_cpf_calculator/year_2015/spr_2_fg_spec.rb +11 -11
  41. data/spec/singapore_cpf_calculator/year_2015/spr_2_gg_spec.rb +11 -11
  42. data/spec/singapore_cpf_calculator/year_2015_spec.rb +3 -3
  43. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  44. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  45. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  46. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_65_up_contribution_calculator_spec.rb +63 -0
  47. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +158 -0
  48. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  49. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  50. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  51. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_65_up_contribution_calculator_spec.rb +63 -0
  52. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg_spec.rb +158 -0
  53. data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  54. data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  55. data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  56. data/spec/singapore_cpf_calculator/year_2016/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  57. data/spec/singapore_cpf_calculator/year_2016/spr_1_gg_spec.rb +158 -0
  58. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  59. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  60. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  61. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_65_up_contribution_calculator_spec.rb +63 -0
  62. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg_spec.rb +158 -0
  63. data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  64. data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  65. data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  66. data/spec/singapore_cpf_calculator/year_2016/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  67. data/spec/singapore_cpf_calculator/year_2016/spr_2_gg_spec.rb +158 -0
  68. data/spec/singapore_cpf_calculator/year_2016_spec.rb +187 -0
  69. data/spec/spec_helper.rb +3 -3
  70. metadata +82 -3
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.13"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.18"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove60To65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.09"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.14"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65UpContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.075"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.125"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ require_relative "spr_1_gg/age_55_below_contribution_calculator"
2
+ require_relative "spr_1_gg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_1_gg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_1_gg/age_65_up_contribution_calculator"
5
+
6
+ module SingaporeCPFCalculator
7
+ module Year2016
8
+
9
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
10
+ # employer contribution and graduated (G, partial) employee contribution
11
+ module SPR1GG
12
+
13
+ extend ResidencyModuleCommon
14
+ extend SPR1GGCommon
15
+
16
+ class << self
17
+
18
+ private
19
+
20
+ def calculators
21
+ [
22
+ Age55BelowContributionCalculator,
23
+ Age55To60ContributionCalculator,
24
+ Age60To65ContributionCalculator,
25
+ Age65UpContributionCalculator,
26
+ ]
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::Group55YearsAndBelow
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.04"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.09"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Age55BelowContributionCalculator
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove60To65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.035"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.085"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR1GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65UpContributionCalculator < Age60To65ContributionCalculator
7
+
8
+ extend Requirements::GroupAbove65Years
9
+
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,34 @@
1
+ require_relative "spr_2_fg/age_55_below_contribution_calculator"
2
+ require_relative "spr_2_fg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_2_fg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_2_fg/age_65_up_contribution_calculator"
5
+
6
+ module SingaporeCPFCalculator
7
+ module Year2016
8
+
9
+ # For Singapore Permanent Resident (SPR) on their second year with graduated (G, partial)
10
+ # employee contribution and full (F) employer contribution
11
+ module SPR2FG
12
+
13
+ extend ResidencyModuleCommon
14
+ extend SPR2FGCommon
15
+
16
+ class << self
17
+
18
+ private
19
+
20
+ def calculators
21
+ [
22
+ Age55BelowContributionCalculator,
23
+ Age55To60ContributionCalculator,
24
+ Age60To65ContributionCalculator,
25
+ Age65UpContributionCalculator,
26
+ ]
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::Group55YearsAndBelow
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.17"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.32"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.15"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.45"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove55To60Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.13"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.255"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.125"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.375"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove60To65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.09"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.165"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.075"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.225"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65UpContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove65Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.075"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.125"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.05"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.15"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,34 @@
1
+ require_relative "spr_2_gg/age_55_below_contribution_calculator"
2
+ require_relative "spr_2_gg/age_55_to_60_contribution_calculator"
3
+ require_relative "spr_2_gg/age_60_to_65_contribution_calculator"
4
+ require_relative "spr_2_gg/age_65_up_contribution_calculator"
5
+
6
+ module SingaporeCPFCalculator
7
+ module Year2016
8
+
9
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
10
+ # employer contribution and graduated (G, partial) employee contribution
11
+ module SPR2GG
12
+
13
+ extend ResidencyModuleCommon
14
+ extend SPR2GGCommon
15
+
16
+ class << self
17
+
18
+ private
19
+
20
+ def calculators
21
+ [
22
+ Age55BelowContributionCalculator,
23
+ Age55To60ContributionCalculator,
24
+ Age60To65ContributionCalculator,
25
+ Age65UpContributionCalculator,
26
+ ]
27
+ end
28
+
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2016
3
+ module SPR2GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::Group55YearsAndBelow
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.09"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.24"
18
+ end
19
+
20
+ def ec_rate
21
+ "0.15"
22
+ end
23
+
24
+ def adjustment_rate
25
+ "0.45"
26
+ end
27
+
28
+ end
29
+
30
+ end
31
+ end
32
+ end