diff --git a/src/ClientBuilder.js b/src/ClientBuilder.js index 51ff894..19a85b5 100644 --- a/src/ClientBuilder.js +++ b/src/ClientBuilder.js @@ -187,6 +187,23 @@ class ClientBuilder { return this.withCustomCommaSeperatedQuery("features", "component-analysis"); } + /** + * Adds to the request query to use the financial history feature. + * @return ClientBuilder this to accommodate method chaining. + */ + withFinancialHistory() { + return this.withCustomCommaSeperatedQuery("features", "financial"); + } + + /** + * Adds to the request query to use the occupant use feature. + * @return ClientBuilder this to accommodate method chaining. + */ + withOccupantUse() { + return this.withCustomCommaSeperatedQuery("features", "occupant-use"); + } + + buildSender() { if (this.httpSender) return this.httpSender; diff --git a/src/international_street/Candidate.js b/src/international_street/Candidate.js index 21f0859..9219316 100644 --- a/src/international_street/Candidate.js +++ b/src/international_street/Candidate.js @@ -155,6 +155,7 @@ class Candidate { this.metadata.geocodePrecision = responseData.metadata.geocode_precision; this.metadata.maxGeocodePrecision = responseData.metadata.max_geocode_precision; this.metadata.addressFormat = responseData.metadata.address_format; + this.metadata.occupantUse = responseData.metadata.occupant_use; } } } diff --git a/src/us_enrichment/Lookup.js b/src/us_enrichment/Lookup.js index b1ebe89..045947c 100644 --- a/src/us_enrichment/Lookup.js +++ b/src/us_enrichment/Lookup.js @@ -5,6 +5,7 @@ class Lookup { this.exclude = exclude; this.dataset = dataset; this.dataSubset = dataSubset; + this.features = undefined; this.response = {}; this.customParameters = {}; diff --git a/src/us_enrichment/Response.js b/src/us_enrichment/Response.js index ba359fb..26cb040 100644 --- a/src/us_enrichment/Response.js +++ b/src/us_enrichment/Response.js @@ -121,6 +121,54 @@ class Response { this.attributes.exerciseRoom = responseData.attributes.exercise_room; this.attributes.exteriorWalls = responseData.attributes.exterior_walls; this.attributes.familyRoom = responseData.attributes.family_room; + this.attributes.financialHistory = !responseData.attributes.financial_history ? [] : responseData.attributes.financial_history.map(history => { + return { + codeTitleCompany: history.code_title_company, + instrumentDate: history.instrument_date, + interestRateType2: history.interest_rate_type_2, + lenderAddress: history.lender_address, + lenderAddress2: history.lender_address_2, + lenderCity: history.lender_city, + lenderCity2: history.lender_city_2, + lenderCode: history.lender_code, + lenderCode2: history.lender_code_2, + lenderFirstName: history.lender_first_name, + lenderFirstName2: history.lender_first_name_2, + lenderLastName: history.lender_last_name, + lenderLastName2: history.lender_last_name_2, + lenderName: history.lender_name, + lenderName2: history.lender_name_2, + lenderSellerCarryBack: history.lender_seller_carry_back, + lenderSellerCarryBack2: history.lender_seller_carry_back_2, + lenderState: history.lender_state, + lenderState2: history.lender_state_2, + lenderZip: history.lender_zip, + lenderZip2: history.lender_zip_2, + lenderZipExtended: history.lender_zip_extended, + lenderZipExtended2: history.lender_zip_extended_2, + mortgageAmount: history.mortgage_amount, + mortgageAmount2: history.mortgage_amount_2, + mortgageDueDate: history.mortgage_due_date, + mortgageDueDate2: history.mortgage_due_date_2, + mortgageInterestRate: history.mortgage_interest_rate, + mortgageInterestRateType: history.mortgage_interest_rate_type, + mortgageLenderCode: history.mortgage_lender_code, + mortgageRate: history.mortgage_rate, + mortgageRate2: history.mortgage_rate_2, + mortgageRecordingDate: history.mortgage_recording_date, + mortgageRecordingDate2: history.mortgage_recording_date_2, + mortgageTerm: history.mortgage_term, + mortgageTerm2: history.mortgage_term_2, + mortgageTermType: history.mortgage_term_type, + mortgageTermType2: history.mortgage_term_type_2, + mortgageType: history.mortgage_type, + mortgageType2: history.mortgage_type_2, + multiParcelFlag: history.multi_parcel_flag, + nameTitleCompany: history.name_title_company, + recordingDate: history.recording_date, + transferAmount: history.transfer_amount, + } + }) this.attributes.fence = responseData.attributes.fence; this.attributes.fenceArea = responseData.attributes.fence_area; this.attributes.fipsCode = responseData.attributes.fips_code; diff --git a/tests/international_street/test_Candidate.js b/tests/international_street/test_Candidate.js index ca40e55..7e3b898 100644 --- a/tests/international_street/test_Candidate.js +++ b/tests/international_street/test_Candidate.js @@ -70,6 +70,7 @@ describe("An International match candidate", function () { geocode_precision: "54", max_geocode_precision: "55", address_format: "56", + occupant_use: "56.5", }, analysis: { verification_status: "57", @@ -204,6 +205,7 @@ describe("An International match candidate", function () { expect(metadata.geocodePrecision).to.equal("54"); expect(metadata.maxGeocodePrecision).to.equal("55"); expect(metadata.addressFormat).to.equal("56"); + expect(metadata.occupantUse).to.equal("56.5"); let analysis = candidate.analysis; expect(analysis.verificationStatus).to.equal("57"); expect(analysis.addressPrecision).to.equal("58"); diff --git a/tests/us_enrichment/test_Lookup.js b/tests/us_enrichment/test_Lookup.js index 2cae627..419c944 100644 --- a/tests/us_enrichment/test_Lookup.js +++ b/tests/us_enrichment/test_Lookup.js @@ -3,20 +3,27 @@ const expect = chai.expect; const Lookup = require("../../src/us_enrichment/Lookup"); describe("A US Enrichment Lookup", function () { - it("can be newed up with all basic fields.", function () { - const expectedSmartyKey = "a"; - const expectedInclude = "b"; - const expectedExclude = "c"; - const expectedDataset = "d"; - const expectedDataSubset = "e"; - - let lookup = new Lookup(expectedSmartyKey, expectedInclude, expectedExclude, expectedDataset, expectedDataSubset); - expect(lookup.smartyKey).to.equal(expectedSmartyKey); - expect(lookup.include).to.equal(expectedInclude); - expect(lookup.exclude).to.equal(expectedExclude); - expect(lookup.dataset).to.equal(expectedDataset); - expect(lookup.dataSubset).to.equal(expectedDataSubset); - }); - + it("can be newed up with all basic fields.", function () { + const expectedSmartyKey = "a"; + const expectedInclude = "b"; + const expectedExclude = "c"; + const expectedDataset = "d"; + const expectedDataSubset = "e"; + const expectedFeatures = "f"; + let lookup = new Lookup( + expectedSmartyKey, + expectedInclude, + expectedExclude, + expectedDataset, + expectedDataSubset, + ); + lookup.features = expectedFeatures; + expect(lookup.smartyKey).to.equal(expectedSmartyKey); + expect(lookup.include).to.equal(expectedInclude); + expect(lookup.exclude).to.equal(expectedExclude); + expect(lookup.dataset).to.equal(expectedDataset); + expect(lookup.dataSubset).to.equal(expectedDataSubset); + expect(lookup.features).to.equal(expectedFeatures); + }); }); \ No newline at end of file