@lendi/integrations-transform
Advanced tools
Comparing version 1.6.6 to 1.6.7-beta.0
{ | ||
"definitions": { | ||
"Payload": { | ||
"$ref": "#/definitions/payload" | ||
"payload": { | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/applicantDefinition" | ||
}, | ||
{ | ||
"$ref": "#/definitions/deleteApplicantDefinition" | ||
} | ||
] | ||
}, | ||
@@ -44,3 +52,4 @@ "id": { | ||
"type": "number", | ||
"minimum": 0 | ||
"minimum": 0, | ||
"maximum": 100 | ||
}, | ||
@@ -65,32 +74,4 @@ "isAddedOnThisApplicant": { | ||
"enum": ["EMPLOYEE", "SELF_EMPLOYED", "UNKNOWN"], | ||
"description": "applicant's employment type" | ||
"description": "LEGACY. DO NOT USE. Historic events only - applicant's employment type. Use the employment events instead!" | ||
}, | ||
"guarantorRelationshipToBorrowerApplicantId": { | ||
"$ref": "#/definitions/id", | ||
"description": "Applicant Id of borrower that has relationship with guarantor." | ||
}, | ||
"guarantorRelationshipToBorrowerType": { | ||
"enum": ["Father", "Mother", "Spouse", "Brother", "Sister", "Son", "Daughter", "Other Relative", "Other"], | ||
"description": "The relationship between borrower and guarantor." | ||
}, | ||
"guarantorRelationshipToBorrowerTypeOther": { | ||
"type": "string", | ||
"description": "Description of relationship between borrower and guarantor when other." | ||
}, | ||
"guarantorRelationshipToBorrowerDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"applicantId": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerApplicantId" | ||
}, | ||
"type": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerType" | ||
}, | ||
"typeOther": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerTypeOther" | ||
} | ||
}, | ||
"required": ["applicantId", "type"] | ||
}, | ||
"isPrimaryApplicant": { | ||
@@ -126,12 +107,17 @@ "type": "boolean" | ||
}, | ||
"name": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 256 | ||
}, | ||
"firstName": { | ||
"type": "string", | ||
"$ref": "#/definitions/name", | ||
"description": "customer's first name" | ||
}, | ||
"middleName": { | ||
"type": "string", | ||
"$ref": "#/definitions/name", | ||
"description": "customer's middle name" | ||
}, | ||
"lastName": { | ||
"type": "string", | ||
"$ref": "#/definitions/name", | ||
"description": "customer's last name" | ||
@@ -405,3 +391,3 @@ }, | ||
}, | ||
"AustralianStates": { | ||
"australianStates": { | ||
"example": "NSW", | ||
@@ -416,3 +402,3 @@ "type": "string", | ||
}, | ||
"AddressStandard": { | ||
"addressStandard": { | ||
"type": "object", | ||
@@ -423,3 +409,5 @@ "additionalProperties": false, | ||
"description": "The building name", | ||
"type": "string" | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 512 | ||
}, | ||
@@ -429,7 +417,10 @@ "deliveryAddress": { | ||
"type": "string", | ||
"example": "PO Box 1" | ||
"example": "PO Box 1", | ||
"maxLength": 512 | ||
}, | ||
"lotSection": { | ||
"description": "The lot number", | ||
"type": "string" | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 512 | ||
}, | ||
@@ -445,3 +436,4 @@ "streetName": { | ||
"type": "string", | ||
"example": "North" | ||
"example": "North", | ||
"maxLength": 128 | ||
}, | ||
@@ -464,3 +456,4 @@ "streetType": { | ||
"postcode": { | ||
"type": "string" | ||
"type": "string", | ||
"maxLength": 32 | ||
}, | ||
@@ -472,3 +465,3 @@ "state": { | ||
{ | ||
"$ref": "#/definitions/AustralianStates" | ||
"$ref": "#/definitions/australianStates" | ||
}, | ||
@@ -490,3 +483,3 @@ { | ||
"standard": { | ||
"$ref": "#/definitions/AddressStandard" | ||
"$ref": "#/definitions/addressStandard" | ||
} | ||
@@ -567,6 +560,2 @@ } | ||
}, | ||
"entity": { | ||
"enum": ["PERSON", "COMPANY"], | ||
"description": "applicant's entity. For a person applicant this is 'PERSON'" | ||
}, | ||
"isFirstHomeBuyer": { | ||
@@ -576,6 +565,67 @@ "type": "boolean", | ||
}, | ||
"payload": { | ||
"guarantorRelationshipToBorrowerApplicantId": { | ||
"$ref": "#/definitions/id", | ||
"description": "Applicant Id of borrower that has relationship with guarantor." | ||
}, | ||
"guarantorRelationshipToBorrowerType": { | ||
"enum": ["Father", "Mother", "Spouse", "Brother", "Sister", "Son", "Daughter", "Other Relative", "Other"], | ||
"description": "The relationship between borrower and guarantor." | ||
}, | ||
"guarantorRelationshipToBorrowerTypeOther": { | ||
"type": "string", | ||
"description": "Description of relationship between borrower and guarantor when other." | ||
}, | ||
"guarantorRelationshipToBorrowerDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"applicantId": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerApplicantId" | ||
}, | ||
"type": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerType" | ||
}, | ||
"typeOther": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerTypeOther" | ||
} | ||
}, | ||
"required": ["applicantId", "type"] | ||
}, | ||
"cityOfBirth": { | ||
"type": "string", | ||
"example": "Sydney" | ||
}, | ||
"industryCode": { | ||
"type": "string", | ||
"pattern": "^\\d{4}$", | ||
"description": "ANZSIC business code lookup " | ||
}, | ||
"isPassiveEntity": { | ||
"type": "boolean", | ||
"description": "If the entity's primary business activity is investing" | ||
}, | ||
"legalEntities": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"maximum": 1000000 | ||
}, | ||
"description": { | ||
"type": "string", | ||
"minLength": 1, | ||
"maxLength": 1024 | ||
}, | ||
"numOfMonths": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 1200 | ||
}, | ||
"yesNoIntend": { | ||
"type": "string", | ||
"enum": ["Yes", "No", "Intend"] | ||
}, | ||
"personApplicantDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
@@ -600,2 +650,6 @@ "$ref": "#/definitions/id", | ||
}, | ||
"entity": { | ||
"enum": ["PERSON"], | ||
"description": "applicant's entity. For a person applicant this is 'PERSON'" | ||
}, | ||
"applicantType": { | ||
@@ -607,11 +661,5 @@ "$ref": "#/definitions/applicantType" | ||
}, | ||
"entity": { | ||
"$ref": "#/definitions/entity" | ||
}, | ||
"employmentType": { | ||
"$ref": "#/definitions/employmentType" | ||
}, | ||
"guarantorRelationshipToBorrower": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerDefinition" | ||
}, | ||
"isPrimaryApplicant": { | ||
@@ -665,2 +713,5 @@ "$ref": "#/definitions/isPrimaryApplicant" | ||
}, | ||
"cityOfBirth": { | ||
"$ref": "#/definitions/cityOfBirth" | ||
}, | ||
"citizenship": { | ||
@@ -675,26 +726,321 @@ "$ref": "#/definitions/countries" | ||
"$ref": "#/definitions/isFirstHomeBuyer" | ||
}, | ||
"guarantorRelationshipToBorrower": { | ||
"$ref": "#/definitions/guarantorRelationshipToBorrowerDefinition" | ||
} | ||
}, | ||
"required": ["id", "applicationId", "customerId"], | ||
"description": "create/update applicant payload" | ||
"required": ["id", "applicationId", "customerId", "meta", "entity", "applicantType"], | ||
"description": "applicant payload." | ||
}, | ||
"trustType": { | ||
"enum": [ | ||
"CASH_MANAGEMENT_TRUST", | ||
"DISCRETIONARY_TRUST", | ||
"FIXED", | ||
"HYBRID", | ||
"SUPERANNUATION_TRUSTS", | ||
"UNIT", | ||
"OTHER" | ||
] | ||
}, | ||
"trustApplicantDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"$ref": "#/definitions/id" | ||
}, | ||
"applicationId": { | ||
"$ref": "#/definitions/id" | ||
}, | ||
"meta": { | ||
"$ref": "#/definitions/applicantMeta" | ||
}, | ||
"applicantType": { | ||
"$ref": "#/definitions/applicantType" | ||
}, | ||
"entity": { | ||
"enum": ["TRUST"], | ||
"description": "applicant's entity. For a trust applicant this is 'TRUST'" | ||
}, | ||
"trustName": { | ||
"$ref": "#/definitions/name" | ||
}, | ||
"trustType": { | ||
"$ref": "#/definitions/trustType" | ||
}, | ||
"registeredDate": { | ||
"$ref": "#/definitions/date" | ||
}, | ||
"registeredCountry": { | ||
"$ref": "#/definitions/countries" | ||
}, | ||
"registeredAddress": { | ||
"$ref": "#/definitions/address" | ||
}, | ||
"mailingAddress": { | ||
"$ref": "#/definitions/address" | ||
}, | ||
"industryCode": { | ||
"$ref": "#/definitions/industryCode" | ||
}, | ||
"isPassiveEntity": { | ||
"$ref": "#/definitions/isPassiveEntity" | ||
} | ||
}, | ||
"required": ["id", "applicationId", "meta", "entity", "applicantType"], | ||
"description": "trust payload." | ||
}, | ||
"abn": { | ||
"type": "string", | ||
"pattern": "^\\d{11}$", | ||
"description": "Company ABN Number" | ||
}, | ||
"acn": { | ||
"type": "string", | ||
"pattern": "^\\d{9}$", | ||
"description": "Australian Company Number" | ||
}, | ||
"yearsOfTrading": { | ||
"type": "string", | ||
"enum": ["1", "2", "3", "4", "5", "5-10", ">10"] | ||
}, | ||
"companyType": { | ||
"enum": ["INCORPORATED", "LTD", "NL", "PTY_LTD"] | ||
}, | ||
"companyStructure": { | ||
"enum": ["SOLE_TRADER", "PARTNERSHIP", "CORPORATION", "TRUST"] | ||
}, | ||
"companyApplicantDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"$ref": "#/definitions/id", | ||
"description": "uuid of applicant" | ||
}, | ||
"applicationId": { | ||
"$ref": "#/definitions/id", | ||
"description": "uuid of application" | ||
}, | ||
"meta": { | ||
"$ref": "#/definitions/applicantMeta" | ||
}, | ||
"applicantType": { | ||
"$ref": "#/definitions/applicantType" | ||
}, | ||
"entity": { | ||
"enum": ["COMPANY"], | ||
"description": "applicant's entity. For a company applicant this is 'COMPANY'" | ||
}, | ||
"companyName": { | ||
"$ref": "#/definitions/name" | ||
}, | ||
"companyType": { | ||
"$ref": "#/definitions/companyType" | ||
}, | ||
"companyStructure": { | ||
"$ref": "#/definitions/companyStructure" | ||
}, | ||
"industryCode": { | ||
"$ref": "#/definitions/industryCode" | ||
}, | ||
"isDiversified": { | ||
"type": "boolean" | ||
}, | ||
"legalEntitiesInGroup": { | ||
"$ref": "#/definitions/legalEntities" | ||
}, | ||
"isPassiveEntity": { | ||
"$ref": "#/definitions/isPassiveEntity" | ||
}, | ||
"isCommercialRelationship": { | ||
"type": "boolean" | ||
}, | ||
"abn": { | ||
"$ref": "#/definitions/abn" | ||
}, | ||
"acn": { | ||
"$ref": "#/definitions/acn" | ||
}, | ||
"registeredState": { | ||
"$ref": "#/definitions/australianStates" | ||
}, | ||
"registeredDate": { | ||
"$ref": "#/definitions/date" | ||
}, | ||
"yearsOfTrading": { | ||
"$ref": "#/definitions/yearsOfTrading" | ||
}, | ||
"currentLender": { | ||
"$ref": "#/definitions/name" | ||
}, | ||
"legalEntitiesWithCurrentLender": { | ||
"$ref": "#/definitions/legalEntities" | ||
}, | ||
"monthsWithCurrentLender": { | ||
"$ref": "#/definitions/numOfMonths" | ||
}, | ||
"branch": { | ||
"$ref": "#/definitions/name" | ||
}, | ||
"hasMoreThan25PercentBusinessWithOneCustomer": { | ||
"type": "boolean", | ||
"description": "Company doing more than 25% of business with one customer or supplier" | ||
}, | ||
"moreThan25PercentBusinessWithOneCustomerDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"hasOutstandingTax": { | ||
"type": "boolean" | ||
}, | ||
"outstandingTaxDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"isPrincipalPlaceOfBusinessLeased": { | ||
"type": "boolean", | ||
"description": "Is the principal place of business leased" | ||
}, | ||
"principalPlaceOfBusinessLeasedDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"doesTermLoanNeed100PercentFunding": { | ||
"type": "boolean", | ||
"description": "100% funding required for Term Loans" | ||
}, | ||
"termLoanNeed100PercentFundingDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"isActingAsFranchise": { | ||
"$ref": "#/definitions/yesNoIntend" | ||
}, | ||
"actingAsFranchiseDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"isWorkingInImportExport": { | ||
"$ref": "#/definitions/yesNoIntend" | ||
}, | ||
"workingInImportExportDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"isInvestingInProperty": { | ||
"$ref": "#/definitions/yesNoIntend" | ||
}, | ||
"investingInPropertyDetails": { | ||
"$ref": "#/definitions/description" | ||
}, | ||
"hasGoodConduct": { | ||
"type": "boolean", | ||
"description": "The applicant has not been over the credit limit, in arrears or in hardship in relation to any existing credit or other fixed expenses" | ||
}, | ||
"wasBankruptOrInsolvent": { | ||
"type": "boolean", | ||
"description": "Have you been: bankrupt or insolvent, petitioned or aware of anyone petitioning you for bankruptcy, advised to seek bankruptcy, or associated with a company that was or threatened to be placed into administration?" | ||
}, | ||
"hasPastOrCurrentDebts": { | ||
"type": "boolean", | ||
"description": "Have you or a company with which you are associated had any past or current debts that were or are in default of the payment arrangement?" | ||
}, | ||
"hadRepaymentDifficultyOrLegalProceedings": { | ||
"type": "boolean", | ||
"description": "Have you had any difficulty in meeting your existing loan repayments, or had any financial judgments or legal proceedings, in the past two years?" | ||
}, | ||
"isUSCitizenOrResident": { | ||
"type": "boolean", | ||
"description": "Is the applicant a US citizen or resident for US tax purposes?" | ||
}, | ||
"hadLatePaymentsOrArrearsOrAdverseCreditHistory": { | ||
"type": "boolean", | ||
"description": "Has the applicant had any late payments, loan arrears or adverse credit history such as current or prior defaults or bankruptcies?" | ||
} | ||
}, | ||
"required": ["id", "applicationId", "meta", "entity", "applicantType"], | ||
"description": "company payload." | ||
}, | ||
"applicantDefinition": { | ||
"type": "object", | ||
"oneOf": [ | ||
{ | ||
"$ref": "#/definitions/trustApplicantDefinition" | ||
}, | ||
{ | ||
"$ref": "#/definitions/companyApplicantDefinition" | ||
}, | ||
{ | ||
"$ref": "#/definitions/personApplicantDefinition" | ||
} | ||
], | ||
"discriminator": { | ||
"propertyName": "entity" | ||
} | ||
}, | ||
"deleteApplicantDefinition": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"format": "uuid" | ||
}, | ||
"applicationId": { | ||
"$ref": "#/definitions/id", | ||
"description": "uuid of application" | ||
}, | ||
"meta": { | ||
"$ref": "#/definitions/applicantMeta" | ||
} | ||
}, | ||
"required": ["id", "applicationId", "meta"] | ||
} | ||
}, | ||
"type": "object", | ||
"title": "The applicant event schema", | ||
"title": "The applicant-person/company/trust event schema", | ||
"description": "Create, update or delete. UpdatePrimaryApplicant is DEPRECATED", | ||
"additionalProperties": false, | ||
"properties": { | ||
"version": { | ||
"type": "string", | ||
"description": "schema version" | ||
"allOf": [ | ||
{ | ||
"additionalProperties": false, | ||
"properties": { | ||
"version": { | ||
"type": "string", | ||
"description": "schema version" | ||
}, | ||
"type": { | ||
"type": "string", | ||
"enum": ["DeleteApplicant", "UpdateApplicant", "CreateApplicant"] | ||
}, | ||
"payload": { | ||
"$ref": "#/definitions/payload" | ||
} | ||
}, | ||
"required": ["version", "payload", "type"] | ||
}, | ||
"type": { | ||
"type": "string", | ||
"enum": ["UpdateApplicant", "CreateApplicant"] | ||
{ | ||
"if": { | ||
"properties": { "type": { "const": "DeleteApplicant" } } | ||
}, | ||
"then": { | ||
"properties": { "payload": { "$ref": "#/definitions/deleteApplicantDefinition" } } | ||
} | ||
}, | ||
"payload": { | ||
"$ref": "#/definitions/Payload" | ||
{ | ||
"if": { | ||
"properties": { "type": { "const": "UpdateApplicant" } } | ||
}, | ||
"then": { | ||
"properties": { "payload": { "$ref": "#/definitions/applicantDefinition" } } | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { "type": { "const": "CreateApplicant" } } | ||
}, | ||
"then": { | ||
"properties": { "payload": { "$ref": "#/definitions/applicantDefinition" } } | ||
} | ||
} | ||
}, | ||
"required": ["version", "payload", "type"] | ||
] | ||
} |
@@ -155,3 +155,3 @@ { | ||
"brand": { | ||
"enum": ["lendi", "domain", "domain variation", "lendi variation"] | ||
"enum": ["lendi", "domain", "domain variation", "lendi variation", "aussie"] | ||
}, | ||
@@ -158,0 +158,0 @@ "hasOptedInRateLock": { |
import { YesNoList } from '@lendi/integrations-protocol/lib/types/lixi-internal-request'; | ||
import { Contact, Dependant, Payload as ApplicantPayload } from '../types/events/public-applicant'; | ||
import { Payload as ApplicantPayload } from '../types/events/public-applicant'; | ||
export declare const booleanMapping: (input?: boolean) => YesNoList; | ||
/** | ||
* Transforms a partial Applicant event to a partial LIXI application. | ||
* | ||
* @param applicant: A partial applicant. | ||
* @param applicant | ||
* @returns partialApplication an incomplete application. | ||
*/ | ||
export declare function transformApplicant(applicant: ApplicantPayload): {}; | ||
/** | ||
* Generates a LIXI contact from given contact. | ||
* | ||
* @param contact | ||
* @param id | ||
*/ | ||
export declare function generateContact(contact: Contact, id: string): { | ||
lixiContact: {}; | ||
lixiAddresses: any[]; | ||
}; | ||
/** | ||
* Generate dependants | ||
* | ||
* @param dependants | ||
* @param id | ||
*/ | ||
export declare function generateDependants(dependants: Dependant[], id: string): { | ||
'@Age': number; | ||
'@UniqueID': string; | ||
FinancialProvider: { | ||
'@x_Party': string; | ||
}[]; | ||
}[]; | ||
export declare function transformApplicant(applicant: ApplicantPayload): import("../types/recursive-partial").RecursivePartial<import("@lendi/integrations-credit-protocol/types/lixi-internal-request").InternalRequest>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateDependants = exports.generateContact = exports.transformApplicant = exports.booleanMapping = void 0; | ||
const lixi_internal_request_1 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request"); | ||
exports.transformApplicant = exports.booleanMapping = void 0; | ||
const lixi_internal_request_1 = require("@lendi/integrations-credit-protocol/types/lixi-internal-request"); | ||
const lixi_internal_request_2 = require("@lendi/integrations-protocol/lib/types/lixi-internal-request"); | ||
const application_paths_1 = require("@lendi/integrations-protocol/lib/utils/application-paths"); | ||
const lodash_1 = require("lodash"); | ||
const address_tools_1 = require("../utils/address-tools"); | ||
const enum_mappings_1 = require("../types/enum-mappings"); | ||
const applicant_gender_1 = require("../types/enum-mappings/applicant-gender"); | ||
const applicant_type_1 = require("../types/enum-mappings/applicant-type"); | ||
const guarantor_relationship_type_1 = require("../types/enum-mappings/guarantor-relationship-type"); | ||
const public_applicant_1 = require("../types/events/public-applicant"); | ||
const errors_1 = require("../utils/errors"); | ||
const normalise_date_1 = require("../utils/normalise-date"); | ||
const booleanMapping = (input = false) => (input === true ? lixi_internal_request_1.YesNoList.Yes : lixi_internal_request_1.YesNoList.No); | ||
const booleanMapping = (input = false) => (input === true ? lixi_internal_request_2.YesNoList.Yes : lixi_internal_request_2.YesNoList.No); | ||
exports.booleanMapping = booleanMapping; | ||
const applicantMapping = { | ||
applicationId: application_paths_1.paths.ApplicationId, | ||
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`, | ||
contact: `${application_paths_1.paths.PersonApplicant}.Contact`, | ||
dependants: 'dependants', | ||
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`, | ||
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`, | ||
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`, | ||
isFirstHomeBuyer: `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`, | ||
isPrimaryApplicant: `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`, | ||
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`, | ||
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`, | ||
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`, | ||
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`, | ||
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`, | ||
title: `${application_paths_1.paths.PersonName}.@NameTitle`, | ||
}; | ||
/** | ||
* Transforms a partial Applicant event to a partial LIXI application. | ||
* | ||
* @param applicant: A partial applicant. | ||
* @param applicant | ||
* @returns partialApplication an incomplete application. | ||
*/ | ||
function transformApplicant(applicant) { | ||
const partialApplication = {}; | ||
const { id: applicantId, applicationId } = applicant; | ||
(0, lodash_1.set)(partialApplication, applicantMapping['isFirstHomeBuyer'], (0, exports.booleanMapping)(applicant.isFirstHomeBuyer)); | ||
(0, lodash_1.set)(partialApplication, applicantMapping['isPrimaryApplicant'], (0, exports.booleanMapping)(applicant.isPrimaryApplicant)); | ||
(0, lodash_1.set)(partialApplication, applicantMapping['title'], enum_mappings_1.titleMapping[applicant.title || public_applicant_1.Title.Unknown]); | ||
const applicantUpdated = (0, lodash_1.omit)(applicant, ['isFirstHomeBuyer', 'isPrimaryApplicant', 'title']); | ||
for (const [key, value] of Object.entries(applicantUpdated)) { | ||
const applicantId = applicant.id; // This is how SF events cross reference applicant with its entities. | ||
const applicantMapping = { | ||
applicantType: `${application_paths_1.paths.PersonApplicant}.@ApplicantType`, | ||
applicationId: application_paths_1.paths.ApplicationId, | ||
citizenship: `${application_paths_1.paths.PersonApplicant}.@Citizenship`, | ||
cityOfBirth: `${application_paths_1.paths.PersonApplicant}.@PlaceOfBirth`, | ||
contact: 'contact', | ||
countryOfBirth: `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`, | ||
dateOfBirth: `${application_paths_1.paths.PersonApplicant}.@DateOfBirth`, | ||
dependants: 'dependants', | ||
email: `${application_paths_1.paths.PersonApplicant}.Contact.EmailAddress[0].@Email`, | ||
firstName: `${application_paths_1.paths.PersonApplicant}.PersonName.@FirstName`, | ||
id: `${application_paths_1.paths.PersonApplicant}.@UniqueID`, | ||
lastName: `${application_paths_1.paths.PersonApplicant}.PersonName.@Surname`, | ||
maritalDetails: `${application_paths_1.paths.PersonApplicant}.MaritalStatusDetails.@x_Spouse`, | ||
maritalStatus: `${application_paths_1.paths.PersonApplicant}.@MaritalStatus`, | ||
middleName: `${application_paths_1.paths.PersonApplicant}.PersonName.@MiddleNames`, | ||
mothersMaidenName: `${application_paths_1.paths.PersonApplicant}.@MothersMaidenName`, | ||
phone: `${application_paths_1.paths.PersonApplicant}.Contact.Mobile.@Number`, | ||
residencyStatus: `${application_paths_1.paths.PersonApplicant}.@ResidencyStatus`, | ||
title: `${application_paths_1.paths.PersonName}.@NameTitle`, | ||
}; | ||
// Any applicant event need to have at least dateOfBirth, firstName and lastName. | ||
if (!(applicant.dateOfBirth && applicant.firstName && applicant.lastName)) { | ||
throw new errors_1.InvalidEvent('Applicant needs to have dateOfBirth, firstName and lastName'); | ||
} | ||
// If applicant event comes without an applicantType then default it to ApplicantType.Borrower | ||
if (!applicant.applicantType) { | ||
applicant.applicantType = public_applicant_1.ApplicantType.Borrower; | ||
} | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonName}.@NameTitle`, lixi_internal_request_1.NameTitleList.Other); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@PrimaryApplicant`, (0, exports.booleanMapping)(applicant.isPrimaryApplicant)); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@FirstHomeBuyer`, (0, exports.booleanMapping)(applicant.isFirstHomeBuyer)); | ||
if (applicant.applicantType === public_applicant_1.ApplicantType.Guarantor) { | ||
const mappedGuarantorRelationship = applicant.guarantorRelationshipToBorrower | ||
? guarantor_relationship_type_1.guarantorRelationshipTypeMappings[applicant.guarantorRelationshipToBorrower.type] | ||
: lixi_internal_request_1.KinRelationshipList.OtherRelative; | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@RelationshipToPrimaryApplicant`, mappedGuarantorRelationship); | ||
// Credit Report event is not available for Guarantors, we should use | ||
// the gender from the applicant event. If a Guarantor were to be converted to | ||
// Borrower, the credit report should override the value for `@Gender` | ||
if (applicant.gender) { | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Gender`, applicant_gender_1.applicantGenderMapping[applicant.gender]); | ||
} | ||
} | ||
for (const [key, value] of Object.entries(applicant)) { | ||
if (applicantMapping[key]) { | ||
switch (key) { | ||
case 'applicantType': | ||
(0, lodash_1.set)(partialApplication, applicantMapping[key], applicant_type_1.applicantTypeMapping[value]); | ||
break; | ||
case 'dateOfBirth': | ||
@@ -53,5 +76,2 @@ (0, lodash_1.set)(partialApplication, applicantMapping[key], (0, normalise_date_1.normaliseDate)(value)); | ||
break; | ||
case 'citizenship': | ||
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.countryCodeMapping[value]); | ||
break; | ||
case 'residencyStatus': | ||
@@ -65,5 +85,14 @@ (0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.residencyStatusMapping[value]); | ||
if (value === public_applicant_1.ResidencyStatus.AustralianCitizen) { | ||
(0, lodash_1.set)(partialApplication, applicantMapping.citizenship, lixi_internal_request_1.CountryCodeList.Au); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, lixi_internal_request_2.CountryCodeList.Au); | ||
} | ||
break; | ||
case 'countryOfBirth': | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@CountryOfBirth`, enum_mappings_1.countryCodeMapping[value]); | ||
break; | ||
case 'citizenship': | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.PersonApplicant}.@Citizenship`, enum_mappings_1.countryCodeMapping[value]); | ||
break; | ||
case 'title': | ||
(0, lodash_1.set)(partialApplication, applicantMapping[key], enum_mappings_1.titleMapping[value]); | ||
break; | ||
case 'maritalDetails': | ||
@@ -75,11 +104,22 @@ const id = (0, lodash_1.get)(value, 'applicantId'); | ||
case 'contact': | ||
const { lixiContact, lixiAddresses } = generateContact(value, applicantId); | ||
(0, lodash_1.set)(partialApplication, applicantMapping[key], lixiContact); | ||
if (lixiAddresses.length > 0) { | ||
(0, lodash_1.set)(partialApplication, application_paths_1.paths.Addresses, lixiAddresses); | ||
const emailAddress = (0, lodash_1.get)(value, 'emailAddress'); | ||
const mobileNumber = (0, lodash_1.get)(value, 'mobileNumber'); | ||
if (emailAddress) { | ||
(0, lodash_1.set)(partialApplication, applicantMapping.email, emailAddress); | ||
} | ||
if (mobileNumber) { | ||
(0, lodash_1.set)(partialApplication, applicantMapping.phone, mobileNumber.replace('+61', '0')); | ||
} | ||
break; | ||
case 'dependants': | ||
const dependants = generateDependants(value, applicantId); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.@UniqueID`, `${applicationId}-household`); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.@UniqueID`, `${applicant.applicationId}-household`); | ||
const dependants = value.map((dependant) => ({ | ||
'@Age': dependant.age, | ||
'@UniqueID': dependant.id, | ||
FinancialProvider: [ | ||
{ | ||
'@x_Party': applicantId, | ||
}, | ||
], | ||
})); | ||
(0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Household}.Dependant`, dependants); | ||
@@ -96,89 +136,1 @@ break; | ||
exports.transformApplicant = transformApplicant; | ||
const contactMapping = { | ||
emailAddress: 'EmailAddress.0.@Email', | ||
mobileNumber: 'Mobile.@Number', | ||
currentAddress: 'CurrentAddress', | ||
previousAddresses: 'PreviousAddress', | ||
priorAddress: 'PriorAddress', | ||
mailingAddress: 'CurrentAddress.@x_MailingAddress', | ||
postSettlementAddress: 'PostSettlementAddress', | ||
}; | ||
/** | ||
* Generates a LIXI contact from given contact. | ||
* | ||
* @param contact | ||
* @param id | ||
*/ | ||
function generateContact(contact, id) { | ||
const lixiContact = {}; | ||
const lixiAddresses = []; | ||
for (const [key, value] of Object.entries(contact)) { | ||
if (contactMapping[key]) { | ||
switch (key) { | ||
case 'currentAddress': | ||
{ | ||
const addressId = `${id}-current`; | ||
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(value, addressId); | ||
lixiAddresses.push(lixiAddress); | ||
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress); | ||
} | ||
break; | ||
case 'postSettlementAddress': | ||
{ | ||
const addressId = `${id}-postSettlement`; | ||
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId); | ||
lixiAddresses.push(lixiAddress); | ||
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress); | ||
} | ||
break; | ||
case 'mailingAddress': | ||
{ | ||
const addressId = `${id}-mailing`; | ||
const { lixiAddress } = (0, address_tools_1.rebuildAddress)({ residentialAddress: value }, addressId); | ||
lixiAddresses.push(lixiAddress); | ||
(0, lodash_1.set)(lixiContact, contactMapping[key], addressId); | ||
} | ||
break; | ||
case 'previousAddresses': | ||
{ | ||
const addressId = `${id}-previous`; | ||
const previousAddresses = value.sort((lhs, rhs) => lhs.endDate.localeCompare(rhs.endDate)); | ||
const previousAddress = previousAddresses.pop(); | ||
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(previousAddress, addressId); | ||
lixiAddresses.push(lixiAddress); | ||
(0, lodash_1.set)(lixiContact, contactMapping[key], lixiContactAddress); | ||
// PriorAddresses | ||
previousAddresses.forEach((address, index) => { | ||
const { lixiAddress, lixiContactAddress } = (0, address_tools_1.rebuildAddress)(address, `${id}-prior-${index}`); | ||
lixiAddresses.push(lixiAddress); | ||
(0, lodash_1.set)(lixiContact, `${contactMapping['priorAddress']}.${index}`, lixiContactAddress); | ||
}); | ||
} | ||
break; | ||
default: | ||
(0, lodash_1.set)(lixiContact, contactMapping[key], value); | ||
break; | ||
} | ||
} | ||
} | ||
return { lixiContact, lixiAddresses }; | ||
} | ||
exports.generateContact = generateContact; | ||
/** | ||
* Generate dependants | ||
* | ||
* @param dependants | ||
* @param id | ||
*/ | ||
function generateDependants(dependants, id) { | ||
return dependants.map((dependant) => ({ | ||
'@Age': dependant.age, | ||
'@UniqueID': dependant.id, | ||
FinancialProvider: [ | ||
{ | ||
'@x_Party': id, | ||
}, | ||
], | ||
})); | ||
} | ||
exports.generateDependants = generateDependants; |
import { Payload as ApplicationPayload } from '../types/events/public-application'; | ||
export interface TransformApplicationOptions { | ||
uniqueIdSuffix?: string; | ||
/** | ||
* Enables/disables the rate lock mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema) | ||
*/ | ||
enableRateLock?: boolean; | ||
/** | ||
* Enables/disables the fast refi mapping (Used to enable the mapping in AW and disable in DW simulatenously due to having to notify integrated approval confidence lenders of schema changes if the attribute is added to schema) | ||
*/ | ||
enableFastRefi?: boolean; | ||
@@ -6,0 +12,0 @@ } |
@@ -35,2 +35,8 @@ "use strict"; | ||
} | ||
/** | ||
* Please note that fast refinance is only applicable to applications where the primary purpose of the application is Refinance | ||
* Hence there is logic in the fixApplicationInconsistencies method used by the updateApplication middleware in AW that removes or defaults the value of the FastRefinance attribute | ||
* based on the primary purpose of the application. This logic was placed in the fixApplicationInconsistencies method in the updateApplication middleware as this is where we know the correct primary purpose of the | ||
* application. | ||
*/ | ||
if (enableFastRefi) { | ||
@@ -37,0 +43,0 @@ (0, lodash_1.set)(partialApplication, `${application_paths_1.paths.Overview}.@FastRefinance`, (0, transform_applicant_1.booleanMapping)(isFastRefi)); |
@@ -13,5 +13,12 @@ /** | ||
/** | ||
* create/update applicant payload | ||
* trust payload. | ||
* | ||
* company payload. | ||
* | ||
* applicant payload. | ||
*/ | ||
export interface Payload { | ||
abn?: string; | ||
acn?: string; | ||
actingAsFranchiseDetails?: string; | ||
applicantType?: ApplicantType; | ||
@@ -22,3 +29,5 @@ /** | ||
applicationId: string; | ||
branch?: string; | ||
citizenship?: Countries; | ||
cityOfBirth?: string; | ||
/** | ||
@@ -28,12 +37,27 @@ * uuid of source applicant | ||
clonedFromApplicantId?: string; | ||
companyName?: string; | ||
companyStructure?: CompanyStructure; | ||
companyType?: CompanyType; | ||
contact?: Contact; | ||
countryOfBirth?: Countries; | ||
creditStatus?: CreditStatus; | ||
currentLender?: string; | ||
/** | ||
* uuid of customer | ||
*/ | ||
customerId: string; | ||
customerId?: string; | ||
dateOfBirth?: string; | ||
dependants?: Dependant[]; | ||
/** | ||
* 100% funding required for Term Loans | ||
*/ | ||
doesTermLoanNeed100PercentFunding?: boolean; | ||
employmentType?: EmploymentType; | ||
/** | ||
* applicant's entity. For a trust applicant this is 'TRUST' | ||
* | ||
* applicant's entity. For a company applicant this is 'COMPANY' | ||
* | ||
* applicant's entity. For a person applicant this is 'PERSON' | ||
*/ | ||
entity?: Entity; | ||
@@ -43,2 +67,27 @@ firstName?: string; | ||
guarantorRelationshipToBorrower?: GuarantorRelationshipToBorrowerDefinition; | ||
/** | ||
* Has the applicant had any late payments, loan arrears or adverse credit history such as | ||
* current or prior defaults or bankruptcies? | ||
*/ | ||
hadLatePaymentsOrArrearsOrAdverseCreditHistory?: boolean; | ||
/** | ||
* Have you had any difficulty in meeting your existing loan repayments, or had any | ||
* financial judgments or legal proceedings, in the past two years? | ||
*/ | ||
hadRepaymentDifficultyOrLegalProceedings?: boolean; | ||
/** | ||
* The applicant has not been over the credit limit, in arrears or in hardship in relation | ||
* to any existing credit or other fixed expenses | ||
*/ | ||
hasGoodConduct?: boolean; | ||
/** | ||
* Company doing more than 25% of business with one customer or supplier | ||
*/ | ||
hasMoreThan25PercentBusinessWithOneCustomer?: boolean; | ||
hasOutstandingTax?: boolean; | ||
/** | ||
* Have you or a company with which you are associated had any past or current debts that | ||
* were or are in default of the payment arrangement? | ||
*/ | ||
hasPastOrCurrentDebts?: boolean; | ||
hasSelfEmploymentProof?: boolean; | ||
@@ -49,10 +98,31 @@ /** | ||
id: string; | ||
industryCode?: string; | ||
investingInPropertyDetails?: string; | ||
invitationStatus?: InvitationStatus; | ||
isActingAsFranchise?: YesNoIntend; | ||
isCommercialRelationship?: boolean; | ||
isDiversified?: boolean; | ||
isFirstHomeBuyer?: boolean; | ||
isInvestingInProperty?: YesNoIntend; | ||
isPassiveEntity?: boolean; | ||
isPrimaryApplicant?: boolean; | ||
/** | ||
* Is the principal place of business leased | ||
*/ | ||
isPrincipalPlaceOfBusinessLeased?: boolean; | ||
/** | ||
* Is the applicant a US citizen or resident for US tax purposes? | ||
*/ | ||
isUSCitizenOrResident?: boolean; | ||
isWorkingInImportExport?: YesNoIntend; | ||
lastName?: string; | ||
legalEntitiesInGroup?: number; | ||
legalEntitiesWithCurrentLender?: number; | ||
mailingAddress?: Address; | ||
maritalDetails?: ApplicantKeyObject; | ||
maritalStatus?: MaritalStatus; | ||
meta?: ApplicantMeta; | ||
meta: ApplicantMeta; | ||
middleName?: string; | ||
monthsWithCurrentLender?: number; | ||
moreThan25PercentBusinessWithOneCustomerDetails?: string; | ||
/** | ||
@@ -62,5 +132,22 @@ * Mothers Maiden Name | ||
mothersMaidenName?: string; | ||
outstandingTaxDetails?: string; | ||
principalPlaceOfBusinessLeasedDetails?: string; | ||
registeredAddress?: Address; | ||
registeredCountry?: Countries; | ||
registeredDate?: string; | ||
registeredState?: AustralianStates; | ||
residencyStatus?: ResidencyStatus; | ||
termLoanNeed100PercentFundingDetails?: string; | ||
title?: Title; | ||
totalIncomeEstimate?: number; | ||
trustName?: string; | ||
trustType?: TrustType; | ||
/** | ||
* Have you been: bankrupt or insolvent, petitioned or aware of anyone petitioning you for | ||
* bankruptcy, advised to seek bankruptcy, or associated with a company that was or | ||
* threatened to be placed into administration? | ||
*/ | ||
wasBankruptOrInsolvent?: boolean; | ||
workingInImportExportDetails?: string; | ||
yearsOfTrading?: YearsOfTrading; | ||
} | ||
@@ -313,2 +400,14 @@ export declare enum ApplicantType { | ||
} | ||
export declare enum CompanyStructure { | ||
Corporation = "CORPORATION", | ||
Partnership = "PARTNERSHIP", | ||
SoleTrader = "SOLE_TRADER", | ||
Trust = "TRUST" | ||
} | ||
export declare enum CompanyType { | ||
Incorporated = "INCORPORATED", | ||
Ltd = "LTD", | ||
Nl = "NL", | ||
PtyLtd = "PTY_LTD" | ||
} | ||
export interface Contact { | ||
@@ -420,3 +519,4 @@ currentAddress?: CommonAddressProperties; | ||
/** | ||
* applicant's employment type | ||
* LEGACY. DO NOT USE. Historic events only - applicant's employment type. Use the | ||
* employment events instead! | ||
*/ | ||
@@ -429,2 +529,6 @@ export declare enum EmploymentType { | ||
/** | ||
* applicant's entity. For a trust applicant this is 'TRUST' | ||
* | ||
* applicant's entity. For a company applicant this is 'COMPANY' | ||
* | ||
* applicant's entity. For a person applicant this is 'PERSON' | ||
@@ -434,3 +538,4 @@ */ | ||
Company = "COMPANY", | ||
Person = "PERSON" | ||
Person = "PERSON", | ||
Trust = "TRUST" | ||
} | ||
@@ -471,2 +576,7 @@ export declare enum Gender { | ||
} | ||
export declare enum YesNoIntend { | ||
Intend = "Intend", | ||
No = "No", | ||
Yes = "Yes" | ||
} | ||
export declare enum MaritalStatus { | ||
@@ -499,2 +609,12 @@ DeFacto = "DE_FACTO", | ||
} | ||
export declare enum AustralianStates { | ||
Act = "ACT", | ||
NT = "NT", | ||
Nsw = "NSW", | ||
Qld = "QLD", | ||
Sa = "SA", | ||
Tas = "TAS", | ||
Vic = "VIC", | ||
Wa = "WA" | ||
} | ||
export declare enum ResidencyStatus { | ||
@@ -514,5 +634,24 @@ AustralianCitizen = "AUSTRALIAN_CITIZEN", | ||
} | ||
export declare enum TrustType { | ||
CashManagementTrust = "CASH_MANAGEMENT_TRUST", | ||
DiscretionaryTrust = "DISCRETIONARY_TRUST", | ||
Fixed = "FIXED", | ||
Hybrid = "HYBRID", | ||
Other = "OTHER", | ||
SuperannuationTrusts = "SUPERANNUATION_TRUSTS", | ||
Unit = "UNIT" | ||
} | ||
export declare enum YearsOfTrading { | ||
The1 = "1", | ||
The10 = ">10", | ||
The2 = "2", | ||
The3 = "3", | ||
The4 = "4", | ||
The5 = "5", | ||
The510 = "5-10" | ||
} | ||
export declare enum Type { | ||
CreateApplicant = "CreateApplicant", | ||
DeleteApplicant = "DeleteApplicant", | ||
UpdateApplicant = "UpdateApplicant" | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Type = exports.Title = exports.ResidencyStatus = exports.ActionedByRole = exports.MaritalStatus = exports.InvitationStatus = exports.GuarantorRelationshipToBorrowerType = exports.Gender = exports.Entity = exports.EmploymentType = exports.CreditStatus = exports.HousingStatusList = exports.Countries = exports.ApplicantType = void 0; | ||
exports.Type = exports.YearsOfTrading = exports.TrustType = exports.Title = exports.ResidencyStatus = exports.AustralianStates = exports.ActionedByRole = exports.MaritalStatus = exports.YesNoIntend = exports.InvitationStatus = exports.GuarantorRelationshipToBorrowerType = exports.Gender = exports.Entity = exports.EmploymentType = exports.CreditStatus = exports.HousingStatusList = exports.CompanyType = exports.CompanyStructure = exports.Countries = exports.ApplicantType = void 0; | ||
var ApplicantType; | ||
@@ -252,2 +252,16 @@ (function (ApplicantType) { | ||
})(Countries = exports.Countries || (exports.Countries = {})); | ||
var CompanyStructure; | ||
(function (CompanyStructure) { | ||
CompanyStructure["Corporation"] = "CORPORATION"; | ||
CompanyStructure["Partnership"] = "PARTNERSHIP"; | ||
CompanyStructure["SoleTrader"] = "SOLE_TRADER"; | ||
CompanyStructure["Trust"] = "TRUST"; | ||
})(CompanyStructure = exports.CompanyStructure || (exports.CompanyStructure = {})); | ||
var CompanyType; | ||
(function (CompanyType) { | ||
CompanyType["Incorporated"] = "INCORPORATED"; | ||
CompanyType["Ltd"] = "LTD"; | ||
CompanyType["Nl"] = "NL"; | ||
CompanyType["PtyLtd"] = "PTY_LTD"; | ||
})(CompanyType = exports.CompanyType || (exports.CompanyType = {})); | ||
var HousingStatusList; | ||
@@ -275,3 +289,4 @@ (function (HousingStatusList) { | ||
/** | ||
* applicant's employment type | ||
* LEGACY. DO NOT USE. Historic events only - applicant's employment type. Use the | ||
* employment events instead! | ||
*/ | ||
@@ -285,2 +300,6 @@ var EmploymentType; | ||
/** | ||
* applicant's entity. For a trust applicant this is 'TRUST' | ||
* | ||
* applicant's entity. For a company applicant this is 'COMPANY' | ||
* | ||
* applicant's entity. For a person applicant this is 'PERSON' | ||
@@ -292,2 +311,3 @@ */ | ||
Entity["Person"] = "PERSON"; | ||
Entity["Trust"] = "TRUST"; | ||
})(Entity = exports.Entity || (exports.Entity = {})); | ||
@@ -326,2 +346,8 @@ var Gender; | ||
})(InvitationStatus = exports.InvitationStatus || (exports.InvitationStatus = {})); | ||
var YesNoIntend; | ||
(function (YesNoIntend) { | ||
YesNoIntend["Intend"] = "Intend"; | ||
YesNoIntend["No"] = "No"; | ||
YesNoIntend["Yes"] = "Yes"; | ||
})(YesNoIntend = exports.YesNoIntend || (exports.YesNoIntend = {})); | ||
var MaritalStatus; | ||
@@ -343,2 +369,13 @@ (function (MaritalStatus) { | ||
})(ActionedByRole = exports.ActionedByRole || (exports.ActionedByRole = {})); | ||
var AustralianStates; | ||
(function (AustralianStates) { | ||
AustralianStates["Act"] = "ACT"; | ||
AustralianStates["NT"] = "NT"; | ||
AustralianStates["Nsw"] = "NSW"; | ||
AustralianStates["Qld"] = "QLD"; | ||
AustralianStates["Sa"] = "SA"; | ||
AustralianStates["Tas"] = "TAS"; | ||
AustralianStates["Vic"] = "VIC"; | ||
AustralianStates["Wa"] = "WA"; | ||
})(AustralianStates = exports.AustralianStates || (exports.AustralianStates = {})); | ||
var ResidencyStatus; | ||
@@ -360,6 +397,27 @@ (function (ResidencyStatus) { | ||
})(Title = exports.Title || (exports.Title = {})); | ||
var TrustType; | ||
(function (TrustType) { | ||
TrustType["CashManagementTrust"] = "CASH_MANAGEMENT_TRUST"; | ||
TrustType["DiscretionaryTrust"] = "DISCRETIONARY_TRUST"; | ||
TrustType["Fixed"] = "FIXED"; | ||
TrustType["Hybrid"] = "HYBRID"; | ||
TrustType["Other"] = "OTHER"; | ||
TrustType["SuperannuationTrusts"] = "SUPERANNUATION_TRUSTS"; | ||
TrustType["Unit"] = "UNIT"; | ||
})(TrustType = exports.TrustType || (exports.TrustType = {})); | ||
var YearsOfTrading; | ||
(function (YearsOfTrading) { | ||
YearsOfTrading["The1"] = "1"; | ||
YearsOfTrading["The10"] = ">10"; | ||
YearsOfTrading["The2"] = "2"; | ||
YearsOfTrading["The3"] = "3"; | ||
YearsOfTrading["The4"] = "4"; | ||
YearsOfTrading["The5"] = "5"; | ||
YearsOfTrading["The510"] = "5-10"; | ||
})(YearsOfTrading = exports.YearsOfTrading || (exports.YearsOfTrading = {})); | ||
var Type; | ||
(function (Type) { | ||
Type["CreateApplicant"] = "CreateApplicant"; | ||
Type["DeleteApplicant"] = "DeleteApplicant"; | ||
Type["UpdateApplicant"] = "UpdateApplicant"; | ||
})(Type = exports.Type || (exports.Type = {})); |
@@ -27,2 +27,3 @@ /** | ||
export declare enum Brand { | ||
Aussie = "aussie", | ||
Domain = "domain", | ||
@@ -29,0 +30,0 @@ DomainVariation = "domain variation", |
@@ -6,2 +6,3 @@ "use strict"; | ||
(function (Brand) { | ||
Brand["Aussie"] = "aussie"; | ||
Brand["Domain"] = "domain"; | ||
@@ -8,0 +9,0 @@ Brand["DomainVariation"] = "domain variation"; |
@@ -1,3 +0,3 @@ | ||
import { InternalRequest } from '@lendi/integrations-protocol/lib/types/lixi-internal-request'; | ||
import { InternalRequest } from '@lendi/integrations-credit-protocol/types/lixi-internal-request'; | ||
import { RecursivePartial } from './recursive-partial'; | ||
export declare type PartialApplication = RecursivePartial<InternalRequest>; |
@@ -1,14 +0,5 @@ | ||
import { InternalRequest, PersonApplicant } from '@lendi/integrations-credit-protocol/types/lixi-internal-request'; | ||
import { InternalRequest } from '@lendi/integrations-credit-protocol/types/lixi-internal-request'; | ||
import { Payload as RequiredDocEventPayload } from '../types/events/public-required-document'; | ||
import { RecursivePartial } from '../types/recursive-partial'; | ||
/** | ||
* Remove proof of identity document from a person applicant | ||
* | ||
* @param {PersonApplicant} personApplicant Person applicant to remove the id document from | ||
* @param {string} id Proof of identity document | ||
* | ||
* @returns {PersonApplicant} Updated person applicant | ||
*/ | ||
export declare const removeIDDocumentFromApplicant: (personApplicant: PersonApplicant, id: string) => PersonApplicant; | ||
/** | ||
* Removes ProofOfIdentity ID document that is in status Not Required | ||
@@ -18,5 +9,4 @@ * | ||
* @param {RequiredDocEventPayload} eventPayload - Required Document event payload | ||
* | ||
* @returns {RecursivePartial<InternalRequest>} Updated application | ||
*/ | ||
export declare const removeIdsNotRequired: (application: RecursivePartial<InternalRequest>, eventPayload: RequiredDocEventPayload) => RecursivePartial<InternalRequest>; |
@@ -14,3 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.removeIdsNotRequired = exports.removeIDDocumentFromApplicant = void 0; | ||
exports.removeIdsNotRequired = void 0; | ||
const application_paths_1 = require("@lendi/integrations-credit-protocol/utils/application-paths"); | ||
@@ -24,12 +24,22 @@ const lodash_1 = require("lodash"); | ||
* @param {string} id Proof of identity document | ||
* | ||
* @param {identification} identification Identification data in RequiredDocument event | ||
* @returns {PersonApplicant} Updated person applicant | ||
*/ | ||
const removeIDDocumentFromApplicant = (personApplicant, id) => { | ||
const removeIDDocumentFromApplicant = (personApplicant, id, identification) => { | ||
const { ProofOfIdentity = [] } = personApplicant, rest = __rest(personApplicant, ["ProofOfIdentity"]); | ||
const updatedProofOfIdentity = ProofOfIdentity.filter((proofOfId) => proofOfId['@UniqueID'] !== id); | ||
const updatedProofOfIdentity = ProofOfIdentity.filter((proofOfId) => { | ||
let shouldKeepProofOfId = true; | ||
if (proofOfId['@UniqueID']) { | ||
shouldKeepProofOfId = proofOfId['@UniqueID'] !== id; | ||
} | ||
else { | ||
if (identification === null || identification === void 0 ? void 0 : identification.idNumber) { | ||
shouldKeepProofOfId = proofOfId['@DocumentNumber'] !== identification.idNumber; | ||
} | ||
} | ||
return shouldKeepProofOfId; | ||
}); | ||
// If the updateProofOfIdentity is an empty array then we remove the ProofOfIdentity attribute from the person applicant | ||
return Object.assign(Object.assign({}, rest), (updatedProofOfIdentity.length && { ProofOfIdentity: updatedProofOfIdentity })); | ||
}; | ||
exports.removeIDDocumentFromApplicant = removeIDDocumentFromApplicant; | ||
/** | ||
@@ -40,13 +50,12 @@ * Removes ProofOfIdentity ID document that is in status Not Required | ||
* @param {RequiredDocEventPayload} eventPayload - Required Document event payload | ||
* | ||
* @returns {RecursivePartial<InternalRequest>} Updated application | ||
*/ | ||
const removeIdsNotRequired = (application, eventPayload) => { | ||
const { status: verificationStatus, id, applicantId } = eventPayload; | ||
const { status: verificationStatus, identification, applicantId, id } = eventPayload; | ||
const personApplicants = (0, lodash_1.get)(application, application_paths_1.paths.PersonApplicants, []); | ||
const updatedApplication = application; | ||
const updatedApplication = (0, lodash_1.cloneDeep)(application); | ||
if (verificationStatus === public_required_document_1.Status.NotRequired && personApplicants.length) { | ||
const personApplicantIndex = personApplicants.findIndex((personApplicant) => personApplicant['@UniqueID'] === applicantId); | ||
if (personApplicantIndex !== -1) { | ||
const updatedPersonApplicant = (0, exports.removeIDDocumentFromApplicant)(personApplicants[personApplicantIndex], id); | ||
const updatedPersonApplicant = removeIDDocumentFromApplicant(personApplicants[personApplicantIndex], id, identification); | ||
(0, lodash_1.set)(updatedApplication, `${application_paths_1.paths.PersonApplicants}.[${personApplicantIndex}]`, updatedPersonApplicant); | ||
@@ -53,0 +62,0 @@ } |
{ | ||
"name": "@lendi/integrations-transform", | ||
"version": "1.6.6", | ||
"version": "1.6.7-beta.0", | ||
"description": "Library for kafka event data transforming", | ||
@@ -24,4 +24,4 @@ "author": "Integrations <integrations@lendi.com.au>", | ||
"dependencies": { | ||
"@lendi/integrations-credit-protocol": "^1.17.5", | ||
"@lendi/integrations-protocol": "^2.6.4", | ||
"@lendi/integrations-credit-protocol": "^1.18.0", | ||
"@lendi/integrations-protocol": "^2.6.7", | ||
"@lendi/logging": "^1.0.0", | ||
@@ -28,0 +28,0 @@ "clean-deep": "^3.4.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
541906
199
14679
2