@lendi/integrations-transform 1.1.5 → 1.2.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/lib/utils/is-income-type.d.ts +12 -13
- package/lib/utils/is-income-type.js +28 -26
- package/package.json +1 -1
|
@@ -39,22 +39,22 @@ export declare function isOtherIncomeWithDesc(incomeType: string): boolean;
|
|
|
39
39
|
* @returns {boolean} True if either Full Doc or Low Doc Self Employed Income.
|
|
40
40
|
*/
|
|
41
41
|
export declare function isFullDocOrLowDocIncome(incomeType: IncomeType): boolean;
|
|
42
|
-
declare type EmploymentTypes = 'PAYG' | 'SelfEmployed' | 'NotEmployed';
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @param {
|
|
47
|
-
* @
|
|
43
|
+
* Checks if there is some employment for the applicant that has the same employment id as the employment id in the income event
|
|
44
|
+
*
|
|
45
|
+
* @param {PersonApplicant} applicant - An applicant
|
|
46
|
+
* @param {string} employmentId - Employment id being searched for
|
|
47
|
+
* @returns {boolean} - Whether or not the applicant has an employment with matching employmentId
|
|
48
48
|
*/
|
|
49
|
-
export declare
|
|
49
|
+
export declare const hasMatchingEmploymentId: (applicant: PersonApplicant, employmentId: string) => boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {string}
|
|
55
|
-
* @returns {string | undefined}
|
|
51
|
+
* Gets the applicant id using the employment id
|
|
52
|
+
*
|
|
53
|
+
* @param {PersonApplicant[]} applicants - An array of applicants.
|
|
54
|
+
* @param {string} employmentId - Employment ID
|
|
55
|
+
* @returns {string | undefined} - Applicant id or undefined
|
|
56
56
|
*/
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function getApplicantIdFromEmploymentId(applicants: PersonApplicant[], employmentId: string): string | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* @description Get an applicantId from the event or the applicants.
|
|
60
60
|
* @param {Income} income Income.
|
|
@@ -69,4 +69,3 @@ export declare function getApplicantId({ percentOwned, employmentId }: Income, a
|
|
|
69
69
|
* @returns {0 | < 0 | > 0} Returns a number to be used for sorting income.
|
|
70
70
|
*/
|
|
71
71
|
export declare const sortBusinessIncome: ({ year: yearA }: IncomeBusinessDetails, { year: yearB }: IncomeBusinessDetails) => number;
|
|
72
|
-
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.sortBusinessIncome = exports.getApplicantId = exports.
|
|
3
|
+
exports.sortBusinessIncome = exports.getApplicantId = exports.getApplicantIdFromEmploymentId = exports.hasMatchingEmploymentId = exports.isFullDocOrLowDocIncome = exports.isOtherIncomeWithDesc = exports.isOtherIncome = exports.isRentalIncome = exports.isSelfEmployedIncome = exports.isPaygIncome = exports.otherIncomeList = exports.PAYGList = exports.descriptionOtherIncomeTypes = void 0;
|
|
4
4
|
var lodash_1 = require("lodash");
|
|
5
5
|
var public_income_1 = require("../types/events/public-income");
|
|
6
6
|
exports.descriptionOtherIncomeTypes = [
|
|
@@ -83,32 +83,37 @@ function isFullDocOrLowDocIncome(incomeType) {
|
|
|
83
83
|
}
|
|
84
84
|
exports.isFullDocOrLowDocIncome = isFullDocOrLowDocIncome;
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param {
|
|
89
|
-
* @
|
|
86
|
+
* Checks if there is some employment for the applicant that has the same employment id as the employment id in the income event
|
|
87
|
+
*
|
|
88
|
+
* @param {PersonApplicant} applicant - An applicant
|
|
89
|
+
* @param {string} employmentId - Employment id being searched for
|
|
90
|
+
* @returns {boolean} - Whether or not the applicant has an employment with matching employmentId
|
|
90
91
|
*/
|
|
91
|
-
function
|
|
92
|
-
return (
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
var hasMatchingEmploymentId = function (applicant, employmentId) {
|
|
93
|
+
return (applicant.Employment || []).some(function (employment) {
|
|
94
|
+
var id = (0, lodash_1.get)(employment, 'PAYG.@UniqueID') ||
|
|
95
|
+
(0, lodash_1.get)(employment, 'SelfEmployed.@UniqueID') ||
|
|
96
|
+
(0, lodash_1.get)(employment, 'NotEmployed.@UniqueID');
|
|
97
|
+
return id === employmentId;
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
exports.hasMatchingEmploymentId = hasMatchingEmploymentId;
|
|
95
101
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* @param {
|
|
99
|
-
* @param {string}
|
|
100
|
-
* @returns {string | undefined}
|
|
102
|
+
* Gets the applicant id using the employment id
|
|
103
|
+
*
|
|
104
|
+
* @param {PersonApplicant[]} applicants - An array of applicants.
|
|
105
|
+
* @param {string} employmentId - Employment ID
|
|
106
|
+
* @returns {string | undefined} - Applicant id or undefined
|
|
101
107
|
*/
|
|
102
|
-
function
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
return applicant['@UniqueID'];
|
|
108
|
+
function getApplicantIdFromEmploymentId(applicants, employmentId) {
|
|
109
|
+
var applicantId;
|
|
110
|
+
if (applicants && employmentId) {
|
|
111
|
+
var applicant = applicants.find(function (applicant) { return (0, exports.hasMatchingEmploymentId)(applicant, employmentId); });
|
|
112
|
+
applicantId = applicant === null || applicant === void 0 ? void 0 : applicant['@UniqueID'];
|
|
108
113
|
}
|
|
109
|
-
return
|
|
114
|
+
return applicantId;
|
|
110
115
|
}
|
|
111
|
-
exports.
|
|
116
|
+
exports.getApplicantIdFromEmploymentId = getApplicantIdFromEmploymentId;
|
|
112
117
|
/**
|
|
113
118
|
* @description Get an applicantId from the event or the applicants.
|
|
114
119
|
* @param {Income} income Income.
|
|
@@ -118,10 +123,7 @@ exports.getStoredApplicantId = getStoredApplicantId;
|
|
|
118
123
|
function getApplicantId(_a, applicants) {
|
|
119
124
|
var percentOwned = _a.percentOwned, employmentId = _a.employmentId;
|
|
120
125
|
if (applicants === void 0) { applicants = []; }
|
|
121
|
-
return (
|
|
122
|
-
getStoredApplicantId(applicants, employmentId, 'PAYG') ||
|
|
123
|
-
getStoredApplicantId(applicants, employmentId, 'SelfEmployed') ||
|
|
124
|
-
getStoredApplicantId(applicants, employmentId, 'NotEmployed'));
|
|
126
|
+
return (0, lodash_1.get)(percentOwned, 'owners[0].applicantId') || getApplicantIdFromEmploymentId(applicants, employmentId);
|
|
125
127
|
}
|
|
126
128
|
exports.getApplicantId = getApplicantId;
|
|
127
129
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lendi/integrations-transform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.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",
|