@casomoltd/nhs-pay 0.29.0 → 0.31.0
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.
- package/README.md +78 -249
- package/dist/bands.d.ts +9 -1
- package/dist/bands.js +20 -0
- package/dist/bands.js.map +1 -1
- package/dist/dates.d.ts +3 -0
- package/dist/dates.js +7 -2
- package/dist/dates.js.map +1 -1
- package/dist/document-source.d.ts +16 -0
- package/dist/document-source.js +3 -1
- package/dist/document-source.js.map +1 -1
- package/dist/errors.d.ts +46 -11
- package/dist/errors.js +68 -28
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +14 -0
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +13 -11
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/member/benefits.js +41 -39
- package/dist/member/benefits.js.map +1 -1
- package/dist/member/index.d.ts +1 -1
- package/dist/member/input-period.d.ts +41 -0
- package/dist/member/input-period.js +168 -0
- package/dist/member/input-period.js.map +1 -0
- package/dist/member/service.d.ts +8 -1
- package/dist/member/service.js +18 -1
- package/dist/member/service.js.map +1 -1
- package/dist/member/types.d.ts +101 -44
- package/dist/member/types.js.map +1 -1
- package/dist/member/valuation.d.ts +72 -14
- package/dist/member/valuation.js +115 -34
- package/dist/member/valuation.js.map +1 -1
- package/dist/pay-path.d.ts +21 -25
- package/dist/pay-path.js +85 -67
- package/dist/pay-path.js.map +1 -1
- package/dist/pension/ages.d.ts +6 -4
- package/dist/pension/ages.js +6 -4
- package/dist/pension/ages.js.map +1 -1
- package/dist/pension/curve.d.ts +2 -1
- package/dist/pension/curve.js +15 -7
- package/dist/pension/curve.js.map +1 -1
- package/dist/pension/history.d.ts +18 -3
- package/dist/pension/history.js +12 -5
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +15 -9
- package/dist/pension/ledger.js +91 -56
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/prices.d.ts +11 -2
- package/dist/pension/prices.js +35 -14
- package/dist/pension/prices.js.map +1 -1
- package/dist/pension/scheme-year.d.ts +59 -0
- package/dist/pension/scheme-year.js +80 -0
- package/dist/pension/scheme-year.js.map +1 -0
- package/dist/pension/seed.d.ts +66 -50
- package/dist/pension/seed.js +111 -65
- package/dist/pension/seed.js.map +1 -1
- package/dist/pension/uplift.d.ts +13 -33
- package/dist/pension/uplift.js +11 -56
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.js +30 -22
- package/dist/pension-projection.js.map +1 -1
- package/dist/post.d.ts +1 -10
- package/dist/post.js +1 -12
- package/dist/post.js.map +1 -1
- package/dist/revaluation.d.ts +34 -35
- package/dist/revaluation.js +41 -41
- package/dist/revaluation.js.map +1 -1
- package/dist/scale-point.d.ts +6 -0
- package/dist/sections/final-salary.d.ts +64 -52
- package/dist/sections/final-salary.js +131 -69
- package/dist/sections/final-salary.js.map +1 -1
- package/dist/sections/section-2015.d.ts +2 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +10 -0
- package/dist/sources.js +20 -0
- package/dist/sources.js.map +1 -1
- package/dist/take-home.d.ts +4 -20
- package/dist/take-home.js +3 -23
- package/dist/take-home.js.map +1 -1
- package/package.json +3 -3
package/dist/errors.d.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* the library does not publish ({@link ScaleUnavailable} and
|
|
5
5
|
* siblings — never silently substitute another year's or nation's
|
|
6
6
|
* figures), a member it cannot build pay for
|
|
7
|
-
* ({@link PayPathUnavailable}),
|
|
7
|
+
* ({@link PayPathUnavailable}), service it does not model
|
|
8
8
|
* ({@link BenefitNotModelled}, keyed by a {@link NOT_MODELLED}
|
|
9
|
-
* code)
|
|
9
|
+
* code), and a read before a member's statement, where no balance
|
|
10
|
+
* exists ({@link BeforeStatement}).
|
|
10
11
|
* - RangeError, thrown where a caller's input cannot be true.
|
|
11
12
|
* - {@link invariant} — an internal consistency guard. Its failure
|
|
12
13
|
* is a library bug, not an input problem, so no caller catches it;
|
|
@@ -19,15 +20,6 @@ interface YearsMonths {
|
|
|
19
20
|
readonly years: number;
|
|
20
21
|
readonly months: number;
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Assert a domain invariant that must ALWAYS hold. Throws a bare
|
|
24
|
-
* Error when `condition` is false. Unlike the absent-data errors
|
|
25
|
-
* below — which callers catch by type — an invariant failure signals
|
|
26
|
-
* an internal inconsistency (a regression), so it is deliberately a
|
|
27
|
-
* plain, uncatchable-by-type throw: better a loud stop in a test or
|
|
28
|
-
* page than a silently wrong figure.
|
|
29
|
-
*/
|
|
30
|
-
export declare function invariant(condition: unknown, message: string): asserts condition;
|
|
31
23
|
/**
|
|
32
24
|
* Thrown when no pay scale is published for a
|
|
33
25
|
* (nation, year), optionally narrowed to a grade and a
|
|
@@ -158,6 +150,40 @@ export declare class BenefitNotModelled extends Error {
|
|
|
158
150
|
readonly code: NotModelled;
|
|
159
151
|
constructor(code: NotModelled, detail: string);
|
|
160
152
|
}
|
|
153
|
+
/** What a {@link BeforeStatement} refused, as a closed set a consumer can
|
|
154
|
+
* branch on. */
|
|
155
|
+
export declare const STATEMENT_READS: {
|
|
156
|
+
/** A leaving, which a walk would never reach. */
|
|
157
|
+
readonly leaving: "leaving";
|
|
158
|
+
/** The balance held on a date. */
|
|
159
|
+
readonly balance: "balance";
|
|
160
|
+
/** The close of a scheme year. */
|
|
161
|
+
readonly yearClose: "year-close";
|
|
162
|
+
};
|
|
163
|
+
export type StatementRead = (typeof STATEMENT_READS)[keyof typeof STATEMENT_READS];
|
|
164
|
+
/**
|
|
165
|
+
* A read of a member's 2015 Section balance on a date before their
|
|
166
|
+
* statement's 31 March, or a leaving before it. Not a build to come: a
|
|
167
|
+
* statement gives a balance at its 31 March and nothing of the dates
|
|
168
|
+
* before it, so there is no figure to give, and answering with the
|
|
169
|
+
* statement's own balance would state one nobody holds. Data absence,
|
|
170
|
+
* like {@link ScaleUnavailable}.
|
|
171
|
+
*/
|
|
172
|
+
export declare class BeforeStatement extends Error {
|
|
173
|
+
/** What was refused. */
|
|
174
|
+
readonly read: StatementRead;
|
|
175
|
+
/** The date it was asked on. */
|
|
176
|
+
readonly on: Date;
|
|
177
|
+
/** The statement's 31 March. */
|
|
178
|
+
readonly statementDate: Date;
|
|
179
|
+
constructor(
|
|
180
|
+
/** What was refused. */
|
|
181
|
+
read: StatementRead,
|
|
182
|
+
/** The date it was asked on. */
|
|
183
|
+
on: Date,
|
|
184
|
+
/** The statement's 31 March. */
|
|
185
|
+
statementDate: Date);
|
|
186
|
+
}
|
|
161
187
|
/** Why an additional pension purchase is refused, as a closed set a
|
|
162
188
|
* consumer can branch on. */
|
|
163
189
|
export declare const ADDITIONAL_PENSION_REFUSALS: {
|
|
@@ -184,4 +210,13 @@ export declare class AdditionalPensionUnavailable extends Error {
|
|
|
184
210
|
readonly code: AdditionalPensionRefusal;
|
|
185
211
|
constructor(code: AdditionalPensionRefusal, detail: string);
|
|
186
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Assert a domain invariant that must ALWAYS hold. Throws a bare
|
|
215
|
+
* Error when `condition` is false. Unlike the absent-data errors
|
|
216
|
+
* above — which callers catch by type — an invariant failure signals
|
|
217
|
+
* an internal inconsistency (a regression), so it is deliberately a
|
|
218
|
+
* plain, uncatchable-by-type throw: better a loud stop in a test or
|
|
219
|
+
* page than a silently wrong figure.
|
|
220
|
+
*/
|
|
221
|
+
export declare function invariant(condition: unknown, message: string): asserts condition;
|
|
187
222
|
export {};
|
package/dist/errors.js
CHANGED
|
@@ -4,27 +4,15 @@
|
|
|
4
4
|
* the library does not publish ({@link ScaleUnavailable} and
|
|
5
5
|
* siblings — never silently substitute another year's or nation's
|
|
6
6
|
* figures), a member it cannot build pay for
|
|
7
|
-
* ({@link PayPathUnavailable}),
|
|
7
|
+
* ({@link PayPathUnavailable}), service it does not model
|
|
8
8
|
* ({@link BenefitNotModelled}, keyed by a {@link NOT_MODELLED}
|
|
9
|
-
* code)
|
|
9
|
+
* code), and a read before a member's statement, where no balance
|
|
10
|
+
* exists ({@link BeforeStatement}).
|
|
10
11
|
* - RangeError, thrown where a caller's input cannot be true.
|
|
11
12
|
* - {@link invariant} — an internal consistency guard. Its failure
|
|
12
13
|
* is a library bug, not an input problem, so no caller catches it;
|
|
13
14
|
* it throws a bare Error to fail loud in tests and pages.
|
|
14
15
|
*/
|
|
15
|
-
/**
|
|
16
|
-
* Assert a domain invariant that must ALWAYS hold. Throws a bare
|
|
17
|
-
* Error when `condition` is false. Unlike the absent-data errors
|
|
18
|
-
* below — which callers catch by type — an invariant failure signals
|
|
19
|
-
* an internal inconsistency (a regression), so it is deliberately a
|
|
20
|
-
* plain, uncatchable-by-type throw: better a loud stop in a test or
|
|
21
|
-
* page than a silently wrong figure.
|
|
22
|
-
*/
|
|
23
|
-
export function invariant(condition, message) {
|
|
24
|
-
if (!condition) {
|
|
25
|
-
throw new Error(message);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
16
|
/**
|
|
29
17
|
* Thrown when no pay scale is published for a
|
|
30
18
|
* (nation, year), optionally narrowed to a grade and a
|
|
@@ -128,17 +116,6 @@ export class AwardUnavailable extends Error {
|
|
|
128
116
|
this.name = 'AwardUnavailable';
|
|
129
117
|
}
|
|
130
118
|
}
|
|
131
|
-
function scaleMessage(nation, year, gradeId, pointLabel) {
|
|
132
|
-
if (pointLabel !== undefined) {
|
|
133
|
-
return `No scale point "${pointLabel}" for `
|
|
134
|
-
+ `${gradeId} in ${nation} ${year}`;
|
|
135
|
-
}
|
|
136
|
-
if (gradeId !== undefined) {
|
|
137
|
-
return `No published scale for ${gradeId} in `
|
|
138
|
-
+ `${nation} ${year}`;
|
|
139
|
-
}
|
|
140
|
-
return `No published pay scale for ${nation} ${year}`;
|
|
141
|
-
}
|
|
142
119
|
/**
|
|
143
120
|
* A pay-point label matched more than one point on a scale.
|
|
144
121
|
*
|
|
@@ -155,8 +132,8 @@ export class AmbiguousScalePoint extends Error {
|
|
|
155
132
|
matches;
|
|
156
133
|
constructor(grade, pointLabel, matches) {
|
|
157
134
|
super(`Pay point "${pointLabel}" matches ${matches} points on `
|
|
158
|
-
+ `${grade} — it does not identify one
|
|
159
|
-
+ '
|
|
135
|
+
+ `${grade} — it does not identify one; pass the point itself `
|
|
136
|
+
+ 'where the caller holds it.');
|
|
160
137
|
this.grade = grade;
|
|
161
138
|
this.pointLabel = pointLabel;
|
|
162
139
|
this.matches = matches;
|
|
@@ -210,6 +187,43 @@ export class BenefitNotModelled extends Error {
|
|
|
210
187
|
this.name = 'BenefitNotModelled';
|
|
211
188
|
}
|
|
212
189
|
}
|
|
190
|
+
/** What a {@link BeforeStatement} refused, as a closed set a consumer can
|
|
191
|
+
* branch on. */
|
|
192
|
+
export const STATEMENT_READS = {
|
|
193
|
+
/** A leaving, which a walk would never reach. */
|
|
194
|
+
leaving: 'leaving',
|
|
195
|
+
/** The balance held on a date. */
|
|
196
|
+
balance: 'balance',
|
|
197
|
+
/** The close of a scheme year. */
|
|
198
|
+
yearClose: 'year-close',
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* A read of a member's 2015 Section balance on a date before their
|
|
202
|
+
* statement's 31 March, or a leaving before it. Not a build to come: a
|
|
203
|
+
* statement gives a balance at its 31 March and nothing of the dates
|
|
204
|
+
* before it, so there is no figure to give, and answering with the
|
|
205
|
+
* statement's own balance would state one nobody holds. Data absence,
|
|
206
|
+
* like {@link ScaleUnavailable}.
|
|
207
|
+
*/
|
|
208
|
+
export class BeforeStatement extends Error {
|
|
209
|
+
read;
|
|
210
|
+
on;
|
|
211
|
+
statementDate;
|
|
212
|
+
constructor(
|
|
213
|
+
/** What was refused. */
|
|
214
|
+
read,
|
|
215
|
+
/** The date it was asked on. */
|
|
216
|
+
on,
|
|
217
|
+
/** The statement's 31 March. */
|
|
218
|
+
statementDate) {
|
|
219
|
+
super(`A ${read} on ${on.toDateString()}, before the statement's `
|
|
220
|
+
+ `balance at ${statementDate.toDateString()}`);
|
|
221
|
+
this.read = read;
|
|
222
|
+
this.on = on;
|
|
223
|
+
this.statementDate = statementDate;
|
|
224
|
+
this.name = 'BeforeStatement';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
213
227
|
/** Why an additional pension purchase is refused, as a closed set a
|
|
214
228
|
* consumer can branch on. */
|
|
215
229
|
export const ADDITIONAL_PENSION_REFUSALS = {
|
|
@@ -239,4 +253,30 @@ export class AdditionalPensionUnavailable extends Error {
|
|
|
239
253
|
this.name = 'AdditionalPensionUnavailable';
|
|
240
254
|
}
|
|
241
255
|
}
|
|
256
|
+
/**
|
|
257
|
+
* Assert a domain invariant that must ALWAYS hold. Throws a bare
|
|
258
|
+
* Error when `condition` is false. Unlike the absent-data errors
|
|
259
|
+
* above — which callers catch by type — an invariant failure signals
|
|
260
|
+
* an internal inconsistency (a regression), so it is deliberately a
|
|
261
|
+
* plain, uncatchable-by-type throw: better a loud stop in a test or
|
|
262
|
+
* page than a silently wrong figure.
|
|
263
|
+
*/
|
|
264
|
+
export function invariant(condition, message) {
|
|
265
|
+
if (!condition) {
|
|
266
|
+
throw new Error(message);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/** The message a missing scale, grade or point gives, most specific
|
|
270
|
+
* first. */
|
|
271
|
+
function scaleMessage(nation, year, gradeId, pointLabel) {
|
|
272
|
+
if (pointLabel !== undefined) {
|
|
273
|
+
return `No scale point "${pointLabel}" for `
|
|
274
|
+
+ `${gradeId} in ${nation} ${year}`;
|
|
275
|
+
}
|
|
276
|
+
if (gradeId !== undefined) {
|
|
277
|
+
return `No published scale for ${gradeId} in `
|
|
278
|
+
+ `${nation} ${year}`;
|
|
279
|
+
}
|
|
280
|
+
return `No published pay scale for ${nation} ${year}`;
|
|
281
|
+
}
|
|
242
282
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],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C7B,OAAO,mBAAmB,UAAU,QAAQ;cACxC,GAAG,OAAO,OAAO,MAAM,IAAI,IAAI,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,0BAA0B,OAAO,MAAM;cAC1C,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,8BAA8B,MAAM,IAAI,IAAI,EAAE,CAAC;AACxD,CAAC"}
|
package/dist/factor-basis.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LEGACY_PENSION_AGES } from './pension/ages.js';
|
|
2
2
|
import { FactorTable } from './gad/factor-table.js';
|
|
3
|
+
import type { ProjectionMoney } from './pension/money.js';
|
|
3
4
|
import type { FactorProvenance, FactorTableKind } from './gad/factor-table.js';
|
|
4
5
|
/**
|
|
5
6
|
* The factor tables the library reads, named for what each is for. The
|
|
@@ -122,6 +123,19 @@ export type FactorOutcome = {
|
|
|
122
123
|
readonly source: typeof FACTOR_SOURCES.noLateUplift;
|
|
123
124
|
readonly factor: 1;
|
|
124
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* A figure before and after its early or late factor, and the factor.
|
|
128
|
+
* Read the figure before it from `beforeFactor`, never by dividing `after`
|
|
129
|
+
* by `factor`: a pension and its lump sum each have their own factor.
|
|
130
|
+
* `F` is `FactorOutcome | null` where the rules may apply no factor
|
|
131
|
+
* because they pay nothing.
|
|
132
|
+
*/
|
|
133
|
+
export interface Factored<F extends FactorOutcome | null = FactorOutcome> {
|
|
134
|
+
readonly beforeFactor: ProjectionMoney;
|
|
135
|
+
/** After the factor: what is paid. */
|
|
136
|
+
readonly after: ProjectionMoney;
|
|
137
|
+
readonly factor: F;
|
|
138
|
+
}
|
|
125
139
|
/**
|
|
126
140
|
* Read the factor for a drawing. The date decides the direction as well
|
|
127
141
|
* as the cell, so a basis whose direction the dates contradict is a bug
|
package/dist/factor-basis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factor-basis.js","sourceRoot":"","sources":["../src/factor-basis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAC,mBAAmB,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"factor-basis.js","sourceRoot":"","sources":["../src/factor-basis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAC,mBAAmB,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAQlD,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B;2CACuC;IACvC,SAAS,EAAE,OAAO;IAClB;iCAC6B;IAC7B,QAAQ,EAAE,OAAO;IACjB;sCACkC;IAClC,yBAAyB,EAAE,OAAO;IAClC,6CAA6C;IAC7C,gBAAgB,EAAE,OAAO;IACzB,w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AAC;IACnC,OAAO;QACL,MAAM,EAAE,cAAc,CAAC,KAAK;QAC5B,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC;QAC/B,SAAS,EAAE,KAAK,CAAC,IAAI;QACrB,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { afcBand1 } from './afc-scales.js';
|
|
|
2
2
|
export type { AfcBand1, AfcBand1Published } from './afc-scales.js';
|
|
3
3
|
export { AFC_BANDS, AFC_BAND_IDS, afcScaleSource, latestAfcYear, payYearLag, isAwaitingPayAward, assertPayYearLagIsSane, afcPayYears, NLW_HOURLY, WALES_LIVING_WAGE, annualiseHourly, } from './scales.js';
|
|
4
4
|
export type { AfcBandId, HcasZone, HcasZones, WalesLivingWage, } from './scales.js';
|
|
5
|
-
export type { ScalePoint } from './scale-point.js';
|
|
5
|
+
export type { PayLadder, ScalePoint } from './scale-point.js';
|
|
6
6
|
export { PensionTiers, getEmployerPensionRate, getPensionScheme, getPensionTiers, getPensionTiersVO, lookupPensionTier, pensionTierRate, } from './pension.js';
|
|
7
7
|
export type { EmployerPensionRate, NhsPensionScheme, PensionTier, } from './pension.js';
|
|
8
8
|
export type { SalaryRange } from './values.js';
|
|
@@ -19,13 +19,13 @@ export { ADDITIONAL_PENSION_LIMIT, ADDITIONAL_PENSION_PAYMENTS, ADDITIONAL_PENSI
|
|
|
19
19
|
export type { AdditionalPensionPayment, AdditionalPensionPurchase, } from './additional-pension.js';
|
|
20
20
|
export { ADDITIONAL_PENSION_COVERS } from './gad/additional-pension-table.js';
|
|
21
21
|
export type { AdditionalPensionCover, AdditionalPensionProvenance, } from './gad/additional-pension-table.js';
|
|
22
|
-
export { ADDITIONAL_PENSION_REFUSALS, AdditionalPensionUnavailable, AmbiguousScalePoint, AwardUnavailable, BenefitNotModelled, NOT_MODELLED, PayPathUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, } from './errors.js';
|
|
23
|
-
export type { AdditionalPensionRefusal, NotModelled } from './errors.js';
|
|
22
|
+
export { ADDITIONAL_PENSION_REFUSALS, AdditionalPensionUnavailable, AmbiguousScalePoint, AwardUnavailable, BeforeStatement, BenefitNotModelled, NOT_MODELLED, PayPathUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, STATEMENT_READS, } from './errors.js';
|
|
23
|
+
export type { AdditionalPensionRefusal, NotModelled, StatementRead, } from './errors.js';
|
|
24
24
|
export { DocumentSource } from './document-source.js';
|
|
25
25
|
export { isoDate, isoMonth, monthOf, firstOfMonth, monthToDate, isoToDate, isoDateOf, } from './iso-date.js';
|
|
26
26
|
export type { IsoDate, IsoMonth } from './iso-date.js';
|
|
27
|
-
export type { DocumentSourceFields, SourceCurrency, } from './document-source.js';
|
|
28
|
-
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
27
|
+
export type { DocumentSourceFields, PageSource, SourceCurrency, } from './document-source.js';
|
|
28
|
+
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, NHSBSA_ESTIMATE_GUIDE, NHSBSA_STATEMENT_GUIDE, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
29
29
|
export { AWARD_FAMILIES, afcAward, anyNationSettled, awardFamilyFor, awardsFor, changesFor, } from './award.js';
|
|
30
30
|
export type { AwardFamily, ForthcomingChange, PayAward, PayChange, PayScaleId, } from './award.js';
|
|
31
31
|
export { payRound } from './pay-round.js';
|
|
@@ -39,10 +39,10 @@ export type { PayBasis, PayPath, YearPay } from './pay-path.js';
|
|
|
39
39
|
export { ACCRUALS, memberBenefits, PAST_YEARS, PERIOD_KINDS, REMEDY, REMEDY_BASES, SECTION_OPENED, SECTIONS, } from './member/index.js';
|
|
40
40
|
export { PAY_MEASURES } from './sections/final-salary.js';
|
|
41
41
|
export type { PayMeasure } from './sections/final-salary.js';
|
|
42
|
-
export type { Assumptions, Award, DeclaredPeriod, Holdings, LegacyRules, LegacySectionId, Member, MemberBenefits, PastYears, Position, RemedyBasis, RemedyElection, RetirementChoices, SectionId, ServicePeriod, } from './member/index.js';
|
|
42
|
+
export type { Assumptions, Award, DeclaredPeriod, Holdings, LegacyRules, LegacySectionId, Member, MemberBenefits, PastYears, Position, RemedyBasis, RemedyElection, RetirementChoices, RulerLedgers, Section2015Walk, SectionId, ServicePeriod, StatementBalance, } from './member/index.js';
|
|
43
43
|
export type { DeclaredPay, MemberPay } from './pay-path.js';
|
|
44
44
|
export { FACTOR_APPLIES, FACTOR_SOURCES } from './factor-basis.js';
|
|
45
|
-
export type { Applies2015, FactorOutcome } from './factor-basis.js';
|
|
45
|
+
export type { Applies2015, Factored, FactorOutcome } from './factor-basis.js';
|
|
46
46
|
export { factor2015 } from './sections/section-2015.js';
|
|
47
47
|
export { CASH_CHOICES } from './commutation.js';
|
|
48
48
|
export type { CashChoice } from './commutation.js';
|
|
@@ -59,8 +59,10 @@ export { createPrices, createPublishedPrices, inflationFactor, TODAYS_MONEY_CPI,
|
|
|
59
59
|
export type { CpiEntry, CpiSource, Prices, } from './pension/prices.js';
|
|
60
60
|
export { activeRatePct, deferredRatePct, upliftsFor, } from './pension/uplift.js';
|
|
61
61
|
export type { AppliedUplift, MemberPhase, UpliftSource, } from './pension/uplift.js';
|
|
62
|
-
export { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate,
|
|
63
|
-
export type {
|
|
62
|
+
export { isSchemeYearEnd, schemeYearAfter, schemeYearBefore, schemeYearClosedBy, schemeYearEnd, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, } from './pension/scheme-year.js';
|
|
63
|
+
export type { SchemeYearEnd } from './pension/scheme-year.js';
|
|
64
|
+
export { SEED_BASES, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
|
|
65
|
+
export type { LedgerSeed, SeedBasis } from './pension/seed.js';
|
|
64
66
|
export { buildLedger } from './pension/ledger.js';
|
|
65
67
|
export type { AppliedDrawing, AppliedLeaverAdjustment, LedgerRequest, LedgerYear, MemberLedger, } from './pension/ledger.js';
|
|
66
68
|
export type { EstimatedHistory } from './pension/history.js';
|
|
@@ -70,9 +72,9 @@ export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
|
|
|
70
72
|
export type { HcasPct } from './hcas-pcts.js';
|
|
71
73
|
export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
|
|
72
74
|
export type { AfcRegionId, ResolvedRegion, } from './regions.js';
|
|
73
|
-
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
|
|
75
|
+
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, afcPointOf, getAfcScales, } from './bands.js';
|
|
74
76
|
export type { AfcBandMeta, AfcScaleData, } from './bands.js';
|
|
75
|
-
export {
|
|
77
|
+
export { nhsTakeHome } from './take-home.js';
|
|
76
78
|
export { afcWeekInForce, afcWeeklyHours, hoursPerYear } from './working-week.js';
|
|
77
79
|
export type { NhsTakeHomeOptions } from './take-home.js';
|
|
78
80
|
export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, formatPctPrecise, yearLabel, } from './format.js';
|
package/dist/index.js
CHANGED
|
@@ -13,14 +13,14 @@ export { DENTAL_GRADES, DENTAL_GRADE_IDS, DENTAL_PAY_YEARS, getDentalScales, } f
|
|
|
13
13
|
export { ADDITIONAL_PENSION_LIMIT, ADDITIONAL_PENSION_PAYMENTS, ADDITIONAL_PENSION_UNIT, additionalPensionCost, additionalPensionToBuy, } from './additional-pension.js';
|
|
14
14
|
export { ADDITIONAL_PENSION_COVERS } from './gad/additional-pension-table.js';
|
|
15
15
|
// ── Errors ───────────────────────────────────────
|
|
16
|
-
export { ADDITIONAL_PENSION_REFUSALS, AdditionalPensionUnavailable, AmbiguousScalePoint, AwardUnavailable, BenefitNotModelled, NOT_MODELLED, PayPathUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, } from './errors.js';
|
|
16
|
+
export { ADDITIONAL_PENSION_REFUSALS, AdditionalPensionUnavailable, AmbiguousScalePoint, AwardUnavailable, BeforeStatement, BenefitNotModelled, NOT_MODELLED, PayPathUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, STATEMENT_READS, } from './errors.js';
|
|
17
17
|
// ── Cited documents ──────────────────────────────
|
|
18
18
|
// Every published document the library reads a figure from. A consumer
|
|
19
19
|
// citing "where these figures come from" reads the record rather than
|
|
20
20
|
// keeping its own copy of the url.
|
|
21
21
|
export { DocumentSource } from './document-source.js';
|
|
22
22
|
export { isoDate, isoMonth, monthOf, firstOfMonth, monthToDate, isoToDate, isoDateOf, } from './iso-date.js';
|
|
23
|
-
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
23
|
+
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, NHSBSA_ESTIMATE_GUIDE, NHSBSA_STATEMENT_GUIDE, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
24
24
|
// ── Pay awards ───────────────────────────────────
|
|
25
25
|
export { AWARD_FAMILIES, afcAward, anyNationSettled, awardFamilyFor, awardsFor, changesFor, } from './award.js';
|
|
26
26
|
// ── Pay rounds ───────────────────────────────────
|
|
@@ -63,7 +63,8 @@ export { firstJoinedOf, LEGACY_PENSION_AGES, mayDrawOn, memberMinimumPensionAge,
|
|
|
63
63
|
// A consumer reads the ledger only when it wants the workings.
|
|
64
64
|
export { createPrices, createPublishedPrices, inflationFactor, TODAYS_MONEY_CPI, } from './pension/prices.js';
|
|
65
65
|
export { activeRatePct, deferredRatePct, upliftsFor, } from './pension/uplift.js';
|
|
66
|
-
export { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate,
|
|
66
|
+
export { isSchemeYearEnd, schemeYearAfter, schemeYearBefore, schemeYearClosedBy, schemeYearEnd, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, } from './pension/scheme-year.js';
|
|
67
|
+
export { SEED_BASES, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
|
|
67
68
|
export { buildLedger } from './pension/ledger.js';
|
|
68
69
|
// ── HCAS ─────────────────────────────────────────
|
|
69
70
|
export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } from './hcas.js';
|
|
@@ -72,9 +73,9 @@ export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
|
|
|
72
73
|
// ── Regions ──────────────────────────────────────
|
|
73
74
|
export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
|
|
74
75
|
// ── Bands ────────────────────────────────────────
|
|
75
|
-
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
|
|
76
|
+
export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, afcPointOf, getAfcScales, } from './bands.js';
|
|
76
77
|
// ── Take-home ────────────────────────────────────
|
|
77
|
-
export {
|
|
78
|
+
export { nhsTakeHome } from './take-home.js';
|
|
78
79
|
// ── Working week ──────────────────────────────
|
|
79
80
|
export { afcWeekInForce, afcWeeklyHours, hoursPerYear } from './working-week.js';
|
|
80
81
|
// ── Format ───────────────────────────────────────
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AASrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAUtB,oDAAoD;AACpD,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAU/C,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAS3E,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAK5B,oDAAoD;AACpD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAK5E,oDAAoD;AACpD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AASrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM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AAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,iDAAiD;AACjD,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/E,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC"}
|
package/dist/member/benefits.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A member's benefits across every section they hold: built once from
|
|
3
3
|
* what the member told us, then asked one question per set of
|
|
4
|
-
* retirement choices.
|
|
4
|
+
* retirement choices, and one per tax year for what it put in.
|
|
5
5
|
*
|
|
6
6
|
* Everything ABOUT the member goes in once, when the owner is built;
|
|
7
7
|
* each method takes only the question. So a caller never assembles the
|
|
@@ -18,22 +18,27 @@
|
|
|
18
18
|
* across that one total.
|
|
19
19
|
*
|
|
20
20
|
* Its parts sit beside it: the vocabulary in `types.ts`, the service
|
|
21
|
-
* check and the remedy's dates in `service.ts`,
|
|
22
|
-
* in `valuation.ts
|
|
21
|
+
* check and the remedy's dates in `service.ts`, each section's award
|
|
22
|
+
* in `valuation.ts`, and a tax year's pension input per arrangement in
|
|
23
|
+
* `input-period.ts`. This module owns the member; `index.ts` is the door
|
|
23
24
|
* a caller comes through.
|
|
24
25
|
*/
|
|
25
26
|
import { cashAt, nhsCommutationLimits } from '../commutation.js';
|
|
26
|
-
import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
|
|
27
|
+
import { BenefitNotModelled, invariant, NOT_MODELLED } from '../errors.js';
|
|
27
28
|
import { isoToDate } from '../iso-date.js';
|
|
28
29
|
import { drawingTest, firstJoinedOf, mayDrawOn, memberMinimumPensionAge, normalPensionAge, } from '../pension/ages.js';
|
|
29
30
|
import { buildPayPath } from '../pay-path.js';
|
|
30
31
|
import { npaDate } from '../dates.js';
|
|
31
32
|
import { sumMoney } from '../pension/money.js';
|
|
32
33
|
import { createPrices, createPublishedPrices, TODAYS_MONEY_CPI, } from '../pension/prices.js';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
34
|
+
import { schemeYearEndDate } from '../pension/scheme-year.js';
|
|
35
|
+
import { answersFrom } from '../pension/seed.js';
|
|
36
|
+
import { electionsFor, periodsOf, refuseElectionMismatch, REMEDY, servicePeriods, } from './service.js';
|
|
37
|
+
import { careerAward, finalSalaryValued, holdings, legacyAward, refuseLeavingAfterDeclared, RULES, section2015, seed2015, walksWindow, windowSeed, } from './valuation.js';
|
|
38
|
+
import { inputPeriods } from './input-period.js';
|
|
39
|
+
import { PAST_YEARS, SECTIONS } from './types.js';
|
|
40
|
+
/** The call every refusal of `at()`'s choices names. */
|
|
41
|
+
const ASKED = 'at';
|
|
37
42
|
/** The price series each reading of the past is priced on. Total over
|
|
38
43
|
* `PastYears`, so a new reading fails the build until it has one. */
|
|
39
44
|
const CASH_SERIES = {
|
|
@@ -58,6 +63,7 @@ export function memberBenefits(member, assumptions, today) {
|
|
|
58
63
|
const history = {
|
|
59
64
|
born: member.dateOfBirth, firstJoined: firstJoinedOf(member),
|
|
60
65
|
};
|
|
66
|
+
const cashSeriesAt = (cpi) => CASH_SERIES[assumptions.pastYears](cpi, today);
|
|
61
67
|
const built = {
|
|
62
68
|
member,
|
|
63
69
|
history,
|
|
@@ -66,61 +72,64 @@ export function memberBenefits(member, assumptions, today) {
|
|
|
66
72
|
npaOn: npaDate(born, normalPensionAge(born)),
|
|
67
73
|
payPath: buildPayPath(member.dateOfBirth, member.pay),
|
|
68
74
|
legacy,
|
|
75
|
+
remedy,
|
|
69
76
|
ordinary2015,
|
|
70
|
-
cashPrices:
|
|
77
|
+
cashPrices: cashSeriesAt(assumptions.assumedCpi),
|
|
71
78
|
todaysPrices: createPrices(TODAYS_MONEY_CPI, today),
|
|
72
79
|
};
|
|
73
80
|
return {
|
|
74
81
|
periods: periodsOf(held),
|
|
75
82
|
remedy,
|
|
83
|
+
elections: electionsFor(remedy),
|
|
76
84
|
legacy: legacy === null ? null : legacyOf(legacy.section),
|
|
77
85
|
payPath: built.payPath,
|
|
86
|
+
statementAnswersFrom: answersFrom(seed2015(built)),
|
|
78
87
|
minimumPensionAgeOn: (drawing) => memberMinimumPensionAge(history, drawing),
|
|
79
88
|
mayDrawOn: (drawing) => mayDrawOn(history, drawing),
|
|
80
89
|
now: () => holdings(built),
|
|
81
|
-
at: (choices) => position(built,
|
|
90
|
+
at: (choices) => position(built, choices),
|
|
91
|
+
pensionInputPeriod: inputPeriods(built, cashSeriesAt),
|
|
82
92
|
};
|
|
83
93
|
}
|
|
84
94
|
/** Every section's award at one set of choices, summed, with cash taken
|
|
85
95
|
* across the total. */
|
|
86
|
-
function position(b,
|
|
87
|
-
const dates = checked(b,
|
|
96
|
+
function position(b, choices) {
|
|
97
|
+
const dates = checked(b, choices);
|
|
88
98
|
const awards = b.legacy === null
|
|
89
99
|
? []
|
|
90
100
|
: legacyAwards(b, b.legacy, choices, dates);
|
|
91
101
|
const own = careerAward(b, {
|
|
92
102
|
section: SECTIONS.s2015,
|
|
93
103
|
window: b.ordinary2015,
|
|
94
|
-
|
|
104
|
+
seed: seed2015(b),
|
|
95
105
|
}, dates);
|
|
96
106
|
awards.push(own.award);
|
|
97
|
-
const pension = sumMoney(awards.map((a) => a.pension), dates.drawing);
|
|
98
|
-
const automaticLumpSum = sumMoney(awards.map((a) => a.automaticLumpSum), dates.drawing);
|
|
107
|
+
const pension = sumMoney(awards.map((a) => a.pension.after), dates.drawing);
|
|
108
|
+
const automaticLumpSum = sumMoney(awards.map((a) => a.automaticLumpSum.after), dates.drawing);
|
|
99
109
|
return {
|
|
100
110
|
choices,
|
|
101
111
|
awards,
|
|
102
112
|
crystallised: { pension, automaticLumpSum },
|
|
103
113
|
cash: cashAt(pension, automaticLumpSum, choices.cash, nhsCommutationLimits(b.cashPrices)),
|
|
104
114
|
prices: b.cashPrices,
|
|
105
|
-
|
|
115
|
+
section2015: section2015(b, own, dates),
|
|
106
116
|
};
|
|
107
117
|
}
|
|
108
118
|
/** The legacy section's awards: on the legacy basis every legacy period
|
|
109
119
|
* is final salary; on the 2015 basis the remedy window leaves it for a
|
|
110
120
|
* career average walk, paid from the legacy section. */
|
|
111
121
|
function legacyAwards(b, legacy, choices, dates) {
|
|
112
|
-
const {
|
|
122
|
+
const { window } = legacy;
|
|
123
|
+
const basis = choices.remedy.kind;
|
|
124
|
+
const finalSalary = legacyAward(b, finalSalaryValued(legacy, basis), dates);
|
|
125
|
+
if (!walksWindow(basis))
|
|
126
|
+
return [finalSalary];
|
|
113
127
|
// `checked` refused a 2015 basis for a member with no window.
|
|
114
|
-
|
|
115
|
-
if (!onThe2015Basis || window === null) {
|
|
116
|
-
return [legacyAward(b, legacy, legacyPeriodsOf(legacy), dates)];
|
|
117
|
-
}
|
|
128
|
+
invariant(window !== null, 'a 2015 basis with no remedy window valued');
|
|
118
129
|
return [
|
|
119
|
-
|
|
130
|
+
finalSalary,
|
|
120
131
|
careerAward(b, {
|
|
121
|
-
section: legacy.section,
|
|
122
|
-
window,
|
|
123
|
-
seedFor: () => seedFromJoinDate(isoToDate(window.from)),
|
|
132
|
+
section: legacy.section, window, seed: windowSeed(window),
|
|
124
133
|
}, dates).award,
|
|
125
134
|
];
|
|
126
135
|
}
|
|
@@ -129,7 +138,8 @@ function refuseUnmodelled(member, remedy, legacy) {
|
|
|
129
138
|
// Deferred until the split of a pre-rollback balance is read:
|
|
130
139
|
// https://github.com/casomoltd/nhs-pay/issues/20
|
|
131
140
|
if (remedy && member.statement !== null
|
|
132
|
-
&&
|
|
141
|
+
&& schemeYearEndDate(member.statement.yearEnd)
|
|
142
|
+
< isoToDate(REMEDY.rollback)) {
|
|
133
143
|
throw new BenefitNotModelled(NOT_MODELLED.statementBeforeRollback, 'a statement from before rollback on 1 October 2023, which '
|
|
134
144
|
+ 'counts the remedy years in the 2015 Section');
|
|
135
145
|
}
|
|
@@ -152,27 +162,19 @@ function legacyOf(section) {
|
|
|
152
162
|
};
|
|
153
163
|
}
|
|
154
164
|
/** Refuse choices that cannot be valued, and return their dates. */
|
|
155
|
-
function checked(b,
|
|
165
|
+
function checked(b, choices) {
|
|
156
166
|
const leaving = isoToDate(choices.leaving);
|
|
157
167
|
const drawing = isoToDate(choices.drawing);
|
|
158
168
|
if (drawing < leaving) {
|
|
159
|
-
throw new RangeError(
|
|
160
|
-
}
|
|
161
|
-
if (b.ordinary2015.to !== null && isoToDate(b.ordinary2015.to) < leaving) {
|
|
162
|
-
throw new RangeError(`at: leaving after the member already left, on ${b.ordinary2015.to}`);
|
|
163
|
-
}
|
|
164
|
-
const elects = choices.remedy.kind !== REMEDY_BASES.none;
|
|
165
|
-
const electionMismatch = remedy !== elects;
|
|
166
|
-
if (electionMismatch) {
|
|
167
|
-
throw new RangeError(remedy
|
|
168
|
-
? 'at: a remedy member needs an election'
|
|
169
|
-
: 'at: an election for a member with no remediable service');
|
|
169
|
+
throw new RangeError(`${ASKED}: drawn before leaving`);
|
|
170
170
|
}
|
|
171
|
+
refuseLeavingAfterDeclared(ASKED, b, leaving);
|
|
172
|
+
refuseElectionMismatch(ASKED, b.remedy, choices.remedy.kind);
|
|
171
173
|
// The scheme pays nothing before the minimum pension age outside ill
|
|
172
174
|
// health, so a figure there would be one no member could draw.
|
|
173
175
|
const { mayDraw, minimumAge } = drawingTest(b.history, choices.drawing);
|
|
174
176
|
if (!mayDraw) {
|
|
175
|
-
throw new RangeError(
|
|
177
|
+
throw new RangeError(`${ASKED}: drawn before the minimum pension age, ${minimumAge}`);
|
|
176
178
|
}
|
|
177
179
|
return { leaving, drawing };
|
|
178
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"benefits.js","sourceRoot":"","sources":["../../src/member/benefits.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"benefits.js","sourceRoot":"","sources":["../../src/member/benefits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAC,MAAM,EAAE,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAEzE,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,uBAAuB,EAC9D,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,YAAY,EAAE,qBAAqB,EAAE,gBAAgB,GACtD,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,YAAY,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,EAAE,cAAc,GACxE,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EACrD,0BAA0B,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EACrE,UAAU,GACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,UAA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