This commit is contained in:
Zeeshaun
2026-03-13 12:58:13 -05:00
parent 4e6099ff5c
commit 64856c640e
203 changed files with 106084 additions and 0 deletions
@@ -0,0 +1,17 @@
**/*.bat
**/*.log
**/*.md
**/*.yml
**/.dockerignore
**/.editorconfig
**/.git
**/.gitattributes
**/.gitignore
**/.vs
**/.vscode
**/bin
**/dist
**/dockerfile
**/node_modules
**/obj
**/package-lock.json
@@ -0,0 +1,362 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
@@ -0,0 +1,45 @@
FROM mono:6.12 AS build
WORKDIR /src
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
RUN sed -i 's|deb.debian.org/debian|archive.debian.org/debian|g; s|security.debian.org/debian-security|archive.debian.org/debian-security|g; s|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends ca-certificates curl mono-complete && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
# Bring in full source
COPY . .
# Preconfigure Azure Artifacts feed credentials (PAT passed from pipeline)
RUN nuget sources Add -Name "LCU-Internal" -Source "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -Username "build" -Password "${PAT}" -StorePasswordInClearText
# Restore using the solution (now present after full copy)
RUN nuget restore LCU.API.Internal.CoreSoapApiWrapper/LCU.API.Internal.CoreSoapApiWrapper.sln -NonInteractive
# Build a minimal site layout for xsp4 (/out contains Web.config + Global.asax + bin/)
RUN mkdir -p /out/bin && \
msbuild LCU.API.Internal.CoreSoapApiWrapper/LCU.API.Internal.CoreSoapApiWrapper.csproj /p:Configuration=Release /p:Platform=AnyCPU /p:OutputPath=/out/bin && \
cp -a LCU.API.Internal.CoreSoapApiWrapper/Web.config LCU.API.Internal.CoreSoapApiWrapper/Global.asax /out/
FROM mono:6.12
WORKDIR /app
RUN sed -i 's|deb.debian.org/debian|archive.debian.org/debian|g; s|security.debian.org/debian-security|archive.debian.org/debian-security|g; s|deb.debian.org/debian-security|archive.debian.org/debian-security|g' /etc/apt/sources.list && \
apt-get update && apt-get install -y --no-install-recommends \
mono-xsp4 ca-certificates mono-utils && \
update-ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /out/ .
ENV PEM_PATH=/etc/ssl/lcu-internal-ca-bundle.pem
EXPOSE 8080
ENTRYPOINT ["/bin/sh","-lc", "\
if [ -f \"$PEM_PATH\" ]; then \
cp \"$PEM_PATH\" /usr/local/share/ca-certificates/lcu-internal-ca-bundle.crt && \
update-ca-certificates && \
cert-sync /etc/ssl/certs/ca-certificates.crt || true; \
fi; \
exec xsp4 --port 8080 --nonstop --address 0.0.0.0 --applications '/:.' \
"]
@@ -0,0 +1,17 @@
FROM soap
# Install OS CA tooling + mono cert sync tool (Debian/Ubuntu-based images)
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates mono-utils \
&& rm -rf /var/lib/apt/lists/*
# Add your internal CA chain as a trusted CA bundle
COPY local-config/LandmarkRootCA.crt /usr/local/share/ca-certificates/LandmarkRootCA.crt
COPY local-config/LandmarkIssuingCA1.crt /usr/local/share/ca-certificates/LandmarkIssuingCA1.crt
# Update OS trust + sync into Mono trust
RUN update-ca-certificates \
&& cert-sync /etc/ssl/certs/ca-certificates.crt
# (Optional) Point SSL_CERT_FILE at the system bundle Mono is most likely to use
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
@@ -0,0 +1,72 @@
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
using Swashbuckle.Swagger;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.Description;
namespace LCU.API.Internal.CoreSoapApiWrapper.App_Start
{
/// <summary>
/// Adds ApiKey + Client headers to every operation and (when available)
/// marks them as security requirements so Swagger UI shows Authorize boxes.
/// </summary>
public class AssignSecurityRequirements : IOperationFilter
{
public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription)
{
bool hasSecurityAttribute =
apiDescription.ActionDescriptor
.GetCustomAttributes<ApiKeyAuthorizeAttribute>().Any()
|| apiDescription.ActionDescriptor.ControllerDescriptor
.GetCustomAttributes<ApiKeyAuthorizeAttribute>().Any();
if (!hasSecurityAttribute)
return;
// ensure parameter list
operation.parameters = operation.parameters ?? new List<Parameter>();
// avoid duplicates if multiple filters run
bool HasParam(string name) =>
operation.parameters.Any(p => p.name == name && p.@in == "header");
if (!HasParam("ApiKey"))
{
operation.parameters.Add(new Parameter
{
name = "ApiKey",
@in = "header",
type = "string",
required = false
});
}
if (!HasParam("Client"))
{
operation.parameters.Add(new Parameter
{
name = "Client",
@in = "header",
type = "string",
required = false
});
}
// On newer swashbuckle-core builds, Operation has 'security'.
// If your package doesn't, just delete this block.
try
{
operation.security = operation.security ?? new List<IDictionary<string, IEnumerable<string>>>();
if (!operation.security.Any(s => s.ContainsKey("ApiKey")))
operation.security.Add(new Dictionary<string, IEnumerable<string>> { ["ApiKey"] = new string[0] });
if (!operation.security.Any(s => s.ContainsKey("Client")))
operation.security.Add(new Dictionary<string, IEnumerable<string>> { ["Client"] = new string[0] });
}
catch
{
// Older versions may not expose 'security' on Operation – safe to ignore.
}
}
}
}
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace LCU.API.Internal.CoreSoapApiWrapper
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace LCU.API.Internal.CoreSoapApiWrapper.App_Start
{
public class IocBootstrapper
{
public static void Run()
{
IocConfig.Initialize(GlobalConfiguration.Configuration);
}
}
}
@@ -0,0 +1,89 @@
using Autofac;
using Autofac.Integration.WebApi;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using Serilog;
using Serilog.Events;
using SerilogWeb.Classic.Enrichers;
using System;
using System.Configuration;
using System.IO;
using System.Reflection;
using System.Web.Http;
namespace LCU.API.Internal.CoreSoapApiWrapper.App_Start
{
public class IocConfig
{
public static IContainer Container;
public static void Initialize(HttpConfiguration config)
{
Initialize(config, RegisterServices(new ContainerBuilder()));
}
public static void Initialize(HttpConfiguration config, IContainer container)
{
config.DependencyResolver = new AutofacWebApiDependencyResolver(container);
}
private static IContainer RegisterServices(ContainerBuilder builder)
{
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
builder.Register(c => { return new SoapConfiguration(); }).As<SoapConfiguration>();
RegisterServiceClasses(builder);
RegisterDaoClasses(builder);
RegisterSoapClasses(builder);
// Get apikey from secret file if available, otherwise fallback to appsettings
var seqApiKey = ConfigurationManager.AppSettings["serilog:write-to:Seq.apiKey"];
try
{
seqApiKey = File.ReadAllText("/vault/secrets/core-soap-api-wrapper-api-seq-api-key.json").Trim();
} catch (Exception)
{
// do nothing
}
builder.Register<ILogger>((c, p) =>
{
return new LoggerConfiguration().Enrich.FromLogContext()
.Enrich.With<HttpRequestIdEnricher>()
.WriteTo.Seq(ConfigurationManager.AppSettings["serilog:write-to:Seq.serverUrl"], LogEventLevel.Information, 1000, null, seqApiKey)
.CreateLogger();
}).SingleInstance();
return builder.Build();
}
private static void RegisterServiceClasses(ContainerBuilder builder)
{
builder.RegisterType<AccountService>().As<IAccountService>();
builder.RegisterType<CollateralMaintenanceService>().As<ICollateralMaintenanceService>();
builder.RegisterType<MonetaryTransactionService>().As<IMonetaryTransactionService>();
builder.RegisterType<IndirectLoanService>().As<IIndirectLoanService>();
builder.RegisterType<PersonAgreementService>().As<IPersonAgreementService>();
builder.RegisterType<TaxService>().As<ITaxService>();
}
private static void RegisterDaoClasses(ContainerBuilder builder)
{
builder.RegisterType<AccountDao>().As<IAccountDao>();
builder.RegisterType<CollateralMaintenanceDao>().As<ICollateralMaintenanceDao>();
builder.RegisterType<MonetaryTransactionDao>().As<IMonetaryTransactionDao>();
builder.RegisterType<IndirectLoanDao>().As<IIndirectLoanDao>();
builder.RegisterType<PersonAgreementDao>().As<IPersonAgreementDao>();
builder.RegisterType<TaxDao>().As<ITaxDao>();
}
private static void RegisterSoapClasses(ContainerBuilder builder)
{
builder.RegisterType<CoreSoapConnection>().As<ICoreSoapConnection>();
builder.RegisterType<CoreSoapRequest>().As<ICoreSoapRequest>();
builder.RegisterType<CoreCmcConnection>().As<ICoreCmcConnection>();
}
}
}
@@ -0,0 +1,19 @@
using System.Web.Mvc;
using System.Web.Routing;
namespace LCU.API.Internal.CoreSoapApiWrapper
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
@@ -0,0 +1,313 @@
using System.Web.Http;
using WebActivatorEx;
using LCU.API.Internal.CoreSoapApiWrapper;
using Swashbuckle.Application;
using LCU.API.Internal.CoreSoapApiWrapper.App_Start;
using System;
using System.Linq;
using System.Net.Http;
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]
namespace LCU.API.Internal.CoreSoapApiWrapper
{
public class SwaggerConfig
{
public static void Register()
{
var thisAssembly = typeof(SwaggerConfig).Assembly;
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
// By default, the service root url is inferred from the request used to access the docs.
// However, there may be situations (e.g. proxy and load-balanced environments) where this does not
// resolve correctly. You can workaround this by providing your own code to determine the root URL.
//
c.RootUrl(GetRootUrlFromProxyHeaders);
// If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access
// the docs is taken as the default. If your API supports multiple schemes and you want to be explicit
// about them, you can use the "Schemes" option as shown below.
//
//c.Schemes(new[] { "http", "https" });
// Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to
// hold additional metadata for an API. Version and title are required but you can also provide
// additional fields by chaining methods off SingleApiVersion.
//
c.SingleApiVersion("v1", "LCU.API.Internal.CoreSoapApiWrapper");
// If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option.
//
//c.PrettyPrint();
// If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion".
// In this case, you must provide a lambda that tells Swashbuckle which actions should be
// included in the docs for a given API version. Like "SingleApiVersion", each call to "Version"
// returns an "Info" builder so you can provide additional metadata per API version.
//
//c.MultipleApiVersions(
// (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion),
// (vc) =>
// {
// vc.Version("v2", "Swashbuckle Dummy API V2");
// vc.Version("v1", "Swashbuckle Dummy API V1");
// });
// You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API.
// See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details.
// NOTE: These only define the schemes and need to be coupled with a corresponding "security" property
// at the document or operation level to indicate which schemes are required for an operation. To do this,
// you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties
// according to your specific authorization implementation
//
//c.BasicAuth("basic")
// .Description("Basic HTTP Authentication");
//
// NOTE: You must also configure 'EnableApiKeySupport' below in the SwaggerUI section
//c.ApiKey("apiKey")
// .Description("API Key Authentication")
// .Name("apiKey")
// .In("header");
//
//c.OAuth2("oauth2")
// .Description("OAuth2 Implicit Grant")
// .Flow("implicit")
// .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog")
// //.TokenUrl("https://tempuri.org/token")
// .Scopes(scopes =>
// {
// scopes.Add("read", "Read access to protected resources");
// scopes.Add("write", "Write access to protected resources");
// });
// Set this flag to omit descriptions for any actions decorated with the Obsolete attribute
//c.IgnoreObsoleteActions();
// Each operation be assigned one or more tags which are then used by consumers for various reasons.
// For example, the swagger-ui groups operations according to the first tag of each operation.
// By default, this will be controller name but you can use the "GroupActionsBy" option to
// override with any value.
//
//c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString());
// You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate
// the order in which operations are listed. For example, if the default grouping is in place
// (controller name) and you specify a descending alphabetic sort order, then actions from a
// ProductsController will be listed before those from a CustomersController. This is typically
// used to customize the order of groupings in the swagger-ui.
//
//c.OrderActionGroupsBy(new DescendingAlphabeticComparer());
// If you annotate Controllers and API Types with
// Xml comments (http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx), you can incorporate
// those comments into the generated docs and UI. You can enable this by providing the path to one or
// more Xml comment files.
//
//c.IncludeXmlComments(GetXmlCommentsPath());
// Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types
// exposed in your API. However, there may be occasions when more control of the output is needed.
// This is supported through the "MapType" and "SchemaFilter" options:
//
// Use the "MapType" option to override the Schema generation for a specific type.
// It should be noted that the resulting Schema will be placed "inline" for any applicable Operations.
// While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not.
// It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only
// use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a
// complex Schema, use a Schema filter.
//
//c.MapType<ProductType>(() => new Schema { type = "integer", format = "int32" });
// If you want to post-modify "complex" Schemas once they've been generated, across the board or for a
// specific type, you can wire up one or more Schema filters.
//
//c.SchemaFilter<ApplySchemaVendorExtensions>();
// In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique
// Schema Id. By default, Swashbuckle does NOT use the full type name in Schema Ids. In most cases, this
// works well because it prevents the "implementation detail" of type namespaces from leaking into your
// Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll
// need to opt out of this behavior to avoid Schema Id conflicts.
//
//c.UseFullTypeNameInSchemaIds();
// Alternatively, you can provide your own custom strategy for inferring SchemaId's for
// describing "complex" types in your API.
//
//c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName);
// Set this flag to omit schema property descriptions for any type properties decorated with the
// Obsolete attribute
//c.IgnoreObsoleteProperties();
// In accordance with the built in JsonSerializer, Swashbuckle will, by default, describe enums as integers.
// You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given
// enum type. Swashbuckle will honor this change out-of-the-box. However, if you use a different
// approach to serialize enums as strings, you can also force Swashbuckle to describe them as strings.
//
//c.DescribeAllEnumsAsStrings();
// Similar to Schema filters, Swashbuckle also supports Operation and Document filters:
//
// Post-modify Operation descriptions once they've been generated by wiring up one or more
// Operation filters.
//
//c.OperationFilter<AddDefaultResponse>();
//
// If you've defined an OAuth2 flow as described above, you could use a custom filter
// to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required
// to execute the operation
//
//c.OperationFilter<AssignOAuth2SecurityRequirements>();
// Post-modify the entire Swagger document by wiring up one or more Document filters.
// This gives full control to modify the final SwaggerDocument. You should have a good understanding of
// the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md
// before using this option.
//
//c.DocumentFilter<ApplyDocumentVendorExtensions>();
// In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL
// to an action. As a result, Swashbuckle will raise an exception if it encounters multiple actions
// with the same path (sans query string) and HTTP method. You can workaround this by providing a
// custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs
//
//c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
// Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an
// alternative implementation for ISwaggerProvider with the CustomProvider option.
//
//c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider));
c.ApiKey("ApiKey")
.Description("API Key Header")
.Name("ApiKey")
.In("header");
c.ApiKey("Client")
.Description("Client Header")
.Name("Client")
.In("header");
c.OperationFilter<AssignSecurityRequirements>();
})
.EnableSwaggerUi(c =>
{
// Use the "DocumentTitle" option to change the Document title.
// Very helpful when you have multiple Swagger pages open, to tell them apart.
//
//c.DocumentTitle("My Swagger UI");
// Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets.
// The file must be included in your project as an "Embedded Resource", and then the resource's
// "Logical Name" is passed to the method as shown below.
//
//c.InjectStylesheet(containingAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css");
// Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui
// has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's
// "Logical Name" is passed to the method as shown above.
//
//c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js");
// The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false"
// strings as the possible choices. You can use this option to change these to something else,
// for example 0 and 1.
//
//c.BooleanValues(new[] { "0", "1" });
// By default, swagger-ui will validate specs against swagger.io's online validator and display the result
// in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the
// feature entirely.
//c.SetValidatorUrl("http://localhost/validator");
//c.DisableValidator();
// Use this option to control how the Operation listing is displayed.
// It can be set to "None" (default), "List" (shows operations for each resource),
// or "Full" (fully expanded: shows operations and their details).
//
//c.DocExpansion(DocExpansion.List);
// Specify which HTTP operations will have the 'Try it out!' option. An empty paramter list disables
// it for all operations.
//
//c.SupportedSubmitMethods("GET", "HEAD");
// Use the CustomAsset option to provide your own version of assets used in the swagger-ui.
// It's typically used to instruct Swashbuckle to return your version instead of the default
// when a request is made for "index.html". As with all custom content, the file must be included
// in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to
// the method as shown below.
//
//c.CustomAsset("index", containingAssembly, "YourWebApiProject.SwaggerExtensions.index.html");
// If your API has multiple versions and you've applied the MultipleApiVersions setting
// as described above, you can also enable a select box in the swagger-ui, that displays
// a discovery URL for each version. This provides a convenient way for users to browse documentation
// for different API versions.
//
//c.EnableDiscoveryUrlSelector();
// If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to
// the Swagger 2.0 specification, you can enable UI support as shown below.
//
//c.EnableOAuth2Support(
// clientId: "test-client-id",
// clientSecret: null,
// realm: "test-realm",
// appName: "Swagger UI"
// //additionalQueryStringParams: new Dictionary<string, string>() { { "foo", "bar" } }
//);
// If your API supports ApiKey, you can override the default values.
// "apiKeyIn" can either be "query" or "header"
//
//c.EnableApiKeySupport("apiKey", "header");
});
}
private static string GetRootUrlFromProxyHeaders(HttpRequestMessage request)
{
var forwardedProto = GetFirstHeaderValue(request, "X-Forwarded-Proto");
var forwardedHost = GetFirstHeaderValue(request, "X-Forwarded-Host");
var forwardedPrefix = GetFirstHeaderValue(request, "X-Forwarded-Prefix");
var scheme = string.IsNullOrWhiteSpace(forwardedProto) ? request.RequestUri.Scheme : forwardedProto;
var authority = !string.IsNullOrWhiteSpace(forwardedHost)
? forwardedHost
: (string.IsNullOrWhiteSpace(request.Headers.Host) ? request.RequestUri.Authority : request.Headers.Host);
var pathBase = request.GetRequestContext()?.VirtualPathRoot ?? "/";
var prefix = NormalizePrefix(forwardedPrefix);
if (!string.IsNullOrWhiteSpace(prefix) && prefix != "/")
{
pathBase = prefix;
}
return $"{scheme}://{authority}{(pathBase ?? "/").TrimEnd('/')}";
}
private static string GetFirstHeaderValue(HttpRequestMessage request, string headerName)
{
if (request == null) return null;
if (string.IsNullOrWhiteSpace(headerName)) return null;
if (!request.Headers.TryGetValues(headerName, out var values)) return null;
var value = values?.FirstOrDefault();
if (string.IsNullOrWhiteSpace(value)) return null;
return value.Split(',').Select(v => v.Trim()).FirstOrDefault(v => !string.IsNullOrWhiteSpace(v));
}
private static string NormalizePrefix(string prefix)
{
if (string.IsNullOrWhiteSpace(prefix)) return null;
var trimmed = prefix.Trim();
if (!trimmed.StartsWith("/")) trimmed = "/" + trimmed;
return trimmed.EndsWith("/") && trimmed.Length > 1 ? trimmed.TrimEnd('/') : trimmed;
}
}
}
@@ -0,0 +1,22 @@
using System.Web.Http;
namespace LCU.API.Internal.CoreSoapApiWrapper
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
config.EnableCors();
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "v1/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
@@ -0,0 +1,87 @@
using Serilog;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
namespace LCU.API.Internal.CoreSoapApiWrapper.Attributes
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false)]
public sealed class ApiKeyAuthorizeAttribute : AuthorizeAttribute
{
private const string AuthFailureMessage = "Unauthorized client: ";
private const string NotProvidedMessage = "Header Not Provided: ";
private const string KeySetPrefix = "ApiSecurityConfiguration:ExternalApiKeySet:";
private readonly Dictionary<string, string> _externalApiKeySet;
private readonly string _authenticationFailureBehavior;
public ApiKeyAuthorizeAttribute()
{
_externalApiKeySet = ConfigurationManager.AppSettings.AllKeys
.Where(k => k.StartsWith(KeySetPrefix))
.ToDictionary(
k => k.Substring(KeySetPrefix.Length),
k => ConfigurationManager.AppSettings[k]);
try
{
var coreSoapApiWrapperKey = File.ReadAllText("/vault/secrets/core-soap-api-wrapper-external-api-key-core-soap-api-wrapper.json").Trim();
_externalApiKeySet["CoreSoapApiWrapper"] = coreSoapApiWrapperKey;
} catch(Exception)
{
// do nothing, fallback to appsettings value if secret file is not found or cannot be read
}
_authenticationFailureBehavior = ConfigurationManager.AppSettings["ApiSecurityConfiguration:ApiKeyAuthenticationFailureBehavior"] ?? "Error";
}
protected override bool IsAuthorized(HttpActionContext actionContext)
{
var request = actionContext.Request;
if (!request.Headers.TryGetValues("ApiKey", out var apiKeys))
{
return HandleFailure(NotProvidedMessage, "ApiKey");
}
if (!request.Headers.TryGetValues("Client", out var clients))
{
return HandleFailure(NotProvidedMessage, "Client");
}
var apiKey = apiKeys.FirstOrDefault();
var client = clients.FirstOrDefault();
_externalApiKeySet.TryGetValue(client, out var externalApiKey);
if (string.IsNullOrEmpty(apiKey) || !apiKey.Equals(externalApiKey))
{
return HandleFailure(AuthFailureMessage, "ApiKey");
}
return true;
}
private bool HandleFailure(string message, string type)
{
if (_authenticationFailureBehavior.Equals("Warn", StringComparison.OrdinalIgnoreCase))
{
Log.Warning(message + type);
return true;
}
Log.Error(message + type);
return false;
}
protected override void HandleUnauthorizedRequest(HttpActionContext actionContext)
{
actionContext.Response = new HttpResponseMessage(HttpStatusCode.Unauthorized)
{
Content = new StringContent(AuthFailureMessage + "ApiKey")
};
}
}
}
@@ -0,0 +1,241 @@
using Serilog;
using System;
using System.Web.Http;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/Account")]
public class AccountController : ApiController
{
private readonly IAccountService _accountService;
public AccountController(IAccountService accountService)
{
_accountService = accountService;
}
[Route("{accountNumber:long}/GetAccountByAccountNumber")]
public IHttpActionResult GetAccountByAccountNumber(long accountNumber)
{
if (accountNumber <= 0)
{
Log.Warning($"Account number must be greater than 0. AccountNumber: {accountNumber}");
return BadRequest("Account number must be greater than 0");
}
try
{
var accountOwnerships = _accountService.GetAccountByAccountNumber(accountNumber);
return Ok(accountOwnerships);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountMaintenanceRequest")]
public IHttpActionResult PutAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest)
{
if (accountMaintenanceRequest == null)
{
return BadRequest("AccountMaintenance Request cannot be null.");
}
try
{
var accountMaintenanceResponse = _accountService.SendAccountMaintenanceRequest(accountMaintenanceRequest);
return Ok(accountMaintenanceResponse);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountBranchUpdateRequest")]
public IHttpActionResult PutAccountBranchUpdateRequest(AccountBranchUpdateRequest accountBranchUpdateRequest)
{
if (accountBranchUpdateRequest == null)
{
return BadRequest("AccountBranchUpdate Request cannot be null.");
}
try
{
var accountBranchUpdateResponse = _accountService.SendAccountBranchUpdateRequest(accountBranchUpdateRequest);
return Ok(accountBranchUpdateResponse);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountLtvUpdateRequest")]
public IHttpActionResult PutAccountLtvUpdateRequest(AccountLtvUpdateRequest accountLtvUpdateRequest)
{
if (accountLtvUpdateRequest == null)
{
return BadRequest("AccountLtvUpdateRequest Request cannot be null.");
}
try
{
var accountLtvUpdateResponse = _accountService.SendAccountLtvUpdateRequest(accountLtvUpdateRequest);
return Ok(accountLtvUpdateResponse);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountAnalysisGroupMaintenanceRequest")]
public IHttpActionResult PutAccountAnalysisGroupMaintenanceRequest(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest)
{
if (accountAnalysisGroupMaintenanceRequest == null)
{
return BadRequest("AccountAnalysisGroupMaintenance Request cannot be null.");
}
try
{
var accountAnalysisUpdateResponse = _accountService.SendAccountAnalysisGroupMaintenanceRequest(accountAnalysisGroupMaintenanceRequest);
return Ok(accountAnalysisUpdateResponse);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("PersonAccountRequest")]
public IHttpActionResult PostPersonAccountRequest([FromBody] CreatePersonAccountRequest request)
{
if (request == null)
{
return BadRequest("CreatePersonAccountRequest cannot be null.");
}
try
{
var response = _accountService.AddPersonAccount(request);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("OrganizationAccountRequest")]
public IHttpActionResult PostOrganizationAccountRequest([FromBody] CreateOrganizationAccountRequest request)
{
if (request == null)
{
return BadRequest("CreateOrganizationAccountRequest cannot be null.");
}
try
{
var response = _accountService.AddOrganizationAccount(request);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("OrganizationMaintenanceRequest")]
public IHttpActionResult PutOrganizationMaintenanceRequest([FromBody] OrganizationMaintenanceRequest request)
{
if (request == null)
{
return BadRequest("OrganizationMaintenanceRequest cannot be null.");
}
try
{
var response = _accountService.AddOrganizationControlPerson(request);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountNickNameUpdateRequest")]
public IHttpActionResult PutAccountNickNameUpdateRequest([FromBody] AccountNickNameUpdateRequest request)
{
if (request == null)
{
return BadRequest("AccountNickNameUpdateRequest cannot be null.");
}
try
{
var response = _accountService.SendAccountNickNameUpdateRequest(request);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountCreditReportTypeRequest")]
public IHttpActionResult PutAccountCreditReportTypeUpdateRequest(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest)
{
if (accountCreditReportTypeUpdateRequest == null)
{
return BadRequest("AccountCreditReportTypeUpdateRequest Request cannot be null.");
}
try
{
var accountCreditReportTypeUpdateResponse = _accountService.SendAccountCreditReportTypeUpdateRequest(accountCreditReportTypeUpdateRequest);
return Ok(accountCreditReportTypeUpdateResponse);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("AccountContractDateUpdateRequest")]
public IHttpActionResult PutAccountContractDateUpdateRequest([FromBody] AccountContractDateUpdateRequest request)
{
if (request == null)
{
return BadRequest("AccountContractDateUpdateRequest cannot be null.");
}
try
{
var response = _accountService.SendAccountContractDateUpdateRequest(request);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,78 @@
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using Serilog;
using System;
using System.Web.Http;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/CollateralMaintenance")]
public class CollateralMaintenanceController : ApiController
{
private readonly ICollateralMaintenanceService _collateralMaintenanceService;
public CollateralMaintenanceController(ICollateralMaintenanceService collateralMaintenanceService)
{
_collateralMaintenanceService = collateralMaintenanceService;
}
[Route("{propertyNumber:long}/GetCollateralByPropertyNumber")]
public IHttpActionResult Get(long propertyNumber)
{
try
{
if (propertyNumber <= 0)
{
Log.Warning($"Property number must be greater than 0. AccountNumber: {propertyNumber}");
return BadRequest("Property number must be greater than 0");
}
var collateral = _collateralMaintenanceService.GetCollateralMaintenanceByPropertyNumber(propertyNumber);
return Ok(collateral);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("PostCollateralMaintenance")]
public IHttpActionResult PostCollateralMaintenance([FromBody] UserFieldRequest request)
{
try
{
if (request == null)
{
Log.Warning($"Request cannot be null");
return BadRequest("Request cannot be null");
}
var collateral = _collateralMaintenanceService.InsertCollateralMaintenance(request);
return Ok(collateral);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("PutCollateralMaintenance")]
public IHttpActionResult PutCollateralMaintenance([FromBody] UserFieldRequest request)
{
try
{
if (request == null)
{
Log.Warning($"Request cannot be null");
return BadRequest("Request cannot be null");
}
var collateral = _collateralMaintenanceService.UpdateCollateralMaintenance(request);
return Ok(collateral);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,42 @@
using System;
using System.Web.Http;
using System.Collections.Generic;
using System.Linq;
using Serilog;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/IndirectLoan")]
public class IndirectLoanController : ApiController
{
private readonly IIndirectLoanService _indirectLoanService;
public IndirectLoanController (IIndirectLoanService indirectLoanService)
{
_indirectLoanService = indirectLoanService;
}
[ApiKeyAuthorize]
[Route("PutDealerOriginalBalance")]
public IHttpActionResult PutDealerOriginalBalance(string accountNumber)
{
if (string.IsNullOrEmpty(accountNumber))
{
Log.Warning($"Account number is invalid");
return BadRequest("Account number cannot be null.");
}
try
{
var response = _indirectLoanService.UpdateDealerOriginalBalances(accountNumber);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,68 @@
using Serilog;
using System;
using System.Web.Http;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/MonetaryTransaction")]
public class MonetaryTransactionController : ApiController
{
private readonly IMonetaryTransactionService _monetaryTransactionService;
public MonetaryTransactionController(IMonetaryTransactionService monetaryTransactionService)
{
_monetaryTransactionService = monetaryTransactionService;
}
[ApiKeyAuthorize]
[Route("PostMonetaryTransactions")]
public IHttpActionResult PostMonetaryTransactions(List<GroupedMonetaryTransactionRequest> requests)
{
if (requests == null)
{
Log.Warning($"Request cannot be null");
return BadRequest("Invalid Request");
}
try
{
var response = _monetaryTransactionService.AddMonetaryTransactions(requests);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
[ApiKeyAuthorize]
[Route("PostFundsToAccount")]
public IHttpActionResult PostFundsToAccount([FromBody] List<FundsToAccountRequest> requests)
{
if (requests == null)
{
return BadRequest("Invalid Request");
}
if (!ModelState.IsValid)
{
return BadRequest("FundsToAccountRequest is invalid.");
}
try
{
var response = _monetaryTransactionService.AddFundsToAccount(requests);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.Web.Http;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Attributes;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/PersonAgreement")]
public class PersonAgreementController : ApiController
{
private readonly IPersonAgreementService _personAgreementService;
public PersonAgreementController(IPersonAgreementService personAgreementService)
{
_personAgreementService = personAgreementService;
}
[ApiKeyAuthorize]
[Route("PutPersonAgreementsDetailTypes")]
public IHttpActionResult PutPersonAgreementsDetailTypes([FromBody] PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest)
{
try
{
if (!ModelState.IsValid)
{
return BadRequest("PersonAgreementDetailTypeRequest is invalid.");
}
if (personAgreementDetailTypeRequest == null)
{
return BadRequest("PersonAgreementDetailTypeRequest Request cannot be null.");
}
var response = _personAgreementService.UpdatePersonAgreementsDetailTypes(personAgreementDetailTypeRequest);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,35 @@
using System;
using System.Configuration;
using System.Web.Http;
using Serilog;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/status")]
public class StatusController : ApiController
{
public StatusController()
{
}
[Route("")]
public IHttpActionResult Get()
{
try
{
var result = new EnvironmentView();
result.Application = "LCU.API.Internal.CoreSoapApiWrapper";
result.CurrentDate = DateTime.Now;
result.Environment = ConfigurationManager.AppSettings["KnownEnvironment"];
Log.Verbose($"{result.Application}'s status endpoint was hit in {result.Environment}");
return Ok(result);
}
catch (Exception ex)
{
Log.Error(ex, "Error getting status.");
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,38 @@
using System;
using System.Web.Http;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
namespace LCU.API.Internal.CoreSoapApiWrapper.Controllers
{
[RoutePrefix("api/core/Tax")]
public class TaxController : ApiController
{
private readonly ITaxService _taxService;
public TaxController(ITaxService taxService)
{
_taxService = taxService;
}
[Route("{taxId:long}/GetTaxIdData")]
public IHttpActionResult GetTaxIdData(long taxId)
{
try
{
if (taxId == 0)
{
return BadRequest("A taxId must be provided, and cannot be 0.");
}
var response = _taxService.GetTaxIdData(taxId);
return Ok(response);
}
catch (Exception ex)
{
return BadRequest(ex.Message);
}
}
}
}
@@ -0,0 +1,202 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public class CoreCmcConnection : ICoreCmcConnection
{
private readonly SoapConfiguration _soapConfiguration;
private const int WhoIsTokenRequestTimeOut = 10 * 60 * 1000;
public CoreCmcConnection(SoapConfiguration soapConfiguration)
{
_soapConfiguration = soapConfiguration;
}
public Cmc.Transaction<TRequest> CreateSocketTransactionRequest<TRequest>(TRequest request)
{
var whoIsToken = GetWhoIsToken();
var userAuthentication = new Cmc.UserAuthentication()
{
AuthTyp = _soapConfiguration.AuthenticationType,
ApplNbr = _soapConfiguration.SocketApplicationId,
PhysAddr = _soapConfiguration.SocketDeviceId,
Passwd = whoIsToken
};
var requestsBase = new List<TRequest>();
requestsBase.Add(request);
var input = new Cmc.Input<TRequest>()
{
UserAuthentication = userAuthentication,
Requests = requestsBase
};
var transaction = new Cmc.Transaction<TRequest>()
{
Input = input,
CommitRollbackYN = "Y"
};
return transaction;
}
/// <summary>
/// This code could be refactored, some of this logic is duplicated.
/// </summary>
public string GetWhoIsToken()
{
try
{
var signOnResponse = DirectSSORequest();
var xmlResponseDocument = new XmlDocument();
xmlResponseDocument.LoadXml(signOnResponse);
var unSuccessful = !Convert.ToBoolean(xmlResponseDocument.DocumentElement.Attributes["Successful"].Value);
if (unSuccessful)
{
var exceptionCode = xmlResponseDocument.DocumentElement.Attributes["ExceptionCode"].Value;
var exceptionMessage = xmlResponseDocument.DocumentElement.Attributes["ExceptionMessage"].Value;
throw new Exception($"Unsuccessfull direct signon. ExceptionCode: {exceptionCode}, ExceptionMessage: {exceptionMessage}");
}
var ssoTicketNode = xmlResponseDocument.DocumentElement.SelectSingleNode("SSOTicket");
var ssoTicket = ssoTicketNode.InnerText;
return RequestWhoIsToken(ssoTicket);
}
catch (Exception ex)
{
throw new Exception($"Failure to get a who is token. Exception: {ex}");
}
}
/// <summary>
/// This code could be refactored, some of this logic is duplicated.
/// </summary>
private string DirectSSORequest()
{
try
{
var xmlRequest = new StringBuilder();
var settings = new XmlWriterSettings
{
Indent = true
};
using (Utf8StringWriter utf8StringWriter = new Utf8StringWriter(xmlRequest))
using (XmlWriter writer = XmlWriter.Create(utf8StringWriter, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("DirectSSORequest");
writer.WriteAttributeString("MessageDateTime",
System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime.ToString(DateTime.Now));
writer.WriteAttributeString("TrackingId", Guid.NewGuid().ToString());
writer.WriteElementString("DeviceId", _soapConfiguration.SocketDeviceId);
writer.WriteElementString("UserId", _soapConfiguration.SocketUserId);
writer.WriteElementString("Password", _soapConfiguration.SocketPassword);
writer.WriteElementString("ProdEnvCd", _soapConfiguration.EnvironmentCode);
writer.WriteElementString("ProdDefCd", _soapConfiguration.DefCode);
writer.WriteEndElement();
writer.WriteEndDocument();
}
var xml = xmlRequest.ToString();
var productIntegration = new ProductIntegration()
{
Url = _soapConfiguration.SafUrl,
UseDefaultCredentials = true
};
var xmlResponse = productIntegration.DirectSignon(xmlRequest.ToString());
return xmlResponse;
}
catch (Exception ex)
{
throw new Exception($"Failure to make direct SSO request. Exception:{ex}");
}
}
/// <summary>
/// This code could be refactored, some of this logic is duplicated.
/// </summary>
private class Utf8StringWriter : StringWriter
{
public Utf8StringWriter(StringBuilder sb) : base(sb) { }
public override Encoding Encoding { get { return Encoding.UTF8; } }
}
/// <summary>
/// This code could be refactored, some of this logic is duplicated.
/// </summary>
private string RequestWhoIsToken(string ssoTicket)
{
try
{
var xmlResponse = WhoIsRequest(ssoTicket);
var xmlResponseDocument = new XmlDocument();
xmlResponseDocument.LoadXml(xmlResponse);
xmlResponseDocument.RemoveChild(xmlResponseDocument.FirstChild);
var unSuccessful = !Convert.ToBoolean(xmlResponseDocument.DocumentElement.Attributes["Successful"].Value);
if (unSuccessful)
{
var exceptionCode = xmlResponseDocument.DocumentElement.Attributes["ExceptionCode"].Value;
var exceptionMessage = xmlResponseDocument.DocumentElement.Attributes["ExceptionMessage"].Value;
throw new Exception($"Unsuccessfull direct signon. ExceptionCode: {exceptionCode}, ExceptionMessage: {exceptionMessage}");
}
return xmlResponseDocument.InnerXml;
}
catch (Exception ex)
{
throw new Exception($"Failure to request a who is token. Exception: {ex}");
}
}
/// <summary>
/// This code could be refactored, some of this logic is duplicated.
/// </summary>
private string WhoIsRequest(string ssoTicket)
{
var xmlRequest = new StringBuilder();
var settings = new XmlWriterSettings()
{
Indent = true
};
using (Utf8StringWriter str = new Utf8StringWriter(xmlRequest))
using (XmlWriter writer = XmlWriter.Create(str, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("WhoIsRequest");
writer.WriteAttributeString("MessageDateTime",
System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime.ToString(DateTime.Now));
writer.WriteAttributeString("TrackingId", Guid.NewGuid().ToString());
writer.WriteAttributeString("SSOTicket", ssoTicket);
writer.WriteElementString("LookupSSOTicket", ssoTicket);
writer.WriteEndDocument();
}
var productIntegration = new ProductIntegration()
{
Url = _soapConfiguration.SafUrl,
UseDefaultCredentials = true,
Timeout = WhoIsTokenRequestTimeOut
};
var xmlResponse = productIntegration.WhoIs(xmlRequest.ToString());
return xmlResponse;
}
}
}
@@ -0,0 +1,195 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public class CoreSoapConnection : ICoreSoapConnection
{
private readonly SoapConfiguration _soapConfiguration;
private const int WhoIsTokenRequestTimeOut = 10 * 60 * 1000;
public CoreSoapConnection(SoapConfiguration soapConfiguration)
{
_soapConfiguration = soapConfiguration;
}
public TransactionInput CreateTransactionInput<TRequest>(TRequest request) where TRequest : RequestBase
{
var requests = new List<TRequest>() { request };
return CreateTransactionInput(requests);
}
public TransactionInput CreateTransactionInput<TRequest>(List<TRequest> requests) where TRequest : RequestBase
{
var whoIsToken = GetWhoIsToken();
var userAuthentication = new UAInput()
{
ApplID = _soapConfiguration.ApplicationId,
AuthorizationType = AuthTypes.SingleSignOn,
Password = whoIsToken,
NetworkNodeName = _soapConfiguration.DeviceId
};
var requestsBase = new RequestBase[requests.Count];
var requestIndex = 0;
foreach (var request in requests)
{
requestsBase[requestIndex] = request;
requestIndex++;
}
var input = new Input()
{
Requests = requestsBase,
UserAuthentication = userAuthentication
};
var transactionInput = new TransactionInput()
{
Input = input
};
return transactionInput;
}
public string GetWhoIsToken()
{
try
{
var signOnResponse = DirectSSORequest();
var xmlResponseDocument = new XmlDocument();
xmlResponseDocument.LoadXml(signOnResponse);
var unSuccessful = !Convert.ToBoolean(xmlResponseDocument.DocumentElement.Attributes["Successful"].Value);
if (unSuccessful)
{
var exceptionCode = xmlResponseDocument.DocumentElement.Attributes["ExceptionCode"].Value;
var exceptionMessage = xmlResponseDocument.DocumentElement.Attributes["ExceptionMessage"].Value;
throw new Exception($"Unsuccessfull direct signon. ExceptionCode: {exceptionCode}, ExceptionMessage: {exceptionMessage}");
}
var ssoTicketNode = xmlResponseDocument.DocumentElement.SelectSingleNode("SSOTicket");
var ssoTicket = ssoTicketNode.InnerText;
return RequestWhoIsToken(ssoTicket);
}
catch (Exception ex)
{
throw new Exception($"Failure to get a who is token. Exception: {ex}");
}
}
private string DirectSSORequest()
{
try
{
var xmlRequest = new StringBuilder();
var settings = new XmlWriterSettings
{
Indent = true
};
using (Utf8StringWriter utf8StringWriter = new Utf8StringWriter(xmlRequest))
using (XmlWriter writer = XmlWriter.Create(utf8StringWriter, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("DirectSSORequest");
writer.WriteAttributeString("MessageDateTime",
System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime.ToString(DateTime.Now));
writer.WriteAttributeString("TrackingId", Guid.NewGuid().ToString());
writer.WriteElementString("DeviceId", _soapConfiguration.DeviceId);
writer.WriteElementString("UserId", _soapConfiguration.UserId);
writer.WriteElementString("Password", _soapConfiguration.Password);
writer.WriteElementString("ProdEnvCd", _soapConfiguration.EnvironmentCode);
writer.WriteElementString("ProdDefCd", _soapConfiguration.DefCode);
writer.WriteEndElement();
writer.WriteEndDocument();
}
var xml = xmlRequest.ToString();
var productIntegration = new ProductIntegration()
{
Url = _soapConfiguration.SafUrl,
UseDefaultCredentials = true
};
var xmlResponse = productIntegration.DirectSignon(xmlRequest.ToString());
return xmlResponse;
}
catch (Exception ex)
{
throw new Exception($"Failure to make direct SSO request. Exception:{ex}");
}
}
private class Utf8StringWriter : StringWriter
{
public Utf8StringWriter(StringBuilder sb) : base(sb) { }
public override Encoding Encoding { get { return Encoding.UTF8; } }
}
private string RequestWhoIsToken(string ssoTicket)
{
try
{
var xmlResponse = WhoIsRequest(ssoTicket);
var xmlResponseDocument = new XmlDocument();
xmlResponseDocument.LoadXml(xmlResponse);
xmlResponseDocument.RemoveChild(xmlResponseDocument.FirstChild);
var unSuccessful = !Convert.ToBoolean(xmlResponseDocument.DocumentElement.Attributes["Successful"].Value);
if (unSuccessful)
{
var exceptionCode = xmlResponseDocument.DocumentElement.Attributes["ExceptionCode"].Value;
var exceptionMessage = xmlResponseDocument.DocumentElement.Attributes["ExceptionMessage"].Value;
throw new Exception($"Unsuccessfull direct signon. ExceptionCode: {exceptionCode}, ExceptionMessage: {exceptionMessage}");
}
return xmlResponseDocument.InnerXml;
}
catch (Exception ex)
{
throw new Exception($"Failure to request a who is token. Exception: {ex}");
}
}
private string WhoIsRequest(string ssoTicket)
{
var xmlRequest = new StringBuilder();
var settings = new XmlWriterSettings()
{
Indent = true
};
using (Utf8StringWriter str = new Utf8StringWriter(xmlRequest))
using (XmlWriter writer = XmlWriter.Create(str, settings))
{
writer.WriteStartDocument();
writer.WriteStartElement("WhoIsRequest");
writer.WriteAttributeString("MessageDateTime",
System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime.ToString(DateTime.Now));
writer.WriteAttributeString("TrackingId", Guid.NewGuid().ToString());
writer.WriteAttributeString("SSOTicket", ssoTicket);
writer.WriteElementString("LookupSSOTicket", ssoTicket);
writer.WriteEndDocument();
}
var productIntegration = new ProductIntegration()
{
Url = _soapConfiguration.SafUrl,
UseDefaultCredentials = true,
Timeout = WhoIsTokenRequestTimeOut
};
var xmlResponse = productIntegration.WhoIs(xmlRequest.ToString());
return xmlResponse;
}
}
}
@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public class CoreSoapRequest : ICoreSoapRequest
{
private readonly ICoreSoapConnection _coreSoapConnection;
private readonly SoapConfiguration _soapConfiguration;
public CoreSoapRequest(ICoreSoapConnection coreSoapConnection,
SoapConfiguration soapConfiguration)
{
_coreSoapConnection = coreSoapConnection;
_soapConfiguration = soapConfiguration;
}
public TResponse SubmitRequest<TRequest, TResponse>(TRequest request)
where TRequest : RequestBase
where TResponse : ResponseBase
{
var transactionInput = _coreSoapConnection.CreateTransactionInput(request);
var output = SubmitTransactionInput(transactionInput);
var response = (TResponse)output.Output.Responses[0];
return response;
}
public List<TResponse> SubmitRequests<TRequest, TResponse>(List<TRequest> requests)
where TRequest : RequestBase
where TResponse : ResponseBase
{
var transaction = _coreSoapConnection.CreateTransactionInput(requests);
var output = SubmitTransactionInput(transaction);
var responses = new List<TResponse>();
foreach (var outputResponse in output.Output.Responses)
{
responses.Add((TResponse)outputResponse);
}
return responses;
}
private TransactionOutput SubmitTransactionInput(TransactionInput transactionInput)
{
var client = new CoreApiServiceClient(_soapConfiguration.Endpoint);
TransactionOutput output = client.SubmitRequest(transactionInput);
if (output?.Output?.UserAuthentication == null || output?.Output?.Responses == null)
{
throw new NullReferenceException();
}
if (output.Output.UserAuthentication.Errors != null)
{
throw new Exception(output.Output.UserAuthentication.Errors[0].ErrorMessage);
}
return output;
}
}
}
@@ -0,0 +1,9 @@
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public interface ICoreCmcConnection
{
Cmc.Transaction<TRequest> CreateSocketTransactionRequest<TRequest> (TRequest request);
}
}
@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public interface ICoreSoapConnection
{
TransactionInput CreateTransactionInput<TRequest>(TRequest request) where TRequest : RequestBase;
TransactionInput CreateTransactionInput<TRequest>(List<TRequest> request) where TRequest : RequestBase;
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities
{
public interface ICoreSoapRequest
{
TResponse SubmitRequest<TRequest, TResponse>(TRequest request)
where TRequest : RequestBase
where TResponse : ResponseBase;
List<TResponse> SubmitRequests<TRequest, TResponse>(List<TRequest> requests)
where TRequest : RequestBase
where TResponse : ResponseBase;
}
}
@@ -0,0 +1,47 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class AccountDao : BaseDao, IAccountDao
{
private const string AvailableMethodCode = "ABHP";
public AccountDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
{
}
public AccountDetailInquiryResponse FindAccountByAccountNumber(long accountNumber)
{
var accountDetailInquiryRequest = new AccountDetailInquiryRequest()
{
AccountNumber = accountNumber,
AvailableMethodCode = AvailableMethodCode,
IsExternalEntity = false,
IsGetRTXNData = false
};
var response =
_coreSoapRequest.SubmitRequest<AccountDetailInquiryRequest, AccountDetailInquiryResponse>(
accountDetailInquiryRequest);
return response;
}
public AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest)
{
var response = _coreSoapRequest.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(accountMaintenanceRequest);
return response;
}
public AccountAnalysisMaintenanceResponse SendAccountAnalysisMaintenanceRequest(AccountAnalysisMaintenanceRequest accountAnalysisMaintenanceRequest)
{
var response = _coreSoapRequest.SubmitRequest<AccountAnalysisMaintenanceRequest, AccountAnalysisMaintenanceResponse>(accountAnalysisMaintenanceRequest);
return response;
}
public OrgMaintenanceResponse SendOrgMaintenanceRequest(OrgMaintenanceRequest orgMaintenanceRequest)
{
var response = _coreSoapRequest.SubmitRequest<OrgMaintenanceRequest, OrgMaintenanceResponse>(orgMaintenanceRequest);
return response;
}
}
}
@@ -0,0 +1,14 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public abstract class BaseDao
{
protected readonly ICoreSoapRequest _coreSoapRequest;
public BaseDao(ICoreSoapRequest coreSoapRequest)
{
_coreSoapRequest = coreSoapRequest;
}
}
}
@@ -0,0 +1,36 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class CollateralMaintenanceDao: BaseDao, ICollateralMaintenanceDao
{
public CollateralMaintenanceDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
{
}
public CollateralMaintenanceResponse AddCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request)
{
return _coreSoapRequest.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(request);
}
public CollateralSearchResponse FindCollateralMaintenanceByPropertyNumber(long propertyNumber)
{
var collateralRequest = new CollateralSearchRequest();
collateralRequest.PropertyCollateral = new PropertyCollateralRequest();
collateralRequest.PropertyCollateral.PropertyNumber = propertyNumber;
var response = _coreSoapRequest.SubmitRequest<CollateralSearchRequest, CollateralSearchResponse>(collateralRequest);
return response;
}
public CollateralMaintenanceResponse UpdateCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request)
{
return _coreSoapRequest.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(request);
}
}
}
@@ -0,0 +1,12 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface IAccountDao
{
AccountDetailInquiryResponse FindAccountByAccountNumber(long accountNumber);
AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest);
AccountAnalysisMaintenanceResponse SendAccountAnalysisMaintenanceRequest(AccountAnalysisMaintenanceRequest accountAnalysisMaintenanceRequest);
OrgMaintenanceResponse SendOrgMaintenanceRequest(OrgMaintenanceRequest orgMaintenanceRequest);
}
}
@@ -0,0 +1,16 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface ICollateralMaintenanceDao
{
CollateralSearchResponse FindCollateralMaintenanceByPropertyNumber(long propertyNumber);
CollateralMaintenanceResponse AddCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request);
CollateralMaintenanceResponse UpdateCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request);
}
}
@@ -0,0 +1,9 @@
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface IIndirectLoanDao
{
Cmc.Transaction<TRequest> UpdateDealerOriginalBalance<TRequest>(Cmc.Transaction<TRequest> transaction);
}
}
@@ -0,0 +1,10 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface IMonetaryTransactionDao
{
List<MonetaryTransactionResponse> AddMonetaryTransactions (List<MonetaryTransactionRequest> request);
}
}
@@ -0,0 +1,9 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface IPersonAgreementDao
{
PersonAgreementMaintenanceResponse SendPersonAgreementMaintenanceRequest(PersonAgreementMaintenanceRequest personAgreementMaintenanceRequest);
}
}
@@ -0,0 +1,9 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public interface ITaxDao
{
GetTaxIdDataResponse GetTaxIdData(long taxId);
}
}
@@ -0,0 +1,90 @@
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using Serilog;
using System.Xml.Serialization;
using System.Xml;
using System.IO;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class IndirectLoanDao : IIndirectLoanDao
{
private readonly SoapConfiguration _soapConfiguration;
public IndirectLoanDao (SoapConfiguration soapConfiguration)
{
_soapConfiguration = soapConfiguration;
}
public Cmc.Transaction<TRequest> UpdateDealerOriginalBalance<TRequest>(Cmc.Transaction<TRequest> transaction)
{
try
{
return SendRequest<TRequest>(transaction);
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while updating accounts");
throw ex;
}
}
private Cmc.Transaction<TRequest> SendRequest<TRequest>(Cmc.Transaction<TRequest> transaction)
{
byte[] byteBuffer = new byte[50000];
byte[] message;
int bytesSent;
int bytesReceived;
IPAddress ipAddress = IPAddress.Parse(_soapConfiguration.IPAddress);
IPEndPoint remoteEP = new IPEndPoint(ipAddress, _soapConfiguration.PortId);
Socket socketSender = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try
{
socketSender.SendTimeout = _soapConfiguration.SocketTimeout;
socketSender.ReceiveTimeout = _soapConfiguration.SocketTimeout;
socketSender.Connect(remoteEP);
string xmlString;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Cmc.Transaction<TRequest>));
using (var stringWriter = new StringWriter())
{
using (XmlWriter writer = XmlWriter.Create(stringWriter))
{
xmlSerializer.Serialize(writer, transaction);
xmlString = stringWriter.ToString();
}
}
message = Encoding.ASCII.GetBytes(xmlString);
bytesSent = socketSender.Send(message);
bytesReceived = socketSender.Receive(byteBuffer);
string response = Encoding.ASCII.GetString(byteBuffer, 0, bytesReceived);
var transactionResult = new Cmc.Transaction<TRequest>();
using (var stringReader = new StringReader(response))
{
transactionResult = (Cmc.Transaction<TRequest>)xmlSerializer.Deserialize(stringReader);
}
socketSender.Shutdown(SocketShutdown.Both);
socketSender.Close();
return transactionResult;
}
catch (Exception ex)
{
socketSender.Shutdown(SocketShutdown.Both);
socketSender.Close();
Log.Error(ex, $"There was an error while updating accounts.");
throw ex;
}
}
}
}
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class MonetaryTransactionDao : BaseDao, IMonetaryTransactionDao
{
public MonetaryTransactionDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
{
}
public List<MonetaryTransactionResponse> AddMonetaryTransactions (List<MonetaryTransactionRequest> requests)
{
try
{
return _coreSoapRequest.SubmitRequests<MonetaryTransactionRequest, MonetaryTransactionResponse>(requests);
}
catch (Exception exception)
{
throw exception;
}
}
}
}
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class PersonAgreementDao : BaseDao, IPersonAgreementDao
{
public PersonAgreementDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
{
}
public PersonAgreementMaintenanceResponse SendPersonAgreementMaintenanceRequest(PersonAgreementMaintenanceRequest personAgreementMaintenanceRequest)
{
var response = _coreSoapRequest.SubmitRequest<PersonAgreementMaintenanceRequest, PersonAgreementMaintenanceResponse>(personAgreementMaintenanceRequest);
return response;
}
}
}
@@ -0,0 +1,25 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
{
public class TaxDao : BaseDao, ITaxDao
{
private const int MethodCodeForTaxIdRequest = 1;
public TaxDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
{
}
public GetTaxIdDataResponse GetTaxIdData(long taxId)
{
var taxIdDataRequest = new GetTaxIdDataRequest
{
MethodNumber = MethodCodeForTaxIdRequest,
ReferenceNumber = taxId.ToString()
};
return _coreSoapRequest.SubmitRequest<GetTaxIdDataRequest, GetTaxIdDataResponse>(taxIdDataRequest);
}
}
}
@@ -0,0 +1 @@
<%@ Application Codebehind="Global.asax.cs" Inherits="LCU.API.Internal.CoreSoapApiWrapper.WebApiApplication" Language="C#" %>
@@ -0,0 +1,46 @@
using Serilog;
using System.Net;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using LCU.API.Internal.CoreSoapApiWrapper.App_Start;
namespace LCU.API.Internal.CoreSoapApiWrapper
{
public class WebApiApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
IocBootstrapper.Run();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings
.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
GlobalConfiguration.Configuration.Formatters
.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
Log.Logger = new LoggerConfiguration()
.ReadFrom.AppSettings()
.Enrich.WithMachineName()
.Enrich.WithEnvironmentUserName()
.Enrich.WithHttpRequestClientHostIP()
.Enrich.WithHttpRequestClientHostName()
.Enrich.WithHttpRequestRawUrl()
.Enrich.WithHttpRequestType()
.Enrich.WithHttpRequestUrl()
.Enrich.WithHttpRequestUrlReferrer()
.Enrich.WithWebApiActionName()
.Enrich.WithWebApiControllerName()
.Enrich.WithWebApiRouteData()
.Enrich.WithWebApiRouteTemplate()
.CreateLogger();
Log.Information("Core Soap Api Wrapper Starting Up");
}
}
}
@@ -0,0 +1,339 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LCU.API.Internal.CoreSoapApiWrapper</RootNamespace>
<AssemblyName>LCU.API.Internal.CoreSoapApiWrapper</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort>44329</IISExpressSSLPort>
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac, Version=4.9.2.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>packages\Autofac.4.9.2\lib\net45\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.WebApi, Version=4.2.1.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<HintPath>packages\Autofac.WebApi2.4.2.1\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Documents.Client, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.Azure.DocumentDB.2.4.1\lib\net45\Microsoft.Azure.Documents.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.2.10.0\lib\net45\Serilog.dll</HintPath>
</Reference>
<Reference Include="Serilog.Enrichers.Environment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Enrichers.Environment.2.1.3\lib\net45\Serilog.Enrichers.Environment.dll</HintPath>
</Reference>
<Reference Include="Serilog.Formatting.Compact, Version=1.1.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Formatting.Compact.1.1.0\lib\net452\Serilog.Formatting.Compact.dll</HintPath>
</Reference>
<Reference Include="Serilog.Settings.AppSettings, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Settings.AppSettings.2.2.2\lib\net45\Serilog.Settings.AppSettings.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.AzureDocumentDB, Version=4.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.AzureDocumentDB.4.0.0\lib\net45\Serilog.Sinks.AzureDocumentDB.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.Console, Version=3.1.1.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.Console.3.1.1\lib\net45\Serilog.Sinks.Console.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.File, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.File.5.0.0\lib\net45\Serilog.Sinks.File.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.PeriodicBatching, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.PeriodicBatching.2.3.0\lib\net45\Serilog.Sinks.PeriodicBatching.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.Seq, Version=5.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>packages\Serilog.Sinks.Seq.5.0.0\lib\net45\Serilog.Sinks.Seq.dll</HintPath>
</Reference>
<Reference Include="SerilogWeb.Classic, Version=5.0.0.0, Culture=neutral, PublicKeyToken=9462ddd55fbc0e7f, processorArchitecture=MSIL">
<HintPath>packages\SerilogWeb.Classic.5.0.48\lib\net45\SerilogWeb.Classic.dll</HintPath>
</Reference>
<Reference Include="SerilogWeb.Classic.WebApi, Version=4.0.0.0, Culture=neutral, PublicKeyToken=9462ddd55fbc0e7f, processorArchitecture=MSIL">
<HintPath>packages\SerilogWeb.Classic.WebApi.4.0.5\lib\net45\SerilogWeb.Classic.WebApi.dll</HintPath>
</Reference>
<Reference Include="Swashbuckle.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd1bb07a5ac7c7bc, processorArchitecture=MSIL">
<HintPath>packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Caching" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Web.Cors, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.Cors.5.2.4\lib\net45\System.Web.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Http.Cors, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Cors.5.2.4\lib\net45\System.Web.Http.Cors.dll</HintPath>
</Reference>
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.Mvc.5.2.7\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.Razor.3.2.7\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.7\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="WebActivatorEx, Version=2.0.0.0, Culture=neutral, PublicKeyToken=7b26dc2a43f6a0d4, processorArchitecture=MSIL">
<HintPath>packages\WebActivatorEx.2.0\lib\net40\WebActivatorEx.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>packages\WebGrease.1.6.0\lib\WebGrease.dll</HintPath>
</Reference>
<Reference Include="Antlr3.Runtime">
<Private>True</Private>
<HintPath>packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\AssignSecurityRequirements.cs" />
<Compile Include="Attributes\ApiKeyAuthorizeAttribute.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\IocBootstrapper.cs" />
<Compile Include="App_Start\IocConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\SwaggerConfig.cs" />
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\CollateralMaintenanceController.cs" />
<Compile Include="Controllers\PersonAgreementController.cs" />
<Compile Include="Controllers\IndirectLoanController.cs" />
<Compile Include="Controllers\MonetaryTransactionController.cs" />
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\StatusController.cs" />
<Compile Include="Controllers\TaxController.cs" />
<Compile Include="CoreSoapUtilities\CoreCMCConnection.cs" />
<Compile Include="CoreSoapUtilities\CoreSoapConnection.cs" />
<Compile Include="CoreSoapUtilities\CoreSoapRequest.cs" />
<Compile Include="CoreSoapUtilities\ICoreCMCConnection.cs" />
<Compile Include="CoreSoapUtilities\ICoreSoapConnection.cs" />
<Compile Include="CoreSoapUtilities\ICoreSoapRequest.cs" />
<Compile Include="DataAccess\CollateralMaintenanceDao.cs" />
<Compile Include="DataAccess\ICollateralMaintenanceDao.cs" />
<Compile Include="DataAccess\IPersonAgreementDao.cs" />
<Compile Include="DataAccess\ITaxDao.cs" />
<Compile Include="DataAccess\PersonAgreementDao.cs" />
<Compile Include="DataAccess\IIndirectLoanDao.cs" />
<Compile Include="DataAccess\IMonetaryTransactionDao.cs" />
<Compile Include="DataAccess\IndirectLoanDao.cs" />
<Compile Include="DataAccess\MonetaryTransactionDao.cs" />
<Compile Include="DataAccess\AccountDao.cs" />
<Compile Include="DataAccess\BaseDao.cs" />
<Compile Include="DataAccess\IAccountDao.cs" />
<Compile Include="DataAccess\TaxDao.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Models\CMC\Account.cs" />
<Compile Include="Models\CMC\Error.cs" />
<Compile Include="Models\CMC\Output.cs" />
<Compile Include="Models\CMC\Response.cs" />
<Compile Include="Models\Constants\EntityTypeCodes.cs" />
<Compile Include="Models\Requests\AccountContractDateUpdateRequest.cs" />
<Compile Include="Models\Requests\AccountCreditReportTypeUpdateRequest.cs" />
<Compile Include="Models\Requests\AccountAnalysisGroupMaintenanceRequest.cs" />
<Compile Include="Models\Requests\AccountNickNameUpdateRequest.cs" />
<Compile Include="Models\Requests\AccountLtvUpdateRequest.cs" />
<Compile Include="Models\Requests\CreateAccountRequest.cs" />
<Compile Include="Models\Requests\CreateCollateralMaintenanceRequest.cs" />
<Compile Include="Models\Requests\OrganizationMaintenanceRequest.cs" />
<Compile Include="Models\Requests\CreateOrganizationAccountRequest.cs" />
<Compile Include="Models\Requests\CreatePersonAccountRequest.cs" />
<Compile Include="Models\Requests\FundRequest.cs" />
<Compile Include="Models\Requests\FundsToAccountRequest.cs" />
<Compile Include="Models\Requests\AccountBranchUpdateRequest.cs" />
<Compile Include="Models\Requests\DetailType.cs" />
<Compile Include="Models\Requests\PersonAgreementDetailTypeRequest.cs" />
<Compile Include="Models\Requests\UserFieldRequest.cs" />
<Compile Include="Models\Responses\BasicResponse.cs" />
<Compile Include="Models\Responses\CreatedAccountResponse.cs" />
<Compile Include="Models\Responses\UpdateDealerOriginalBalanceResponse.cs" />
<Compile Include="Models\CMC\Transaction.cs" />
<Compile Include="Models\CMC\AccountRequest.cs" />
<Compile Include="Models\CMC\Input.cs" />
<Compile Include="Models\CMC\UserAuthentication.cs" />
<Compile Include="Models\EnvironmentView.cs" />
<Compile Include="Models\Requests\GroupedMonetaryTransactionsRequest.cs" />
<Compile Include="Models\SoapConfiguration.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CoreSoapUtilities\SafLevel1Proxy.cs" />
<Compile Include="CoreSoapUtilities\ServiceReference.cs" />
<Compile Include="Services\CollateralMaintenanceService.cs" />
<Compile Include="Services\ICollateralMaintenanceService.cs" />
<Compile Include="Services\IPersonAgreementService.cs" />
<Compile Include="Services\PersonAgreementService.cs" />
<Compile Include="Services\IIndirectLoanService.cs" />
<Compile Include="Services\IMonetaryTransactionService.cs" />
<Compile Include="Services\IndirectLoanService.cs" />
<Compile Include="Services\MonetaryTransactionService.cs" />
<Compile Include="Services\AccountService.cs" />
<Compile Include="Services\IAccountService.cs" />
<Compile Include="Services\TaxService.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Web.config" />
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
<Content Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="Web.Uat.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Uat|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>59554</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>https://localhost:44329/</IISUrl>
<OverrideIISAppRootUrl>True</OverrideIISAppRootUrl>
<IISAppRootUrl>https://localhost:44329/swagger/ui/index</IISAppRootUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Microsoft.Azure.DocumentDB.2.4.1\build\Microsoft.Azure.DocumentDB.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Azure.DocumentDB.2.4.1\build\Microsoft.Azure.DocumentDB.targets'))" />
<!-- <Error Condition="!Exists('packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\build\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />-->
</Target>
<Import Project="packages\Microsoft.Azure.DocumentDB.2.4.1\build\Microsoft.Azure.DocumentDB.targets" Condition="Exists('packages\Microsoft.Azure.DocumentDB.2.4.1\build\Microsoft.Azure.DocumentDB.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target> -->
</Project>
@@ -0,0 +1,36 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LCU.API.Internal.CoreSoapApiWrapper", "LCU.API.Internal.CoreSoapApiWrapper.csproj", "{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LCU.API.Internal.CoreSoapApiWrapperTest", "..\LCU.API.Internal.CoreSoapApiWrapperTest\LCU.API.Internal.CoreSoapApiWrapperTest.csproj", "{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Uat|Any CPU = Uat|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Release|Any CPU.Build.0 = Release|Any CPU
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Uat|Any CPU.ActiveCfg = Uat|Any CPU
{8D3B1FC1-7D69-4CBA-932C-4C8B49047394}.Uat|Any CPU.Build.0 = Uat|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Release|Any CPU.Build.0 = Release|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Uat|Any CPU.ActiveCfg = Debug|Any CPU
{C6DFD7D1-6678-4A6C-A74A-B0FDFFD71DA3}.Uat|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CA8CD165-2FAE-4F34-B3A0-6F30295E3F7E}
EndGlobalSection
EndGlobal
@@ -0,0 +1,12 @@
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class Account
{
[XmlAttribute("acctNbr")]
public string AcctNbr { get; set; }
}
}
@@ -0,0 +1,14 @@
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class AccountRequest
{
[XmlAttribute("reqTypCd")]
public string ReqTypCd { get; set; }
public Account Account { get; set; }
}
}
@@ -0,0 +1,13 @@
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class Error
{
public string ErrorMsg { get; set; }
public int ErrorNbr { get; set; }
public string AcctNbr { get; set; }
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class Input<TRequest>
{
[XmlArrayItem("Request")]
public List<TRequest> Requests { get; set; }
public UserAuthentication UserAuthentication { get; set; }
}
}
@@ -0,0 +1,13 @@
using System.Collections.Generic;
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class Output
{
[XmlArrayItem("Response")]
public List<Response> Responses { get; set; }
}
}
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
[XmlType("Response")]
public class Response
{
[IgnoreDataMember]
[XmlAttribute("successYN")]
public string SuccessYN { get; set; }
[IgnoreDataMember]
[XmlArrayItem("Error")]
public List<Error> Errors { get; set; }
}
}
@@ -0,0 +1,17 @@
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
[XmlRoot("Transaction")]
public class Transaction<TRequest>
{
public Input<TRequest> Input { get; set; }
public Output Output { get; set; }
[XmlAttribute("commitRollbackYN")]
public string CommitRollbackYN { get; set; }
}
}
@@ -0,0 +1,23 @@
using System.Xml.Serialization;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc
{
public class UserAuthentication
{
[XmlAttribute("authTyp")]
public string AuthTyp { get; set; }
public string UserId { get; set; }
public string ApplNbr { get; set; }
public string PhysAddr { get; set; }
public string Passwd { get; set; }
[XmlAttribute("successYN")]
public string SuccessYN { get; set; }
}
}
@@ -0,0 +1,7 @@
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Constants
{
public static class EntityTypeCodes
{
public const string PersonEntityTypeCode = "PERS";
}
}
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models
{
public class EnvironmentView
{
public string Application { get; set; }
public DateTime CurrentDate { get; set; }
public string BuildVersion { get; set; }
public DateTime? BuildDate { get; set; }
public string Environment { get; set; }
public string ApexConn { get; set; }
}
}
@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountAnalysisGroupMaintenanceRequest
{
[Required]
public long AccountNumber { get; set; }
public bool IsGenerateAnalysisStatement { get; set; }
public bool IsPrintAnalysisStatement { get; set; }
public bool IsUseForServiceCharge { get; set; }
public static AccountAnalysisMaintenanceRequest UpdateAccountAnalysisMaintenanceRequest(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest)
{
var accountList = new List<AccountAnalysisMaintenance>()
{
new AccountAnalysisMaintenance()
{
AccountNumber = accountAnalysisGroupMaintenanceRequest.AccountNumber
}
};
var accountGroupsList = new List<AccountGroupMaintenance>()
{
new AccountGroupMaintenance()
{
AccountGroupNumber = 0, //If new group number assign zero
IsGenerateAnalysisStatement = accountAnalysisGroupMaintenanceRequest.IsGenerateAnalysisStatement,
IsPrintAnalysisStatement = accountAnalysisGroupMaintenanceRequest.IsPrintAnalysisStatement,
IsUseForServiceCharge = accountAnalysisGroupMaintenanceRequest.IsUseForServiceCharge,
ServiceChargeAccountNumber = accountAnalysisGroupMaintenanceRequest.AccountNumber,
StatementAccountNumber = accountAnalysisGroupMaintenanceRequest.AccountNumber,
Accounts = accountList.ToArray()
}
};
var accountAnalysisMaintenanceRequest = new AccountAnalysisMaintenanceRequest()
{
AccountGroups = accountGroupsList.ToArray()
};
return accountAnalysisMaintenanceRequest;
}
}
}
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountBranchUpdateRequest
{
[Required]
public long AccountNumber { get; set; }
[Required]
public long BranchOrganizationNumber { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintenanceRequest(AccountBranchUpdateRequest updateAccountRequest)
{
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountNumber = updateAccountRequest.AccountNumber,
BranchOrganizationNumber = updateAccountRequest.BranchOrganizationNumber,
IsAccountMaintenance = true
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountContractDateUpdateRequest
{
[Required]
public long AccountNumber { get; set; }
[Required]
public DateTime ContractDate { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintenanceRequest(AccountContractDateUpdateRequest accountContractDateUpdateRequest)
{
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountNumber = accountContractDateUpdateRequest.AccountNumber,
IsAccountMaintenance = true,
ContractDate = accountContractDateUpdateRequest.ContractDate
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountCreditReportTypeUpdateRequest
{
[Required]
public long AccountNumber { get; set; }
[Required]
public string CreditReportType { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintenanceRequest(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest)
{
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountNumber = accountCreditReportTypeUpdateRequest.AccountNumber,
IsAccountMaintenance = true,
AccountLoanDetail = new AccountLoanDetail()
{
AccountLoanInformation = new AccountLoanInformation()
{
CreditReportTypeCode = accountCreditReportTypeUpdateRequest.CreditReportType
}
}
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountLtvUpdateRequest
{
[Required]
public long AccountNumber { get; set; }
[Required]
public double LoanToValue { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintenanceRequest(AccountLtvUpdateRequest accountLtvUpdateRequest)
{
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountNumber = accountLtvUpdateRequest.AccountNumber,
IsAccountMaintenance = true,
AccountLoanDetail = new AccountLoanDetail()
{
AccountLoanInformation = new AccountLoanInformation()
{
OrignalLTVRatio = accountLtvUpdateRequest.LoanToValue
}
}
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,34 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class AccountNickNameUpdateRequest
{
[Required]
public long AccountNumber { get; set; }
[Required]
public string AccountDescription { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintenanceRequest(AccountNickNameUpdateRequest updateAccountRequest)
{
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountNumber = updateAccountRequest.AccountNumber,
AccountDescription = updateAccountRequest.AccountDescription,
IsAccountMaintenance = true
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,41 @@
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class CreateAccountRequest
{
[Required, Display(Description = "ACCTDESC - The Account Description column is a textual description of the account.")]
public string AccountDescription { get; set; }
[Required]
public int BankOrganizationNumber { get; set; }
[Required]
public int BranchOrganizationNumber { get; set; }
[Required, Display(Description = "CURRMIACCTTYPCD -The Current Minor Account Type Code identifies the secondary product grouping for the account.")]
public string CurrentMinorAccountTypeCode { get; set; }
[Required]
public string DeliveryMethodCode { get; set; }
[Required, Display(Description = "MJACCTTYPCD - The Major Account Type Code identifies the highest product grouping for the account.")]
public string MajorAccountTypeCode { get; set; }
[Required, Display(Description = "OWNCD - The Ownership Code identifies the kind of ownership that pertains to the account.")]
public string OwnershipCode { get; set; }
[Required, Display(Description = "TAXRPTFOROWNYN - The Tax Reported For Owner indicates if the account has a tax reported for owner. Y = Yes N = No")]
public bool IsTaxReportedForOwner { get; set; }
[Required, Display(Description = "TAXRPTFORSIGYN - The Tax Reported For Signatory indicates if the account has a tax reported for signator. Y = Yes N = NO")]
public bool IsTaxReportedForSigner { get; set; }
[Required, Display(Description = "VALIDYN - The Valid indicator indicates if the account has been validated for transaction processing. Validation does NOT necessarily mean approval. Y = Yes N = No")]
public bool IsValid { get; set; }
[Required]
public string CurrentAccountStatusCode { get; set; }
}
}
@@ -0,0 +1,44 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class CreateCollateralMaintenanceRequest
{
[Required]
public long PropertyNumber { get; set; }
[Required]
public string Value { get; set; }
[Required]
public string Code { get; set; }
public static CollateralMaintenanceRequest CreateMaintenanceRequest(UserFieldRequest request)
{
var userFields = new List<UserField>()
{
new UserField()
{
Code = request.UserFieldCode,
Value = request.Value
}
};
var newAccounts = new List<CollateralMaintenancePropertyRequest>()
{
new CollateralMaintenancePropertyRequest()
{
PropertyNumber = request.PropertyNumber,
UserFields = userFields.ToArray()
}
};
var collateralMaintenanceRequest = new CollateralMaintenanceRequest()
{
PropertyList = newAccounts.ToArray()
};
return collateralMaintenanceRequest;
}
}
}
@@ -0,0 +1,48 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class CreateOrganizationAccountRequest : CreateAccountRequest
{
[Required]
public long OrganizationNumber { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintanceRequest(CreateOrganizationAccountRequest createAccountRequest)
{
var accountMaintenanceOrganizations = new List<Organization>()
{
new Organization()
{
IsTaxReportedForOwner = createAccountRequest.IsTaxReportedForOwner,
IsTaxReportedForSigner = createAccountRequest.IsTaxReportedForSigner,
OrganizationNumber = createAccountRequest.OrganizationNumber,
}
};
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountDescription = createAccountRequest.AccountDescription,
BankOrganizationNumber = createAccountRequest.BankOrganizationNumber,
BranchOrganizationNumber = createAccountRequest.BranchOrganizationNumber,
CurrentMinorAccountTypeCode = createAccountRequest.CurrentMinorAccountTypeCode,
CurrentAccountStatusCode = createAccountRequest.CurrentAccountStatusCode,
DeliveryMethodCode = createAccountRequest.DeliveryMethodCode,
MajorAccountTypeCode = createAccountRequest.MajorAccountTypeCode,
OwnershipCode = createAccountRequest.OwnershipCode,
Organizations = accountMaintenanceOrganizations.ToArray()
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,64 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class CreatePersonAccountRequest : CreateAccountRequest
{
[Required]
public long? PersonNumber { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public static AccountMaintenanceRequest CreateAccountMaintanceRequest(CreatePersonAccountRequest createAccountRequest)
{
var accountMaintenancePersons = new List<AccountMaintenancePerson>()
{
new AccountMaintenancePerson()
{
Identification = new AccountMaintenanceIdentification()
{
IsTaxReportedForOwner = createAccountRequest.IsTaxReportedForOwner,
IsTaxReportedForSigner = createAccountRequest.IsTaxReportedForSigner,
},
IsValid = createAccountRequest?.IsValid,
IsSupportPatriotActValidation = true,
Name = new PersonName()
{
FirstName = createAccountRequest.FirstName,
LastName = createAccountRequest.LastName
},
PersonNumber = createAccountRequest.PersonNumber,
Demographics = new AccountMaintenanceDemographics ()
{
MemberGroupCode = "REGM"
}
}
};
var newAccounts = new List<MaintenanceAccount>()
{
new MaintenanceAccount()
{
AccountDescription = createAccountRequest.AccountDescription,
BankOrganizationNumber = createAccountRequest.BankOrganizationNumber,
BranchOrganizationNumber = createAccountRequest.BranchOrganizationNumber,
CurrentMinorAccountTypeCode = createAccountRequest.CurrentMinorAccountTypeCode,
CurrentAccountStatusCode = createAccountRequest.CurrentAccountStatusCode,
DeliveryMethodCode = createAccountRequest.DeliveryMethodCode,
MajorAccountTypeCode = createAccountRequest.MajorAccountTypeCode,
OwnershipCode = createAccountRequest.OwnershipCode,
Persons = accountMaintenancePersons.ToArray()
}
};
var accountMaintenanceRequest = new AccountMaintenanceRequest()
{
Accounts = newAccounts.ToArray()
};
return accountMaintenanceRequest;
}
}
}
@@ -0,0 +1,12 @@
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class DetailType
{
[Required]
public string DetailTypeCode { get; set; }
[Required]
public string DetailValue { get; set; }
}
}
@@ -0,0 +1,43 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class FundRequest
{
[Required]
public string ClearingCategoryCode { get; set; }
[Required]
public double? FundAmount { get; set; }
[Required]
public string FundTypeCode { get; set; }
[Required]
public string FundTypeDetailCode { get; set; }
public static Fund CreateFund(FundRequest fundRequest)
{
var fund = new Fund()
{
ClearingCategoryCode = fundRequest.ClearingCategoryCode,
FundAmount = fundRequest.FundAmount,
FundTypeCode = fundRequest.FundTypeCode,
FundTypeDetailCode = fundRequest.FundTypeDetailCode
};
return fund;
}
public static List<Fund> CreateFunds(List<FundRequest> fundRequests)
{
var funds = new List<Fund>();
foreach (FundRequest fundRequest in fundRequests)
{
var fund = FundRequest.CreateFund(fundRequest);
funds.Add(fund);
}
return funds;
}
}
}
@@ -0,0 +1,40 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class FundsToAccountRequest
{
private const string SingleRequestNumber = "1";
[Required]
public long AccountNumber { get; set; }
[Required]
public string Description { get; set; }
[Required]
public double? TransactionAmount { get; set; }
[Required]
public string TransactionTypeCode { get; set; }
[Required]
public List<FundRequest> FundRequests { get; set; }
public static MonetaryTransactionRequest CreateMonetaryTransactionRequest(FundsToAccountRequest request, SoapConfiguration soapConfiguration)
{
var funds = FundRequest.CreateFunds(request.FundRequests);
var monetaryTransactionRequest = new MonetaryTransactionRequest()
{
OverrideCashBoxNumber = long.Parse(soapConfiguration.OverrideCashBoxNumber),
ApprovalPersonNumber = long.Parse(soapConfiguration.ApprovalPersonNumber),
RequestNumber = SingleRequestNumber,
AccountNumber = request.AccountNumber,
Description = request.Description,
TransactionAmount = request.TransactionAmount,
TransactionTypeCode = request.TransactionTypeCode,
Funds = funds.ToArray()
};
return monetaryTransactionRequest;
}
}
}
@@ -0,0 +1,17 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class GroupedMonetaryTransactionRequest
{
public string ParentRequestNumber { get; set; }
public List<MonetaryTransactionRequest> MonetaryTransactionRequests { get; set; }
}
}
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class OrganizationMaintenanceRequest
{
[Required]
public long OrganizationNumber { get; set; }
[Required]
public long? ControllingPersonNumber { get; set; }
public static OrgMaintenanceRequest CreateOrgMaintenanceRequest(OrganizationMaintenanceRequest orgMaintenanceRequest)
{
var orgOwnerPersons = new List<OrganizationOwnerPerson>()
{
new OrganizationOwnerPerson()
{
IsControllingPerson = true,
OwnerPersonNumber = orgMaintenanceRequest.ControllingPersonNumber,
OwnershipPercent = 1
}
};
var organizationMaintenanceRequest = new OrgMaintenanceRequest()
{
OrganizationOwnerPersons = orgOwnerPersons.ToArray(),
OrgNumber = orgMaintenanceRequest.OrganizationNumber
};
return organizationMaintenanceRequest;
}
}
}
@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class PersonAgreementDetailTypeRequest
{
[Required]
public long PersonNumber { get; set; }
[Required]
public decimal AgreeNumber { get; set; }
[Required]
public string AgreeTypeCode { get; set; }
[Required]
public List<DetailType> DetailTypes { get; set; }
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Requests
{
public class UserFieldRequest
{
public long PropertyNumber { get; set; }
public string UserFieldCode { get; set; }
public string Value { get; set; }
}
}
@@ -0,0 +1,27 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Responses
{
public class BasicResponse
{
public BasicResponse(ResponseBase response)
{
Success = response.WasSuccessful == null ? true : (bool)response.WasSuccessful;
Errors = new List<string>();
if(response.Errors == null)
{
return;
}
foreach (var error in response.Errors)
{
Errors.Add(error.ErrorMessage);
}
}
public bool Success { get; set; }
public List<string> Errors { get; set; }
}
}
@@ -0,0 +1,24 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Responses
{
public class CreatedAccountResponse
{
public CreatedAccountResponse(AccountMaintenanceResponse accountMaintenanceResponse)
{
if (accountMaintenanceResponse?.ResponseAccounts != null && accountMaintenanceResponse?.ResponseAccounts.Length > 0)
{
AccountNumber = accountMaintenanceResponse?.ResponseAccounts[0]?.AccountNumber;
MajorTypeCode = accountMaintenanceResponse?.ResponseAccounts[0]?.MajorTypeCode;
MinorTypeCode = accountMaintenanceResponse?.ResponseAccounts[0]?.MinorTypeCode;
}
BasicResponse = new BasicResponse(accountMaintenanceResponse);
}
public long? AccountNumber { get; set; }
public string MajorTypeCode { get; set; }
public string MinorTypeCode { get; set; }
public BasicResponse BasicResponse { get; set; }
}
}
@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models.Response
{
[XmlType("Response")]
public class UpdateDealerOriginalBalanceResponse
{
public string AccountNumber { get; set; }
public string ErrorMessage { get; set; }
}
}
@@ -0,0 +1,69 @@
using System;
using System.Configuration;
using System.IO;
namespace LCU.API.Internal.CoreSoapApiWrapper.Models
{
public class SoapConfiguration
{
public SoapConfiguration()
{
int defaultValue;
SafUrl = ConfigurationManager.AppSettings["soapconnection:safUrl"];
DeviceId = ConfigurationManager.AppSettings["soapconnection:deviceId"];
UserId = ReadSecret("/vault/secrets/core-soap-api-wrapper-soap-connection-user-id.json") ?? ConfigurationManager.AppSettings["soapconnection:userId"];
Password = ReadSecret("/vault/secrets/core-soap-api-wrapper-soap-connection-password.json") ?? ConfigurationManager.AppSettings["soapconnection:password"];
EnvironmentCode = ConfigurationManager.AppSettings["soapconnection:prodEnvCd"];
DefCode = ConfigurationManager.AppSettings["soapconnection:prodDefCd"];
ApplicationId = ConfigurationManager.AppSettings["soapconnection:applId"];
Endpoint = ConfigurationManager.AppSettings["soapconnection:endpoint"];
ApprovalPersonNumber = ConfigurationManager.AppSettings["soapconnection:approvalpersonnumber"];
OverrideCashBoxNumber = ConfigurationManager.AppSettings["soapconnection:overridecashboxnumber"];
SocketDeviceId = ConfigurationManager.AppSettings["socketconnection:deviceId"];
SocketApplicationId = ConfigurationManager.AppSettings["socketconnection:applId"];
SocketUserId = ReadSecret("/vault/secrets/core-soap-api-wrapper-socket-connection-user-id.json") ?? ConfigurationManager.AppSettings["socketconnection:userId"];
SocketPassword = ReadSecret("/vault/secrets/core-soap-api-wrapper-socket-connection-password.json") ?? ConfigurationManager.AppSettings["socketconnection:password"];
SocketTimeout = int.TryParse(ConfigurationManager.AppSettings["socketconnection:timeout"], out defaultValue) ? defaultValue : 10000;
IPAddress = ConfigurationManager.AppSettings["socketconnection:ipAddress"];
PortId = int.TryParse(ConfigurationManager.AppSettings["socketconnection:portId"], out defaultValue) ? defaultValue : 2503;
RequestType = ConfigurationManager.AppSettings["socketconnection:reqType"];
AuthenticationType = ConfigurationManager.AppSettings["socketconnection:authType"];
string ReadSecret(string path)
{
try
{
var s = File.ReadAllText(path).Trim();
if (string.IsNullOrWhiteSpace(s))
throw new InvalidOperationException($"Secret file '{path}' is empty.");
return s;
}
catch (Exception)
{
return null;
}
}
}
public string SafUrl { get; set; }
public string DeviceId { get; set; }
public string UserId { get; set; }
public string Password { get; set; }
public string EnvironmentCode { get; set; }
public string DefCode { get; set; }
public string ApplicationId { get; set; }
public string Endpoint { get; set; }
public string ApprovalPersonNumber { get; set; }
public string OverrideCashBoxNumber { get; set; }
public string SocketDeviceId { get; set; }
public string SocketApplicationId { get; set; }
public string SocketUserId { get; set; }
public string SocketPassword { get; set; }
public int SocketTimeout { get; set; }
public string IPAddress { get; set; }
public int PortId { get; set; }
public string RequestType { get; set; }
public string AuthenticationType { get; set; }
}
}
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LCU.API.Internal.CoreSoapApiWrapper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LCU.API.Internal.CoreSoapApiWrapper")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f624cf44-1861-45ec-8b1f-13b95310318d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,197 @@
using Newtonsoft.Json;
using System;
using Serilog;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public class AccountService : IAccountService
{
private readonly IAccountDao _accountDao;
public AccountService(IAccountDao accountDao)
{
_accountDao = accountDao;
}
public AccountDetailInquiryResponse GetAccountByAccountNumber(long accountNumber)
{
try
{
return _accountDao.FindAccountByAccountNumber(accountNumber);
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while getting account by account number {accountNumber}");
throw;
}
}
public AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest)
{
try
{
return _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while submitting the following AccountMaintenanceRequest: {accountMaintenanceRequest}");
throw;
}
}
public BasicResponse SendAccountBranchUpdateRequest(AccountBranchUpdateRequest accountBranchUpdateRequest)
{
try
{
AccountMaintenanceRequest accountMaintenanceRequest = new AccountMaintenanceRequest();
accountMaintenanceRequest = AccountBranchUpdateRequest.CreateAccountMaintenanceRequest(accountBranchUpdateRequest);
var result = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while submitting the following AccountBranchUpdateRequest: {accountBranchUpdateRequest}");
throw;
}
}
public BasicResponse SendAccountAnalysisGroupMaintenanceRequest(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest)
{
try
{
var result = _accountDao.SendAccountAnalysisMaintenanceRequest(AccountAnalysisGroupMaintenanceRequest.UpdateAccountAnalysisMaintenanceRequest(accountAnalysisGroupMaintenanceRequest));
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while submitting the following AccountAnalysisGroupMaintenanceRequest: {accountAnalysisGroupMaintenanceRequest}");
throw;
}
}
public BasicResponse SendAccountLtvUpdateRequest(AccountLtvUpdateRequest accountLtvUpdateRequest)
{
try
{
AccountMaintenanceRequest accountMaintenanceRequest = new AccountMaintenanceRequest();
accountMaintenanceRequest = AccountLtvUpdateRequest.CreateAccountMaintenanceRequest(accountLtvUpdateRequest);
var result = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while submitting the following AccountLtvUpdateRequest: {accountLtvUpdateRequest}");
throw;
}
}
public CreatedAccountResponse AddPersonAccount(CreatePersonAccountRequest createAccountRequest)
{
try
{
var accountMaintenanceRequest = CreatePersonAccountRequest.CreateAccountMaintanceRequest(createAccountRequest);
var accountMaintenanceResponse = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
return createdAccountResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following " +
$"CreatePersonAccountRequest: {JsonConvert.SerializeObject(createAccountRequest)}");
throw;
}
}
public CreatedAccountResponse AddOrganizationAccount(CreateOrganizationAccountRequest createAccountRequest)
{
try
{
var accountMaintenanceRequest = CreateOrganizationAccountRequest.CreateAccountMaintanceRequest(createAccountRequest);
var accountMaintenanceResponse = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var createdAccountResponse = new CreatedAccountResponse(accountMaintenanceResponse);
return createdAccountResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following " +
$"CreateOrganizationAccountRequest: {JsonConvert.SerializeObject(createAccountRequest)}");
throw;
}
}
public BasicResponse AddOrganizationControlPerson(OrganizationMaintenanceRequest orgMaintRequest)
{
try
{
var organizationMaintenanceRequest = OrganizationMaintenanceRequest.CreateOrgMaintenanceRequest(orgMaintRequest);
var orgMaintenanceResponse = _accountDao.SendOrgMaintenanceRequest(organizationMaintenanceRequest);
var basicSoapResponse = new BasicResponse(orgMaintenanceResponse);
return basicSoapResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following " +
$"OrganizationMaintenanceRequest: {JsonConvert.SerializeObject(orgMaintRequest)}");
throw;
}
}
public BasicResponse SendAccountNickNameUpdateRequest(AccountNickNameUpdateRequest accountNickNameUpdateRequest)
{
try
{
AccountMaintenanceRequest accountMaintenanceRequest = new AccountMaintenanceRequest();
accountMaintenanceRequest = AccountNickNameUpdateRequest.CreateAccountMaintenanceRequest(accountNickNameUpdateRequest);
var result = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following AccountNickNameUpdateRequest: {accountNickNameUpdateRequest}");
throw;
}
}
public BasicResponse SendAccountCreditReportTypeUpdateRequest(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest)
{
try
{
AccountMaintenanceRequest accountMaintenanceRequest = new AccountMaintenanceRequest();
accountMaintenanceRequest = AccountCreditReportTypeUpdateRequest.CreateAccountMaintenanceRequest(accountCreditReportTypeUpdateRequest);
var result = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following AccountCreditReportTypeUpdateRequest: {accountCreditReportTypeUpdateRequest}");
throw;
}
}
public BasicResponse SendAccountContractDateUpdateRequest(AccountContractDateUpdateRequest accountContractDateUpdateRequest)
{
try
{
AccountMaintenanceRequest accountMaintenanceRequest = new AccountMaintenanceRequest();
accountMaintenanceRequest = AccountContractDateUpdateRequest.CreateAccountMaintenanceRequest(accountContractDateUpdateRequest);
var result = _accountDao.SendAccountMaintenanceRequest(accountMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while submitting the following AccountContractDateUpdateRequest: {accountContractDateUpdateRequest}");
throw;
}
}
}
}
@@ -0,0 +1,62 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
using Serilog;
using System;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public class CollateralMaintenanceService : ICollateralMaintenanceService
{
private readonly ICollateralMaintenanceDao _collateralMaintenanceDao;
public CollateralMaintenanceService(ICollateralMaintenanceDao collateralMaintenanceDao)
{
_collateralMaintenanceDao = collateralMaintenanceDao;
}
public CollateralSearchResponse GetCollateralMaintenanceByPropertyNumber(long propertyNumber)
{
try
{
return _collateralMaintenanceDao.FindCollateralMaintenanceByPropertyNumber(propertyNumber);
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while getting property information by propery number {propertyNumber}");
throw;
}
}
public BasicResponse InsertCollateralMaintenance(UserFieldRequest request)
{
try
{
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
var result = _collateralMaintenanceDao.AddCollateralMaintenanceByPropertyNumber(maintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while adding property information");
throw ex;
}
}
public BasicResponse UpdateCollateralMaintenance(UserFieldRequest request)
{
try
{
var maintenanceRequest = CreateCollateralMaintenanceRequest.CreateMaintenanceRequest(request);
var result = _collateralMaintenanceDao.UpdateCollateralMaintenanceByPropertyNumber(maintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while updating property information");
throw ex;
}
}
}
}
@@ -0,0 +1,21 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface IAccountService
{
AccountDetailInquiryResponse GetAccountByAccountNumber(long accountNumber);
AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest);
BasicResponse SendAccountBranchUpdateRequest(AccountBranchUpdateRequest accountMaintenanceRequest);
BasicResponse SendAccountLtvUpdateRequest(AccountLtvUpdateRequest accountLtvUpdateRequest);
BasicResponse SendAccountAnalysisGroupMaintenanceRequest(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest);
CreatedAccountResponse AddPersonAccount(CreatePersonAccountRequest createAccountRequest);
CreatedAccountResponse AddOrganizationAccount(CreateOrganizationAccountRequest createAccountRequest);
BasicResponse AddOrganizationControlPerson(OrganizationMaintenanceRequest orgMaintRequest);
BasicResponse SendAccountNickNameUpdateRequest(AccountNickNameUpdateRequest accountNickNameUpdateRequest);
BasicResponse SendAccountCreditReportTypeUpdateRequest(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest);
BasicResponse SendAccountContractDateUpdateRequest(AccountContractDateUpdateRequest request);
}
}
@@ -0,0 +1,13 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface ICollateralMaintenanceService
{
CollateralSearchResponse GetCollateralMaintenanceByPropertyNumber(long propertyNumber);
BasicResponse InsertCollateralMaintenance(UserFieldRequest request);
BasicResponse UpdateCollateralMaintenance(UserFieldRequest request);
}
}
@@ -0,0 +1,10 @@
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Response;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface IIndirectLoanService
{
List<UpdateDealerOriginalBalanceResponse> UpdateDealerOriginalBalances (string accountNumber);
}
}
@@ -0,0 +1,13 @@
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface IMonetaryTransactionService
{
List<MonetaryTransactionResponse> AddMonetaryTransactions (List<GroupedMonetaryTransactionRequest> requests);
List<BasicResponse> AddFundsToAccount(List<FundsToAccountRequest> requests);
}
}
@@ -0,0 +1,10 @@
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface IPersonAgreementService
{
BasicResponse UpdatePersonAgreementsDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest);
}
}
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Serilog;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Response;
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public class IndirectLoanService : IIndirectLoanService
{
private readonly IIndirectLoanDao _indirectLoanDao;
private readonly ICoreCmcConnection _coreCMCConnection;
private readonly SoapConfiguration _soapConfiguration;
public IndirectLoanService(IIndirectLoanDao indirectLoanDao, ICoreCmcConnection coreCMCConnection, SoapConfiguration soapConfiguration)
{
_coreCMCConnection = coreCMCConnection;
_indirectLoanDao = indirectLoanDao;
_soapConfiguration = soapConfiguration;
}
public List<UpdateDealerOriginalBalanceResponse> UpdateDealerOriginalBalances(string accountNumber)
{
try
{
var responseList = new List<UpdateDealerOriginalBalanceResponse>();
var accountValue = new Cmc.Account()
{
AcctNbr = accountNumber
};
var accountRequest = new Cmc.AccountRequest()
{
Account = accountValue,
ReqTypCd = _soapConfiguration.RequestType
};
var transaction = _coreCMCConnection.CreateSocketTransactionRequest(accountRequest);
var transactionResponse = _indirectLoanDao.UpdateDealerOriginalBalance(transaction);
var response = AssignAccountError(transactionResponse, accountNumber);
if (!String.IsNullOrEmpty(response.ErrorMessage))
{
responseList.Add(response); //unsuccessful return account and error messaging
}
return responseList;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while updating account: {accountNumber}");
throw ex;
}
}
private UpdateDealerOriginalBalanceResponse AssignAccountError(Cmc.Transaction<Cmc.AccountRequest> transactionResponse, string account)
{
var stringBuilder = new StringBuilder();
foreach (var result in transactionResponse.Output.Responses)
{
if (result.Errors != null || result.Errors.Any())
{
var response = new UpdateDealerOriginalBalanceResponse();
foreach (var error in result.Errors)
{
response.AccountNumber = account;
stringBuilder.Append($"Error: { error.ErrorNbr } {error.ErrorMsg},");
response.ErrorMessage = stringBuilder.ToString();
}
return response;
}
break;
}
return null;
}
}
}
@@ -0,0 +1,76 @@
using System;
using Serilog;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public class MonetaryTransactionService : IMonetaryTransactionService
{
private readonly IMonetaryTransactionDao _monetaryTransactionDao;
private readonly SoapConfiguration _soapConfiguration;
public MonetaryTransactionService(IMonetaryTransactionDao monetaryTransactionDao, SoapConfiguration soapConfiguration)
{
_monetaryTransactionDao = monetaryTransactionDao;
_soapConfiguration = soapConfiguration;
}
public List<MonetaryTransactionResponse> AddMonetaryTransactions (List<GroupedMonetaryTransactionRequest> requests)
{
try
{
var response = new List<MonetaryTransactionResponse>();
foreach (var request in requests) //add monetary transactions from the grouped list
{
foreach (var transactionrequest in request.MonetaryTransactionRequests) {
transactionrequest.OverrideCashBoxNumber = long.Parse(_soapConfiguration.OverrideCashBoxNumber);
transactionrequest.ApprovalPersonNumber = long.Parse(_soapConfiguration.ApprovalPersonNumber);
}
response.AddRange(_monetaryTransactionDao.AddMonetaryTransactions(request.MonetaryTransactionRequests));
}
return response;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while saving a transaction");
throw;
}
}
public List<BasicResponse> AddFundsToAccount(List<FundsToAccountRequest> requests)
{
try
{
List<MonetaryTransactionRequest> fundRequestList = new List<MonetaryTransactionRequest>();
List<BasicResponse> basicResponseList = new List<BasicResponse>();
foreach (var fundRequests in requests)
{
var monetaryTransactionRequest = FundsToAccountRequest.CreateMonetaryTransactionRequest(fundRequests, _soapConfiguration);
fundRequestList.Add(monetaryTransactionRequest);
}
var monetaryTransactionResponse = _monetaryTransactionDao.AddMonetaryTransactions(fundRequestList);
foreach (var transactionResponse in monetaryTransactionResponse)
{
basicResponseList.Add(new BasicResponse(transactionResponse));
}
return basicResponseList;
}
catch (Exception exception)
{
Log.Error(exception, $"There was an error while saving funds to account.");
throw;
}
}
}
}
@@ -0,0 +1,65 @@
using System;
using System.Linq;
using Serilog;
using Newtonsoft.Json;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Constants;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public class PersonAgreementService : IPersonAgreementService
{
private readonly IPersonAgreementDao _personAgreementDao;
public PersonAgreementService(IPersonAgreementDao personAgreementDao)
{
_personAgreementDao = personAgreementDao;
}
public BasicResponse UpdatePersonAgreementsDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest)
{
try
{
if(personAgreementDetailTypeRequest.DetailTypes == null)
{
throw new ArgumentNullException("DetailTypes");
}
Detail[] details = personAgreementDetailTypeRequest
.DetailTypes.Select(detailType =>
new Detail()
{
DetailTypeCode = detailType.DetailTypeCode,
Value = detailType.DetailValue
}).ToArray();
var personMaintAgreement = new PersonMaintAgreement()
{
AgreeNumber = personAgreementDetailTypeRequest.AgreeNumber,
TypeCode = personAgreementDetailTypeRequest.AgreeTypeCode,
Details = details
};
var personAgreementMaintenanceRequest = new PersonAgreementMaintenanceRequest()
{
EntityTypeCode = EntityTypeCodes.PersonEntityTypeCode,
EntityNumber = personAgreementDetailTypeRequest.PersonNumber,
Agreements = new PersonMaintAgreement[] { personMaintAgreement }
};
var result = _personAgreementDao.SendPersonAgreementMaintenanceRequest(personAgreementMaintenanceRequest);
var basicSoapResponse = new BasicResponse(result);
return basicSoapResponse;
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error UpdatePersonAgreementsDetailTypes with the following " +
$"PersonAgreementDetailTypeRequest: {JsonConvert.SerializeObject(personAgreementDetailTypeRequest)}");
throw;
}
}
}
}
@@ -0,0 +1,36 @@
using System;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using Serilog;
using LCU.API.Internal.CoreSoapApiWrapper.DataAccess;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapper.Services
{
public interface ITaxService
{
GetTaxIdDataResponse GetTaxIdData(long taxId);
}
public class TaxService : ITaxService
{
private readonly ITaxDao _taxDao;
public TaxService(ITaxDao taxDao)
{
_taxDao = taxDao;
}
public GetTaxIdDataResponse GetTaxIdData(long taxId)
{
try
{
return _taxDao.GetTaxIdData(taxId);
}
catch (Exception ex)
{
Log.Error(ex, $"There was an error while getting TaxIdData for taxId: {taxId}");
throw;
}
}
}
}
@@ -0,0 +1,45 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="RemoveAttributes(file)">
<!-- LOGGING -->
<add key="serilog:write-to:Seq.serverUrl" value="https://qa-seq.lcu-internal.com" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:write-to:Seq.apiKey" value="byPieHGnsNNUTfpDZpjq" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:enrich:with-property:Environment" value="Development" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END LOGGING -->
<!-- SECURITY -->
<add key="ApiSecurityConfiguration:ApiKeyAuthenticationFailureBehavior" value="Error" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="ApiSecurityConfiguration:ExternalApiKeySet:CoreSoapApiWrapper" value="55ffc97e-aead-4baf-acae-27723257db95" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END SECURITY -->
<add key="KnownEnvironment" value="Development" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Soap Connection-->
<add key="soapconnection:safUrl" value="https://UATapi.dna.lcu-internal.com:10005/SAF/ProductIntegration/ProductIntegration.asmx" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:userId" value="ASERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:password" value="ASland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodEnvCd" value="PRODUCTION" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodDefCd" value="SAF2006" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:applId" value="7e837e75-2e19-45d5-8c3a-4735a275a6cf" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:endpoint" value="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:approvalpersonnumber" value="5775" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:overridecashboxnumber" value="800" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Socket Connection-->
<add key="socketconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:applId" value="7726" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:userId" value="CMCSERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:password" value="CSland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:ipAddress" value="10.10.3.72" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:portId" value="2503" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:timeout" value="10000" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:reqType" value="16340" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:authType" value="3" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END Soap Connection -->
</appSettings>
<system.serviceModel>
<client>
<endpoint address="https://UATapi.dna.lcu-internal.com:10005/Extensions/DNA.CoreApiService/CoreApiService.svc/Soap11" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities.ICoreApiService" name="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</client>
</system.serviceModel>
<system.web>
<httpModules xdt:Transform="Remove" />
</system.web>
</configuration>
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="RemoveAttributes(file)">
<!-- LOGGING -->
<add key="serilog:write-to:Seq.serverUrl" value="https://seq.lcu-internal.com" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:write-to:Seq.apiKey" value="9IIfjzJP9LUiFFY3G4Qs" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:enrich:with-property:Environment" value="Production" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END LOGGING -->
<!-- SECURITY -->
<add key="ApiSecurityConfiguration:ApiKeyAuthenticationFailureBehavior" value="Error" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="ApiSecurityConfiguration:ExternalApiKeySet:CoreSoapApiWrapper" value="674c1654-e24c-4a98-8f9a-ee8a6ddb30ac" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END SECURITY -->
<add key="KnownEnvironment" value="Production" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Soap Connection-->
<add key="soapconnection:safUrl" value="https://prodapi.dna.lcu-internal.com:10002/SAF/ProductIntegration/ProductIntegration.asmx" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:userId" value="ASERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:password" value="ASland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodEnvCd" value="PRODUCTION" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodDefCd" value="SAF2006" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:applId" value="7e837e75-2e19-45d5-8c3a-4735a275a6cf" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:endpoint" value="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:approvalpersonnumber" value="5775" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:overridecashboxnumber" value="800" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Socket Connection-->
<add key="socketconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:applId" value="7726" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:userId" value="CMCSERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:password" value="CSland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:ipAddress" value="10.10.3.26" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:portId" value="2500" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:timeout" value="10000" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:reqType" value="16340" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:authType" value="3" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END Soap Connection -->
</appSettings>
<system.serviceModel>
<client>
<endpoint address="https://prodapi.dna.lcu-internal.com:10002/Extensions/DNA.CoreApiService/CoreApiService.svc/Soap11" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities.ICoreApiService" name="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</client>
</system.serviceModel>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)"/>
<httpModules xdt:Transform="Remove" />
</system.web>
</configuration>
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="RemoveAttributes(file)">
<!-- LOGGING -->
<add key="serilog:write-to:Seq.serverUrl" value="https://uat-seq.lcu-internal.com" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:write-to:Seq.apiKey" value="PMxyyWRWmKAwrsQXjjnX" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="serilog:enrich:with-property:Environment" value="UAT" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END LOGGING -->
<!-- SECURITY -->
<add key="ApiSecurityConfiguration:ApiKeyAuthenticationFailureBehavior" value="Error" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="ApiSecurityConfiguration:ExternalApiKeySet:CoreSoapApiWrapper" value="c2be5f10-a723-4425-89f2-7923e28689d2" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END SECURITY -->
<add key="KnownEnvironment" value="Staging" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Soap Connection-->
<add key="soapconnection:safUrl" value="https://UATapi.dna.lcu-internal.com:10005/SAF/ProductIntegration/ProductIntegration.asmx" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:userId" value="ASERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:password" value="ASland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodEnvCd" value="PRODUCTION" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:prodDefCd" value="SAF2006" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:applId" value="7e837e75-2e19-45d5-8c3a-4735a275a6cf" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:endpoint" value="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:approvalpersonnumber" value="5775" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="soapconnection:overridecashboxnumber" value="800" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- Socket Connection-->
<add key="socketconnection:deviceId" value="FULL" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:applId" value="7726" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:userId" value="CMCSERVICE" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:password" value="CSland21!!" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:ipAddress" value="10.10.3.72" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:portId" value="2503" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:timeout" value="10000" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:reqType" value="16340" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<add key="socketconnection:authType" value="3" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
<!-- END Soap Connection -->
</appSettings>
<system.serviceModel>
<client>
<endpoint address="https://UATapi.dna.lcu-internal.com:10005/Extensions/DNA.CoreApiService/CoreApiService.svc/Soap11" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities.ICoreApiService" name="lcu_10002" xdt:Transform="Replace" xdt:Locator="Match(name)"/>
</client>
</system.serviceModel>
<system.web>
<compilation xdt:Transform="RemoveAttributes(debug)"/>
<httpModules xdt:Transform="Remove" />
</system.web>
</configuration>
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings file="/app/config/environment-appsettings/appsettings.config">
<!-- LOGGING -->
<add key="serilog:level-switch:$controlSwitch" value="Verbose" />
<add key="serilog:minimum-level:controlled-by" value="$controlSwitch" />
<add key="serilog:using:Console" value="Serilog.Sinks.Console" />
<add key="serilog:write-to:Console" />
<add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />
<add key="serilog:write-to:Seq.serverUrl" value="https://localhost" />
<add key="serilog:write-to:Seq.apiKey" value="VALUE-IN-KEYVAULT" />
<add key="serilog:write-to:Seq.controlLevelSwitch" value="$controlSwitch" />
<add key="serilog:using:File" value="Serilog.Sinks.File" />
<add key="serilog:write-to:File.path" value="C:\Logs\CoreAPI.txt" />
<add key="serilog:write-to:File.rollingInterval" value="Day" />
<add key="serilog:write-to:File.retainedFileCountLimit" value="4" />
<add key="serilog:enrich:with-property:Application" value="Core Soap API Wrapper" />
<add key="serilog:enrich:with-property:Environment" value="Development" />
<!-- END LOGGING -->
<!-- SECURITY -->
<add key="ApiSecurityConfiguration:ApiKeyAuthenticationFailureBehavior" value="Error"/>
<add key="ApiSecurityConfiguration:ExternalApiKeySet:CoreSoapApiWrapper" value="VALUE-IN-KEYVAULT"/>
<!-- END SECURITY -->
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="KnownEnvironment" value="Local" />
<!-- Soap Connection-->
<add key="soapconnection:safUrl" value="https://UATapi.dna.lcu-internal.com:10005/SAF/ProductIntegration/ProductIntegration.asmx" />
<add key="soapconnection:deviceId" value="FULL" />
<add key="soapconnection:userId" value="VALUE-IN-KEYVAULT" />
<add key="soapconnection:password" value="VALUE-IN-KEYVAULT" />
<add key="soapconnection:prodEnvCd" value="PRODUCTION" />
<add key="soapconnection:prodDefCd" value="SAF2006" />
<add key="soapconnection:applId" value="7e837e75-2e19-45d5-8c3a-4735a275a6cf" />
<add key="soapconnection:endpoint" value="lcu_10002" />
<add key="soapconnection:approvalpersonnumber" value="5775" />
<add key="soapconnection:overridecashboxnumber" value="800" />
<!-- END Soap Connection -->
<!-- Socket Connection-->
<add key="socketconnection:deviceId" value="FULL" />
<add key="socketconnection:applId" value="7726" />
<add key="socketconnection:userId" value="VALUE-IN-KEYVAULT" />
<add key="socketconnection:password" value="VALUE-IN-KEYVAULT" />
<add key="socketconnection:ipAddress" value="10.10.3.72" />
<add key="socketconnection:portId" value="2503" />
<add key="socketconnection:timeout" value="10000"/>
<add key="socketconnection:reqType" value="16340" />
<add key="socketconnection:authType" value="3" />
<!-- END Socket Connection -->
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483646" maxBufferSize="2147483646" maxReceivedMessageSize="2147483646" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="2147483646" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="BasicHttpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" maxReceivedMessageSize="483646" useDefaultWebProxy="true" />
<binding name="BasicHttpBinding_ICoreApiService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://UATapi.dna.lcu-internal.com:10005/Extensions/DNA.CoreApiService/CoreApiService.svc/Soap11" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities.ICoreApiService" name="lcu_10002"/>
</client>
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" />
<endToEndTracing activityTracing="true" />
</diagnostics>
</system.serviceModel>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.6.1" />
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</httpModules>
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.9.2.0" newVersion="4.9.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.Documents.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.4.0.0" newVersion="2.4.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Http.WebHost" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Serilog.Sinks.File" publicKeyToken="24c2f752a8e58a10" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Antlr" version="3.5.0.2" targetFramework="net472" />
<package id="Autofac" version="4.9.2" targetFramework="net452" />
<package id="Autofac.WebApi2" version="4.2.1" targetFramework="net452" />
<package id="bootstrap" version="3.4.1" targetFramework="net472" />
<package id="jQuery" version="3.4.1" targetFramework="net472" />
<package id="Microsoft.AspNet.Cors" version="5.2.4" targetFramework="net452" />
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.4" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.HelpPage" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.7" targetFramework="net472" />
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net472" />
<package id="Microsoft.Azure.DocumentDB" version="2.4.1" targetFramework="net452" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net472" />
<package id="Modernizr" version="2.8.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="Serilog" version="2.10.0" targetFramework="net452" />
<package id="Serilog.Enrichers.Environment" version="2.1.3" targetFramework="net452" />
<package id="Serilog.Formatting.Compact" version="1.1.0" targetFramework="net452" />
<package id="Serilog.Settings.AppSettings" version="2.2.2" targetFramework="net452" />
<package id="Serilog.Sinks.AzureDocumentDB" version="4.0.0" targetFramework="net452" />
<package id="Serilog.Sinks.Console" version="3.1.1" targetFramework="net452" />
<package id="Serilog.Sinks.File" version="5.0.0" targetFramework="net452" />
<package id="Serilog.Sinks.PeriodicBatching" version="2.3.0" targetFramework="net452" />
<package id="Serilog.Sinks.Seq" version="5.0.0" targetFramework="net452" />
<package id="SerilogWeb.Classic" version="5.0.48" targetFramework="net452" />
<package id="SerilogWeb.Classic.WebApi" version="4.0.5" targetFramework="net452" />
<package id="Swashbuckle" version="5.6.0" targetFramework="net452" />
<package id="Swashbuckle.Core" version="5.6.0" targetFramework="net452" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net452" />
<package id="WebActivatorEx" version="2.0" targetFramework="net452" />
<package id="WebGrease" version="1.6.0" targetFramework="net472" />
</packages>
@@ -0,0 +1,310 @@
using Moq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Web.Http.Results;
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
{
[TestClass]
public class AccountControllerTest
{
private AccountController _controller;
private Mock<IAccountService> _mockAccountService;
public AccountControllerTest()
{
_mockAccountService = new Mock<IAccountService>();
_controller = new AccountController(_mockAccountService.Object);
}
[TestMethod]
public void GetAccountByAccountNumber_OK()
{
var maintenanceResponse = new AccountDetailInquiryResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.GetAccountByAccountNumber(100L)).Returns(maintenanceResponse).Verifiable();
var result = _controller.GetAccountByAccountNumber(100L);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<AccountDetailInquiryResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
_mockAccountService.Verify();
}
[TestMethod]
public void GetAccountByAccountNumber_LongIsZero_BadRequest()
{
_mockAccountService.Verify(x => x.GetAccountByAccountNumber(It.IsAny<long>()),
Times.Never);
var result = _controller.GetAccountByAccountNumber(0);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify(x => x.GetAccountByAccountNumber(It.IsAny<long>()), Times.Never);
}
[TestMethod]
public void GetAccountByAccountNumber_Exception()
{
_mockAccountService.Setup(x => x.GetAccountByAccountNumber(100L)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.GetAccountByAccountNumber(100);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountMaintenanceRequest_OK()
{
var maintenanceRequest = new AccountMaintenanceRequest
{
Accounts = new[]{
new MaintenanceAccount
{
AccountNumber = 123456,
DeliveryMethodCode = "PRNT"
}
}
};
var maintenanceResponse = new AccountMaintenanceResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Returns(maintenanceResponse).Verifiable();
var result = _controller.PutAccountMaintenanceRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<AccountMaintenanceResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountMaintenanceRequest_Null_BadRequest()
{
_mockAccountService.Verify(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>()),
Times.Never);
var result = _controller.PutAccountMaintenanceRequest(null);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify(x => x.SendAccountMaintenanceRequest(It.IsAny<AccountMaintenanceRequest>()),
Times.Never);
}
[TestMethod]
public void PutAccountMaintenanceRequest_Exception()
{
var maintenanceRequest = new AccountMaintenanceRequest
{
Accounts = new[]{
new MaintenanceAccount
{
AccountNumber = 123456,
DeliveryMethodCode = "PRNT"
}
}
};
_mockAccountService.Setup(x => x.SendAccountMaintenanceRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutAccountMaintenanceRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountAnalysisGroupMaintenanceRequest_OK()
{
var maintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
{
AccountNumber = 11111111,
IsGenerateAnalysisStatement = true,
IsPrintAnalysisStatement = true,
IsUseForServiceCharge = true,
};
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.SendAccountAnalysisGroupMaintenanceRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PutAccountAnalysisGroupMaintenanceRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountAnalysisGroupMaintenanceRequest_Exception()
{
var maintenanceRequest = new AccountAnalysisGroupMaintenanceRequest
{
AccountNumber = 11111111,
IsGenerateAnalysisStatement = true,
IsPrintAnalysisStatement = true,
IsUseForServiceCharge = true,
};
_mockAccountService.Setup(x => x.SendAccountAnalysisGroupMaintenanceRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutAccountAnalysisGroupMaintenanceRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountNickNameUpdateRequest_OK()
{
var maintenanceRequest = new AccountNickNameUpdateRequest
{
AccountNumber = 11111111,
AccountDescription = "TestSuccess"
};
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.SendAccountNickNameUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PutAccountNickNameUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountNickNameUpdateRequest_Exception()
{
var maintenanceRequest = new AccountNickNameUpdateRequest
{
AccountNumber = 11111111,
AccountDescription = "TestException"
};
_mockAccountService.Setup(x => x.SendAccountNickNameUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutAccountNickNameUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountCreditReportTypeUpdateRequest_OK()
{
var maintenanceRequest = new AccountCreditReportTypeUpdateRequest
{
AccountNumber = 11111111,
CreditReportType = "EXCL"
};
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.SendAccountCreditReportTypeUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PutAccountCreditReportTypeUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountCreditReportTypeUpdateRequest_Exception()
{
var maintenanceRequest = new AccountCreditReportTypeUpdateRequest
{
AccountNumber = 11111111,
CreditReportType = "EXCL"
};
_mockAccountService.Setup(x => x.SendAccountCreditReportTypeUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutAccountCreditReportTypeUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountContractDateUpdateRequest_OK()
{
var maintenanceRequest = new AccountContractDateUpdateRequest
{
AccountNumber = 11111111,
ContractDate = DateTime.Now,
};
var maintenanceResponse = new AccountAnalysisMaintenanceResponse
{
WasSuccessful = true
};
_mockAccountService.Setup(x => x.SendAccountContractDateUpdateRequest(maintenanceRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PutAccountContractDateUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockAccountService.Verify();
}
[TestMethod]
public void PutAccountContractDateUpdateRequest_Exception()
{
var maintenanceRequest = new AccountContractDateUpdateRequest
{
AccountNumber = 11111111,
ContractDate = DateTime.Now,
};
_mockAccountService.Setup(x => x.SendAccountContractDateUpdateRequest(maintenanceRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutAccountContractDateUpdateRequest(maintenanceRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockAccountService.Verify();
}
}
}
@@ -0,0 +1,158 @@
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Responses;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Web.Http.Results;
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
{
[TestClass]
public class CollateralMaintenanceControllerTest
{
private CollateralMaintenanceController _controller;
private Mock<ICollateralMaintenanceService> _mockCollateralMaintenanceService;
public CollateralMaintenanceControllerTest()
{
_mockCollateralMaintenanceService = new Mock<ICollateralMaintenanceService>();
_controller = new CollateralMaintenanceController(_mockCollateralMaintenanceService.Object);
}
[TestMethod]
public void GetPropertyByPropertyNumber_OK()
{
var searchResponse = new CollateralSearchResponse()
{
WasSuccessful = true
};
_mockCollateralMaintenanceService.Setup(x => x.GetCollateralMaintenanceByPropertyNumber(15000)).Returns(searchResponse).Verifiable();
var result = _controller.Get(15000);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<CollateralSearchResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.WasSuccessful);
_mockCollateralMaintenanceService.Verify();
}
[TestMethod]
public void GetPropertyByPropertyNumber_IntIsZero_BadRequest()
{
_mockCollateralMaintenanceService.Verify(x => x.GetCollateralMaintenanceByPropertyNumber(It.IsAny<int>()),
Times.Never);
var result = _controller.Get(0);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockCollateralMaintenanceService.Verify(x => x.GetCollateralMaintenanceByPropertyNumber(It.IsAny<int>()), Times.Never);
}
[TestMethod]
public void GetPropertyByPropertyNumber_Exception()
{
_mockCollateralMaintenanceService.Setup(x => x.GetCollateralMaintenanceByPropertyNumber(15000)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.Get(15000);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockCollateralMaintenanceService.Verify();
}
[TestMethod]
public void PutCollateralMaintenanceRequest_OK()
{
var fieldRequest = new UserFieldRequest()
{
PropertyNumber = 11111,
UserFieldCode = "TEST",
Value = "TEST"
};
var maintenanceResponse = new CollateralMaintenanceResponse()
{
WasSuccessful = true
};
_mockCollateralMaintenanceService.Setup(x => x.UpdateCollateralMaintenance(fieldRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PutCollateralMaintenance(fieldRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockCollateralMaintenanceService.Verify();
}
[TestMethod]
public void PutAccountMaintenanceRequest_Exception()
{
var fieldRequest = new UserFieldRequest()
{
PropertyNumber = 11111,
UserFieldCode = "TEST",
Value = "TEST"
};
_mockCollateralMaintenanceService.Setup(x => x.UpdateCollateralMaintenance(fieldRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutCollateralMaintenance(fieldRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockCollateralMaintenanceService.Verify();
}
[TestMethod]
public void PostCollateralMaintenanceRequest_OK()
{
var fieldRequest = new UserFieldRequest()
{
PropertyNumber = 11111,
UserFieldCode = "TEST",
Value = "TEST"
};
var maintenanceResponse = new CollateralMaintenanceResponse()
{
WasSuccessful = true
};
_mockCollateralMaintenanceService.Setup(x => x.InsertCollateralMaintenance(fieldRequest)).Returns(new BasicResponse(maintenanceResponse)).Verifiable();
var result = _controller.PostCollateralMaintenance(fieldRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<BasicResponse>;
Assert.IsNotNull(okResult);
Assert.IsTrue((bool)okResult.Content.Success);
_mockCollateralMaintenanceService.Verify();
}
[TestMethod]
public void PostCollateralMaintenanceRequest_Exception()
{
var fieldRequest = new UserFieldRequest()
{
PropertyNumber = 11111,
UserFieldCode = "TEST",
Value = "TEST"
};
_mockCollateralMaintenanceService.Setup(x => x.InsertCollateralMaintenance(fieldRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PostCollateralMaintenance(fieldRequest);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockCollateralMaintenanceService.Verify();
}
}
}
@@ -0,0 +1,63 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System.Web.Http.Results;
using System;
using System.Collections.Generic;
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Response;
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
{
[TestClass]
public class indirectLoanControllerTest
{
private IndirectLoanController _controller;
private Mock<IIndirectLoanService> _mockIndirectLoanService;
public indirectLoanControllerTest()
{
_mockIndirectLoanService = new Mock<IIndirectLoanService>();
_controller = new IndirectLoanController(_mockIndirectLoanService.Object);
}
[TestMethod]
public void PutDealerOriginalBalanceRequest_OK()
{
var request = "19618754052";
var response = new UpdateDealerOriginalBalanceResponse();
var responseList = new List<UpdateDealerOriginalBalanceResponse> { response };
_mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalances(request)).Returns(responseList).Verifiable();
var result = _controller.PutDealerOriginalBalance(request);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<List<UpdateDealerOriginalBalanceResponse>>;
Assert.IsNotNull(okResult);
_mockIndirectLoanService.Verify();
}
[TestMethod]
public void PutDealerOriginalBalance_Exception()
{
var request = "19618754052";
var response = new UpdateDealerOriginalBalanceResponse()
{
AccountNumber = "19618754052",
ErrorMessage = "Error: 000000 This account has failed to update."
};
var responseList = new List<UpdateDealerOriginalBalanceResponse> { response };
_mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalances(request)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutDealerOriginalBalance(request);
Assert.IsNotNull(result);
var badResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(badResult);
_mockIndirectLoanService.Verify();
}
}
}
@@ -0,0 +1,210 @@
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Web.Http.Results;
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
{
[TestClass]
public class MonetaryTransactionControllerTest
{
private MonetaryTransactionController _controller;
private Mock<IMonetaryTransactionService> _mockMonetaryTransactionService;
public MonetaryTransactionControllerTest()
{
_mockMonetaryTransactionService = new Mock<IMonetaryTransactionService>();
_controller = new MonetaryTransactionController(_mockMonetaryTransactionService.Object);
}
[TestMethod]
public void PostMonetaryTransactionsRequest_OK()
{
var groupRequest = new GroupedMonetaryTransactionRequest()
{
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
new MonetaryTransactionRequest()
{
AccountNumber = 19618756535,
RequestNumber = "1",
TransactionTypeCode = "DEXP",
FundBalanceTypes = new FundBalanceType[1]
{
new FundBalanceType()
{
FundBalanceAmount = 1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "IMED"
}
},
BalanceTypes = new BalanceType1[1] {
new BalanceType1() {
BalanceCategoryCode = "UPFR",
BalanceTypeCode = "DLR",
BalanceTypeAmount = 1.25
}
},
Funds = new Fund[1] {
new Fund() {
ClearingCategoryCode = "IMED",
FundAmount = 1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "INTR",
NumberOfItems = 1
}
}
},
new MonetaryTransactionRequest()
{
AccountNumber = 19617805142,
TransactionAmount = -1.25,
ParentRequestNumber = "1",
RequestNumber = "2",
TransactionTypeCode = "DRIR",
Description = "",
BalanceTypes = new BalanceType1[1] {
new BalanceType1() {
BalanceCategoryCode = "UPFR",
BalanceTypeCode = "DLR",
BalanceTypeAmount = -1.25
}
},
Funds = new Fund[1] {
new Fund() {
ClearingCategoryCode = "IMED",
FundAmount = -1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "INTR",
NumberOfItems = 1
}
}
}
}
};
var response = new MonetaryTransactionResponse()
{
WasSuccessful = false
};
var listResponse = new List<MonetaryTransactionResponse> { response };
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
_mockMonetaryTransactionService.Setup(x => x.AddMonetaryTransactions(listGroupRequest)).Returns(listResponse).Verifiable();
var result = _controller.PostMonetaryTransactions(listGroupRequest);
Assert.IsNotNull(result);
var okResult = result as OkNegotiatedContentResult<List<MonetaryTransactionResponse>>;
Assert.IsNotNull(okResult);
_mockMonetaryTransactionService.Verify();
}
[TestMethod]
public void PostMonetaryTransactionsRequest_Exception()
{
var groupRequest = new GroupedMonetaryTransactionRequest()
{
MonetaryTransactionRequests = new List<MonetaryTransactionRequest>() {
new MonetaryTransactionRequest()
{
AccountNumber = 19618756535,
RequestNumber = "1",
TransactionTypeCode = "DEXP",
FundBalanceTypes = new FundBalanceType[1]
{
new FundBalanceType()
{
FundBalanceAmount = 1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "IMED"
}
},
BalanceTypes = new BalanceType1[1] {
new BalanceType1() {
BalanceCategoryCode = "UPFR",
BalanceTypeCode = "DLR",
BalanceTypeAmount = 1.25
}
},
Funds = new Fund[1] {
new Fund() {
ClearingCategoryCode = "IMED",
FundAmount = 1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "INTR",
NumberOfItems = 1
}
}
},
new MonetaryTransactionRequest()
{
AccountNumber = 19617805142,
TransactionAmount = -1.25,
ParentRequestNumber = "1",
RequestNumber = "2",
TransactionTypeCode = "DRIR",
Description = "",
BalanceTypes = new BalanceType1[1] {
new BalanceType1() {
BalanceCategoryCode = "UPFR",
BalanceTypeCode = "DLR",
BalanceTypeAmount = -1.25
}
},
Funds = new Fund[1] {
new Fund() {
ClearingCategoryCode = "IMED",
FundAmount = -1.25,
FundTypeCode = "EL",
FundTypeDetailCode = "INTR",
NumberOfItems = 1
}
}
}
}
};
var response = new MonetaryTransactionResponse()
{
WasSuccessful = false
};
var listResponse = new List<MonetaryTransactionResponse> { response };
var listGroupRequest = new List<GroupedMonetaryTransactionRequest> { groupRequest };
_mockMonetaryTransactionService.Setup(x => x.AddMonetaryTransactions(listGroupRequest)).Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PostMonetaryTransactions(listGroupRequest);
Assert.IsNotNull(result);
var badResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(badResult);
_mockMonetaryTransactionService.Verify();
}
}
}
@@ -0,0 +1,68 @@
using LCU.API.Internal.CoreSoapApiWrapper.Controllers;
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
using LCU.API.Internal.CoreSoapApiWrapper.Services;
using Moq;
using System.Web.Http.Results;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using LCU.API.Internal.CoreSoapApiWrapper.Models.Requests;
using System.Collections.Generic;
namespace LCU.API.Internal.CoreSoapApiWrapperTest.Controllers
{
[TestClass]
public class PersonAgreementControllerTest
{
private PersonAgreementController _controller;
private Mock<IPersonAgreementService> _mockPersonAgreementService;
public PersonAgreementControllerTest()
{
_mockPersonAgreementService = new Mock<IPersonAgreementService>();
_controller = new PersonAgreementController(_mockPersonAgreementService.Object);
}
[TestMethod]
public void PutPersonAgreementsDetailTypes_Null_BadRequest()
{
_mockPersonAgreementService.Verify(x => x.UpdatePersonAgreementsDetailTypes(
It.IsAny<PersonAgreementDetailTypeRequest>()), Times.Never);
var result = _controller.PutPersonAgreementsDetailTypes(null);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockPersonAgreementService.Verify(x => x.UpdatePersonAgreementsDetailTypes(
It.IsAny<PersonAgreementDetailTypeRequest>()), Times.Never);
}
[TestMethod]
public void PutPersonAgreementsDetailTypes_Exception()
{
var request = new PersonAgreementDetailTypeRequest()
{
PersonNumber = 1,
AgreeNumber = 2,
DetailTypes = new List<DetailType>()
{
new DetailType()
{
DetailTypeCode = "Stat",
DetailValue = "CLOS"
}
}
};
_mockPersonAgreementService.Setup(x => x.UpdatePersonAgreementsDetailTypes(request))
.Throws(new Exception("Error thrown in unit test.")).Verifiable();
var result = _controller.PutPersonAgreementsDetailTypes(request);
Assert.IsNotNull(result);
var okResult = result as BadRequestErrorMessageResult;
Assert.IsNotNull(okResult);
_mockPersonAgreementService.Verify();
}
}
}

Some files were not shown because too many files have changed in this diff Show More