@companieshouse/api-sdk-node 2.0.10 → 2.0.13

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.
@@ -10,6 +10,7 @@ export interface BasketResource {
10
10
  self?: string;
11
11
  };
12
12
  total_basket_cost?: string;
13
+ enrolled: boolean;
13
14
  }
14
15
  export interface DeliveryDetailsResource {
15
16
  address_line_1: string;
@@ -34,6 +35,7 @@ export interface Basket {
34
35
  self?: string;
35
36
  };
36
37
  totalBasketCost?: string;
38
+ enrolled: boolean;
37
39
  }
38
40
  export interface DeliveryDetails {
39
41
  addressLine1: string;
@@ -16,7 +16,8 @@ const mapOverseasEntity = (body) => {
16
16
  return {
17
17
  presenter: Object.assign({}, body.presenter),
18
18
  entity: Object.assign({}, body.entity),
19
- due_diligence: Object.assign({}, body.due_diligence),
19
+ due_diligence: mapDueDiligence(body.due_diligence),
20
+ overseas_entity_due_diligence: mapOverseasEntityDueDiligence(body.overseas_entity_due_diligence),
20
21
  beneficial_owners_statement: body.beneficial_owners_statement,
21
22
  beneficial_owners_individual: mapBeneficialOwnersIndividual(body.beneficial_owners_individual),
22
23
  beneficial_owners_corporate: mapBeneficialOwnersCorporate(body.beneficial_owners_corporate),
@@ -82,6 +83,37 @@ const mapManagingOfficersIndividual = (moIndividuals = []) => {
82
83
  });
83
84
  return moIndividualResources;
84
85
  };
86
+ /**
87
+ * Convert the Due Diligence object data into the Resource format that the API expects
88
+ * (just converting dates currently)
89
+ * @param DueDiligence object
90
+ * @returns DueDiligenceResource Object
91
+ */
92
+ const mapDueDiligence = (dueDiligence) => {
93
+ if (dueDiligence && Object.keys(dueDiligence).length) {
94
+ const identityDate = dueDiligence.identity_date || {};
95
+ const identity_date = convertDateToIsoDateString(identityDate.day, identityDate.month, identityDate.year);
96
+ return Object.assign(Object.assign({}, dueDiligence), { identity_date });
97
+ }
98
+ return {};
99
+ };
100
+ /**
101
+ * Convert the Overseas Entity Due Diligence data into the Resource format that the API expects
102
+ * (just converting dates currently)
103
+ * @param oeDueDiligence OverseasEntityDueDiligence objects
104
+ * @returns OverseasEntityDueDiligenceResource
105
+ */
106
+ const mapOverseasEntityDueDiligence = (oeDueDiligence) => {
107
+ if (oeDueDiligence && Object.keys(oeDueDiligence).length) {
108
+ const identityDate = oeDueDiligence.identity_date || {};
109
+ const identity_date = convertOptionalDateToIsoDateString(identityDate.day, identityDate.month, identityDate.year);
110
+ return Object.assign(Object.assign({}, oeDueDiligence), { identity_date });
111
+ }
112
+ return {};
113
+ };
114
+ const convertOptionalDateToIsoDateString = (day = "", month = "", year = "") => {
115
+ return (day && month && year) ? convertDateToIsoDateString(day, month, year) : "";
116
+ };
85
117
  const convertDateToIsoDateString = (day, month, year) => {
86
118
  return `${year}-${zeroPadNumber(month)}-${zeroPadNumber(day)}`;
87
119
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mapping.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/mapping.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAMO,MAAM,iBAAiB,GAAG,CAAC,IAAoB,EAA0B,EAAE;IAC9E,OAAO;QACH,SAAS,oBAAO,IAAI,CAAC,SAAS,CAAE;QAChC,MAAM,oBAAO,IAAI,CAAC,MAAM,CAAE;QAC1B,aAAa,oBAAO,IAAI,CAAC,aAAa,CAAE;QACxC,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;QAC7D,4BAA4B,EAAE,6BAA6B,CAAC,IAAI,CAAC,4BAA4B,CAAC;QAC9F,2BAA2B,EAAE,4BAA4B,CAAC,IAAI,CAAC,2BAA2B,CAAC;QAC3F,gDAAgD,EAAE,6BAA6B,CAAC,IAAI,CAAC,gDAAgD,CAAC;QACtI,4BAA4B,EAAE,6BAA6B,CAAC,IAAI,CAAC,4BAA4B,CAAC;QAC9F,2BAA2B,EAAE,IAAI,CAAC,2BAA2B;KAChE,CAAC;AACN,CAAC,CAAC;AAZW,QAAA,iBAAiB,qBAY5B;AAEF;;;;;GAKG;AAC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
6
  entity?: Entity;
7
7
  due_diligence?: DueDiligence;
8
+ overseas_entity_due_diligence?: OverseasEntityDueDiligence;
8
9
  beneficial_owners_statement?: BeneficialOwnersStatementType;
9
10
  beneficial_owners_individual?: BeneficialOwnerIndividual[];
10
11
  beneficial_owners_corporate?: BeneficialOwnerCorporate[];
@@ -15,7 +16,8 @@ export interface OverseasEntity {
15
16
  export interface OverseasEntityResource {
16
17
  presenter?: Presenter;
17
18
  entity?: Entity;
18
- due_diligence?: DueDiligence;
19
+ due_diligence?: DueDiligenceResource;
20
+ overseas_entity_due_diligence?: OverseasEntityDueDiligenceResource;
19
21
  beneficial_owners_statement?: BeneficialOwnersStatementType;
20
22
  beneficial_owners_individual?: BeneficialOwnerIndividualResource[];
21
23
  beneficial_owners_corporate?: BeneficialOwnerCorporateResource[];
@@ -57,6 +59,35 @@ export interface DueDiligence {
57
59
  partner_name?: string;
58
60
  diligence?: string;
59
61
  }
62
+ export interface DueDiligenceResource {
63
+ identity_date?: string;
64
+ name?: string;
65
+ identity_address?: Address;
66
+ email?: string;
67
+ supervisory_name?: string;
68
+ aml_number?: string;
69
+ agent_code?: string;
70
+ partner_name?: string;
71
+ diligence?: string;
72
+ }
73
+ export interface OverseasEntityDueDiligence {
74
+ identity_date?: InputDate;
75
+ name?: string;
76
+ identity_address?: Address;
77
+ email?: string;
78
+ supervisory_name?: string;
79
+ aml_number?: string;
80
+ partner_name?: string;
81
+ }
82
+ export interface OverseasEntityDueDiligenceResource {
83
+ identity_date?: string;
84
+ name?: string;
85
+ identity_address?: Address;
86
+ email?: string;
87
+ supervisory_name?: string;
88
+ aml_number?: string;
89
+ partner_name?: string;
90
+ }
60
91
  export interface BeneficialOwnerIndividual {
61
92
  first_name?: string;
62
93
  last_name?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/overseas-entities/types.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA8MH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAQD,IAAY,6BAIX;AAJD,WAAY,6BAA6B;IACrC,0FAAyD,CAAA;IACzD,4FAA2D,CAAA;IAC3D,oEAAmC,CAAA;AACvC,CAAC,EAJW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAIxC;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;;;AAgPH,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,6CAAM,CAAA;IACN,+CAAO,CAAA;AACX,CAAC,EAHW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAGxB;AAQD,IAAY,6BAIX;AAJD,WAAY,6BAA6B;IACrC,0FAAyD,CAAA;IACzD,4FAA2D,CAAA;IAC3D,oEAAmC,CAAA;AACvC,CAAC,EAJW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAIxC;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": "2.0.10",
3
+ "version": "2.0.13",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [