This repository was archived by the owner on Sep 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathforeignIndirectInterest.js
More file actions
54 lines (49 loc) · 1.48 KB
/
foreignIndirectInterest.js
File metadata and controls
54 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import foreignCoOwnersModel from 'models/shared/foreignCoOwners'
import { namePattern } from 'constants/patterns'
import { DEFAULT_LATEST } from 'constants/dateLimits'
const foreignIndirectInterest = {
InterestTypes: {
presence: true,
array: {
validator: { presence: true },
length: { minimum: 1 },
},
},
InterestType: { presence: true, hasValue: true },
Firstname: {
presence: true,
hasValue: { validator: { format: namePattern } },
},
Lastname: {
presence: true,
hasValue: { validator: { format: namePattern } },
},
Relationship: { presence: true, hasValue: true },
Acquired: { presence: true, date: { latest: DEFAULT_LATEST } },
HowAcquired: { presence: true, hasValue: true },
Cost: { presence: true, hasValue: true },
Value: { presence: true, hasValue: true },
Sold: (value, attributes) => {
const { Acquired, SoldNotApplicable } = attributes
if (SoldNotApplicable && SoldNotApplicable.applicable === false) {
return {}
}
const dateLimits = {}
if (Acquired) dateLimits.earliest = Acquired
return { presence: true, date: dateLimits }
},
Explanation: (value, attributes) => {
const { SoldNotApplicable } = attributes
if (SoldNotApplicable && SoldNotApplicable.applicable === false) {
return {}
}
return { presence: true, hasValue: true }
},
CoOwners: {
presence: true,
model: {
validator: foreignCoOwnersModel,
},
},
}
export default foreignIndirectInterest