@companieshouse/api-sdk-node 1.0.104 → 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,4 +1,15 @@
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) => {
@@ -6,10 +17,47 @@ const mapOverseasEntity = (body) => {
6
17
  presenter: Object.assign({}, body.presenter),
7
18
  entity: Object.assign({}, body.entity),
8
19
  beneficial_owners_statement: body.beneficial_owners_statement,
9
- beneficial_owners_individual: Object.assign({}, body.beneficial_owners_individual),
10
- beneficial_owners_corporate: Object.assign({}, body.beneficial_owners_corporate),
20
+ beneficial_owners_individual: mapBeneficialOwnersIndividual(body.beneficial_owners_individual),
21
+ beneficial_owners_corporate: mapBeneficialOwnersCorporate(body.beneficial_owners_corporate),
11
22
  beneficial_owners_government_or_public_authority: Object.assign({}, body.beneficial_owners_government_or_public_authority)
12
23
  };
13
24
  };
14
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
+ };
15
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,IAA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,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,IAC3F,CAAA;IACN,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC;AACjC,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,CAAC,eAA2C,EAAE,EAAsC,EAAE;IACvH,MAAM,oBAAoB,GAAuC,EAAE,CAAC;IACpE,YAAY,CAAC,OAAO,CAAC,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"}
@@ -9,6 +9,14 @@ export interface OverseasEntity {
9
9
  beneficial_owners_corporate?: BeneficialOwnerCorporate[];
10
10
  beneficial_owners_government_or_public_authority?: BeneficialOwnerGovernmentOrPublicAuthority[];
11
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[];
19
+ }
12
20
  export interface OverseasEntityCreated {
13
21
  id: string;
14
22
  }
@@ -48,7 +56,37 @@ export interface BeneficialOwnerIndividual {
48
56
  non_legal_firm_members_nature_of_control_types?: NatureOfControlType[];
49
57
  is_on_sanctions_list?: yesNoResponse;
50
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
+ }
51
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 {
52
90
  name?: string;
53
91
  principal_address?: Address;
54
92
  service_address?: Address;
@@ -59,9 +97,9 @@ export interface BeneficialOwnerCorporate {
59
97
  register_name?: string;
60
98
  registration_number?: string;
61
99
  start_date?: string;
62
- beneficial_owner_nature_of_control_types?: NatureOfControlType;
63
- trustees_nature_of_control_types?: NatureOfControlType;
64
- non_legal_firm_members_nature_of_control_types?: NatureOfControlType;
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[];
65
103
  is_on_sanctions_list?: yesNoResponse;
66
104
  }
67
105
  export interface BeneficialOwnerGovernmentOrPublicAuthority {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAiGH,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"}
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.104",
3
+ "version": "1.0.105",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [