using CRIF.ACTion.Common; using CRIF.ACTion.Configuration; using Landmark.OLA.Models.Assets; using Landmark.OLA.Models.Loan.Enums; namespace CRIF.ACTion.Loan.Assets { public class VehicleAppBuilder : ILoanApplicationRequestBuilder { private readonly CrifSettings _settings; public VehicleAppBuilder(CrifSettings settings) { _settings = settings; } public void SetDetails(LoanApplicationRequestBuilder createApp) { createApp.AppDetails = new AppDetailVehicleSection(createApp.CrifRequestSectionNamespace, _settings); if (createApp.LoanApplication.LoanType.Value == LoanType.V_VehiclePreapproval && createApp.LoanApplication.Vehicle is null) { createApp.LoanApplication.Vehicle = new Vehicle { InitialEstimatedValue = createApp.LoanApplication.RequestedAmount }; } ((AppDetailVehicleSection)createApp.AppDetails).AddPropertyDetails(createApp.LoanApplication.Vehicle); ((AppDetailVehicleSection)createApp.AppDetails).AddSalesPriceDetails(createApp.LoanApplication); createApp.Properties.AddProperty(new VehicleProperty(createApp.LoanApplication.Vehicle)); createApp.VehicleValuations.AddVehicleValuation(createApp.LoanApplication.Vehicle); if (createApp.LoanApplication.LoanType == LoanType.M_Boat && !(createApp.LoanApplication.Vehicle.BoatAddress is null)) { createApp.Addresses.AddAddress(createApp.LoanApplication.Vehicle.BoatAddress, ContactMechanisms.CrifContactMechanism.MarinaAddress); } createApp.AppDetails.SetDetails(createApp.LoanApplication, createApp._sourceChannel); } } }