Files
monorepo/LCU.API.Internal.OnlineLoanApp/CRIF.ACTion/Loan/CreditCardAppBuilder.cs
T
2026-03-11 11:18:25 -05:00

46 lines
2.0 KiB
C#

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<XElement>();
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());
}
}
}