using System.Xml.Linq; using CRIF.ACTion.Common; using CRIF.ACTion.Configuration; using Landmark.OLA.Models.Loan.Enums; namespace CRIF.ACTion.Loan { public class CreditCardAppBuilder : ILoanApplicationRequestBuilder { private readonly CrifSettings _settings; public CreditCardAppBuilder(CrifSettings settings) { _settings = settings; } public void SetDetails(LoanApplicationRequestBuilder createApp) { createApp.AppDetails = new AppDetailBankcardSection(createApp.CrifRequestSectionNamespace, _settings); var additionalContent = new List(); if (createApp.LoanApplication.LoanType == LoanType.CC_Secure) { var collateralId = createApp.LoanApplication.SecuredCardCollateralId; //per Ben V., all Secure CC loans should have a savings account collateral equal to the CC limit createApp.Properties.AddProperty(new SavingsAccountProperty(collateralId, createApp.LoanApplication.RequestedAmount.Value)); var appDetailProperties = new XElement(CrifNamespaces.App + "appDetailProperties", new XElement(CrifNamespaces.App + "appDetailProperty", new XAttribute(CrifNamespaces.Common + "idRef", collateralId), new XAttribute(CrifNamespaces.Common + "propertyType", "CD"), //from CRIF example new XAttribute(CrifNamespaces.Common + "propertySubType", "NoneSelected"), //from CRIF example new XAttribute(CrifNamespaces.App + "statusID", "Active"), //from CRIF example new XAttribute(CrifNamespaces.App + "collateralTypeID", CrifConstants.CollateralIds[CrifConstants.Collateral.CDsOrSavings]))); additionalContent.Add(appDetailProperties); } createApp.AppDetails.SetDetails(createApp.LoanApplication, createApp._sourceChannel, additionalContent: additionalContent.ToArray()); } } }