first commit

This commit is contained in:
Zeeshaun
2026-03-11 11:18:25 -05:00
commit f3cb730f3b
472 changed files with 53651 additions and 0 deletions
@@ -0,0 +1,33 @@
using System.Xml.Linq;
using CRIF.ACTion.Configuration;
namespace CRIF.ACTion.Common.Builders
{
public abstract class BuilderBase : IBuildable
{
public readonly XNamespace CrifRequestSectionNamespace;
private protected CrifSettings _settings;
public BuilderBase(XNamespace mainSectionNamespace, CrifSettings settings)
{
CrifRequestSectionNamespace = mainSectionNamespace;
_settings = settings;
}
public virtual XElement Build(params XElement[] content)
{
return new XElement(CrifNamespaces.Empty + "actionAPI",
new XAttribute("version", 1),
new XAttribute("xmlns", ""),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.Common.Prefix, CrifNamespaces.Common.ToString()),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.App.Prefix, CrifNamespaces.App.ToString()),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.Messages.Prefix, CrifNamespaces.Messages.ToString()),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.QO.Prefix, CrifNamespaces.QO.ToString()),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.Maint.Prefix, CrifNamespaces.Maint.ToString()),
new XAttribute(XNamespace.Xmlns + CrifNamespaces.XSI.Prefix, CrifNamespaces.XSI.ToString()),
content);
}
}
}
@@ -0,0 +1,10 @@
namespace CRIF.ACTion.Common.Builders
{
public class BuilderUtils
{
public static string FormatCrifData(string data)
{
return data?.ToUpper();
}
}
}
@@ -0,0 +1,44 @@
using System.Xml.Linq;
using CRIF.ACTion.Configuration;
namespace CRIF.ACTion.Common.Builders
{
public class CrifRequestSection : IBuildable
{
private readonly XNamespace SectionNamespace;
private readonly string SectionName;
private readonly List<XObject> Content;
private readonly List<XObject> Attributes;
private protected readonly CrifSettings _settings;
private protected CrifRequestSection(XNamespace sectionNamespace, string sectionName, CrifSettings settings)
{
SectionNamespace = sectionNamespace;
SectionName = sectionName;
Content = [];
Attributes = [];
_settings = settings;
}
public XElement Build(params XElement[] content)
{
var element = new XElement(SectionNamespace + SectionName, Attributes);
element.Add([.. Content]);
return element;
}
public void AddContent(XObject element)
{
Content.Add(element);
}
public void AddAttribute(XObject attribute)
{
Attributes.Add(attribute);
}
}
}
@@ -0,0 +1,9 @@
using System.Xml.Linq;
namespace CRIF.ACTion.Common.Builders
{
public interface IBuildable
{
XElement Build(params XElement[] content);
}
}
@@ -0,0 +1,107 @@
using Landmark.OLA.Models.Individuals.Enums;
namespace CRIF.ACTion.Common
{
public static class ContactMechanisms
{
public static CrifContactMechanism GetPhoneType(PhoneType type)
{
switch (type)
{
case PhoneType.Home:
return CrifContactMechanism.HomePhone;
case PhoneType.Mobile:
return CrifContactMechanism.CellPhone;
default:
throw new ArgumentOutOfRangeException(nameof(type), "Unexpected PhoneType value");
}
}
public static ContactMechanismCategory GetContactMechanismCategory(CrifContactMechanism mechanism)
{
switch (mechanism)
{
case CrifContactMechanism.HomePhone:
case CrifContactMechanism.WorkPhone:
case CrifContactMechanism.CellPhone:
case CrifContactMechanism.Fax:
return ContactMechanismCategory.Phone;
case CrifContactMechanism.EMail:
case CrifContactMechanism.URL:
return ContactMechanismCategory.EmailOrUrl;
case CrifContactMechanism.CurrentAddress:
case CrifContactMechanism.MailingAddress:
case CrifContactMechanism.PreviousAddress:
case CrifContactMechanism.RealEstateAddress:
case CrifContactMechanism.ParkContactAddress:
return ContactMechanismCategory.Address;
case CrifContactMechanism.NoneSelected:
default:
throw new ArgumentOutOfRangeException(nameof(mechanism), "ContactMechanismCategory not determined");
}
}
/// <summary>
/// ContactMechanismTypeEnum values from CRIF's commonSchema.xsd
/// </summary>
public enum CrifContactMechanism
{
NoneSelected,
HomePhone,
WorkPhone,
CellPhone,
Fax,
EMail,
CurrentAddress,
URL,
IM,
DriversLicenceState,
MailingAddress,
PreviousAddress,
ContractAddress,
LandlordPostalAddress,
LandlordPhone,
LandlordFax,
InventoryAddress,
AttorneyPostalAddress,
AttorneyPhone,
AttorneyFax,
AttorneyEMailAddress,
CPAPostalAddress,
CPAPhone,
CPAFax,
CPAEMailAddress,
VendorOFACEmail,
RealEstateAddress,
ParkContactAddress,
ParkPhone,
MarinaAddress,
MarinaStorageAddress,
InsurerPostalAddress,
InsurerPhone,
InsurerFax,
SellerPostalAddress,
SellerPhone,
SellerFax,
TitleClerkFax,
Pager,
AdHocPhone,
AdHocFax,
AdHocEMail,
AdHocAddress,
StatementPostalAddress,
BillingPostalAddress,
PropertyContactPhone,
}
/// <summary>
/// Per CRIF Data Mapping document
/// </summary>
public enum ContactMechanismCategory
{
Phone = 1,
Address = 2,
EmailOrUrl = 3,
}
}
}
@@ -0,0 +1,70 @@
using System.Xml;
using System.Xml.Linq;
namespace CRIF.ACTion.Common
{
public class CrifNamespaces
{
public static CrifNamespace App => new("App");
public static CrifNamespace Common => new("Common");
public static CrifNamespace Maint => new("Maint");
public static CrifNamespace Messages => new("msg", "Messages");
public static CrifNamespace QO => new("QO");
public static CrifNamespace Util => new("Util");
public static XNamespace Empty => "";
public static CrifNamespace XSI => new("xsi", "http://www.w3.org/2001/XMLSchema-instance");
public static XmlNamespaceManager GetNamespaceManager(XElement xElement)
{
var namespaceManager = new XmlNamespaceManager(xElement.CreateReader().NameTable);
namespaceManager.AddNamespace(Messages.Prefix, Messages.Namespace.ToString());
namespaceManager.AddNamespace(App.Prefix, App.Namespace.ToString());
namespaceManager.AddNamespace(Maint.Prefix, Maint.Namespace.ToString());
namespaceManager.AddNamespace(Util.Prefix, Util.Namespace.ToString());
namespaceManager.AddNamespace(Common.Prefix, Common.Namespace.ToString());
return namespaceManager;
}
}
public class CrifNamespace
{
public XNamespace Namespace { get; private set; }
public string Prefix { get; private set; }
public CrifNamespace(string prefix, XNamespace namespaceValue)
{
Prefix = prefix;
Namespace = namespaceValue;
}
public CrifNamespace(XNamespace namespaceValue)
{
Prefix = namespaceValue.ToString().ToLower();
Namespace = namespaceValue;
}
public override string ToString()
{
return Namespace.ToString();
}
public static implicit operator XNamespace(CrifNamespace crifNamespace)
{
return crifNamespace.Namespace;
}
public static XName operator +(CrifNamespace crifNamespace, string localName)
{
return crifNamespace.Namespace + localName;
}
}
}
@@ -0,0 +1,16 @@
namespace CRIF.ACTion.Common
{
public static class Dates
{
public static string GetFormattedDOB(DateTime dob)
{
return dob.ToString("yyyy-MM-dd");
}
public static string GetFormattedApplicationDate(DateTime applicationDate)
{
return applicationDate.ToUniversalTime().ToString("o");
}
}
}
@@ -0,0 +1,19 @@
using System.Xml;
using System.Xml.Linq;
namespace CRIF.ACTion.Common
{
public interface ICrifNamespaces
{
XNamespace App { get; }
XNamespace Common { get; }
XNamespace Maint { get; }
XNamespace Messages { get; }
XNamespace QO { get; }
XNamespace Util { get; }
XNamespace Empty { get; }
XmlNamespaceManager GetNamespaceManager(XElement xElement);
}
}
@@ -0,0 +1,9 @@
using System.Xml.Linq;
namespace CRIF.ACTion.Common.Parsers
{
public interface IResponseParser<T>
{
T Parse(XElement xElement);
}
}
@@ -0,0 +1,34 @@
using System.Xml;
using System.Xml.Linq;
using System.Xml.XPath;
namespace CRIF.ACTion.Common.Parsers
{
public static class XElementExtensions
{
/*
Using XPathSelectElement on an XElement starts with the XElement's parent XDocument,
unless you convert the XElement itself to an XDocument
*/
public static XElement XElementXPathSelectElement(this XElement node, string expression)
{
return (new XDocument(node)).XPathSelectElement(expression);
}
public static XElement XElementXPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver resolver)
{
return (new XDocument(node)).XPathSelectElement(expression, resolver);
}
public static IEnumerable<XElement> XElementXPathSelectElements(this XElement node, string expression)
{
return (new XDocument(node)).XPathSelectElements(expression);
}
public static IEnumerable<XElement> XElementXPathSelectElements(this XElement node, string expression, IXmlNamespaceResolver resolver)
{
return (new XDocument(node)).XPathSelectElements(expression, resolver);
}
}
}