singapore_cpf_calculator 1.3.4 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +33 -0
  3. data/Gemfile +1 -0
  4. data/README.md +1 -0
  5. data/lib/singapore_cpf_calculator/age_group.rb +27 -5
  6. data/lib/singapore_cpf_calculator/base_calculator.rb +14 -2
  7. data/lib/singapore_cpf_calculator/requirements/group_above_65_to_70_years.rb +13 -0
  8. data/lib/singapore_cpf_calculator/requirements/group_above_70_years.rb +13 -0
  9. data/lib/singapore_cpf_calculator/requirements.rb +3 -0
  10. data/lib/singapore_cpf_calculator/residency_module_common.rb +5 -1
  11. data/lib/singapore_cpf_calculator/version.rb +1 -1
  12. data/lib/singapore_cpf_calculator/year_2016.rb +2 -2
  13. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator.rb +8 -0
  14. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator.rb +32 -0
  15. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator.rb +32 -0
  16. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator.rb +32 -0
  17. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_calculator.rb +32 -0
  18. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3/citizen_or_spr3_base.rb +9 -0
  19. data/lib/singapore_cpf_calculator/year_2022/citizen_or_spr_3.rb +40 -0
  20. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator.rb +11 -0
  21. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator.rb +32 -0
  22. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator.rb +32 -0
  23. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator.rb +32 -0
  24. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator.rb +32 -0
  25. data/lib/singapore_cpf_calculator/year_2022/spr_1_fg.rb +40 -0
  26. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator.rb +11 -0
  27. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator.rb +12 -0
  28. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator.rb +11 -0
  29. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator.rb +14 -0
  30. data/lib/singapore_cpf_calculator/year_2022/spr_1_gg.rb +34 -0
  31. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator.rb +11 -0
  32. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator.rb +32 -0
  33. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator.rb +32 -0
  34. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator.rb +32 -0
  35. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator.rb +32 -0
  36. data/lib/singapore_cpf_calculator/year_2022/spr_2_fg.rb +40 -0
  37. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator.rb +11 -0
  38. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator.rb +11 -0
  39. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator.rb +11 -0
  40. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator.rb +11 -0
  41. data/lib/singapore_cpf_calculator/year_2022/spr_2_gg.rb +34 -0
  42. data/lib/singapore_cpf_calculator/year_2022.rb +35 -0
  43. data/lib/singapore_cpf_calculator.rb +9 -1
  44. data/singapore_cpf_calculator.gemspec +2 -2
  45. data/spec/singapore_cpf_calculator/age_group_spec.rb +15 -3
  46. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +1 -1
  47. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +2 -2
  48. data/spec/singapore_cpf_calculator/year_2016/citizen_or_spr_3_spec.rb +3 -3
  49. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +1 -1
  50. data/spec/singapore_cpf_calculator/year_2016/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  51. data/spec/singapore_cpf_calculator/year_2016/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +1 -1
  52. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_below_contribution_calculator_spec.rb +63 -0
  53. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_55_to_60_contribution_calculator_spec.rb +63 -0
  54. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_60_to_65_contribution_calculator_spec.rb +63 -0
  55. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_65_to_70_contribution_calculator_spec.rb +63 -0
  56. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3/age_70_up_contribution_spec.rb +63 -0
  57. data/spec/singapore_cpf_calculator/year_2022/citizen_or_spr_3_spec.rb +242 -0
  58. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  59. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  60. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  61. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  62. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  63. data/spec/singapore_cpf_calculator/year_2022/spr_1_fg_spec.rb +176 -0
  64. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  65. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  66. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  67. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  68. data/spec/singapore_cpf_calculator/year_2022/spr_1_gg_spec.rb +158 -0
  69. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_below_contribution_calculator_spec.rb +63 -0
  70. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  71. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  72. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_65_to_70_contribution_calculator_spec.rb +63 -0
  73. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg/age_70_up_contribution_calculator_spec.rb +63 -0
  74. data/spec/singapore_cpf_calculator/year_2022/spr_2_fg_spec.rb +176 -0
  75. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_below_contribution_calculator_spec.rb +63 -0
  76. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_55_to_60_contribution_calculator_spec.rb +63 -0
  77. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_60_to_65_contribution_calculator_spec.rb +63 -0
  78. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg/age_65_up_contribution_calculator_spec.rb +63 -0
  79. data/spec/singapore_cpf_calculator/year_2022/spr_2_gg_spec.rb +158 -0
  80. data/spec/singapore_cpf_calculator/year_2022_spec.rb +192 -0
  81. data/spec/singapore_cpf_calculator_spec.rb +57 -20
  82. data/spec/spec_helper.rb +6 -1
  83. metadata +97 -5
  84. data/.travis.yml +0 -15
@@ -0,0 +1,14 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
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_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 Year2022
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,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::SPR2FG::Age55BelowContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
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.14"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.265"
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 Year2022
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.1"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.175"
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 Year2022
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65To70ContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove65To70Years
9
+
10
+ private
11
+
12
+ def tc_rate_1
13
+ "0.08"
14
+ end
15
+
16
+ def tc_rate_2
17
+ "0.13"
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 Year2022
3
+ module SPR2FG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age70UpContributionCalculator < Year2016::Base
7
+
8
+ extend Requirements::GroupAbove70Years
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,40 @@
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_to_70_contribution_calculator"
5
+ require_relative "spr_2_fg/age_70_up_contribution_calculator"
6
+
7
+ module SingaporeCPFCalculator
8
+ module Year2022
9
+
10
+ # For Singapore Permanent Resident (SPR) on their first year with graduated (G, partial)
11
+ # employer contribution and graduated (G, partial) employee contribution
12
+ module SPR2FG
13
+
14
+ extend ResidencyModuleCommon
15
+ extend SPR2FGCommon
16
+
17
+ class << self
18
+
19
+ private
20
+
21
+ def has_70_up
22
+ true
23
+ end
24
+
25
+ def calculators
26
+ [
27
+ Age55BelowContributionCalculator,
28
+ Age55To60ContributionCalculator,
29
+ Age60To65ContributionCalculator,
30
+ Age65To70ContributionCalculator,
31
+ Age70UpContributionCalculator,
32
+ ]
33
+ end
34
+
35
+ end
36
+
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR2GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 50 and below.
6
+ class Age55BelowContributionCalculator < Year2016::SPR2GG::Age55BelowContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR2GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 55 to 60.
6
+ class Age55To60ContributionCalculator < Year2016::SPR2GG::Age55To60ContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR2GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 60 to 65.
6
+ class Age60To65ContributionCalculator < Year2016::SPR2GG::Age60To65ContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module SingaporeCPFCalculator
2
+ module Year2022
3
+ module SPR2GG
4
+
5
+ # Payment calculator for Singapore's Central Provident Fund for employee's age 65 and above.
6
+ class Age65UpContributionCalculator < Year2016::SPR2GG::Age65UpContributionCalculator
7
+ end
8
+
9
+ end
10
+ end
11
+ 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 Year2022
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,35 @@
1
+ require_relative "year_2016/base"
2
+ require_relative "year_2022/citizen_or_spr_3"
3
+ require_relative "year_2022/spr_2_gg"
4
+ require_relative "year_2022/spr_2_fg"
5
+ require_relative "year_2022/spr_1_gg"
6
+ require_relative "year_2022/spr_1_fg"
7
+
8
+ module SingaporeCPFCalculator
9
+ # Contains the calculators that are used for determining CPF contribution for 2022.
10
+ module Year2022
11
+ class << self
12
+ include YearCommon
13
+
14
+ # @param [Date] date when the CPF contribution is to be calculated for.
15
+ # @return [true, false] true when the date's year is 2022 and later
16
+ def applies_to?(date)
17
+ date.year >= 2022
18
+ end
19
+
20
+ private
21
+
22
+ def residency_modules
23
+ [
24
+ CitizenOrSPR3,
25
+ SPR2GG,
26
+ SPR2FG,
27
+ SPR1GG,
28
+ SPR1FG,
29
+ BeforeSPR,
30
+ ]
31
+ end
32
+ end
33
+
34
+ end
35
+ end
@@ -86,16 +86,22 @@ module SingaporeCPFCalculator
86
86
  raise ArgumentError, "spr_start_date: must be set" if spr_start_date.nil?
87
87
  if contribution_types_required?(date, spr_start_date)
88
88
  if employee_contribution_type.nil?
89
+ # :nocov:
89
90
  raise ArgumentError, "employee_contribution_type: must be set"
91
+ # :nocov:
90
92
  end
91
93
  if employer_contribution_type.nil?
94
+ # :nocov:
92
95
  raise ArgumentError, "employer_contribution_type: must be set"
96
+ # :nocov:
93
97
  end
94
98
  end
95
99
  end
96
100
 
97
101
  unless ["citizen", "permanent_resident"].include? residency_status
102
+ # :nocov:
98
103
  raise ArgumentError, "unsupported residency status: #{ residency_status }"
104
+ # :nocov:
99
105
  end
100
106
  end
101
107
 
@@ -112,7 +118,8 @@ module SingaporeCPFCalculator
112
118
  [
113
119
  Year2014,
114
120
  Year2015,
115
- Year2016
121
+ Year2016,
122
+ Year2022
116
123
  ]
117
124
  end
118
125
  end
@@ -136,3 +143,4 @@ require_relative 'singapore_cpf_calculator/year_2012_to_2015_aw_ceiling_module'
136
143
  require_relative "singapore_cpf_calculator/year_2014"
137
144
  require_relative "singapore_cpf_calculator/year_2015"
138
145
  require_relative "singapore_cpf_calculator/year_2016"
146
+ require_relative "singapore_cpf_calculator/year_2022"
@@ -6,8 +6,8 @@ require 'singapore_cpf_calculator/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "singapore_cpf_calculator"
8
8
  spec.version = SingaporeCPFCalculator::VERSION
9
- spec.authors = ["Ronald Maravilla"]
10
- spec.email = ["rmaravilla@payrollhero.com"]
9
+ spec.authors = ["Ronald Maravilla", "Mathieu Jobin", "Pete Henchaw"]
10
+ spec.email = ["support@payrollhero.com"]
11
11
  spec.summary = "A Singapore's Central Provident Fund (CPF) contributions calculator."
12
12
  spec.description = "A Singapore's Central Provident Fund (CPF) contributions calculator."
13
13
  spec.homepage = "https://github.com/payrollhero/singapore_cpf_calculator"
@@ -3,7 +3,8 @@ require 'spec_helper'
3
3
  describe SingaporeCPFCalculator::AgeGroup do
4
4
 
5
5
  describe "#get" do
6
- let(:age_group) { described_class.get current_date, birthdate: birthdate }
6
+ let(:has_70_up) { false }
7
+ let(:age_group) { described_class.get current_date, birthdate: birthdate, has_70_up: has_70_up }
7
8
 
8
9
  context "born 1950-06-15" do
9
10
  let(:birthdate) { Date.new(1950, 6, 15) }
@@ -55,11 +56,22 @@ describe SingaporeCPFCalculator::AgeGroup do
55
56
 
56
57
  context "when age 100, on the same month of the birth date" do
57
58
  let(:current_date) { Date.new(2050, 6, 30) }
58
- it { expect(age_group).to eq :group_above_65_years }
59
+ let(:has_70_up) { true }
60
+ it { expect(age_group).to eq :group_above_70_years }
59
61
  end
60
62
 
61
63
  end
62
64
 
65
+ context "born 1957-06-15" do
66
+ let(:birthdate) { Date.new(1957, 6, 15) }
67
+ let(:has_70_up) { true }
68
+
69
+ context "when age 65, on the month after the birth month" do
70
+ let(:current_date) { Date.new(2022, 7, 1) }
71
+ it { expect(age_group).to eq :group_above_65_to_70_years }
72
+ end
73
+ end
74
+
63
75
  end
64
-
76
+
65
77
  end
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age55To60ContributionC
50
50
 
51
51
  context "when the total wages amounts to 5,000.00" do
52
52
  let(:ordinary_wages) { 5_000.00 }
53
- it { expect(result).to equal_cpf total: 1_300.00, employee: 650.00, employer: 600.00 }
53
+ it { expect(result).to equal_cpf total: 1_300.00, employee: 650.00, employer: 650.00 }
54
54
  end
55
55
 
56
56
  context "when the total wages amounts to 10,000.00" do
@@ -40,12 +40,12 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3::Age60To65ContributionC
40
40
 
41
41
  context "when the total wages amounts to 749.99" do
42
42
  let(:ordinary_wages) { 749.99 }
43
- it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 64.00 }
43
+ it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 68.00 }
44
44
  end
45
45
 
46
46
  context "when the total wages amounts to 750.00" do
47
47
  let(:ordinary_wages) { 750.00 }
48
- it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 64.00 }
48
+ it { expect(result).to equal_cpf total: 124.00, employee: 56.00, employer: 68.00 }
49
49
  end
50
50
 
51
51
  context "when the total wages amounts to 5,000.00" do
@@ -107,12 +107,12 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
107
107
 
108
108
  context "earned 1k under the AW ceiling cumulative" do
109
109
  let(:cumulative_ordinary) { 98_000 }
110
- it { is_expected.to equal_cpf total: 1480, employee: 400, ow: ordinary_wages, aw: 1000 }
110
+ it { is_expected.to equal_cpf total: 1480, employee: 800, ow: ordinary_wages, aw: 1000 }
111
111
  end
112
112
 
113
113
  context "has earned the wage ceiling" do
114
114
  let(:cumulative_ordinary) { 105_000 }
115
- it { is_expected.to equal_cpf total: 1110, employee: 300, ow: ordinary_wages, aw: 0 }
115
+ it { is_expected.to equal_cpf total: 1110, employee: 600, ow: ordinary_wages, aw: 0 }
116
116
  end
117
117
 
118
118
  describe "using estimated yearly ordinary wages" do
@@ -128,7 +128,7 @@ describe SingaporeCPFCalculator::Year2016::CitizenOrSPR3 do
128
128
 
129
129
  context "estimated yearly earnings at the threshold" do
130
130
  let(:estimated_yearly_ow) { 102_000 }
131
- it { is_expected.to equal_cpf total: 1110, employee: 300, ow: ordinary_wages, aw: 0 }
131
+ it { is_expected.to equal_cpf total: 1110, employee: 600, ow: ordinary_wages, aw: 0 }
132
132
  end
133
133
 
134
134
  context "estimated yearly earnings 1k below threshold" do
@@ -25,7 +25,7 @@ describe SingaporeCPFCalculator::Year2016::SPR1FG::Age55To60ContributionCalculat
25
25
 
26
26
  context "when the total wages amounts to 50.01" do
27
27
  let(:ordinary_wages) { 50.01 }
28
- it { expect(result).to equal_cpf total: 7.00, employee: 0.00, employer: 6.00 }
28
+ it { expect(result).to equal_cpf total: 7.00, employee: 0.00, employer: 7.00 }
29
29
  end
30
30
 
31
31
  context "when the total wages amounts to 500.00" do
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::SPR1FG::Age60To65ContributionCalculat
50
50
 
51
51
  context "when the total wages amounts to 5,000.00" do
52
52
  let(:ordinary_wages) { 5_000.00 }
53
- it { expect(result).to equal_cpf total: 700.00, employee: 250.00, employer: 500.00 }
53
+ it { expect(result).to equal_cpf total: 700.00, employee: 250.00, employer: 450.00 }
54
54
  end
55
55
 
56
56
  context "when the total wages amounts to 10,000.00" do
@@ -50,7 +50,7 @@ describe SingaporeCPFCalculator::Year2016::SPR2FG::Age60To65ContributionCalculat
50
50
 
51
51
  context "when the total wages amounts to 5,000.00" do
52
52
  let(:ordinary_wages) { 5_000.00 }
53
- it { expect(result).to equal_cpf total: 825.00, employee: 375.00, employer: 440.00 }
53
+ it { expect(result).to equal_cpf total: 825.00, employee: 375.00, employer: 450.00 }
54
54
  end
55
55
 
56
56
  context "when the total wages amounts to 10,000.00" do
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::Age55BelowContributionCalculator do
4
+
5
+ subject(:calculator) {
6
+ described_class.new ordinary_wages: ordinary_wages,
7
+ additional_wages: additional_wages
8
+ }
9
+
10
+ let(:result) { calculator.calculate }
11
+
12
+ let(:additional_wages) { 0.0 }
13
+
14
+ describe "#calculate" do
15
+
16
+ context "when the total wages amounts to 0.00" do
17
+ let(:ordinary_wages) { 0.00 }
18
+ it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
19
+ end
20
+
21
+ context "when the total wages amounts to 50.00" do
22
+ let(:ordinary_wages) { 50.00 }
23
+ it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
24
+ end
25
+
26
+ context "when the total wages amounts to 50.01" do
27
+ let(:ordinary_wages) { 50.01 }
28
+ it { expect(result).to equal_cpf total: 9.00, employee: 0.00, employer: 9.00 }
29
+ end
30
+
31
+ context "when the total wages amounts to 500.00" do
32
+ let(:ordinary_wages) { 500.00 }
33
+ it { expect(result).to equal_cpf total: 85.00, employee: 0.00, employer: 85.00 }
34
+ end
35
+
36
+ context "when the total wages amounts to 500.01" do
37
+ let(:ordinary_wages) { 500.01 }
38
+ it { expect(result).to equal_cpf total: 85.00, employee: 0.00, employer: 85.00 }
39
+ end
40
+
41
+ context "when the total wages amounts to 749.99" do
42
+ let(:ordinary_wages) { 749.99 }
43
+ it { expect(result).to equal_cpf total: 277.00, employee: 149.00, employer: 128.00 }
44
+ end
45
+
46
+ context "when the total wages amounts to 750.00" do
47
+ let(:ordinary_wages) { 750.00 }
48
+ it { expect(result).to equal_cpf total: 278.00, employee: 150.00, employer: 128.00 }
49
+ end
50
+
51
+ context "when the total wages amounts to 5,000.00" do
52
+ let(:ordinary_wages) { 5_000.00 }
53
+ it { expect(result).to equal_cpf total: 1_850.00, employee: 1_000.00, employer: 850.00 }
54
+ end
55
+
56
+ context "when the total wages amounts to 10,000.00" do
57
+ let(:ordinary_wages) { 10_000.00 }
58
+ it { expect(result).to equal_cpf total: 2_220.00, employee: 1_200.00, employer: 1_020.00 }
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,63 @@
1
+ require 'spec_helper'
2
+
3
+ describe SingaporeCPFCalculator::Year2022::CitizenOrSPR3::Age55To60ContributionCalculator do
4
+
5
+ subject(:calculator) {
6
+ described_class.new ordinary_wages: ordinary_wages,
7
+ additional_wages: additional_wages
8
+ }
9
+
10
+ let(:result) { calculator.calculate }
11
+
12
+ let(:additional_wages) { 0.0 }
13
+
14
+ describe "#calculate" do
15
+
16
+ context "when the total wages amounts to 0.00" do
17
+ let(:ordinary_wages) { 0.00 }
18
+ it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
19
+ end
20
+
21
+ context "when the total wages amounts to 50.00" do
22
+ let(:ordinary_wages) { 50.00 }
23
+ it { expect(result).to equal_cpf total: 0.00, employee: 0.00, employer: 0.00 }
24
+ end
25
+
26
+ context "when the total wages amounts to 50.01" do
27
+ let(:ordinary_wages) { 50.01 }
28
+ it { expect(result).to equal_cpf total: 7.00, employee: 0.00, employer: 7.00 }
29
+ end
30
+
31
+ context "when the total wages amounts to 500.00" do
32
+ let(:ordinary_wages) { 500.00 }
33
+ it { expect(result).to equal_cpf total: 70.00, employee: 0.00, employer: 70.00 }
34
+ end
35
+
36
+ context "when the total wages amounts to 500.01" do
37
+ let(:ordinary_wages) { 500.01 }
38
+ it { expect(result).to equal_cpf total: 70.00, employee: 0.00, employer: 70.00 }
39
+ end
40
+
41
+ context "when the total wages amounts to 749.99" do
42
+ let(:ordinary_wages) { 749.99 }
43
+ it { expect(result).to equal_cpf total: 210.00, employee: 104.00, employer: 106.00 }
44
+ end
45
+
46
+ context "when the total wages amounts to 750.00" do
47
+ let(:ordinary_wages) { 750.00 }
48
+ it { expect(result).to equal_cpf total: 210.00, employee: 105.00, employer: 105.00 }
49
+ end
50
+
51
+ context "when the total wages amounts to 5,000.00" do
52
+ let(:ordinary_wages) { 5_000.00 }
53
+ it { expect(result).to equal_cpf total: 1_400.00, employee: 700.00, employer: 700.00 }
54
+ end
55
+
56
+ context "when the total wages amounts to 10,000.00" do
57
+ let(:ordinary_wages) { 10_000.00 }
58
+ it { expect(result).to equal_cpf total: 1_680.00, employee: 840.00, employer: 840.00 }
59
+ end
60
+
61
+ end
62
+
63
+ end