385 lines
18 KiB
C#
385 lines
18 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Xunit;
|
|
using CRIF.ACTion.Loan;
|
|
using CRIF.ACTion.Common.Parsers;
|
|
using Landmark.OLA.Models.Addresses;
|
|
using Landmark.OLA.Models.Addresses.Enums;
|
|
using Landmark.OLA.Models.Individuals;
|
|
using Landmark.OLA.Models.Individuals.Enums;
|
|
using Landmark.OLA.Models.Loan;
|
|
using Landmark.OLA.Models.Loan.Enums;
|
|
using Landmark.OLA.Models.Residences;
|
|
|
|
namespace CRIF.ACTion.Tests.Loan
|
|
{
|
|
public class LoanApplicationRequestBuilderTest
|
|
{
|
|
private readonly IResponseParser<LoanApplication> _loanApplicationResponseParser;
|
|
|
|
private readonly LoanApplication _loanApplication =
|
|
new(DateTime.Parse("2018-01-01T06:00:00.0000000Z", null, System.Globalization.DateTimeStyles.AssumeLocal), new Guid("9ed5a50f-279c-49b0-b5b4-d5b614e42501"))
|
|
{
|
|
LoanType = LoanType.CC_Secure,
|
|
RequestedAmount = 154.20m,
|
|
PrimaryContactMethod = "1234567890",
|
|
DisclosureDate = DateTime.Parse("2019-03-08T19:50:26.429Z"),
|
|
IPAddress = "111.11.1111",
|
|
PromoCode = "asdfas-12341",
|
|
Purpose = LoanPurpose.Purpose.Other,
|
|
PrimaryBorrower = new Individual(new Guid("8066fa2a-16ba-4148-b28c-2926ba263c5f"))
|
|
{
|
|
FirstName = "Jane",
|
|
MiddleInitial = "A",
|
|
LastName = "Doe",
|
|
DOB = new DateTime(2018, 7, 9),
|
|
Phone = "1235555555",
|
|
PhoneType = PhoneType.Home,
|
|
SSN = "000090001",
|
|
Email = "[email protected]",
|
|
IsMarried = false,
|
|
Language = LanguageOption.English,
|
|
Address = new CurrentResidenceAddress(new Guid("bf7e502a-9830-43c6-b603-1a32294c7e1a"))
|
|
{
|
|
Address1 = "123 Main St",
|
|
City = "New Berlin",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53151",
|
|
MonthsResided = 12,
|
|
ResidenceType = ResidenceTypeOption.Own,
|
|
MonthlyPayment = 100,
|
|
},
|
|
MailingAddress = new Address(new Guid("f84db562-36a0-4039-9ce5-346a2ba6899b"))
|
|
{
|
|
Address1 = "321 Main St",
|
|
City = "New Berlin",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53151"
|
|
},
|
|
Employers =
|
|
[
|
|
new Employer(employerId: new Guid("eee4efa3-327f-4ce5-9e8b-8c3e7a865fff"))
|
|
{
|
|
Name = "College Pro Painters",
|
|
Title = "tester",
|
|
WorkPhone = "9992245555",
|
|
MonthsEmployed = 60,
|
|
StartDate = new DateTime(2017, 01, 01),
|
|
CurrentEmployer = true,
|
|
EmploymentType = EmploymentTypeOption.FullTime,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Salary",
|
|
AmountPerPeriod = 5000.0m,
|
|
Frequency = Frequency.Annually,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
}
|
|
}
|
|
]
|
|
},
|
|
CoApplicant = new CoApplicant(new Guid("ba99037f-df92-46d4-a477-ffecea1f4837"))
|
|
{
|
|
FirstName = "John",
|
|
LastName = "Smith",
|
|
DOB = new DateTime(2018, 7, 25),
|
|
SSN = "111221111",
|
|
Phone = "5555550983",
|
|
PhoneType = PhoneType.Mobile,
|
|
Email = "[email protected]",
|
|
IsMarried = true,
|
|
Language = LanguageOption.English,
|
|
HasOptedOutTCPA = true,
|
|
Address = new CurrentResidenceAddress(new Guid("ae795a5f-1ea3-4186-b4b8-e9f9b81e3059"))
|
|
{
|
|
Address1 = "339 1st St",
|
|
Address2 = "#76",
|
|
City = "Milwaukee",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53202",
|
|
ResidenceType = ResidenceTypeOption.Rent,
|
|
MonthsResided = 12,
|
|
MonthlyPayment = 100,
|
|
},
|
|
PreviousAddresses =
|
|
[
|
|
new ResidenceAddress(new Guid("e7e881f0-d371-4371-8022-cce4f700e6d6"))
|
|
{
|
|
Address1 = "339 1st St",
|
|
Address2 = "#80",
|
|
City = "Milwaukee",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53202",
|
|
ResidenceType = ResidenceTypeOption.Rent,
|
|
MonthsResided = 6,
|
|
},
|
|
],
|
|
Employers =
|
|
[
|
|
new Employer(employerId: new Guid("e8436884-0e6c-4144-8de5-1f44c7936a23"))
|
|
{
|
|
StartDate = new DateTime(2015, 01, 01),
|
|
Name = "Chocolate Teapot Manfuacturing Inc",
|
|
EmploymentType = EmploymentTypeOption.PartTime,
|
|
Title = "Lead Teapot Assembler",
|
|
WorkPhone = "5556783241",
|
|
CurrentEmployer = true,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Work",
|
|
AmountPerPeriod = 100m,
|
|
Frequency = Frequency.Monthly,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
},
|
|
},
|
|
new Employer(employerId: new Guid("58d25f44-1260-428d-ac2c-d8804b06ed66"))
|
|
{
|
|
StartDate = new DateTime(2015, 01, 01),
|
|
Name = "Vanilla Teapot Manfuacturing Coop",
|
|
EmploymentType = EmploymentTypeOption.PartTime,
|
|
Title = "Junior Teapot Assembler",
|
|
WorkPhone = "5559572318",
|
|
CurrentEmployer = true,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Work",
|
|
AmountPerPeriod = 50m,
|
|
Frequency = Frequency.Monthly,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
|
|
private readonly LoanApplication _loanApplicationWithSpouse =
|
|
new(DateTime.Parse("2018-01-01T06:00:00.0000000Z", null, System.Globalization.DateTimeStyles.AssumeLocal), new Guid("9ed5a50f-279c-49b0-b5b4-d5b614e42501"))
|
|
{
|
|
LoanType = LoanType.CC_Secure,
|
|
RequestedAmount = 154.20m,
|
|
Purpose = LoanPurpose.Purpose.Other,
|
|
DisclosureDate = DateTime.Parse("2019-03-08T19:50:26.429Z"),
|
|
IPAddress = "111.11.1111",
|
|
PrimaryBorrower = new Individual(new Guid("8066fa2a-16ba-4148-b28c-2926ba263c5f"))
|
|
{
|
|
FirstName = "Jane",
|
|
MiddleInitial = "A",
|
|
LastName = "Doe",
|
|
DOB = new DateTime(2018, 7, 9),
|
|
Phone = "1235555555",
|
|
PhoneType = PhoneType.Home,
|
|
SSN = "000090001",
|
|
Email = "[email protected]",
|
|
IsMarried = false,
|
|
Language = LanguageOption.English,
|
|
Address = new CurrentResidenceAddress(new Guid("bf7e502a-9830-43c6-b603-1a32294c7e1a"))
|
|
{
|
|
Address1 = "123 Main St",
|
|
City = "New Berlin",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53151",
|
|
MonthsResided = 12,
|
|
ResidenceType = ResidenceTypeOption.Own,
|
|
MonthlyPayment = 100,
|
|
},
|
|
MailingAddress = new Address(new Guid("f84db562-36a0-4039-9ce5-346a2ba6899b"))
|
|
{
|
|
Address1 = "321 Main St",
|
|
City = "New Berlin",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53151"
|
|
},
|
|
Employers =
|
|
[
|
|
new Employer(employerId: new Guid("eee4efa3-327f-4ce5-9e8b-8c3e7a865fff"))
|
|
{
|
|
Name = "College Pro Painters",
|
|
Title = "tester",
|
|
WorkPhone = "9992245555",
|
|
MonthsEmployed = 60,
|
|
StartDate = new DateTime(2017, 01, 01),
|
|
CurrentEmployer = true,
|
|
EmploymentType = EmploymentTypeOption.FullTime,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Salary",
|
|
AmountPerPeriod = 5000.0m,
|
|
Frequency = Frequency.Annually,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
}
|
|
}
|
|
],
|
|
DetailedNonApplicantSpouse = new HistoryIndividual(new Guid("ba99037f-df92-46d4-a477-ffecea1f4837"))
|
|
{
|
|
FirstName = "John",
|
|
LastName = "Smith",
|
|
DOB = new DateTime(2018, 7, 25),
|
|
SSN = "111221111",
|
|
Phone = "5555550983",
|
|
PhoneType = PhoneType.Mobile,
|
|
Email = "[email protected]",
|
|
Language = LanguageOption.English,
|
|
HasOptedOutTCPA = true,
|
|
Address = new CurrentResidenceAddress(new Guid("ae795a5f-1ea3-4186-b4b8-e9f9b81e3059"))
|
|
{
|
|
Address1 = "339 1st St",
|
|
Address2 = "#76",
|
|
City = "Milwaukee",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53202",
|
|
ResidenceType = ResidenceTypeOption.Rent,
|
|
MonthsResided = 12,
|
|
MonthlyPayment = 100,
|
|
},
|
|
PreviousAddresses =
|
|
[
|
|
new ResidenceAddress(new Guid("e7e881f0-d371-4371-8022-cce4f700e6d6"))
|
|
{
|
|
Address1 = "339 1st St",
|
|
Address2 = "#80",
|
|
City = "Milwaukee",
|
|
State = StateOption.WI,
|
|
Country = CountryOption.UnitedStates,
|
|
PostalCode = "53202",
|
|
ResidenceType = ResidenceTypeOption.Rent,
|
|
MonthsResided = 6,
|
|
},
|
|
],
|
|
Employers =
|
|
[
|
|
new Employer(employerId: new Guid("e8436884-0e6c-4144-8de5-1f44c7936a23"))
|
|
{
|
|
StartDate = new DateTime(2015, 01, 01),
|
|
Name = "Chocolate Teapot Manfuacturing Inc",
|
|
EmploymentType = EmploymentTypeOption.PartTime,
|
|
Title = "Lead Teapot Assembler",
|
|
WorkPhone = "5556783241",
|
|
CurrentEmployer = true,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Work",
|
|
AmountPerPeriod = 100m,
|
|
Frequency = Frequency.Monthly,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
},
|
|
},
|
|
new Employer(employerId: new Guid("58d25f44-1260-428d-ac2c-d8804b06ed66"))
|
|
{
|
|
StartDate = new DateTime(2015, 01, 01),
|
|
Name = "Vanilla Teapot Manfuacturing Coop",
|
|
EmploymentType = EmploymentTypeOption.PartTime,
|
|
Title = "Junior Teapot Assembler",
|
|
WorkPhone = "5559572318",
|
|
CurrentEmployer = true,
|
|
Language = LanguageOption.English,
|
|
Income = new Income
|
|
{
|
|
IncomeTypeCD = IncomeType.Salary,
|
|
SourceName = "Work",
|
|
AmountPerPeriod = 50m,
|
|
Frequency = Frequency.Monthly,
|
|
IncomeStatus = IncomeStatus.IncomeStatus_Included
|
|
},
|
|
},
|
|
],
|
|
}
|
|
}
|
|
};
|
|
|
|
private readonly List<Guid> Guids = new List<Guid>
|
|
{
|
|
new Guid("64f4efa3-327f-4ce5-9e8b-8c3e7a8656d5"), //org
|
|
new Guid("292d0c30-976b-47f9-85a4-487ce0b3e1e8"), //source channel
|
|
new Guid("3090a5a1-d493-4865-ba44-8fd390dfec44"), //distribution/servicing channel
|
|
};
|
|
|
|
public LoanApplicationRequestBuilderTest()
|
|
{
|
|
_loanApplicationResponseParser = new LoanApplicationResponseParser();
|
|
}
|
|
|
|
[Fact]
|
|
public void Validate()
|
|
{
|
|
var createAppElement = new LoanApplicationRequestBuilder(_loanApplication, TestCommon.GetTestSettings()).Build();
|
|
|
|
Assert.Empty(TestCommon.Validate(createAppElement));
|
|
}
|
|
|
|
[Fact]
|
|
public void CreateApplication()
|
|
{
|
|
var appCreator = new LoanApplicationRequestBuilder(_loanApplication, TestCommon.GetTestSettings(),
|
|
Guids[0], Guids[1], Guids[2], new TestDistributionChannelLookupService());
|
|
|
|
var createAppElement = appCreator.Build();
|
|
|
|
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "CreateApp" + System.IO.Path.DirectorySeparatorChar + "CreateApplication.xml";
|
|
|
|
var results = TestCommon.Compare(createAppElement, comparePath);
|
|
|
|
Assert.Empty(results);
|
|
}
|
|
|
|
[Fact]
|
|
public void CreateApplicationWithNote()
|
|
{
|
|
_loanApplication.Note = "Example application note.";
|
|
|
|
var createAppElement = new LoanApplicationRequestBuilder(_loanApplication, TestCommon.GetTestSettings(),
|
|
Guids[0], Guids[1], Guids[2], new TestDistributionChannelLookupService()).Build();
|
|
|
|
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "CreateApp" + System.IO.Path.DirectorySeparatorChar + "CreateApplicationWithNote.xml";
|
|
|
|
var results = TestCommon.Compare(createAppElement, comparePath);
|
|
|
|
Assert.Empty(results);
|
|
}
|
|
|
|
[Fact]
|
|
public void CreateApplicationNonSingingHistorySpouse()
|
|
{
|
|
var createAppElement = new LoanApplicationRequestBuilder(_loanApplicationWithSpouse, TestCommon.GetTestSettings(),
|
|
Guids[0], Guids[1], Guids[2], new TestDistributionChannelLookupService()).Build();
|
|
|
|
string comparePath = "ExampleXML" + System.IO.Path.DirectorySeparatorChar + "CreateApp" + System.IO.Path.DirectorySeparatorChar + "CreateApplicationNonSigningHistorySpouse.xml";
|
|
|
|
var results = TestCommon.Compare(createAppElement, comparePath);
|
|
|
|
Assert.Empty(results);
|
|
}
|
|
|
|
[Fact]
|
|
public void AddPurposeOfLoanSignature()
|
|
{
|
|
_loanApplication.LoanType = LoanType.S_Signature;
|
|
_loanApplication.PurposeOfLoanSignature = "Test Purpose of Loan Signature";
|
|
|
|
bool check = false;
|
|
|
|
if (_loanApplication.LoanType == LoanType.S_Signature && !string.IsNullOrWhiteSpace(_loanApplication.PurposeOfLoanSignature))
|
|
{
|
|
check = true;
|
|
}
|
|
|
|
Assert.True(check);
|
|
}
|
|
}
|
|
}
|