@lendi/integrations-transform 1.6.7 → 1.7.0
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 +6 -0
- package/lib/schemas/public-applicant-event.json +104 -41
- package/lib/transform-events/transform-applicant.d.ts +2 -32
- package/lib/transform-events/transform-applicant.js +79 -132
- package/lib/types/enum-mappings/applicant-gender.d.ts +6 -0
- package/lib/types/enum-mappings/applicant-gender.js +11 -0
- package/lib/types/enum-mappings/applicant-type.d.ts +6 -0
- package/lib/types/enum-mappings/applicant-type.js +10 -0
- package/lib/types/events/public-applicant.d.ts +60 -82
- package/lib/types/events/public-applicant.js +13 -12
- package/lib/utils/errors.d.ts +28 -0
- package/lib/utils/errors.js +43 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"definitions": {
|
|
3
3
|
"Payload": {
|
|
4
|
-
"
|
|
4
|
+
"type": "object",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "#/definitions/createApplicantDefinition"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "#/definitions/updateApplicantDefinition"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
5
13
|
},
|
|
6
14
|
"id": {
|
|
7
15
|
"type": "string",
|
|
@@ -21,7 +29,7 @@
|
|
|
21
29
|
"description": "The metadata of the applicant",
|
|
22
30
|
"properties": {
|
|
23
31
|
"actionedBy": {
|
|
24
|
-
"description": "uuid of user who made the action (create/update
|
|
32
|
+
"description": "uuid of user who made the action (create/update)",
|
|
25
33
|
"type": "string"
|
|
26
34
|
},
|
|
27
35
|
"actionedByRole": {
|
|
@@ -413,30 +421,12 @@
|
|
|
413
421
|
"type": "object",
|
|
414
422
|
"additionalProperties": false,
|
|
415
423
|
"properties": {
|
|
416
|
-
"buildingName": {
|
|
417
|
-
"description": "The building name",
|
|
418
|
-
"type": "string"
|
|
419
|
-
},
|
|
420
|
-
"deliveryAddress": {
|
|
421
|
-
"description": "Postal address, usually a PO Box or Locked Bag",
|
|
422
|
-
"type": "string",
|
|
423
|
-
"example": "PO Box 1"
|
|
424
|
-
},
|
|
425
|
-
"lotSection": {
|
|
426
|
-
"description": "The lot number",
|
|
427
|
-
"type": "string"
|
|
428
|
-
},
|
|
429
424
|
"streetName": {
|
|
430
425
|
"type": "string"
|
|
431
426
|
},
|
|
432
427
|
"streetNumber": {
|
|
433
428
|
"type": "string"
|
|
434
429
|
},
|
|
435
|
-
"streetSuffix": {
|
|
436
|
-
"description": "The street suffix",
|
|
437
|
-
"type": "string",
|
|
438
|
-
"example": "North"
|
|
439
|
-
},
|
|
440
430
|
"streetType": {
|
|
441
431
|
"type": "string"
|
|
442
432
|
},
|
|
@@ -536,13 +526,13 @@
|
|
|
536
526
|
"type": "string",
|
|
537
527
|
"description": "applicant's mobile number formatted in +611234567890"
|
|
538
528
|
},
|
|
529
|
+
"previousAddresses": {
|
|
530
|
+
"$ref": "#/definitions/previousAddresses"
|
|
531
|
+
},
|
|
539
532
|
"postSettlementAddress": {
|
|
540
533
|
"$ref": "#/definitions/address",
|
|
541
534
|
"description": "applicant's post settlement address being captured as part of funnels 5 (post product select)"
|
|
542
535
|
},
|
|
543
|
-
"previousAddresses": {
|
|
544
|
-
"$ref": "#/definitions/previousAddresses"
|
|
545
|
-
},
|
|
546
536
|
"emailAddress": {
|
|
547
537
|
"type": "string",
|
|
548
538
|
"description": "The applicant email"
|
|
@@ -554,14 +544,18 @@
|
|
|
554
544
|
"description": "different invitation statuses an applicant can have"
|
|
555
545
|
},
|
|
556
546
|
"entity": {
|
|
557
|
-
"enum": ["PERSON", "COMPANY"],
|
|
547
|
+
"enum": ["PERSON", "COMPANY", "TRUST"],
|
|
558
548
|
"description": "applicant's entity. For a person applicant this is 'PERSON'"
|
|
559
549
|
},
|
|
560
550
|
"isFirstHomeBuyer": {
|
|
561
551
|
"type": "boolean",
|
|
562
552
|
"description": "Whether it's the applicants first home purchase."
|
|
563
553
|
},
|
|
564
|
-
"
|
|
554
|
+
"cityOfBirth": {
|
|
555
|
+
"type": "string",
|
|
556
|
+
"example": "Sydney"
|
|
557
|
+
},
|
|
558
|
+
"createApplicantDefinition": {
|
|
565
559
|
"type": "object",
|
|
566
560
|
"additionalProperties": false,
|
|
567
561
|
"properties": {
|
|
@@ -573,14 +567,13 @@
|
|
|
573
567
|
"$ref": "#/definitions/id",
|
|
574
568
|
"description": "uuid of application"
|
|
575
569
|
},
|
|
570
|
+
"cityOfBirth": {
|
|
571
|
+
"$ref": "#/definitions/cityOfBirth"
|
|
572
|
+
},
|
|
576
573
|
"customerId": {
|
|
577
574
|
"$ref": "#/definitions/id",
|
|
578
575
|
"description": "uuid of customer"
|
|
579
576
|
},
|
|
580
|
-
"clonedFromApplicantId": {
|
|
581
|
-
"$ref": "#/definitions/id",
|
|
582
|
-
"description": "uuid of source applicant"
|
|
583
|
-
},
|
|
584
577
|
"meta": {
|
|
585
578
|
"$ref": "#/definitions/applicantMeta"
|
|
586
579
|
},
|
|
@@ -599,6 +592,9 @@
|
|
|
599
592
|
"guarantorRelationshipToBorrower": {
|
|
600
593
|
"$ref": "#/definitions/guarantorRelationshipToBorrowerDefinition"
|
|
601
594
|
},
|
|
595
|
+
"isFirstHomeBuyer": {
|
|
596
|
+
"$ref": "#/definitions/isFirstHomeBuyer"
|
|
597
|
+
},
|
|
602
598
|
"isPrimaryApplicant": {
|
|
603
599
|
"$ref": "#/definitions/isPrimaryApplicant"
|
|
604
600
|
},
|
|
@@ -643,28 +639,95 @@
|
|
|
643
639
|
},
|
|
644
640
|
"invitationStatus": {
|
|
645
641
|
"$ref": "#/definitions/invitationStatus"
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
"required": ["id", "applicationId", "customerId", "isPrimaryApplicant", "meta"],
|
|
645
|
+
"description": "create applicant payload"
|
|
646
|
+
},
|
|
647
|
+
"updateApplicantDefinition": {
|
|
648
|
+
"type": "object",
|
|
649
|
+
"additionalProperties": false,
|
|
650
|
+
"properties": {
|
|
651
|
+
"id": {
|
|
652
|
+
"$ref": "#/definitions/id",
|
|
653
|
+
"description": "uuid of applicant"
|
|
646
654
|
},
|
|
647
|
-
"
|
|
648
|
-
"$ref": "#/definitions/
|
|
655
|
+
"applicationId": {
|
|
656
|
+
"$ref": "#/definitions/id",
|
|
657
|
+
"description": "uuid of application"
|
|
649
658
|
},
|
|
650
|
-
"
|
|
651
|
-
"$ref": "#/definitions/
|
|
659
|
+
"customerId": {
|
|
660
|
+
"$ref": "#/definitions/id",
|
|
661
|
+
"description": "uuid of customer"
|
|
652
662
|
},
|
|
653
|
-
"
|
|
654
|
-
"
|
|
655
|
-
"description": "Mothers Maiden Name"
|
|
663
|
+
"meta": {
|
|
664
|
+
"$ref": "#/definitions/applicantMeta"
|
|
656
665
|
},
|
|
657
|
-
"
|
|
658
|
-
"$ref": "#/definitions/
|
|
666
|
+
"applicantType": {
|
|
667
|
+
"$ref": "#/definitions/applicantType"
|
|
668
|
+
},
|
|
669
|
+
"creditStatus": {
|
|
670
|
+
"$ref": "#/definitions/creditStatus"
|
|
671
|
+
},
|
|
672
|
+
"employmentType": {
|
|
673
|
+
"$ref": "#/definitions/employmentType"
|
|
674
|
+
},
|
|
675
|
+
"guarantorRelationshipToBorrower": {
|
|
676
|
+
"$ref": "#/definitions/guarantorRelationshipToBorrowerDefinition"
|
|
677
|
+
},
|
|
678
|
+
"isPrimaryApplicant": {
|
|
679
|
+
"$ref": "#/definitions/isPrimaryApplicant"
|
|
680
|
+
},
|
|
681
|
+
"hasSelfEmploymentProof": {
|
|
682
|
+
"$ref": "#/definitions/hasSelfEmploymentProof"
|
|
683
|
+
},
|
|
684
|
+
"totalIncomeEstimate": {
|
|
685
|
+
"$ref": "#/definitions/totalIncomeEstimate"
|
|
686
|
+
},
|
|
687
|
+
"dateOfBirth": {
|
|
688
|
+
"$ref": "#/definitions/dateOfBirth"
|
|
689
|
+
},
|
|
690
|
+
"gender": {
|
|
691
|
+
"$ref": "#/definitions/gender"
|
|
692
|
+
},
|
|
693
|
+
"maritalStatus": {
|
|
694
|
+
"$ref": "#/definitions/maritalStatus"
|
|
695
|
+
},
|
|
696
|
+
"maritalDetails": {
|
|
697
|
+
"$ref": "#/definitions/applicantKeyObject"
|
|
698
|
+
},
|
|
699
|
+
"residencyStatus": {
|
|
700
|
+
"$ref": "#/definitions/residencyStatus"
|
|
701
|
+
},
|
|
702
|
+
"dependants": {
|
|
703
|
+
"$ref": "#/definitions/dependants"
|
|
704
|
+
},
|
|
705
|
+
"firstName": {
|
|
706
|
+
"$ref": "#/definitions/firstName"
|
|
707
|
+
},
|
|
708
|
+
"middleName": {
|
|
709
|
+
"$ref": "#/definitions/middleName"
|
|
710
|
+
},
|
|
711
|
+
"lastName": {
|
|
712
|
+
"$ref": "#/definitions/lastName"
|
|
713
|
+
},
|
|
714
|
+
"title": {
|
|
715
|
+
"$ref": "#/definitions/title"
|
|
716
|
+
},
|
|
717
|
+
"contact": {
|
|
718
|
+
"$ref": "#/definitions/contact"
|
|
719
|
+
},
|
|
720
|
+
"invitationStatus": {
|
|
721
|
+
"$ref": "#/definitions/invitationStatus"
|
|
659
722
|
}
|
|
660
723
|
},
|
|
661
|
-
"required": ["id", "applicationId", "customerId"],
|
|
662
|
-
"description": "
|
|
724
|
+
"required": ["id", "applicationId", "customerId", "meta"],
|
|
725
|
+
"description": "update applicant payload. Entity shouldn't be updated."
|
|
663
726
|
}
|
|
664
727
|
},
|
|
665
728
|
"type": "object",
|
|
666
729
|
"title": "The applicant event schema",
|
|
667
|
-
"description": "Create
|
|
730
|
+
"description": "Create or update.",
|
|
668
731
|
"additionalProperties": false,
|
|
669
732
|
"properties": {
|
|
670
733
|
"version": {
|
|
@@ -1,34 +1,4 @@
|
|
|
1
1
|
import { YesNoList } from '@lendi/integrations-protocol/lib/types/lixi-internal-request';
|
|
2
|
-
import {
|
|
2
|
+
import { Payload as ApplicantPayload } from '../types/events/public-applicant';
|
|
3
3
|
export declare const booleanMapping: (input?: boolean) => YesNoList;
|
|
4
|
-
|
|
5
|
-
* Transforms a partial Applicant event to a partial LIXI application.
|
|
6
|
-
*
|
|
7
|
-
* @param applicant: A partial applicant.
|
|
8
|
-
* @param applicant
|
|
9
|
-
* @returns partialApplication an incomplete application.
|
|
10
|
-
*/
|
|
11
|
-
export declare function transformApplicant(applicant: ApplicantPayload): {};
|
|
12
|
-
/**
|
|
13
|
-
* Generates a LIXI contact from given contact.
|
|
14
|
-
*
|
|
15
|
-
* @param contact
|
|
16
|
-
* @param id
|
|
17
|
-
*/
|
|
18
|
-
export declare function generateContact(contact: Contact, id: string): {
|
|
19
|
-
lixiContact: {};
|
|
20
|
-
lixiAddresses: any[];
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Generate dependants
|
|
24
|
-
*
|
|
25
|
-
* @param dependants
|
|
26
|
-
* @param id
|
|
27
|
-
*/
|
|
28
|
-
export declare function generateDependants(dependants: Dependant[], id: string): {
|
|
29
|
-
'@Age': number;
|
|
30
|
-
'@UniqueID': string;
|
|
31
|
-
FinancialProvider: {
|
|
32
|
-
'@x_Party': string;
|
|
33
|
-
}[];
|
|
34
|
-
}[];
|
|
4
|
+
export declare function transformApplicant(applicant: ApplicantPayload): import("../types/recursive-partial").RecursivePartial<import("@lendi/integrations-protocol/lib/types/lixi-internal-request").InternalRequest>;
|
|
@@ -1,58 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const lixi_internal_request_1 = require("@lendi/integrations-protocol/
|
|
3
|
+
exports.transformApplicant = exports.booleanMapping = void 0;
|
|
4
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
5
|
+
const lixi_internal_request_2 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request");
|
|
5
6
|
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths");
|
|
6
7
|
const lodash_1 = require("lodash");
|
|
7
|
-
const address_tools_1 = require("../utils/address-tools");
|
|
8
8
|
const enum_mappings_1 = require("../types/enum-mappings");
|
|
9
|
+
const applicant_gender_1 = require("../types/enum-mappings/applicant-gender");
|
|
10
|
+
const applicant_type_1 = require("../types/enum-mappings/applicant-type");
|
|
11
|
+
const guarantor_relationship_type_1 = require("../types/enum-mappings/guarantor-relationship-type");
|
|
9
12
|
const public_applicant_1 = require("../types/events/public-applicant");
|
|
13
|
+
const errors_1 = require("../utils/errors");
|
|
10
14
|
const normalise_date_1 = require("../utils/normalise-date");
|
|
11
|
-
const booleanMapping = (input = false) => (input === true ?
|
|
15
|
+
const booleanMapping = (input = false) => (input === true ? lixi_internal_request_2.YesNoList.Yes : lixi_internal_request_2.YesNoList.No);
|
|
12
16
|
exports.booleanMapping = booleanMapping;
|
|
13
|
-
const applicantMapping = {
|
|
14
|
-
applicationId: application_paths_1.paths.ApplicationId,
|
|
15
|
-
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`,
|
|
16
|
-
contact: `${application_paths_1.paths.PersonApplicant}.Contact`,
|
|
17
|
-
dependants: 'dependants',
|
|
18
|
-
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`,
|
|
19
|
-
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`,
|
|
20
|
-
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`,
|
|
21
|
-
isFirstHomeBuyer: `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`,
|
|
22
|
-
isPrimaryApplicant: `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`,
|
|
23
|
-
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`,
|
|
24
|
-
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`,
|
|
25
|
-
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`,
|
|
26
|
-
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`,
|
|
27
|
-
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`,
|
|
28
|
-
title: `${application_paths_1.paths.PersonName}.@NameTitle`,
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Transforms a partial Applicant event to a partial LIXI application.
|
|
32
|
-
*
|
|
33
|
-
* @param applicant: A partial applicant.
|
|
34
|
-
* @param applicant
|
|
35
|
-
* @returns partialApplication an incomplete application.
|
|
36
|
-
*/
|
|
37
17
|
function transformApplicant(applicant) {
|
|
38
18
|
const partialApplication = {};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
const applicantId = applicant.id; // This is how SF events cross reference applicant with its entities.
|
|
20
|
+
const applicantMapping = {
|
|
21
|
+
applicantType: `${application_paths_1.paths.PersonApplicant}.@ApplicantType`,
|
|
22
|
+
applicationId: application_paths_1.paths.ApplicationId,
|
|
23
|
+
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`,
|
|
24
|
+
cityOfBirth: `${application_paths_1.paths.PersonApplicant}.@PlaceOfBirth`,
|
|
25
|
+
contact: 'contact',
|
|
26
|
+
countryOfBirth: `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`,
|
|
27
|
+
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`,
|
|
28
|
+
dependants: 'dependants',
|
|
29
|
+
email: `${application_paths_1.paths.PersonApplicant}.Contact.EmailAddress[0].@Email`,
|
|
30
|
+
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`,
|
|
31
|
+
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`,
|
|
32
|
+
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`,
|
|
33
|
+
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`,
|
|
34
|
+
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`,
|
|
35
|
+
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`,
|
|
36
|
+
mothersMaidenName: `${application_paths_1.paths.PersonApplicant}.@MothersMaidenName`,
|
|
37
|
+
phone: `${application_paths_1.paths.PersonApplicant}.Contact.Mobile.@Number`,
|
|
38
|
+
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`,
|
|
39
|
+
title: `${application_paths_1.paths.PersonName}.@NameTitle`,
|
|
40
|
+
};
|
|
41
|
+
// Any applicant event need to have at least dateOfBirth, firstName and lastName.
|
|
42
|
+
if (!(applicant.dateOfBirth && applicant.firstName && applicant.lastName)) {
|
|
43
|
+
throw new errors_1.InvalidEvent('Applicant needs to have dateOfBirth, firstName and lastName');
|
|
44
|
+
}
|
|
45
|
+
// If applicant event comes without an applicantType then default it to ApplicantType.Borrower
|
|
46
|
+
if (!applicant.applicantType) {
|
|
47
|
+
applicant.applicantType = public_applicant_1.ApplicantType.Borrower;
|
|
48
|
+
}
|
|
49
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonName}.@NameTitle`, lixi_internal_request_1.NameTitleList.Other);
|
|
50
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`, (0, exports.booleanMapping)(applicant.isPrimaryApplicant));
|
|
51
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`, (0, exports.booleanMapping)(applicant.isFirstHomeBuyer));
|
|
52
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Gender`, applicant_gender_1.applicantGenderMapping[applicant.gender]);
|
|
53
|
+
if (applicant.applicantType === public_applicant_1.ApplicantType.Guarantor) {
|
|
54
|
+
const mappedGuarantorRelationship = applicant.guarantorRelationshipToBorrower
|
|
55
|
+
? guarantor_relationship_type_1.guarantorRelationshipTypeMappings[applicant.guarantorRelationshipToBorrower.type]
|
|
56
|
+
: lixi_internal_request_1.KinRelationshipList.OtherRelative;
|
|
57
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@RelationshipToPrimaryApplicant`, mappedGuarantorRelationship);
|
|
58
|
+
}
|
|
59
|
+
for (const [key, value] of Object.entries(applicant)) {
|
|
45
60
|
if (applicantMapping[key]) {
|
|
46
61
|
switch (key) {
|
|
62
|
+
case 'applicantType':
|
|
63
|
+
(0, lodash_1.set)(partialApplication, applicantMapping[key], applicant_type_1.applicantTypeMapping[value]);
|
|
64
|
+
break;
|
|
47
65
|
case 'dateOfBirth':
|
|
48
66
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], (0, normalise_date_1.normaliseDate)(value));
|
|
49
67
|
break;
|
|
50
68
|
case 'maritalStatus':
|
|
51
69
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.maritalStatusMapping[value]);
|
|
52
70
|
break;
|
|
53
|
-
case 'citizenship':
|
|
54
|
-
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.countryCodeMapping[value]);
|
|
55
|
-
break;
|
|
56
71
|
case 'residencyStatus':
|
|
57
72
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.residencyStatusMapping[value]);
|
|
58
73
|
// Certain bank integrations require the ability to differentiate between permanentResident and Citizen
|
|
@@ -61,24 +76,44 @@ function transformApplicant(applicant) {
|
|
|
61
76
|
// If citizen this field will be always added and value will be AU.
|
|
62
77
|
// @tsilva 21/11/19
|
|
63
78
|
if (value === public_applicant_1.ResidencyStatus.AustralianCitizen) {
|
|
64
|
-
(0, lodash_1.set)(partialApplication,
|
|
79
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, lixi_internal_request_2.CountryCodeList.Au);
|
|
65
80
|
}
|
|
66
81
|
break;
|
|
82
|
+
case 'countryOfBirth':
|
|
83
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`, enum_mappings_1.countryCodeMapping[value]);
|
|
84
|
+
break;
|
|
85
|
+
case 'citizenship':
|
|
86
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, enum_mappings_1.countryCodeMapping[value]);
|
|
87
|
+
break;
|
|
88
|
+
case 'title':
|
|
89
|
+
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.titleMapping[value]);
|
|
90
|
+
break;
|
|
67
91
|
case 'maritalDetails':
|
|
68
92
|
const id = (0, lodash_1.get)(value, 'applicantId');
|
|
69
93
|
if (id)
|
|
70
94
|
(0, lodash_1.set)(partialApplication, applicantMapping[key], id);
|
|
71
95
|
break;
|
|
72
96
|
case 'contact':
|
|
73
|
-
const
|
|
74
|
-
(0, lodash_1.
|
|
75
|
-
if (
|
|
76
|
-
(0, lodash_1.set)(partialApplication,
|
|
97
|
+
const emailAddress = (0, lodash_1.get)(value, 'emailAddress');
|
|
98
|
+
const mobileNumber = (0, lodash_1.get)(value, 'mobileNumber');
|
|
99
|
+
if (emailAddress) {
|
|
100
|
+
(0, lodash_1.set)(partialApplication, applicantMapping.email, emailAddress);
|
|
101
|
+
}
|
|
102
|
+
if (mobileNumber) {
|
|
103
|
+
(0, lodash_1.set)(partialApplication, applicantMapping.phone, mobileNumber.replace('+61', '0'));
|
|
77
104
|
}
|
|
78
105
|
break;
|
|
79
106
|
case 'dependants':
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.@UniqueID`, `${applicant.applicationId}-household`);
|
|
108
|
+
const dependants = value.map((dependant) => ({
|
|
109
|
+
'@Age': dependant.age,
|
|
110
|
+
'@UniqueID': dependant.id,
|
|
111
|
+
FinancialProvider: [
|
|
112
|
+
{
|
|
113
|
+
'@x_Party': applicantId,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
}));
|
|
82
117
|
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.Dependant`, dependants);
|
|
83
118
|
break;
|
|
84
119
|
default:
|
|
@@ -90,91 +125,3 @@ function transformApplicant(applicant) {
|
|
|
90
125
|
return partialApplication;
|
|
91
126
|
}
|
|
92
127
|
exports.transformApplicant = transformApplicant;
|
|
93
|
-
const contactMapping = {
|
|
94
|
-
emailAddress: 'EmailAddress.0.@Email',
|
|
95
|
-
mobileNumber: 'Mobile.@Number',
|
|
96
|
-
currentAddress: 'CurrentAddress',
|
|
97
|
-
previousAddresses: 'PreviousAddress',
|
|
98
|
-
priorAddress: 'PriorAddress',
|
|
99
|
-
mailingAddress: 'CurrentAddress.@x_MailingAddress',
|
|
100
|
-
postSettlementAddress: 'PostSettlementAddress',
|
|
101
|
-
};
|
|
102
|
-
/**
|
|
103
|
-
* Generates a LIXI contact from given contact.
|
|
104
|
-
*
|
|
105
|
-
* @param contact
|
|
106
|
-
* @param id
|
|
107
|
-
*/
|
|
108
|
-
function generateContact(contact, id) {
|
|
109
|
-
const lixiContact = {};
|
|
110
|
-
const lixiAddresses = [];
|
|
111
|
-
for (const [key, value] of Object.entries(contact)) {
|
|
112
|
-
if (contactMapping[key]) {
|
|
113
|
-
switch (key) {
|
|
114
|
-
case 'currentAddress':
|
|
115
|
-
{
|
|
116
|
-
const addressId = `${id}-current`;
|
|
117
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(value, addressId);
|
|
118
|
-
lixiAddresses.push(lixiAddress);
|
|
119
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
case 'postSettlementAddress':
|
|
123
|
-
{
|
|
124
|
-
const addressId = `${id}-postSettlement`;
|
|
125
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId);
|
|
126
|
-
lixiAddresses.push(lixiAddress);
|
|
127
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
128
|
-
}
|
|
129
|
-
break;
|
|
130
|
-
case 'mailingAddress':
|
|
131
|
-
{
|
|
132
|
-
const addressId = `${id}-mailing`;
|
|
133
|
-
const { lixiAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId);
|
|
134
|
-
lixiAddresses.push(lixiAddress);
|
|
135
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], addressId);
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
case 'previousAddresses':
|
|
139
|
-
{
|
|
140
|
-
const addressId = `${id}-previous`;
|
|
141
|
-
const previousAddresses = value.sort((lhs, rhs) => lhs.endDate.localeCompare(rhs.endDate));
|
|
142
|
-
const previousAddress = previousAddresses.pop();
|
|
143
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(previousAddress, addressId);
|
|
144
|
-
lixiAddresses.push(lixiAddress);
|
|
145
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress);
|
|
146
|
-
// PriorAddresses
|
|
147
|
-
previousAddresses.forEach((address, index) => {
|
|
148
|
-
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(address, `${id}-prior-${index}`);
|
|
149
|
-
lixiAddresses.push(lixiAddress);
|
|
150
|
-
(0, lodash_1.set)(lixiContact, `${contactMapping['priorAddress']}.${index}`, lixiContactAddress);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
break;
|
|
154
|
-
default:
|
|
155
|
-
(0, lodash_1.set)(lixiContact, contactMapping[key], value);
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return { lixiContact, lixiAddresses };
|
|
161
|
-
}
|
|
162
|
-
exports.generateContact = generateContact;
|
|
163
|
-
/**
|
|
164
|
-
* Generate dependants
|
|
165
|
-
*
|
|
166
|
-
* @param dependants
|
|
167
|
-
* @param id
|
|
168
|
-
*/
|
|
169
|
-
function generateDependants(dependants, id) {
|
|
170
|
-
return dependants.map((dependant) => ({
|
|
171
|
-
'@Age': dependant.age,
|
|
172
|
-
'@UniqueID': dependant.id,
|
|
173
|
-
FinancialProvider: [
|
|
174
|
-
{
|
|
175
|
-
'@x_Party': id,
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
exports.generateDependants = generateDependants;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Gender } from '../events/public-applicant';
|
|
2
|
+
import { GenderList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
3
|
+
export declare type ApplicantGenderMapping = {
|
|
4
|
+
[key in Gender]: GenderList;
|
|
5
|
+
};
|
|
6
|
+
export declare const applicantGenderMapping: ApplicantGenderMapping;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicantGenderMapping = void 0;
|
|
4
|
+
const public_applicant_1 = require("../events/public-applicant");
|
|
5
|
+
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request");
|
|
6
|
+
exports.applicantGenderMapping = {
|
|
7
|
+
[public_applicant_1.Gender.Female]: lixi_internal_request_1.GenderList.Female,
|
|
8
|
+
[public_applicant_1.Gender.Male]: lixi_internal_request_1.GenderList.Male,
|
|
9
|
+
[public_applicant_1.Gender.Undisclosed]: lixi_internal_request_1.GenderList.Undisclosed,
|
|
10
|
+
[public_applicant_1.Gender.Unknown]: lixi_internal_request_1.GenderList.Undisclosed,
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ApplicantTypeList } from '@lendi/integrations-credit-protocol/types/lixi-internal-request';
|
|
2
|
+
import { ApplicantType } from '../events/public-applicant';
|
|
3
|
+
export declare type ApplicantTypeMapping = {
|
|
4
|
+
[key in ApplicantType]: ApplicantTypeList;
|
|
5
|
+
};
|
|
6
|
+
export declare const applicantTypeMapping: ApplicantTypeMapping;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applicantTypeMapping = 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.applicantTypeMapping = {
|
|
7
|
+
[public_applicant_1.ApplicantType.Borrower]: lixi_internal_request_1.ApplicantTypeList.Borrower,
|
|
8
|
+
[public_applicant_1.ApplicantType.BorrowerAndGuarantor]: lixi_internal_request_1.ApplicantTypeList.BorrowerAndGuarantor,
|
|
9
|
+
[public_applicant_1.ApplicantType.Guarantor]: lixi_internal_request_1.ApplicantTypeList.Guarantor,
|
|
10
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Create
|
|
2
|
+
* Create or update.
|
|
3
3
|
*/
|
|
4
4
|
export interface PublicApplicant {
|
|
5
5
|
payload: Payload;
|
|
@@ -10,7 +10,9 @@ export interface PublicApplicant {
|
|
|
10
10
|
version: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* create
|
|
13
|
+
* create applicant payload
|
|
14
|
+
*
|
|
15
|
+
* update applicant payload. Entity shouldn't be updated.
|
|
14
16
|
*/
|
|
15
17
|
export interface Payload {
|
|
16
18
|
applicantType?: ApplicantType;
|
|
@@ -18,13 +20,8 @@ export interface Payload {
|
|
|
18
20
|
* uuid of application
|
|
19
21
|
*/
|
|
20
22
|
applicationId: string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* uuid of source applicant
|
|
24
|
-
*/
|
|
25
|
-
clonedFromApplicantId?: string;
|
|
23
|
+
cityOfBirth?: string;
|
|
26
24
|
contact?: Contact;
|
|
27
|
-
countryOfBirth?: Countries;
|
|
28
25
|
creditStatus?: CreditStatus;
|
|
29
26
|
/**
|
|
30
27
|
* uuid of customer
|
|
@@ -48,12 +45,8 @@ export interface Payload {
|
|
|
48
45
|
lastName?: string;
|
|
49
46
|
maritalDetails?: ApplicantKeyObject;
|
|
50
47
|
maritalStatus?: MaritalStatus;
|
|
51
|
-
meta
|
|
48
|
+
meta: ApplicantMeta;
|
|
52
49
|
middleName?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Mothers Maiden Name
|
|
55
|
-
*/
|
|
56
|
-
mothersMaidenName?: string;
|
|
57
50
|
residencyStatus?: ResidencyStatus;
|
|
58
51
|
title?: Title;
|
|
59
52
|
totalIncomeEstimate?: number;
|
|
@@ -63,6 +56,57 @@ export declare enum ApplicantType {
|
|
|
63
56
|
BorrowerAndGuarantor = "BORROWER_AND_GUARANTOR",
|
|
64
57
|
Guarantor = "GUARANTOR"
|
|
65
58
|
}
|
|
59
|
+
export interface Contact {
|
|
60
|
+
currentAddress?: CommonAddressProperties;
|
|
61
|
+
/**
|
|
62
|
+
* The applicant email
|
|
63
|
+
*/
|
|
64
|
+
emailAddress?: string;
|
|
65
|
+
/**
|
|
66
|
+
* applicant's mailing address being captured as part of funnels 5 (post product select)
|
|
67
|
+
*/
|
|
68
|
+
mailingAddress?: Address;
|
|
69
|
+
/**
|
|
70
|
+
* applicant's mobile number formatted in +611234567890
|
|
71
|
+
*/
|
|
72
|
+
mobileNumber?: string;
|
|
73
|
+
/**
|
|
74
|
+
* applicant's post settlement address being captured as part of funnels 5 (post product
|
|
75
|
+
* select)
|
|
76
|
+
*/
|
|
77
|
+
postSettlementAddress?: Address;
|
|
78
|
+
previousAddresses?: PreviousAddress[];
|
|
79
|
+
}
|
|
80
|
+
export interface CommonAddressProperties {
|
|
81
|
+
externalId?: string;
|
|
82
|
+
housingStatus?: HousingStatusList;
|
|
83
|
+
residentialAddress?: Address;
|
|
84
|
+
startDate?: string;
|
|
85
|
+
}
|
|
86
|
+
export declare enum HousingStatusList {
|
|
87
|
+
Boarding = "Boarding",
|
|
88
|
+
Caravan = "Caravan",
|
|
89
|
+
Other = "Other",
|
|
90
|
+
OwnHome = "Own Home",
|
|
91
|
+
OwnHomeMortgage = "Own Home Mortgage",
|
|
92
|
+
Renting = "Renting",
|
|
93
|
+
SuppliedByEmployer = "Supplied by Employer",
|
|
94
|
+
WithParents = "With Parents"
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* applicant's mailing address being captured as part of funnels 5 (post product select)
|
|
98
|
+
*
|
|
99
|
+
* applicant's post settlement address being captured as part of funnels 5 (post product
|
|
100
|
+
* select)
|
|
101
|
+
*/
|
|
102
|
+
export interface Address {
|
|
103
|
+
city?: string;
|
|
104
|
+
country?: Countries;
|
|
105
|
+
formatted?: string;
|
|
106
|
+
postcode?: string;
|
|
107
|
+
standard?: AddressStandard;
|
|
108
|
+
state?: string;
|
|
109
|
+
}
|
|
66
110
|
export declare enum Countries {
|
|
67
111
|
Afghanistan = "Afghanistan",
|
|
68
112
|
Albania = "Albania",
|
|
@@ -304,77 +348,10 @@ export declare enum Countries {
|
|
|
304
348
|
Zambia = "Zambia",
|
|
305
349
|
Zimbabwe = "Zimbabwe"
|
|
306
350
|
}
|
|
307
|
-
export interface Contact {
|
|
308
|
-
currentAddress?: CommonAddressProperties;
|
|
309
|
-
/**
|
|
310
|
-
* The applicant email
|
|
311
|
-
*/
|
|
312
|
-
emailAddress?: string;
|
|
313
|
-
/**
|
|
314
|
-
* applicant's mailing address being captured as part of funnels 5 (post product select)
|
|
315
|
-
*/
|
|
316
|
-
mailingAddress?: Address;
|
|
317
|
-
/**
|
|
318
|
-
* applicant's mobile number formatted in +611234567890
|
|
319
|
-
*/
|
|
320
|
-
mobileNumber?: string;
|
|
321
|
-
/**
|
|
322
|
-
* applicant's post settlement address being captured as part of funnels 5 (post product
|
|
323
|
-
* select)
|
|
324
|
-
*/
|
|
325
|
-
postSettlementAddress?: Address;
|
|
326
|
-
previousAddresses?: PreviousAddress[];
|
|
327
|
-
}
|
|
328
|
-
export interface CommonAddressProperties {
|
|
329
|
-
externalId?: string;
|
|
330
|
-
housingStatus?: HousingStatusList;
|
|
331
|
-
residentialAddress?: Address;
|
|
332
|
-
startDate?: string;
|
|
333
|
-
}
|
|
334
|
-
export declare enum HousingStatusList {
|
|
335
|
-
Boarding = "Boarding",
|
|
336
|
-
Caravan = "Caravan",
|
|
337
|
-
Other = "Other",
|
|
338
|
-
OwnHome = "Own Home",
|
|
339
|
-
OwnHomeMortgage = "Own Home Mortgage",
|
|
340
|
-
Renting = "Renting",
|
|
341
|
-
SuppliedByEmployer = "Supplied by Employer",
|
|
342
|
-
WithParents = "With Parents"
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* applicant's mailing address being captured as part of funnels 5 (post product select)
|
|
346
|
-
*
|
|
347
|
-
* applicant's post settlement address being captured as part of funnels 5 (post product
|
|
348
|
-
* select)
|
|
349
|
-
*/
|
|
350
|
-
export interface Address {
|
|
351
|
-
city?: string;
|
|
352
|
-
country?: Countries;
|
|
353
|
-
formatted?: string;
|
|
354
|
-
postcode?: string;
|
|
355
|
-
standard?: AddressStandard;
|
|
356
|
-
state?: string;
|
|
357
|
-
}
|
|
358
351
|
export interface AddressStandard {
|
|
359
|
-
/**
|
|
360
|
-
* The building name
|
|
361
|
-
*/
|
|
362
|
-
buildingName?: string;
|
|
363
|
-
/**
|
|
364
|
-
* Postal address, usually a PO Box or Locked Bag
|
|
365
|
-
*/
|
|
366
|
-
deliveryAddress?: string;
|
|
367
352
|
level?: string;
|
|
368
|
-
/**
|
|
369
|
-
* The lot number
|
|
370
|
-
*/
|
|
371
|
-
lotSection?: string;
|
|
372
353
|
streetName?: string;
|
|
373
354
|
streetNumber?: string;
|
|
374
|
-
/**
|
|
375
|
-
* The street suffix
|
|
376
|
-
*/
|
|
377
|
-
streetSuffix?: string;
|
|
378
355
|
streetType?: string;
|
|
379
356
|
unit?: string;
|
|
380
357
|
}
|
|
@@ -422,7 +399,8 @@ export declare enum EmploymentType {
|
|
|
422
399
|
*/
|
|
423
400
|
export declare enum Entity {
|
|
424
401
|
Company = "COMPANY",
|
|
425
|
-
Person = "PERSON"
|
|
402
|
+
Person = "PERSON",
|
|
403
|
+
Trust = "TRUST"
|
|
426
404
|
}
|
|
427
405
|
export declare enum Gender {
|
|
428
406
|
Female = "FEMALE",
|
|
@@ -470,7 +448,7 @@ export declare enum MaritalStatus {
|
|
|
470
448
|
*/
|
|
471
449
|
export interface ApplicantMeta {
|
|
472
450
|
/**
|
|
473
|
-
* uuid of user who made the action (create/update
|
|
451
|
+
* uuid of user who made the action (create/update)
|
|
474
452
|
*/
|
|
475
453
|
actionedBy: string;
|
|
476
454
|
/**
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Type = exports.Title = exports.ResidencyStatus = exports.ActionedByRole = exports.MaritalStatus = exports.InvitationStatus = exports.GuarantorRelationshipToBorrowerType = exports.Gender = exports.Entity = exports.EmploymentType = exports.CreditStatus = exports.
|
|
3
|
+
exports.Type = exports.Title = exports.ResidencyStatus = exports.ActionedByRole = exports.MaritalStatus = exports.InvitationStatus = exports.GuarantorRelationshipToBorrowerType = exports.Gender = exports.Entity = exports.EmploymentType = exports.CreditStatus = exports.Countries = exports.HousingStatusList = exports.ApplicantType = void 0;
|
|
4
4
|
var ApplicantType;
|
|
5
5
|
(function (ApplicantType) {
|
|
6
6
|
ApplicantType["Borrower"] = "BORROWER";
|
|
7
7
|
ApplicantType["BorrowerAndGuarantor"] = "BORROWER_AND_GUARANTOR";
|
|
8
8
|
ApplicantType["Guarantor"] = "GUARANTOR";
|
|
9
9
|
})(ApplicantType = exports.ApplicantType || (exports.ApplicantType = {}));
|
|
10
|
+
var HousingStatusList;
|
|
11
|
+
(function (HousingStatusList) {
|
|
12
|
+
HousingStatusList["Boarding"] = "Boarding";
|
|
13
|
+
HousingStatusList["Caravan"] = "Caravan";
|
|
14
|
+
HousingStatusList["Other"] = "Other";
|
|
15
|
+
HousingStatusList["OwnHome"] = "Own Home";
|
|
16
|
+
HousingStatusList["OwnHomeMortgage"] = "Own Home Mortgage";
|
|
17
|
+
HousingStatusList["Renting"] = "Renting";
|
|
18
|
+
HousingStatusList["SuppliedByEmployer"] = "Supplied by Employer";
|
|
19
|
+
HousingStatusList["WithParents"] = "With Parents";
|
|
20
|
+
})(HousingStatusList = exports.HousingStatusList || (exports.HousingStatusList = {}));
|
|
10
21
|
var Countries;
|
|
11
22
|
(function (Countries) {
|
|
12
23
|
Countries["Afghanistan"] = "Afghanistan";
|
|
@@ -249,17 +260,6 @@ var Countries;
|
|
|
249
260
|
Countries["Zambia"] = "Zambia";
|
|
250
261
|
Countries["Zimbabwe"] = "Zimbabwe";
|
|
251
262
|
})(Countries = exports.Countries || (exports.Countries = {}));
|
|
252
|
-
var HousingStatusList;
|
|
253
|
-
(function (HousingStatusList) {
|
|
254
|
-
HousingStatusList["Boarding"] = "Boarding";
|
|
255
|
-
HousingStatusList["Caravan"] = "Caravan";
|
|
256
|
-
HousingStatusList["Other"] = "Other";
|
|
257
|
-
HousingStatusList["OwnHome"] = "Own Home";
|
|
258
|
-
HousingStatusList["OwnHomeMortgage"] = "Own Home Mortgage";
|
|
259
|
-
HousingStatusList["Renting"] = "Renting";
|
|
260
|
-
HousingStatusList["SuppliedByEmployer"] = "Supplied by Employer";
|
|
261
|
-
HousingStatusList["WithParents"] = "With Parents";
|
|
262
|
-
})(HousingStatusList = exports.HousingStatusList || (exports.HousingStatusList = {}));
|
|
263
263
|
/**
|
|
264
264
|
* current credit status of the applicant (Customer declared value)
|
|
265
265
|
*/
|
|
@@ -286,6 +286,7 @@ var Entity;
|
|
|
286
286
|
(function (Entity) {
|
|
287
287
|
Entity["Company"] = "COMPANY";
|
|
288
288
|
Entity["Person"] = "PERSON";
|
|
289
|
+
Entity["Trust"] = "TRUST";
|
|
289
290
|
})(Entity = exports.Entity || (exports.Entity = {}));
|
|
290
291
|
var Gender;
|
|
291
292
|
(function (Gender) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare enum ErrorType {
|
|
2
|
+
ApplicationNotFound = "ApplicationNotFound",
|
|
3
|
+
BaseError = "BaseError",
|
|
4
|
+
DatabaseConditionalWriteError = "DatabaseConditionalWriteError",
|
|
5
|
+
DatabaseError = "DatabaseError",
|
|
6
|
+
Errors = "Errors",
|
|
7
|
+
InternalError = "InternalError",
|
|
8
|
+
InvalidApplication = "InvalidApplication",
|
|
9
|
+
InvalidEvent = "InvalidEvent",
|
|
10
|
+
InvalidEventNoApplicationId = "InvalidEventNoApplicationId",
|
|
11
|
+
InvalidEventNotCritical = "InvalidEventNotCritical",
|
|
12
|
+
OwnershipOutOfBounds = "OwnershipOutOfBounds",
|
|
13
|
+
ResourceNotFound = "ResourceNotFound"
|
|
14
|
+
}
|
|
15
|
+
export declare class BaseError extends Error {
|
|
16
|
+
origin: string;
|
|
17
|
+
path: string[];
|
|
18
|
+
type: ErrorType;
|
|
19
|
+
context: object;
|
|
20
|
+
constructor(message: string, path: string[], origin: string, context?: object);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* InvalidEvent occurs when an incorrect/damaged event has been consumed and
|
|
24
|
+
* found to be invalid against its related schema.
|
|
25
|
+
*/
|
|
26
|
+
export declare class InvalidEvent extends BaseError {
|
|
27
|
+
constructor(message: string, path?: string[], origin?: string, context?: object);
|
|
28
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidEvent = exports.BaseError = exports.ErrorType = void 0;
|
|
4
|
+
var ErrorType;
|
|
5
|
+
(function (ErrorType) {
|
|
6
|
+
ErrorType["ApplicationNotFound"] = "ApplicationNotFound";
|
|
7
|
+
ErrorType["BaseError"] = "BaseError";
|
|
8
|
+
ErrorType["DatabaseConditionalWriteError"] = "DatabaseConditionalWriteError";
|
|
9
|
+
ErrorType["DatabaseError"] = "DatabaseError";
|
|
10
|
+
ErrorType["Errors"] = "Errors";
|
|
11
|
+
ErrorType["InternalError"] = "InternalError";
|
|
12
|
+
ErrorType["InvalidApplication"] = "InvalidApplication";
|
|
13
|
+
ErrorType["InvalidEvent"] = "InvalidEvent";
|
|
14
|
+
ErrorType["InvalidEventNoApplicationId"] = "InvalidEventNoApplicationId";
|
|
15
|
+
ErrorType["InvalidEventNotCritical"] = "InvalidEventNotCritical";
|
|
16
|
+
ErrorType["OwnershipOutOfBounds"] = "OwnershipOutOfBounds";
|
|
17
|
+
ErrorType["ResourceNotFound"] = "ResourceNotFound";
|
|
18
|
+
})(ErrorType = exports.ErrorType || (exports.ErrorType = {}));
|
|
19
|
+
class BaseError extends Error {
|
|
20
|
+
/* istanbul ignore next */
|
|
21
|
+
constructor(message, path = [], origin, context = {}) {
|
|
22
|
+
super(message);
|
|
23
|
+
Object.setPrototypeOf(this, BaseError.prototype);
|
|
24
|
+
this.type = ErrorType.BaseError;
|
|
25
|
+
this.path = path;
|
|
26
|
+
this.origin = origin;
|
|
27
|
+
this.context = context;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.BaseError = BaseError;
|
|
31
|
+
/**
|
|
32
|
+
* InvalidEvent occurs when an incorrect/damaged event has been consumed and
|
|
33
|
+
* found to be invalid against its related schema.
|
|
34
|
+
*/
|
|
35
|
+
class InvalidEvent extends BaseError {
|
|
36
|
+
/* istanbul ignore next */
|
|
37
|
+
constructor(message, path, origin, context) {
|
|
38
|
+
super(message, path, origin, context);
|
|
39
|
+
Object.setPrototypeOf(this, InvalidEvent.prototype);
|
|
40
|
+
this.type = ErrorType.InvalidEvent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.InvalidEvent = InvalidEvent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
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",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"url": "git+ssh://git@bitbucket.org/lendi-dev/integrations-shared-packages.git"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@lendi/integrations-credit-protocol": "^1.
|
|
25
|
-
"@lendi/integrations-protocol": "
|
|
24
|
+
"@lendi/integrations-credit-protocol": "^1.18.0",
|
|
25
|
+
"@lendi/integrations-protocol": "2.7.0",
|
|
26
26
|
"@lendi/logging": "^1.0.0",
|
|
27
27
|
"clean-deep": "^3.4.0",
|
|
28
28
|
"date-fns": "2.19.0",
|