@lendi/integrations-transform 1.8.1 → 1.8.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ # 1.8.3
2
+
3
+ Changes
4
+ * Update `@lendi/transform-events` to support company applicant mappings
5
+
6
+ # 1.8.2
7
+
8
+ Changes
9
+ * Use `@lendi/integrations-protocol@2.7.4`
10
+
1
11
  # 1.8.1
2
12
 
3
13
  Changes
@@ -1,4 +1,8 @@
1
1
  import { YesNoList } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
2
2
  import { Payload as ApplicantPayload } from '../types/events/public-applicant';
3
3
  export declare const booleanMapping: (input?: boolean) => YesNoList;
4
+ /**
5
+ *
6
+ * @param applicant
7
+ */
4
8
  export declare function transformApplicant(applicant: ApplicantPayload): import("../types/recursive-partial").RecursivePartial<import("@lendi/integrations-protocol/lib/types/lixi-internal-request").InternalRequest>;
@@ -14,8 +14,14 @@ const trust_1 = require("../types/enum-mappings/trust");
14
14
  const public_applicant_1 = require("../types/events/public-applicant");
15
15
  const errors_1 = require("../utils/errors");
16
16
  const normalise_date_1 = require("../utils/normalise-date");
17
+ const company_type_1 = require("../types/enum-mappings/company-type");
18
+ const company_structure_1 = require("../types/enum-mappings/company-structure");
17
19
  const booleanMapping = (input = false) => (input === true ? lixi_internal_request_2.YesNoList.Yes : lixi_internal_request_2.YesNoList.No);
18
20
  exports.booleanMapping = booleanMapping;
21
+ /**
22
+ *
23
+ * @param applicant
24
+ */
19
25
  function transformApplicant(applicant) {
20
26
  const partialApplication = {};
21
27
  const applicantId = applicant.id; // This is how SF events cross reference applicant with its entities.
@@ -53,6 +59,21 @@ function transformApplicant(applicant) {
53
59
  trustType: `${application_paths_2.paths.TrustApplicant}.@TrustStructure`,
54
60
  };
55
61
  }
62
+ if (applicant.entity === public_applicant_1.Entity.Company) {
63
+ applicantMapping = {
64
+ id: `${application_paths_2.paths.CompanyApplicant}.@UniqueID`,
65
+ applicationId: application_paths_1.paths.ApplicationId,
66
+ applicantType: `${application_paths_2.paths.CompanyApplicant}.@ApplicantType`,
67
+ companyName: `${application_paths_2.paths.CompanyApplicant}.@CompanyName`,
68
+ companyType: `${application_paths_2.paths.CompanyApplicant}.@TypeOfIncorporation`,
69
+ companyStructure: `${application_paths_2.paths.CompanyApplicant}.@BusinessStructure`,
70
+ abn: `${application_paths_2.paths.CompanyApplicant}.@ABN`,
71
+ acn: `${application_paths_2.paths.CompanyApplicant}.@ACN`,
72
+ industryCode: `${application_paths_2.paths.CompanyApplicant}.Business.@IndustryCode`,
73
+ registeredState: `${application_paths_2.paths.CompanyApplicant}.@RegisteredInState`,
74
+ registeredDate: `${application_paths_2.paths.CompanyApplicant}.@DateRegistered`,
75
+ };
76
+ }
56
77
  // Any applicant event need to have at least dateOfBirth, firstName and lastName.
57
78
  if (applicant.entity === public_applicant_1.Entity.Person && !(applicant.dateOfBirth && applicant.firstName && applicant.lastName)) {
58
79
  throw new errors_1.InvalidEvent('Applicant needs to have dateOfBirth, firstName and lastName');
@@ -142,6 +163,12 @@ function transformApplicant(applicant) {
142
163
  }));
143
164
  (0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.Dependant`, dependants);
144
165
  break;
166
+ case 'companyType':
167
+ (0, lodash_1.set)(partialApplication, applicantMapping[key], company_type_1.companyTypeMapping[value]);
168
+ break;
169
+ case 'companyStructure':
170
+ (0, lodash_1.set)(partialApplication, applicantMapping[key], company_structure_1.companyStructureMapping[value]);
171
+ break;
145
172
  default:
146
173
  (0, lodash_1.set)(partialApplication, applicantMapping[key], value);
147
174
  break;
@@ -0,0 +1,7 @@
1
+ import { BusinessStructureFullList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
2
+ import { CompanyStructure } from '../events/public-applicant';
3
+ type CompanyTypeMapping = {
4
+ [key in CompanyStructure]: BusinessStructureFullList;
5
+ };
6
+ export declare const companyStructureMapping: Partial<CompanyTypeMapping>;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.companyStructureMapping = void 0;
4
+ const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
5
+ const public_applicant_1 = require("../events/public-applicant");
6
+ exports.companyStructureMapping = {
7
+ [public_applicant_1.CompanyStructure.SoleTrader]: lixi_internal_request_1.BusinessStructureFullList.SoleTrader,
8
+ [public_applicant_1.CompanyStructure.Partnership]: lixi_internal_request_1.BusinessStructureFullList.Partnership,
9
+ [public_applicant_1.CompanyStructure.Corporation]: lixi_internal_request_1.BusinessStructureFullList.Company,
10
+ };
@@ -0,0 +1,7 @@
1
+ import { TypeOfIncorporationList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
2
+ import { CompanyType } from '../events/public-applicant';
3
+ type CompanyTypeMapping = {
4
+ [key in CompanyType]: TypeOfIncorporationList;
5
+ };
6
+ export declare const companyTypeMapping: CompanyTypeMapping;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.companyTypeMapping = void 0;
4
+ const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
5
+ const public_applicant_1 = require("../events/public-applicant");
6
+ exports.companyTypeMapping = {
7
+ [public_applicant_1.CompanyType.PtyLtd]: lixi_internal_request_1.TypeOfIncorporationList.PtyLtd,
8
+ [public_applicant_1.CompanyType.Nl]: lixi_internal_request_1.TypeOfIncorporationList.Nl,
9
+ [public_applicant_1.CompanyType.Ltd]: lixi_internal_request_1.TypeOfIncorporationList.Ltd,
10
+ [public_applicant_1.CompanyType.Incorporated]: lixi_internal_request_1.TypeOfIncorporationList.Inc,
11
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lendi/integrations-transform",
3
- "version": "1.8.1",
3
+ "version": "1.8.3",
4
4
  "description": "Library for kafka event data transforming",
5
5
  "author": "Integrations <integrations@lendi.com.au>",
6
6
  "homepage": "https://bitbucket.org/lendi-dev/integrations-shared-packages#readme",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@lendi/integrations-credit-protocol": "1.18.5",
25
- "@lendi/integrations-protocol": "2.7.2",
25
+ "@lendi/integrations-protocol": "2.7.4",
26
26
  "@lendi/logging": "^1.0.0",
27
27
  "clean-deep": "^3.4.0",
28
28
  "date-fns": "2.19.0",