@companieshouse/api-sdk-node 1.0.102 → 1.0.105

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.
@@ -1,2 +1,2 @@
1
- import { OverseasEntity } from "./types";
2
- export declare const mapOverseasEntity: (body: OverseasEntity) => OverseasEntity;
1
+ import { OverseasEntity, OverseasEntityResource } from "./types";
2
+ export declare const mapOverseasEntity: (body: OverseasEntity) => OverseasEntityResource;
@@ -1,11 +1,63 @@
1
1
  "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
2
13
  Object.defineProperty(exports, "__esModule", { value: true });
3
14
  exports.mapOverseasEntity = void 0;
4
15
  const mapOverseasEntity = (body) => {
5
16
  return {
6
17
  presenter: Object.assign({}, body.presenter),
7
- entity: Object.assign({}, body.entity)
18
+ entity: Object.assign({}, body.entity),
19
+ beneficial_owners_statement: body.beneficial_owners_statement,
20
+ beneficial_owners_individual: mapBeneficialOwnersIndividual(body.beneficial_owners_individual),
21
+ beneficial_owners_corporate: mapBeneficialOwnersCorporate(body.beneficial_owners_corporate),
22
+ beneficial_owners_government_or_public_authority: Object.assign({}, body.beneficial_owners_government_or_public_authority)
8
23
  };
9
24
  };
10
25
  exports.mapOverseasEntity = mapOverseasEntity;
26
+ /**
27
+ * Convert the BeneficialOwnerIndividual array data into the Resource format that the API expects
28
+ * (just converting dates currently)
29
+ * @param boIndividuals Array of BeneficialOwnerIndividual objects
30
+ * @returns Array of BeneficialOwnerIndividualResource
31
+ */
32
+ const mapBeneficialOwnersIndividual = (boIndividuals = []) => {
33
+ const boIndividualResources = [];
34
+ boIndividuals.forEach(boIndividual => {
35
+ const { date_of_birth, start_date } = boIndividual, rest = __rest(boIndividual, ["date_of_birth", "start_date"]);
36
+ boIndividualResources.push(Object.assign(Object.assign({}, rest), { date_of_birth: convertDateToIsoDateString(date_of_birth.day, date_of_birth.month, date_of_birth.year), start_date: convertDateToIsoDateString(start_date.day, start_date.month, start_date.year) }));
37
+ });
38
+ return boIndividualResources;
39
+ };
40
+ /**
41
+ * Convert the BeneficialOwnerCorporate array data into the Resource format that the API expects
42
+ * (just converting dates currently)
43
+ * @param boCorporates Array of BeneficialOwnerCorporate objects
44
+ * @returns Array of BeneficialOwnerCorporateResource
45
+ */
46
+ const mapBeneficialOwnersCorporate = (boCorporates = []) => {
47
+ const boCorporateResources = [];
48
+ boCorporates.forEach(boCorporate => {
49
+ const { start_date } = boCorporate, rest = __rest(boCorporate, ["start_date"]);
50
+ boCorporateResources.push(Object.assign(Object.assign({}, rest), { start_date: convertDateToIsoDateString(start_date.day, start_date.month, start_date.year) }));
51
+ });
52
+ return boCorporateResources;
53
+ };
54
+ const convertDateToIsoDateString = (day, month, year) => {
55
+ return `${year}-${zeroPadNumber(month)}-${zeroPadNumber(day)}`;
56
+ };
57
+ const zeroPadNumber = (input = "") => {
58
+ if (input.length === 1) {
59
+ return "0" + input;
60
+ }
61
+ return input;
62
+ };
11
63
  //# sourceMappingURL=mapping.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/mapping.ts"],"names":[],"mappings":";;;AAEO,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAAkB,EAAE;IACtE,OAAO;QACH,SAAS,oBAAO,IAAI,CAAC,SAAS,CAAE;QAChC,MAAM,oBAAO,IAAI,CAAC,MAAM,CAAE;KAC7B,CAAC;AACN,CAAC,CAAC;AALW,QAAA,iBAAiB,qBAK5B"}
1
+ {"version":3,"file":"m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AAC,WAAW,CAAC,EAAE;QAC/B,MAAM,EAAE,UAAU,KAAc,WAAW,EAApB,IAAI,UAAK,WAAW,EAArC,cAAuB,CAAc,CAAC;QAC5C,oBAAoB,CAAC,IAAI,iCAClB,IAAI,KACP,UAAU,EAAE,0BAA0B,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAC3F,CAAA;IACN,CAAC,CAAC,CAAC;IACH,OAAO,oBAAoB,CAAC;AAChC,CAAC,CAAA;AAED,MAAM,0BAA0B,GAAG,CAAC,GAAW,EAAE,KAAa,EAAE,IAAY,EAAU,EAAE;IACpF,OAAO,GAAG,IAAI,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;AACnE,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,EAAU,EAAE;IACjD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACpB,OAAO,GAAG,GAAG,KAAK,CAAC;KACtB;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAA"}
@@ -4,6 +4,18 @@
4
4
  export interface OverseasEntity {
5
5
  presenter?: Presenter;
6
6
  entity?: Entity;
7
+ beneficial_owners_statement?: BeneficialOwnersStatementType;
8
+ beneficial_owners_individual?: BeneficialOwnerIndividual[];
9
+ beneficial_owners_corporate?: BeneficialOwnerCorporate[];
10
+ beneficial_owners_government_or_public_authority?: BeneficialOwnerGovernmentOrPublicAuthority[];
11
+ }
12
+ export interface OverseasEntityResource {
13
+ presenter?: Presenter;
14
+ entity?: Entity;
15
+ beneficial_owners_statement?: BeneficialOwnersStatementType;
16
+ beneficial_owners_individual?: BeneficialOwnerIndividualResource[];
17
+ beneficial_owners_corporate?: BeneficialOwnerCorporateResource[];
18
+ beneficial_owners_government_or_public_authority?: BeneficialOwnerGovernmentOrPublicAuthority[];
7
19
  }
8
20
  export interface OverseasEntityCreated {
9
21
  id: string;
@@ -30,6 +42,79 @@ export interface Entity {
30
42
  public_register_name?: string;
31
43
  registration_number?: string;
32
44
  }
45
+ export interface BeneficialOwnerIndividual {
46
+ first_name?: string;
47
+ last_name?: string;
48
+ date_of_birth?: InputDate;
49
+ nationality?: string;
50
+ usual_residential_address?: Address;
51
+ service_address?: Address;
52
+ is_service_address_same_as_usual_residential_address?: yesNoResponse;
53
+ start_date?: InputDate;
54
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
55
+ trustees_nature_of_control_types?: NatureOfControlType[];
56
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
57
+ is_on_sanctions_list?: yesNoResponse;
58
+ }
59
+ export interface BeneficialOwnerIndividualResource {
60
+ first_name?: string;
61
+ last_name?: string;
62
+ date_of_birth?: string;
63
+ nationality?: string;
64
+ usual_residential_address?: Address;
65
+ service_address?: Address;
66
+ is_service_address_same_as_usual_residential_address?: yesNoResponse;
67
+ start_date?: string;
68
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
69
+ trustees_nature_of_control_types?: NatureOfControlType[];
70
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
71
+ is_on_sanctions_list?: yesNoResponse;
72
+ }
73
+ export interface BeneficialOwnerCorporate {
74
+ name?: string;
75
+ principal_address?: Address;
76
+ service_address?: Address;
77
+ is_service_address_same_as_principal_address?: yesNoResponse;
78
+ legal_form?: string;
79
+ law_governed?: string;
80
+ is_on_register_in_country_formed_in?: yesNoResponse;
81
+ register_name?: string;
82
+ registration_number?: string;
83
+ start_date?: InputDate;
84
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
85
+ trustees_nature_of_control_types?: NatureOfControlType[];
86
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
87
+ is_on_sanctions_list?: yesNoResponse;
88
+ }
89
+ export interface BeneficialOwnerCorporateResource {
90
+ name?: string;
91
+ principal_address?: Address;
92
+ service_address?: Address;
93
+ is_service_address_same_as_principal_address?: yesNoResponse;
94
+ legal_form?: string;
95
+ law_governed?: string;
96
+ is_on_register_in_country_formed_in?: yesNoResponse;
97
+ register_name?: string;
98
+ registration_number?: string;
99
+ start_date?: string;
100
+ beneficial_owner_nature_of_control_types?: NatureOfControlType[];
101
+ trustees_nature_of_control_types?: NatureOfControlType[];
102
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
103
+ is_on_sanctions_list?: yesNoResponse;
104
+ }
105
+ export interface BeneficialOwnerGovernmentOrPublicAuthority {
106
+ name?: string;
107
+ principal_address?: Address;
108
+ service_address?: Address;
109
+ is_service_address_same_as_principal_address?: yesNoResponse;
110
+ legal_form?: string;
111
+ law_governed?: string;
112
+ is_on_register_in_country_formed_in?: yesNoResponse;
113
+ register_name?: string;
114
+ registration_number?: string;
115
+ beneficial_owner_nature_of_control_types?: NatureOfControlType;
116
+ non_legal_firm_members_nature_of_control_types?: NatureOfControlType;
117
+ }
33
118
  /**
34
119
  * Shared Data Type
35
120
  */
@@ -42,10 +127,15 @@ export interface Address {
42
127
  country?: string;
43
128
  postcode?: string;
44
129
  }
45
- declare enum yesNoResponse {
130
+ export declare enum yesNoResponse {
46
131
  No = 0,
47
132
  Yes = 1
48
133
  }
134
+ export interface InputDate {
135
+ day: string;
136
+ month: string;
137
+ year: string;
138
+ }
49
139
  declare enum presenterRole {
50
140
  administrator = "administrator",
51
141
  agent = "agent",
@@ -53,4 +143,17 @@ declare enum presenterRole {
53
143
  beneficial_owner = "beneficial_owner",
54
144
  other = "other"
55
145
  }
146
+ export declare enum BeneficialOwnersStatementType {
147
+ all_identified_all_details = "all_identified_all_details",
148
+ all_identified_some_details = "all_identified_some_details",
149
+ some_identified_all_details = "some_identified_all_details",
150
+ some_identified_some_details = "some_identified_some_details",
151
+ none_identified = "none_identified"
152
+ }
153
+ export declare enum NatureOfControlType {
154
+ over_25_percent_of_shares = "over_25_percent_of_shares",
155
+ over_25_percent_of_voting_rights = "over_25_percent_of_voting_rights",
156
+ appoint_or_remove_majority_board_directors = "appoint_or_remove_majority_board_directors",
157
+ significant_influence_or_control = "significant_influence_or_control"
158
+ }
56
159
  export {};
@@ -3,11 +3,12 @@
3
3
  * Overseas Entity interface used within this SDK
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.NatureOfControlType = exports.BeneficialOwnersStatementType = exports.yesNoResponse = void 0;
6
7
  var yesNoResponse;
7
8
  (function (yesNoResponse) {
8
9
  yesNoResponse[yesNoResponse["No"] = 0] = "No";
9
10
  yesNoResponse[yesNoResponse["Yes"] = 1] = "Yes";
10
- })(yesNoResponse || (yesNoResponse = {}));
11
+ })(yesNoResponse = exports.yesNoResponse || (exports.yesNoResponse = {}));
11
12
  var presenterRole;
12
13
  (function (presenterRole) {
13
14
  presenterRole["administrator"] = "administrator";
@@ -16,4 +17,19 @@ var presenterRole;
16
17
  presenterRole["beneficial_owner"] = "beneficial_owner";
17
18
  presenterRole["other"] = "other";
18
19
  })(presenterRole || (presenterRole = {}));
20
+ var BeneficialOwnersStatementType;
21
+ (function (BeneficialOwnersStatementType) {
22
+ BeneficialOwnersStatementType["all_identified_all_details"] = "all_identified_all_details";
23
+ BeneficialOwnersStatementType["all_identified_some_details"] = "all_identified_some_details";
24
+ BeneficialOwnersStatementType["some_identified_all_details"] = "some_identified_all_details";
25
+ BeneficialOwnersStatementType["some_identified_some_details"] = "some_identified_some_details";
26
+ BeneficialOwnersStatementType["none_identified"] = "none_identified";
27
+ })(BeneficialOwnersStatementType = exports.BeneficialOwnersStatementType || (exports.BeneficialOwnersStatementType = {}));
28
+ var NatureOfControlType;
29
+ (function (NatureOfControlType) {
30
+ NatureOfControlType["over_25_percent_of_shares"] = "over_25_percent_of_shares";
31
+ NatureOfControlType["over_25_percent_of_voting_rights"] = "over_25_percent_of_voting_rights";
32
+ NatureOfControlType["appoint_or_remove_majority_board_directors"] = "appoint_or_remove_majority_board_directors";
33
+ NatureOfControlType["significant_influence_or_control"] = "significant_influence_or_control";
34
+ })(NatureOfControlType = exports.NatureOfControlType || (exports.NatureOfControlType = {}));
19
35
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;AA+CH,IAAK,aAGJ;AAHD,WAAK,aAAa;IACd,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHI,aAAa,KAAb,aAAa,QAGjB;AAED,IAAK,aAMJ;AAND,WAAK,aAAa;IACd,gDAA+B,CAAA;IAC/B,gCAAe,CAAA;IACf,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,gCAAe,CAAA;AACnB,CAAC,EANI,aAAa,KAAb,aAAa,QAMjB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA0IH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAQD,IAAK,aAMJ;AAND,WAAK,aAAa;IACd,gDAA+B,CAAA;IAC/B,gCAAe,CAAA;IACf,wCAAuB,CAAA;IACvB,sDAAqC,CAAA;IACrC,gCAAe,CAAA;AACnB,CAAC,EANI,aAAa,KAAb,aAAa,QAMjB;AAED,IAAY,6BAMX;AAND,WAAY,6BAA6B;IACrC,0FAAyD,CAAA;IACzD,4FAA2D,CAAA;IAC3D,4FAA2D,CAAA;IAC3D,8FAA6D,CAAA;IAC7D,oEAAmC,CAAA;AACvC,CAAC,EANW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAMxC;AAED,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC3B,8EAAuD,CAAA;IACvD,4FAAqE,CAAA;IACrE,gHAAyF,CAAA;IACzF,4FAAqE,CAAA;AACzE,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companieshouse/api-sdk-node",
3
- "version": "1.0.102",
3
+ "version": "1.0.105",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [