Adding
This commit is contained in:
@@ -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,332 @@
|
|||||||
|
## 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
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
**/Properties/launchSettings.json
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.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
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
.idea/**
|
||||||
|
.vscode/**
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
COPY ["LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj", "LCU.Api.Internal.CoreApiWrapper/"]
|
||||||
|
COPY ["LCU.Library.Internal.CoreApiWrapperLib/LCU.Library.Internal.CoreApiWrapperLib.csproj", "LCU.Library.Internal.CoreApiWrapperLib/"]
|
||||||
|
COPY ["LCU.Library.Internal.CoreApiWrapperModel/LCU.Library.Internal.CoreApiWrapperModel.csproj", "LCU.Library.Internal.CoreApiWrapperModel/"]
|
||||||
|
COPY ["LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj", "LCU.Api.Internal.CoreApiWrapperTest/"]
|
||||||
|
|
||||||
|
# Install Credential Provider and set environment variables to enable authenticated Nuget restore
|
||||||
|
ARG PAT=bh2lq3jibktw67b2wdbqyfln7cd3je6lk52kijntpj43v6kimpgq
|
||||||
|
RUN curl -L https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | sh
|
||||||
|
#RUN wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
|
||||||
|
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
|
||||||
|
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS "{\"endpointCredentials\": [{\"endpoint\":\"https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json\", \"password\":\"${PAT}\"}]}"
|
||||||
|
|
||||||
|
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj"
|
||||||
|
RUN dotnet restore -s "https://landmarkcu.pkgs.visualstudio.com/_packaging/LCU-Internal/nuget/v3/index.json" -s "https://api.nuget.org/v3/index.json" "LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj"
|
||||||
|
|
||||||
|
COPY ["LCU.Api.Internal.CoreApiWrapper/", "LCU.Api.Internal.CoreApiWrapper/"]
|
||||||
|
COPY ["LCU.Library.Internal.CoreApiWrapperLib/", "LCU.Library.Internal.CoreApiWrapperLib/"]
|
||||||
|
COPY ["LCU.Library.Internal.CoreApiWrapperModel/", "LCU.Library.Internal.CoreApiWrapperModel/"]
|
||||||
|
COPY ["LCU.Api.Internal.CoreApiWrapperTest/", "LCU.Api.Internal.CoreApiWrapperTest/"]
|
||||||
|
|
||||||
|
RUN dotnet build "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS test
|
||||||
|
WORKDIR /src
|
||||||
|
LABEL test=true
|
||||||
|
RUN dotnet test -c Release --results-directory /app/test --logger "trx;LogFileName=test.trx" "LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj"
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
WORKDIR /src
|
||||||
|
RUN dotnet publish "LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||||
|
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT=Development
|
||||||
|
|
||||||
|
FROM base AS final
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "LCU.Api.Internal.CoreApiWrapper.dll"]
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.7.34009.444
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LCU.Api.Internal.CoreApiWrapper", "LCU.Api.Internal.CoreApiWrapper\LCU.Api.Internal.CoreApiWrapper.csproj", "{758BCDB7-FADF-4D90-9832-9F53D6EF5FA3}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LCU.Library.Internal.CoreApiWrapperModel", "LCU.Library.Internal.CoreApiWrapperModel\LCU.Library.Internal.CoreApiWrapperModel.csproj", "{A629C562-34D5-4917-B4AC-84B2A93AE31D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LCU.Library.Internal.CoreApiWrapperLib", "LCU.Library.Internal.CoreApiWrapperLib\LCU.Library.Internal.CoreApiWrapperLib.csproj", "{0F713EAC-1080-4ADA-AA14-91A76B376A8D}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LCU.Api.Internal.CoreApiWrapperTest", "LCU.Api.Internal.CoreApiWrapperTest\LCU.Api.Internal.CoreApiWrapperTest.csproj", "{5588356B-8DFC-4C1D-9B7D-F48BE01CB1D7}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LCU.Api.Internal.CoreApiWrapperIntegrationTest", "LCU.Api.Internal.CoreApiWrapperIntegrationTest\LCU.Api.Internal.CoreApiWrapperIntegrationTest.csproj", "{9993F1F3-51DB-424B-8584-2F23ACA6DBEA}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{758BCDB7-FADF-4D90-9832-9F53D6EF5FA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{758BCDB7-FADF-4D90-9832-9F53D6EF5FA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{758BCDB7-FADF-4D90-9832-9F53D6EF5FA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{758BCDB7-FADF-4D90-9832-9F53D6EF5FA3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A629C562-34D5-4917-B4AC-84B2A93AE31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A629C562-34D5-4917-B4AC-84B2A93AE31D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A629C562-34D5-4917-B4AC-84B2A93AE31D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A629C562-34D5-4917-B4AC-84B2A93AE31D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{0F713EAC-1080-4ADA-AA14-91A76B376A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{0F713EAC-1080-4ADA-AA14-91A76B376A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{0F713EAC-1080-4ADA-AA14-91A76B376A8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{0F713EAC-1080-4ADA-AA14-91A76B376A8D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5588356B-8DFC-4C1D-9B7D-F48BE01CB1D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5588356B-8DFC-4C1D-9B7D-F48BE01CB1D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5588356B-8DFC-4C1D-9B7D-F48BE01CB1D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5588356B-8DFC-4C1D-9B7D-F48BE01CB1D7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9993F1F3-51DB-424B-8584-2F23ACA6DBEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9993F1F3-51DB-424B-8584-2F23ACA6DBEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9993F1F3-51DB-424B-8584-2F23ACA6DBEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9993F1F3-51DB-424B-8584-2F23ACA6DBEA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {41CEB3DD-A1EE-45AD-8A05-C1FC6AA52730}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Configuration
|
||||||
|
{
|
||||||
|
public class CoreApiWrapperConfig
|
||||||
|
{
|
||||||
|
public string AppName { get; set; }
|
||||||
|
public string SeqUrl { get; set; }
|
||||||
|
public string SeqApiKey { get; set; }
|
||||||
|
public string[] CorsAllowedOrigins { get; set; }
|
||||||
|
public FeatureFlags FeatureFlags { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Configuration
|
||||||
|
{
|
||||||
|
public class FeatureFlags
|
||||||
|
{
|
||||||
|
public bool DisableCoreDBWrite { get; set; }
|
||||||
|
public bool UseKeyVault { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons;
|
||||||
|
using System.Linq;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AccessChannelPersonsController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAccessChannelPersonsService _accessChannelPersonsService;
|
||||||
|
|
||||||
|
public AccessChannelPersonsController(IAccessChannelPersonsService accessChannelPersonsService)
|
||||||
|
{
|
||||||
|
_accessChannelPersonsService = accessChannelPersonsService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Get([FromQuery] AccessChannelPersonsByPersonRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accessChannelPersonsService.GetAccessChannelPersonCoreApiResponseAsync(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetWithIncludes")]
|
||||||
|
public async Task<IActionResult> GetWithIncludes([FromQuery] AccessChannelPersonsByPersonRequest request, [FromQuery] List<string> includes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(includes == null || !includes.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Includes is required.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accessChannelPersonsService.GetAccessChannelPersonCoreApiResponseAsync(request, includes);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<IActionResult> Put([FromBody] AccessChannelPerson request, long updateKey)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(updateKey <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Update Key.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accessChannelPersonsService.UpdateAccessChannelPersonAsync(request, updateKey);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AccessTypeController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAccessTypeService _accessTypeService;
|
||||||
|
|
||||||
|
public AccessTypeController(IAccessTypeService accessTypeService)
|
||||||
|
{
|
||||||
|
_accessTypeService = accessTypeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<IActionResult> Put([FromBody] AccessTypeUpdateRequest accessTypeUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accessTypeService.UpdateAccessTypeAsync(accessTypeUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+581
@@ -0,0 +1,581 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Account;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AccountController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
|
||||||
|
public AccountController(IAccountService accountService)
|
||||||
|
{
|
||||||
|
_accountService = accountService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("AccountMaintenanceRequest")]
|
||||||
|
public async Task<IActionResult> AccountMaintenanceRequest([FromBody] List<AccountMaintenanceRequest> accountMaintenanceRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountMaintenanceRequests == null || !accountMaintenanceRequests.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Null or Empty List of AccountMaintenance Requests.");
|
||||||
|
}
|
||||||
|
|
||||||
|
await _accountService.PutAccountMaintenanceRequest(accountMaintenanceRequests);
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error updating account maintenance requests: {accountMaintenanceRequests}.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountBranchCode")]
|
||||||
|
public async Task<IActionResult> PutAccountBranchCode([FromBody] AccountBranchUpdateRequest accountBranchUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountBranchUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountBranchUpdateRequest can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountBranch(accountBranchUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error updating Branch Account Maintenance Request");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountLoanToValue")]
|
||||||
|
public async Task<IActionResult> PutAccountLoanToValue([FromBody] AccountLtvUpdateRequest accountLtvRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountLtvRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountLtvUpdateRequest can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountLoanToValue(accountLtvRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error updating Account Loan to Value Maintenance Request");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountAnalysisGroup")]
|
||||||
|
public async Task<IActionResult> PutAccountAnalysisGroup([FromBody] AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountAnalysisGroupMaintenanceRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountAnalysisGroupMaintenanceRequest can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountAnalysisMaintenance(accountAnalysisGroupMaintenanceRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error updating Account Analysis Maintenance Request");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAccountsForGroupAnalysis")]
|
||||||
|
public async Task<IActionResult> GetAccountsForGroupAnalysisMaintenance()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _accountService.GetAccountsForGroupAnalysisMaintenance();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Error getting Accounts for Group Analysis Maintenance");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAdminBranchCodeChangeAccountNumbers")]
|
||||||
|
public async Task<IActionResult> GetAdminBranchCodeChangeAccountNumbers()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _accountService.GetAdminBranchCodeChangeAccountNumbers();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetVipSavingsToFund")]
|
||||||
|
public async Task<IActionResult> GetVipSavingsToFund()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _accountService.GetVipSavingsToFund();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("QueryActivityAccountDetails")]
|
||||||
|
public async Task<IActionResult> GetActivityAccountDetailsByAccountNumber([FromBody] ActivityAccountDetailsRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _accountService.GetActivityAccountDetailsByAccountNumbers(request.AccountNumbers);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failure in {GetType().Name}");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetOwnersByAccountNumber")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountOwnership>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOwnersByAccountNumber(long accountNumber, string creationDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("An accountNumber must be provided and cannot be less than or equal to 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DateTime.TryParse(creationDate, out DateTime t))
|
||||||
|
{
|
||||||
|
return BadRequest($"The CreationDate provided ({creationDate}) " +
|
||||||
|
$"for AccountNumber: {accountNumber}, can not be converted into a DateTime object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.GetOwnersByAccountNumber(accountNumber, t);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Owners by AccountNumber: {accountNumber} with CreationDate: {creationDate}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPrimaryOwnersByOrganizationName/{*organizationName}")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountOwnership>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPrimaryOwnersByOrganizationName(string organizationName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(organizationName))
|
||||||
|
{
|
||||||
|
return BadRequest("An OrganizationName must be provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.GetPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Owners by OrganizationName: {organizationName}");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPrimaryOwnersByPersonName/{*personName}")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountOwnership>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPrimaryOwnersByPersonName(string personName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(personName))
|
||||||
|
{
|
||||||
|
return BadRequest("An PersonName must be provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.GetPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Owners by PersonName: {personName}");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost("PostPersonAccount")]
|
||||||
|
public async Task<IActionResult> PostPersonAccount([FromBody] CreatePersonAccountRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("CreatePersonAccountRequest cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.AddPersonAccount(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Creating Person Account Request: {request}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost("PostOrganizationAccount")]
|
||||||
|
public async Task<IActionResult> PostOrganizationAccount([FromBody] CreateOrganizationAccountRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("CreateOrganizationAccountRequest cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.AddOrganizationAccount(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Creating Organization Account Request: {request}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutOrganizationMaintenanceRequest")]
|
||||||
|
public async Task<IActionResult> PutOrganizationMaintenanceRequest([FromBody] OrganizationMaintenanceRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("OrganizationMaintenanceRequest cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.PutOrganizationMaintenanceRequest(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Updating Organization Maintenance Request: {request}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountNickNameUpdateRequest")]
|
||||||
|
public async Task<IActionResult> PutAccountNickNameUpdateRequest([FromBody] AccountNickNameUpdateRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountNickNameUpdateRequest cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountNickName(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Updating Account NickName Update Request: {request}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountCreditReportType")]
|
||||||
|
[ProducesResponseType(typeof(BasicResponse), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> PutAccountCreditReportType([FromBody] AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountCreditReportTypeUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountCreditReportTypeUpdateRequest can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountCreditReportType(accountCreditReportTypeUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error updating Account Credit Report Type Maintenance Request");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutAccountContractDateUpdateRequest")]
|
||||||
|
public async Task<IActionResult> PutAccountContractDateUpdateRequest([FromBody] AccountContractDateUpdateRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountContractDateUpdateRequest cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.UpdateAccountContractDate(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Updating Account Contract Date. Update Request: {request}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpGet("GetAccountByAccountNumber")]
|
||||||
|
[ProducesResponseType(typeof(long), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAccountByAccountNumber([FromQuery]long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Account Number.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var account = await _accountService.GetAccountDetailsByAccountNumber(accountNumber);
|
||||||
|
return Ok(account);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error finding account number: {accountNumber}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAccountsByMajorMinorBranchAndStatus")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountsByMajorMinorBranchAndStatusResponse>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAccountsByMajorMinorBranchAndStatus([FromQuery] AccountsByMajorMinorBranchAndStatusRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
return BadRequest("AccountsByMajorMinorBranchAndStatusRequest can't be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountService.GetAccountsByMajorMinorBranchAndStatus(request);
|
||||||
|
|
||||||
|
if (result == null || !result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAccountByRecentTransactions")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<AccountsByRecentTransactionsResponse>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAcccountsByRecentTransactions([FromQuery] AccountsByRecentTransactionsRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _accountService.GetAccountsByRecentTransactions(request);
|
||||||
|
|
||||||
|
if (result == null || !result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AccountUserFieldController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAccountUserFieldService _accountUserFieldService;
|
||||||
|
|
||||||
|
public AccountUserFieldController(IAccountUserFieldService accountUserFieldService)
|
||||||
|
{
|
||||||
|
_accountUserFieldService = accountUserFieldService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut]
|
||||||
|
public async Task<IActionResult> Put([FromBody] List<AccountUserFieldRequest> accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountUserFieldUpdateRequests == null || !accountUserFieldUpdateRequests.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Null or Empty List of Account UserField Update Requests.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountUserFieldService.UpdateAccountUserFieldsAsync(accountUserFieldUpdateRequests);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> Post([FromBody] List<AccountUserFieldRequest> accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountUserFieldUpdateRequests == null || !accountUserFieldUpdateRequests.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Null or Empty List of Account UserField Requests.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountUserFieldService.InsertAccountUserFieldsAsync(accountUserFieldUpdateRequests);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Get(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountNumber < 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid account number.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _accountUserFieldService.GetAccountUserFieldsAsync(accountNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+289
@@ -0,0 +1,289 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using FailedToParseException = LCU.Library.Internal.CoreApiWrapperLib.Exceptions.FailedToParseException;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class ActivityController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IActivityService _activityService;
|
||||||
|
|
||||||
|
public ActivityController(IActivityService activityService)
|
||||||
|
{
|
||||||
|
_activityService = activityService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New Checking Account Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive </param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive </param>
|
||||||
|
/// <param name="limitAmount"> Limit number of records returned, defaults to 100 </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("Checking")]
|
||||||
|
public IActionResult GetNewCheckingAccountActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber, int limitAmount = 100)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewCheckingAccountActivities(newerThanDateTime, afterActivityNumber, limitAmount);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New Digital Banking Checking Account Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive </param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive </param>
|
||||||
|
/// <param name="limitAmount"> Limit number of records returned, defaults to 100 </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("DigitalBankingChecking")]
|
||||||
|
public IActionResult GetNewDigitalBankingCheckingAccountActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber, int limitAmount = 100)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
var result = _activityService.GetNewDigitalBankingCheckingAccountActivities(newerThanDateTime, afterActivityNumber, limitAmount);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New ATM and Check Card Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive </param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive </param>
|
||||||
|
/// <param name="limitAmount"> Limit number of records returned, defaults to 100 </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("AtmCheckCard")]
|
||||||
|
public IActionResult GetNewAtmCheckCardActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber, int limitAmount = 100)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewAtmCheckCardActivities(newerThanDateTime, afterActivityNumber, limitAmount);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New Mortgage Sale Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive</param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("MortgageAccount")]
|
||||||
|
public IActionResult GetNewMortgageAccountActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewMortgageSaleActivities(newerThanDateTime, afterActivityNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New Vehicle Sale Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive</param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("VehicleAccount")]
|
||||||
|
public IActionResult GetNewVehicleSaleActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewVehicleSaleActivities(newerThanDateTime, afterActivityNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New Loan Sales Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber For
|
||||||
|
/// Accounts that can have debt protection but are not incentivized
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanDateTime">dateTime to begin search, inclusive</param>
|
||||||
|
/// <param name="afterActivityNumber">ActvNbr to search after, not inclusive</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("DPEligibleAccounts")]
|
||||||
|
public IActionResult GetNewDebtProtectedLoanSaleActivities([FromQuery] string? newerThanDateTime, long? afterActivityNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewDebtProtectedLoanSaleActivities(newerThanDateTime, afterActivityNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get New ATM and Check Card Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newerThanOriginationDateTime">dateTime to begin search, inclusive</param>
|
||||||
|
/// <param name="afterActivityId">ActvNbr to search after, not inclusive</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("ActivtyManagerIncentiveReferral")]
|
||||||
|
public IActionResult GetNewActivityManagerReferralActivities([FromQuery] string? newerThanOriginationDateTime, long? afterActivityId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetNewActivityManagerIncentiveReferrals(newerThanOriginationDateTime, afterActivityId);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("QueryActivityManagerActivity")]
|
||||||
|
public IActionResult QueryActivityManagerActivity([FromBody] ActivityQueryRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.QueryActivityManagerActivity(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetEStatementDeliveryActivity")]
|
||||||
|
public IActionResult GetEStatementDeliveryActivity([FromQuery] string? newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _activityService.GetEStatementDeliveryActivity(newerThanDateTime);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonActivityByPhoneNumber/{phoneNumber}")]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(typeof(PersonRecentActivityResponse), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonActivityByPhoneNumber(string phoneNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(phoneNumber))
|
||||||
|
{
|
||||||
|
return BadRequest("You must enter a phone number");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(await _activityService.GetPersonActivityByPhoneNumber(phoneNumber));
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonActivityByTaxId/{taxId}")]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(typeof(PersonRecentActivityResponse), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonActivityByTaxId(string taxId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(taxId))
|
||||||
|
{
|
||||||
|
return BadRequest("You must enter a tax Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(await _activityService.GetPersonActivityByTaxId(taxId));
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+156
@@ -0,0 +1,156 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AddressController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAddressService _addressService;
|
||||||
|
|
||||||
|
public AddressController(IAddressService addressService)
|
||||||
|
{
|
||||||
|
_addressService = addressService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetByPersonNumberAndPostalAddressNumber")]
|
||||||
|
public IActionResult GetByPersonNumberAndPostalAddressNumber(string personNumber, string postalAddressNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(personNumber))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid PersonNumber");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(postalAddressNumber))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid PostalAddressNumber");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.GetByPersonNumberAndId(personNumber, postalAddressNumber).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetByPersonNumber")]
|
||||||
|
public IActionResult GetByPersonNumber(string personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(personNumber))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid PersonNumber");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.GetByPersonNumber(personNumber).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("DeleteInsertPersonPostalAddress")]
|
||||||
|
public IActionResult DeleteInsertPersonPostalAddress([FromBody] PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.DeleteInsertPersonPostalAddress(personPostalAddress).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete]
|
||||||
|
[ApiKey]
|
||||||
|
[HttpDelete("DeletePersonPostalAddress")]
|
||||||
|
public IActionResult DeletePersonPostalAddress([FromBody] PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.RemovePersonPostalAddress(personPostalAddress).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost("InsertPersonPostalAddress")]
|
||||||
|
public IActionResult InsertPersonPostalAddress([FromBody] PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.InsertPersonPostalAddress(personPostalAddress).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
[HttpPut("UpdatePersonAddrLine")]
|
||||||
|
public IActionResult UpdatePersonAddrLine([FromBody] PersonAddrLine personAddrLine)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _addressService.UpdatePersonAddrLine(personAddrLine).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+378
@@ -0,0 +1,378 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using System.Linq;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AgreeController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAgreeService _agreeService;
|
||||||
|
|
||||||
|
public AgreeController(IAgreeService agreeService)
|
||||||
|
{
|
||||||
|
_agreeService = agreeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>GetAgreeUsersByAccount utilizes a query that will attempt to get a userId by account numbers.</summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// NOTE: If the account number does not have a UserId a user id of M+{MemberNumber} will be used. This should only be used if that is the desired outcome.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="accountNumbers"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
// GET api/core/Agree/AgreeUsersByAccounts
|
||||||
|
[HttpGet("AgreeUsersByAccounts")]
|
||||||
|
public async Task<IActionResult> GetAgreeUsersByAccounts([FromQuery] List<string> accountNumbers)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountNumbers == null || !accountNumbers.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Null or Empty List of Account Numbers.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreeUsersByAccountNumbers(accountNumbers);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting Agree Users by Accounts.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>GetAgreeUsersByPersonNumber utilizes a query that will attempt to get a userId by a person number.</summary>
|
||||||
|
/// <param name="personNumber"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
// GET api/core/Agree/AgreeUserByPersonNumber/{personNumber}
|
||||||
|
[HttpGet("AgreeUserByPersonNumber/{personNumber:long}")]
|
||||||
|
public async Task<IActionResult> GetAgreeUsersByPersonNumber(long personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personNumber == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("A person number must be provided, and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreeUsersByPersonNumber(personNumber);
|
||||||
|
|
||||||
|
if (!result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting Agree Users by Accounts.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>GetAgreeUserByOrganizationNumber utilizes a query that will attempt to get a userId by an organization number.</summary>
|
||||||
|
/// <param name="organizationNumber"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
// GET api/core/Agree/AgreeUserByOrganizationNumber/{organizationNumber}
|
||||||
|
[HttpGet("AgreeUserByOrganizationNumber/{organizationNumber:long}")]
|
||||||
|
public async Task<IActionResult> GetAgreeUserByOrganizationNumber(long organizationNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (organizationNumber == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("A person number must be provided, and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreeUserByOrganizationNumber(organizationNumber);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(result))
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting Agree Users by Accounts.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementByUserId/{userId}")]
|
||||||
|
[ProducesResponseType(typeof(Agreement), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(userId))
|
||||||
|
{
|
||||||
|
return BadRequest("A Null or Empty UserId was provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementByUserId(userId);
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Agreement by UserId: {userId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementByAgreementId/{agreementId}")]
|
||||||
|
[ProducesResponseType(typeof(Agreement), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementByAgreementId(long agreementId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (agreementId == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("An AgreementId must be provided and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementByAgreementId(agreementId);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Agreement by AgreementId: {agreementId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementsByAccountId/{accountId}")]
|
||||||
|
[ProducesResponseType(typeof(List<Agreement>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementsByAccountId(long accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountId == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("An AccountId must be provided and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementsByAccountId(accountId);
|
||||||
|
|
||||||
|
if (result == null || !result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting Agreements by AccountId: {accountId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementAccountByAccountId/{accountId}")]
|
||||||
|
[ProducesResponseType(typeof(AgreementAccountOwner), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementAccountByAccountId(long accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountId == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("An AccountId must be provided and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementAccountByAccountId(accountId);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting AgreementAccount by AccountId: {accountId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementAccountsByUserId/{userId}")]
|
||||||
|
[ProducesResponseType(typeof(List<AgreementAccount>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementAccountsByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(userId))
|
||||||
|
{
|
||||||
|
return BadRequest("A Null or Empty UserId was provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementAccountsByUserId(userId);
|
||||||
|
if (result == null || !result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting AgreementAccounts by UserId: {userId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementAccountsByOrganizationId/{organizationId}")]
|
||||||
|
[ProducesResponseType(typeof(List<AgreementAccount>), 200)]
|
||||||
|
[ProducesResponseType(204)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementAccountsByOrganizationId(long organizationId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (organizationId == 0)
|
||||||
|
{
|
||||||
|
return BadRequest("An OrganizationId must be provided and cannot be 0.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.GetAgreementAccountsByOrganizationId(organizationId);
|
||||||
|
if (result == null || !result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting AgreementAccounts by OrganizationId: {organizationId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementAccountsAuditFromDateLastMaintained")]
|
||||||
|
[ProducesResponseType(typeof(List<long>), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementAccountsAuditFromDateLastMaintained(string dateLastMaintained)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(dateLastMaintained))
|
||||||
|
{
|
||||||
|
return BadRequest("A Null or Empty dateLastMaintained was provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DateTime.TryParse(dateLastMaintained, out DateTime t))
|
||||||
|
{
|
||||||
|
return BadRequest("The dateLastMaintained provided, can not be converted into a DateTime object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(t);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error auditing Accounts from DateLastMaintained: {dateLastMaintained}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("AgreementAuditFromDateLastMaintained")]
|
||||||
|
[ProducesResponseType(typeof(List<long>), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAgreementAuditFromDateLastMaintained(string dateLastMaintained)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(dateLastMaintained))
|
||||||
|
{
|
||||||
|
return BadRequest("A Null or Empty dateLastMaintained was provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DateTime.TryParse(dateLastMaintained, out DateTime t))
|
||||||
|
{
|
||||||
|
throw new FailedToParseException(
|
||||||
|
"The dateLastMaintained provided, can not be converted into a DateTime object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.AuditAgreementChangesByDateLastMaintained(t);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException fp)
|
||||||
|
{
|
||||||
|
return BadRequest(fp.Message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error auditing Agreements from DateLastMaintained: {dateLastMaintained}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("OrganizationAuditFromDateLastMaintained")]
|
||||||
|
[ProducesResponseType(typeof(List<long>), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOrganizationAuditFromDateLastMaintained(string dateLastMaintained)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(dateLastMaintained))
|
||||||
|
{
|
||||||
|
return BadRequest("A Null or Empty dateLastMaintained was provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DateTime.TryParse(dateLastMaintained, out DateTime t))
|
||||||
|
{
|
||||||
|
throw new FailedToParseException("The dateLastMaintained provided, can not be converted into a DateTime object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _agreeService.AuditOrganizationChangesByDateLastMaintained(t);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException fp)
|
||||||
|
{
|
||||||
|
return BadRequest(fp.Message);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error auditing Organization from DateLastMaintained: {dateLastMaintained}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/agreeperson")]
|
||||||
|
public class AgreePersonController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAgreePersonService _agreePersonService;
|
||||||
|
|
||||||
|
public AgreePersonController(IAgreePersonService agreePersonService)
|
||||||
|
{
|
||||||
|
_agreePersonService = agreePersonService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Get(int fetchSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _agreePersonService.GetAgreePersons(fetchSize).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAgreePersonsWithHyphenatedUserId")]
|
||||||
|
public IActionResult GetAgreePersonsWithHyphenatedUserId()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _agreePersonService.GetAgreePersonsWithHyphenatedUserId().Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetActiveCustodialAgreePersonNumbers")]
|
||||||
|
public IActionResult GetActiveCustodialAgreePersonNumbers()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _agreePersonService.GetActiveCustodialAgreePersonNumbers().Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetActiveCustodialVruCardAgreementAgreePersons")]
|
||||||
|
public IActionResult GetActiveCustodialVruCardAgreementAgreePersons()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _agreePersonService.GetActiveCustodialVruCardAgreementAgreePersons().Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutPersonAgreementDetailTypes")]
|
||||||
|
public IActionResult PutPersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(personAgreementDetailTypeRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("PersonAgreementDetailTypeRequest is null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _agreePersonService.UpdatePersonAgreementDetailTypes(personAgreementDetailTypeRequest).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
return BadRequest(exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+53
@@ -0,0 +1,53 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class ApplicationHistoryController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IApplicationHistoryService _applicationHistoryService;
|
||||||
|
|
||||||
|
public ApplicationHistoryController(IApplicationHistoryService applicationHistoryService)
|
||||||
|
{
|
||||||
|
_applicationHistoryService = applicationHistoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get list of application history by list of application numbers and between a date range
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ApplicationHistoryRequest">
|
||||||
|
/// ApplicationHistoryRequest Properties: ApplicationNumbers, DateRangeStart, DateRangeEnd
|
||||||
|
/// </param>
|
||||||
|
/// <returns>List<ApplicationHistory></returns>
|
||||||
|
[HttpGet("GetApplicationHistory")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<ApplicationHistory>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetApplicationHistory([FromQuery] ApplicationHistoryRequest applicationHistoryRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _applicationHistoryService.GetApplicationHistory(applicationHistoryRequest.ApplicationNumbers,
|
||||||
|
applicationHistoryRequest.EffectiveDate);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class AssociateController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IAssociateService _associateService;
|
||||||
|
|
||||||
|
public AssociateController(IAssociateService associateService)
|
||||||
|
{
|
||||||
|
_associateService = associateService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetAssociateDetailsBySsn/{taxId}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(AssociateDetails), 400)]
|
||||||
|
[ProducesResponseType(404)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetAssociateDetailsBySsn(string taxId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(taxId))
|
||||||
|
{
|
||||||
|
return BadRequest("Must enter a valid taxId");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _associateService.GetAssociateDetailsBySsn(taxId);
|
||||||
|
|
||||||
|
if (result is null)
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class BranchController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IBranchService _branchService;
|
||||||
|
|
||||||
|
public BranchController(IBranchService branchService)
|
||||||
|
{
|
||||||
|
_branchService = branchService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult Get()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _branchService.GetBranches().Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting branches.");
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+124
@@ -0,0 +1,124 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Exceptions;
|
||||||
|
using System.Linq;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class IndirectLoanController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IIndirectLoanService _indirectLoanService;
|
||||||
|
|
||||||
|
public IndirectLoanController(IIndirectLoanService indirectLoanService)
|
||||||
|
{
|
||||||
|
_indirectLoanService = indirectLoanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{accountNumber:long}", Name = "GetIndirectLoanByAccountNumber")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(IndirectLoanDetail), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetIndirectLoanByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _indirectLoanService.GetIndirectLoanByAccountNumber(accountNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{newerThanDateTime}", Name = "GetIndirectLoansByPostedDate")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<IndirectLoanDetail>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetIndirectLoansByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _indirectLoanService.GetIndirectLoansByPostedDate(newerThanDateTime);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Closed/{newerThanDateTime}", Name = "GetClosedIndirectLoansByPostedDate")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<ClosedIndirectLoan>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetClosedIndirectLoansByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _indirectLoanService.GetClosedIndirectLoansByPostedDate(newerThanDateTime);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("ClosedWithDetail/{newerThanDateTime}", Name = "GetClosedIndirectLoansWithDetailByPostedDate")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<IndirectLoanDetail>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetClosedIndirectLoansWithDetailByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _indirectLoanService.GetClosedIndirectLoansWithDetailByPostedDate(newerThanDateTime);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (FailedToParseException)
|
||||||
|
{
|
||||||
|
return BadRequest("Could Not Parse Supplied Date Time");
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[Route("PutDealerOriginalBalance")]
|
||||||
|
[HttpPut]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<UpdateDealerOriginalBalanceResponse>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> PutDealerOriginalBalance([FromBody] string accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _indirectLoanService.UpdateDealerOriginalBalance(accountNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/individuals")]
|
||||||
|
public class IndividualController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IIndividualService _individualService;
|
||||||
|
|
||||||
|
public IndividualController(IIndividualService individualService)
|
||||||
|
{
|
||||||
|
_individualService = individualService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet()]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult GetIndividual(string userId)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(userId))
|
||||||
|
{
|
||||||
|
Log.Error("Request for invalid user id {0}", userId);
|
||||||
|
return BadRequest("User Id must not be null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _individualService.GetIndividualByUserId(userId).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting individual.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+100
@@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class LoanController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ILoanService _loanService;
|
||||||
|
|
||||||
|
public LoanController(ILoanService loanService)
|
||||||
|
{
|
||||||
|
_loanService = loanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetLoanDetails/{accountNumber:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(LoanDetail), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetLoanDetails(long accountNumber)
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Account Number must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var loanDetail = await _loanService.GetLoanDetail(accountNumber);
|
||||||
|
return Ok(loanDetail);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetLoanCollateral/{accountNumber:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<CollateralDetail>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetLoanCollateral(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Account Number must be greater than 0");
|
||||||
|
}
|
||||||
|
var collateral = await _loanService.GetCollateralDetails(accountNumber);
|
||||||
|
return Ok(collateral);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPropertyInformation")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<CollateralDetail>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPropertyInformation([FromQuery]long accountNumber)
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Account Number must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var properties = await _loanService.GetPropertyInformation(accountNumber);
|
||||||
|
return Ok(properties);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+68
@@ -0,0 +1,68 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans;
|
||||||
|
using System.Web;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class LoanPayoffController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ILoanPayoffService _loanPayoffService;
|
||||||
|
|
||||||
|
public LoanPayoffController(ILoanPayoffService loanPayoffService)
|
||||||
|
{
|
||||||
|
_loanPayoffService = loanPayoffService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("LoanPayoffByAccountNumber/{accountNumber:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(LoanDetail), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetLoanDetailsByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var loanDetail = await _loanPayoffService.GetLoanPayoffByAccountNumber(accountNumber);
|
||||||
|
return Ok(loanDetail);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("LoanPayoffByVIN/{VIN}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(LoanDetail), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetLoanDetailsByVIN(string VIN)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var loanDetail = await _loanPayoffService.GetLoanPayoffByVIN(VIN);
|
||||||
|
return Ok(loanDetail);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+190
@@ -0,0 +1,190 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/members")]
|
||||||
|
public class MemberController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IMemberService _memberService;
|
||||||
|
private readonly ILoanService _loanService;
|
||||||
|
|
||||||
|
public MemberController(IMemberService memberService,
|
||||||
|
ILoanService loanService)
|
||||||
|
{
|
||||||
|
_memberService = memberService;
|
||||||
|
_loanService = loanService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{memberId:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult GetMember(long memberId)
|
||||||
|
{
|
||||||
|
if (memberId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Member Id must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var member = _memberService.GetMemberDetails(memberId).Result;
|
||||||
|
return Ok(member);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting member.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetMemberByAccountNumber/{accountNumber:long}")]
|
||||||
|
public async Task<IActionResult> GetMemberByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
if (accountNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Account Number must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var member = await _memberService.GetMemberByAccountNumber(accountNumber);
|
||||||
|
return Ok(member);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{memberId:long}/owners")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult GetMemberOwnership(long memberId)
|
||||||
|
{
|
||||||
|
if (memberId <= 0)
|
||||||
|
{
|
||||||
|
Log.Error("Request for invalid memberId id {0}", memberId);
|
||||||
|
return BadRequest("Member ID must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _memberService.GetMemberOwner(memberId).Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting member owner.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("New endpoints in loan controller were created to accommodate, remove once certain not needed. JDA = 10/1/2021")]
|
||||||
|
[HttpGet("{memberId:long}/loans/{loanId:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult GetMemberLoan(long memberId, long loanId)
|
||||||
|
{
|
||||||
|
if (memberId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Member ID must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loanId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Loan ID must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.Debug("GetMemberLoan being used.");
|
||||||
|
var loan = _loanService.GetLoanDetail(loanId).Result;
|
||||||
|
return Ok(loan);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting member loan.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Obsolete("New endpoints in loan controller were created to accommodate, remove once certain not needed. JDA = 10/1/2021")]
|
||||||
|
[HttpGet("{memberId:long}/loans/{loanId:long}/collateral")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult GetMemberLoanCollateral(long memberId, long loanId)
|
||||||
|
{
|
||||||
|
if (memberId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Member Id must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loanId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Loan Id must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Log.Debug("GetMemberLoanCollateral being used.");
|
||||||
|
var collateral = _loanService.GetCollateralDetails(loanId).Result;
|
||||||
|
return Ok(collateral);
|
||||||
|
}
|
||||||
|
catch (NullReferenceException nre)
|
||||||
|
{
|
||||||
|
Log.Error(nre, "Bad reference getting loan collateral.");
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Error getting loan collateral.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonOrOrganizationNumberByMemberId/{memberId:long}")]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 400)]
|
||||||
|
[ProducesResponseType(typeof(List<string>), 404)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonOrOrganizationNumberByMemberId(long memberId)
|
||||||
|
{
|
||||||
|
if (memberId <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Member Id must be greater than 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var personOrOrganization = await _memberService.GetPersonOrOrganizationNumberByMemberId(memberId);
|
||||||
|
return Ok(personOrOrganization);
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException ane)
|
||||||
|
{
|
||||||
|
Log.Error(ane, ane.Message);
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
catch (NullReferenceException nre)
|
||||||
|
{
|
||||||
|
Log.Error(nre, "Bad reference getting person or organization.");
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting person or organization by member ID: {memberId}.");
|
||||||
|
return BadRequest(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+134
@@ -0,0 +1,134 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class OrganizationController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IOrganizationService _organizationService;
|
||||||
|
|
||||||
|
public OrganizationController(IOrganizationService organizationService)
|
||||||
|
{
|
||||||
|
_organizationService = organizationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetOrganization/{organizationNumber:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<Organization>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOrganizationByOrganizationNumber(long organizationNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _organizationService.GetOrganizationByOrganizationNumber(organizationNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("{organizationName}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<Organization>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOrganizationByOrganizationName(string organizationName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _organizationService.GetOrganizationByName(organizationName);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Like/{organizationName}")]
|
||||||
|
[ProducesResponseType(typeof(List<Organization>), 200)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOrganizationByOrganizationNameLike(string organizationName, [FromQuery] int? limit = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var organizations = await _organizationService.GetOrganizationByNameLike(organizationName, limit);
|
||||||
|
|
||||||
|
return Ok(organizations);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Like/{organizationName}/Count")]
|
||||||
|
[ProducesResponseType(typeof(List<long>), 200)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> CountOrganizationNumbersByName(string organizationName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var organizations = await _organizationService.CountOrganizationNumbersByName(organizationName);
|
||||||
|
|
||||||
|
return Ok(organizations);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetOrganizationByMemberAgreementNumber/{memberId:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(Organization), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetOrganizationByMemberAgreementNumber(long memberId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _organizationService.GetMemberByMemberAgreeNbr(memberId);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+154
@@ -0,0 +1,154 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class PersonController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IPersonService _personService;
|
||||||
|
|
||||||
|
public PersonController(IPersonService personService)
|
||||||
|
{
|
||||||
|
_personService = personService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPerson")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<Person>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPerson([FromQuery] CoreRequestParameters coreRequestParameters,
|
||||||
|
[FromQuery] PersonNameRequest personRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personService.GetPersonsByName(coreRequestParameters, personRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Name/Like")]
|
||||||
|
[ProducesResponseType(typeof(IEnumerable<Person>), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonNameLike([FromQuery] PersonNameRequest personRequest, [FromQuery] int? limit = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personService.GetPersonsByNameLike(personRequest, limit);
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("Name/Like/Count")]
|
||||||
|
[ProducesResponseType(typeof(long), 200)]
|
||||||
|
[ProducesResponseType(400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> CountPersonNameLike([FromQuery] PersonNameRequest personRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!ModelState.IsValid)
|
||||||
|
{
|
||||||
|
return BadRequest(ModelState.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personService.CountPersonsByNameLike(personRequest);
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPerson/{personNumber:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<Person>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonByPersonNumber(long personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _personService.GetPersonByPersonNumber(personNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonByMemberAgreementNumber/{memberId:long}")]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(Person), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> GetPersonByMemberAgreementNumber(long memberId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _personService.GetMemberByMemberAgreeNbr(memberId);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+174
@@ -0,0 +1,174 @@
|
|||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System;
|
||||||
|
using Serilog;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class PersonUserFieldController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IPersonUserFieldService _personUserFieldService;
|
||||||
|
|
||||||
|
public PersonUserFieldController(IPersonUserFieldService personUserFieldService)
|
||||||
|
{
|
||||||
|
_personUserFieldService = personUserFieldService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[Obsolete("New endpoints in PersonUser controller were created to accomadate, remove once certain not needed. CJL = 3/15/2023")]
|
||||||
|
[HttpPut("PutPersonUserFieldForAtmCheckHolds")]
|
||||||
|
public async Task<IActionResult> PutPersonUserFieldForAtmCheckHolds([FromBody] PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personUserFieldUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("Null Person UserField Update Request.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Updating Person User Field Request: {personUserFieldUpdateRequest}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[Obsolete("New endpoints in PersonUser controller were created to accomadate, remove once certain not needed. CJL = 3/15/2023")]
|
||||||
|
[HttpPost("PostPersonUserFieldForAtmCheckHolds")]
|
||||||
|
public async Task<IActionResult> PostPersonUserFieldForAtmCheckHolds([FromBody] PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personUserFieldUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("Null Person UserField Request.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personUserFieldService.InsertPersonUserFieldAsync(personUserFieldUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Adding Person User Field Request: {personUserFieldUpdateRequest}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> Get(long personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personNumber < 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Person Number.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personUserFieldService.GetPersonUserFieldsAsync(personNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error getting Person User Fields with Person Number: {personNumber}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonsForAtmCheckHolds")]
|
||||||
|
public async Task<IActionResult> GetPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate, int? fetchSize = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _personUserFieldService.GetPersonsForAtmCheckHolds(resetStartDate, resetEndDate);
|
||||||
|
if (fetchSize != null)
|
||||||
|
{
|
||||||
|
result = result.Take((int)fetchSize).ToList();
|
||||||
|
}
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error getting Persons for Atm Check Holds with ResetStartDate: {resetStartDate} and ResetEndDate {resetEndDate}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutPersonUserField")]
|
||||||
|
public async Task<IActionResult> PutPersonUserField([FromBody] PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personUserFieldUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("Null Person UserField Update Request.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Updating Person User Field Request: {personUserFieldUpdateRequest}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost("PostPersonUserField")]
|
||||||
|
public async Task<IActionResult> PostPersonUserField([FromBody] PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (personUserFieldUpdateRequest == null)
|
||||||
|
{
|
||||||
|
return BadRequest("Null Person UserField Request.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _personUserFieldService.InsertPersonUserFieldAsync(personUserFieldUpdateRequest);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error Adding Person User Field Request: {personUserFieldUpdateRequest}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class PropertyUserFieldController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IPropertyUserFieldService _propertyUserFieldService;
|
||||||
|
|
||||||
|
public PropertyUserFieldController(IPropertyUserFieldService propertyUserFieldService)
|
||||||
|
{
|
||||||
|
_propertyUserFieldService = propertyUserFieldService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IActionResult> GetPropertyUserField(long propertyNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (propertyNumber < 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Person Number.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _propertyUserFieldService.GetPropertyUserFieldsAsync(propertyNumber);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error getting Property User Fields with Property Number: {propertyNumber}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost("PostPropertyUserField")]
|
||||||
|
public async Task<IActionResult> PostPropertyUserField([FromBody]PropertyUserField request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
Log.Error("Property User Field Cannot be null");
|
||||||
|
return BadRequest("Property User Field Cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _propertyUserFieldService.InsertPropertyUserFieldAsync(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error adding property information.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut("PutPropertyUserField")]
|
||||||
|
public async Task<IActionResult> PutPropertyUserField([FromBody]PropertyUserField request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (request == null)
|
||||||
|
{
|
||||||
|
Log.Error("Property User Field Cannot be null");
|
||||||
|
return BadRequest("Property User Field Cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _propertyUserFieldService.UpdatePropertyUserFieldAsync(request);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error adding property information.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class SafController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ISafService _safService;
|
||||||
|
|
||||||
|
public SafController(ISafService safService)
|
||||||
|
{
|
||||||
|
_safService = safService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of all SAF UserIDs with known Core PersonNbr and Employee Email
|
||||||
|
/// </summary>
|
||||||
|
[HttpGet("UserInfo")]
|
||||||
|
public IActionResult GetAll()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = _safService.GetAllSafUsersCoreInfo().Result;
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting all Saf User Info");
|
||||||
|
return BadRequest(ex.Message.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.Status.Services;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers;
|
||||||
|
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/[controller]")]
|
||||||
|
public class StatusController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IApiHealthCheckService _apiHealthCheckService;
|
||||||
|
|
||||||
|
public StatusController(IApiHealthCheckService apiHealthCheckService)
|
||||||
|
{
|
||||||
|
_apiHealthCheckService = apiHealthCheckService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[ProducesResponseType(200)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public IActionResult Get()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return Ok(_apiHealthCheckService.CheckApiHealthAndBuildEnvironmentView());
|
||||||
|
}
|
||||||
|
catch (ServiceException exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError, exception.Message);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class TaxController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ITaxService _taxService;
|
||||||
|
|
||||||
|
public TaxController(ITaxService taxService)
|
||||||
|
{
|
||||||
|
_taxService = taxService;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetPersonsTaxIdData/{taxId}")]
|
||||||
|
public async Task<IActionResult> GetPersonsTaxIdData(string taxId)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(taxId))
|
||||||
|
{
|
||||||
|
return BadRequest("A taxId must be provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _taxService.GetPersonsTaxIdData(taxId);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting TaxIdData for TaxId: {taxId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError); }
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetOrganizationsTaxIdData/{taxId}")]
|
||||||
|
public async Task<IActionResult> GetOrganizationsTaxIdData(string taxId)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(taxId))
|
||||||
|
{
|
||||||
|
return BadRequest("A taxId must be provided.");
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _taxService.GetOrganizationsTaxIdData(taxId);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error getting TaxIdData for TaxId: {taxId}.");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+193
@@ -0,0 +1,193 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Serilog;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Attributes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Configuration;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Controllers
|
||||||
|
{
|
||||||
|
[ApiController]
|
||||||
|
[Route("api/core/[controller]")]
|
||||||
|
public class TransactionController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly ITransactionService _transactionService;
|
||||||
|
private readonly CoreApiWrapperConfig _coreApiWrapperConfig;
|
||||||
|
|
||||||
|
public TransactionController(ITransactionService transactionService, CoreApiWrapperConfig coreApiWrapperConfig)
|
||||||
|
{
|
||||||
|
_transactionService = transactionService;
|
||||||
|
_coreApiWrapperConfig = coreApiWrapperConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[Route("PostMonetaryTransactions")]
|
||||||
|
[HttpPost]
|
||||||
|
[ProducesResponseType(201)]
|
||||||
|
[ProducesResponseType(typeof(List<MonetaryTransactionResponse>), 400)]
|
||||||
|
[ProducesResponseType(500)]
|
||||||
|
public async Task<IActionResult> PostMonetaryTransactions([FromBody] List<GroupedMonetaryTransactionRequest> groupedTransactions)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (groupedTransactions == null || !groupedTransactions.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Request");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _transactionService.AddMonetaryTransactionsAsync(groupedTransactions);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetTransactionHistory")]
|
||||||
|
public async Task<IActionResult> GetTransactionHistory(
|
||||||
|
long accountNumber,
|
||||||
|
DateTime startDateRange,
|
||||||
|
DateTime endDateRange,
|
||||||
|
[FromQuery] string[] transactionTypeCodes = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _transactionService.GetTransactionHistory(accountNumber, startDateRange, endDateRange, transactionTypeCodes);
|
||||||
|
|
||||||
|
if (result == null)
|
||||||
|
{
|
||||||
|
return NotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result.Any())
|
||||||
|
{
|
||||||
|
return NoContent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetExternalDescriptionsWithSsn")]
|
||||||
|
public async Task<IActionResult> GetExternalDescriptionsWithSsn()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = await _transactionService.GetExternalDescriptionsWithSsn();
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPost("PostFundsToAccount")]
|
||||||
|
public async Task<IActionResult> PostFundsToAccount([FromBody] List<FundsToAccountRequest> requests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (requests == null || !requests.Any())
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid Request");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _transactionService.PostFundsToAccount(requests);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApiKey]
|
||||||
|
[HttpPut("PutExternalDescription")]
|
||||||
|
public IActionResult PutExternalDescription([FromBody] ExternalDescription externalTransactionDescription)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_coreApiWrapperConfig.FeatureFlags.DisableCoreDBWrite)
|
||||||
|
{
|
||||||
|
return BadRequest("This endpoint has been disabled in this environment.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (externalTransactionDescription.ExternalDescriptionNumber <= 0)
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid External Description Number.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(externalTransactionDescription.ExternalDescriptionText))
|
||||||
|
{
|
||||||
|
return BadRequest("Invalid External Description Text.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = _transactionService.UpdateExternalDescription(externalTransactionDescription);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet("GetTransactionsByDateSpan")]
|
||||||
|
public async Task<IActionResult> GetTransactionsByDateSpan(DateTime startDateRange, DateTime endDateRange, [FromQuery] string[] rtxnTypCdToExclude = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (startDateRange > endDateRange)
|
||||||
|
{
|
||||||
|
return BadRequest("EndDateRange cannot be before StartDateRange.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startDateRange == DateTime.MinValue || endDateRange == DateTime.MinValue)
|
||||||
|
{
|
||||||
|
return BadRequest("EndDateRange and StartDateRange cannot have a minimum value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _transactionService.GetTransactionsByDateSpan(startDateRange, endDateRange, rtxnTypCdToExclude);
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
catch (ServiceException)
|
||||||
|
{
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "Unexpected Exception");
|
||||||
|
return StatusCode(StatusCodes.Status500InternalServerError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<Version>2.9.3</Version>
|
||||||
|
<Description>
|
||||||
|
1.0.0 - Initial Setup
|
||||||
|
1.1.0 - Change Get Individuals endpoint to accept string UserId rather then long.
|
||||||
|
1.2.0 - Add Configuration - CoreApiWrapperConfig as the primary config model.
|
||||||
|
1.2.1 - Change Person -> Individual Mapping MiddleName to use Person MiddleInitial.
|
||||||
|
1.2.2 - Creation of ApplicationHistoryController and Service class.
|
||||||
|
1.2.3 - Replace logging setup with LCU logging library.
|
||||||
|
1.2.4 - Add to GetApplicationHistory to also get Applications parameters.
|
||||||
|
1.2.5 - Add AgreeController and AgreeService classes
|
||||||
|
1.2.6 - Added AccountController and services classes to get and update AccountUserFields
|
||||||
|
2.0.0 - Refactor model namespaces
|
||||||
|
2.1.0 - Remove old transaction history related code, created new loanscontrollor, and made GetLoansDetails/GetLoanColatteral endpoints obsolete.
|
||||||
|
2.2.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate.
|
||||||
|
2.2.1 - Adding accountNumber search by organization number, and new audit queries for agreement controller
|
||||||
|
2.3.0 - Removal of UpdateAccountUserFields in Account classes and Added AccountUserField classes/endpoints
|
||||||
|
2.4.0 - Changes to Address methods to handle per person.
|
||||||
|
2.5.0 - New AccessChannelPersons classes and new AgreePerson's with hyphenated userid get method.
|
||||||
|
2.6.0 - New AccessChannelPerson methods, New AgreePerson methods, and new AccessType Classes
|
||||||
|
2.7.0 - New AgreePerson methods to find custodial vru agreements and update PersonAgreements details.
|
||||||
|
2.8.0 - Return card activities in batches with default of 100
|
||||||
|
2.8.1 - Add GetOwnersByAccountNumber to AccountController
|
||||||
|
2.9.0 - Add GetOwnersByOrganizationName and GetOwnersByPersonName to AccountController
|
||||||
|
2.9.1 - Update GetAgreeUserByPersonNumber to return list of UserIDs
|
||||||
|
2.9.2 - Add LoanPayoff Controller and Service
|
||||||
|
2.9.3 - Update to .Net 6.0
|
||||||
|
</Description>
|
||||||
|
<PackageReleaseNotes>
|
||||||
|
1.0.0 - Initial Setup
|
||||||
|
1.1.0 - Change Get Individuals endpoint to accept string UserId rather then long.
|
||||||
|
1.2.0 - Add Configuration - CoreApiWrapperConfig as the primary config model.
|
||||||
|
1.2.1 - Change Person -> Individual Mapping MiddleName to use Person MiddleInitial.
|
||||||
|
1.2.2 - Creation of ApplicationHistoryController and Service class.
|
||||||
|
1.2.3 - Replace logging setup with LCU logging library.
|
||||||
|
1.2.4 - Add to GetApplicationHistory to also get Applications parameters.
|
||||||
|
1.2.5 - Add AgreeController and AgreeService classes
|
||||||
|
1.2.6 - Added AccountController and services classes to get and update AccountUserFields
|
||||||
|
2.0.0 - Refactor model namespaces
|
||||||
|
2.1.0 - Remove old transaction history related code, created new loanscontrollor, and made GetLoansDetails/GetLoanColatteral endpoints obsolete.
|
||||||
|
2.2.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate.
|
||||||
|
2.2.1 - Adding accountNumber search by organization number, and new audit queries for agreement controller
|
||||||
|
2.3.0 - Removal of UpdateAccountUserFields in Account classes and Added AccountUserField classes/endpoints
|
||||||
|
2.4.0 - Changes to Address methods to handle per person.
|
||||||
|
2.5.0 - New AccessChannelPersons classes and new AgreePerson's with hyphenated userid get method.\
|
||||||
|
2.6.0 - New AccessChannelPerson methods, New AgreePerson methods, and new AccessType Classes
|
||||||
|
2.7.0 - New AgreePerson methods to find custodial vru agreements and update PersonAgreements details.
|
||||||
|
2.8.0 - Return card activities in batches with default of 100
|
||||||
|
2.8.1 - Add GetOwnersByAccountNumber to AccountController
|
||||||
|
2.9.0 - Add GetOwnersByOrganizationName and GetOwnersByPersonName to AccountController
|
||||||
|
2.9.1 - Update GetAgreeUserByPersonNumber to return list of UserIDs
|
||||||
|
2.9.2 - Add LoanPayoff Controller and Service
|
||||||
|
2.9.3 - Update to .Net 6.0
|
||||||
|
</PackageReleaseNotes>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="12.0.1" />
|
||||||
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
|
||||||
|
<PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
|
||||||
|
<PackageReference Include="Azure.Identity" Version="1.13.2" />
|
||||||
|
<PackageReference Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
|
||||||
|
<PackageReference Include="LCU.Library.Internal.ApiSecurity" Version="2.0.0" />
|
||||||
|
<PackageReference Include="LCU.Library.Internal.Exceptions" Version="1.0.0" />
|
||||||
|
<PackageReference Include="LCU.Library.Internal.Status" Version="1.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.15" NoWarn="NU1605" />
|
||||||
|
<PackageReference Include="LCU.Library.Internal.Logging" Version="2.1.0" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
|
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LCU.Library.Internal.CoreApiWrapperLib\LCU.Library.Internal.CoreApiWrapperLib.csproj" />
|
||||||
|
<ProjectReference Include="..\LCU.Library.Internal.CoreApiWrapperModel\LCU.Library.Internal.CoreApiWrapperModel.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
+64
@@ -0,0 +1,64 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using LcuModels = LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Addresses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class AddressMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The properties commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public AddressMapper()
|
||||||
|
{
|
||||||
|
CreateMap<PostalAddress, LcuModels.Address>()
|
||||||
|
.ForMember(dest => dest.AddressId, opt => opt.MapFrom(src => src.AddressNumber))
|
||||||
|
.ForMember(dest => dest.Line1, opt => opt.MapFrom(src => src.AddressLine1))
|
||||||
|
.ForMember(dest => dest.Line2, opt => opt.MapFrom(src => src.AddressLine2))
|
||||||
|
.ForMember(dest => dest.Line3, opt => opt.MapFrom(src => src.AddressLine3))
|
||||||
|
.ForMember(dest => dest.City, opt => opt.MapFrom(src => src.CityName))
|
||||||
|
.ForMember(dest => dest.State, opt => opt.MapFrom(src => src.CountrySubdivisionCode))
|
||||||
|
.ForMember(dest => dest.ZipCode, opt => opt.MapFrom(src => CreateZipCode(src)))
|
||||||
|
.ForMember(dest => dest.Country, opt => opt.MapFrom(src => src.CountryCode))
|
||||||
|
.ForMember(dest => dest.CountyName, opt => opt.MapFrom(src => src.CountryName))
|
||||||
|
.ForMember(dest => dest.AddressType, opt => opt.MapFrom(src => GetAddressType(src)))
|
||||||
|
.ForMember(dest => dest.IsPrimary, opt => opt.MapFrom(src => IsPrimaryAddress(src)))
|
||||||
|
.ForMember(dest => dest.IsInternational, opt => opt.MapFrom(src => !IsInUsa(src)))
|
||||||
|
//.ForMember(dest => dest.AddressVerification, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Occupancy, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.StartDate, opt => opt.MapFrom(src => src.StartDate))
|
||||||
|
.ForMember(dest => dest.EndDate, opt => opt.MapFrom(src => src.StopDate));
|
||||||
|
//.ForMember(dest => dest.UspsVerified, opt => opt.MapFrom(src => src.))
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreateZipCode(PostalAddress postalAddress)
|
||||||
|
{
|
||||||
|
return string.IsNullOrEmpty(postalAddress.ZipPlus) ?
|
||||||
|
postalAddress.PostalCode :
|
||||||
|
$"{postalAddress.PostalCode}-{postalAddress.ZipPlus}";
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: May need to add other conditions as found. As of now we know that when Primary then Home is the Type.
|
||||||
|
public string GetAddressType(PostalAddress postalAddress)
|
||||||
|
{
|
||||||
|
if (postalAddress.AddressUseDescription == AddressConstants.AddressUseDescriptionPrimary)
|
||||||
|
{
|
||||||
|
return AddressConstants.HomeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
return postalAddress.AddressUseDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPrimaryAddress(PostalAddress postalAddress)
|
||||||
|
{
|
||||||
|
return postalAddress.AddressUseCode == AddressConstants.PrimaryUseCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInUsa(PostalAddress postalAddress)
|
||||||
|
{
|
||||||
|
return postalAddress.CountryCode == AddressConstants.CountryUSA ||
|
||||||
|
postalAddress.CountryCode == AddressConstants.CountryUS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using LcuModels = LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Branches;
|
||||||
|
using CoreModels = LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class BranchMapper : Profile
|
||||||
|
{
|
||||||
|
public BranchMapper()
|
||||||
|
{
|
||||||
|
CreateMap<CoreModels.Branch, LcuModels.Branch>()
|
||||||
|
.ForMember(dest => dest.BranchId, opt => opt.MapFrom(src => src.BranchNumber))
|
||||||
|
.ForMember(dest => dest.BranchName, opt => opt.MapFrom(src => src.BranchName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class CollateralDetailMapper : Profile
|
||||||
|
{
|
||||||
|
public CollateralDetailMapper()
|
||||||
|
{
|
||||||
|
CreateMap<Property, CollateralDetail>()
|
||||||
|
.ForMember(dest => dest.CollateralId, opt => opt.MapFrom(src => src.PropertyNumber))
|
||||||
|
.ForMember(dest => dest.Description, opt => opt.MapFrom(src => src.Description))
|
||||||
|
.ForMember(dest => dest.CurrentValue, opt => opt.MapFrom(src => src.Value))
|
||||||
|
.ForMember(dest => dest.Vehicle, opt => opt.MapFrom(src => GetVehicleProperties(src)))
|
||||||
|
.ForMember(dest => dest.Other, opt => opt.MapFrom(src => src));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Property GetVehicleProperties(Property property)
|
||||||
|
{
|
||||||
|
var isVehicleProperty = VehicleCodeConstants.VehicleCodes.Contains(property.TypeCode);
|
||||||
|
if (!isVehicleProperty)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return property;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+84
@@ -0,0 +1,84 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Individuals;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class IndividualMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The properties commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public IndividualMapper()
|
||||||
|
{
|
||||||
|
CreateMap<Person, Individual>()
|
||||||
|
.ForMember(dest => dest.IndividualId, opt => opt.MapFrom(src => src.PersonNumber))
|
||||||
|
//.ForMember(dest => dest.IndividualType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.FirstName, opt => opt.MapFrom(src => src.FirstName))
|
||||||
|
.ForMember(dest => dest.MiddleName, opt => opt.MapFrom(src => src.MiddleInitial))
|
||||||
|
.ForMember(dest => dest.LastName, opt => opt.MapFrom(src => src.LastName))
|
||||||
|
.ForMember(dest => dest.NameSuffix, opt => opt.MapFrom(src => src.Suffix))
|
||||||
|
.ForMember(dest => dest.TaxId, opt => opt.MapFrom(src => src.TaxId))
|
||||||
|
//.ForMember(dest => dest.Gender, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.BirthDate, opt => opt.MapFrom(src => src.BirthDate))
|
||||||
|
//.ForMember(dest => dest.Branch, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DriversLicense, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DriversLicenseState, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Ident, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PreferredContact, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MaritalStatus, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IsUSCitizen, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.PrimaryAddressId, opt => opt.MapFrom(src => FindPrimaryAddressId(src)))
|
||||||
|
.ForMember(dest => dest.IsEmployee, opt => opt.MapFrom(src => src.IsEmployee))
|
||||||
|
//.ForMember(dest => dest.EmployeeNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CompanyName, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EmployerName, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ApplicationCountLast90Days, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ApplicationsDeclinedLast90Days, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ApplicationsApprovedLast90Days, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.Address, opt => opt.MapFrom(src => src.PostalAddressList))
|
||||||
|
.ForMember(dest => dest.Email1, opt => opt.MapFrom(src => FindEmail1(src)))
|
||||||
|
//.ForMember(dest => dest.Email2, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.Phone, opt => opt.MapFrom(src => src.Phones));
|
||||||
|
//.ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IsHomeOwner, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IsHeadOfHouseHold, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Language, opt => opt.MapFrom(src => src.))
|
||||||
|
}
|
||||||
|
|
||||||
|
public int FindPrimaryAddressId(Person person)
|
||||||
|
{
|
||||||
|
var primaryAddress = person?.PostalAddressList?.
|
||||||
|
FirstOrDefault(addr => addr.AddressUseCode == AddressConstants.PrimaryUseCode);
|
||||||
|
if(primaryAddress == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return primaryAddress.AddressNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Currently unsure how to tell what is the primary email address.
|
||||||
|
// For now will be assuming the First non inactive email is the primary.
|
||||||
|
public string FindEmail1(Person person)
|
||||||
|
{
|
||||||
|
if(person?.EmailAddressList == null ||
|
||||||
|
person?.EmailAddressList?.Count <= 0)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
var primaryEmail = person.EmailAddressList.
|
||||||
|
FirstOrDefault(email => string.IsNullOrEmpty(email.InactiveDate));
|
||||||
|
if(primaryEmail == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return primaryEmail.EmailAddress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+378
@@ -0,0 +1,378 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class LoanDetailMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The property mappings commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public LoanDetailMapper()
|
||||||
|
{
|
||||||
|
CreateMap<Account, LoanDetail>()
|
||||||
|
//.ForMember(dest => dest.MemberId, opt => opt.MapFrom(src => src.))// DNA memberId is a long so this will be issues. (Not being used in Repo)
|
||||||
|
//.ForMember(dest => dest.LoanId, opt => opt.MapFrom(src => src.))// DNA accountId is a long so this will be issues. (Not being used in Repo)
|
||||||
|
//.ForMember(dest => dest.ExternalLoanId, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.IndividualId, opt => opt.MapFrom(src => GetIndividualList(src)))
|
||||||
|
.ForMember(dest => dest.Borrowers, opt => opt.MapFrom(src => GetBorrowers(src)))
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.LoanType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Title, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Alerts, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Product, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProductCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Template, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProductId, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProductDescription, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProductCategory, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProductClass, opt => opt.MapFrom(src => src.))
|
||||||
|
#endregion
|
||||||
|
//.ForMember(dest => dest.AccountType, opt => opt.MapFrom(src => src.)) //ProductTypeCode?? - Repo ONLY USED IN TEST
|
||||||
|
.ForMember(dest => dest.Status, opt => opt.MapFrom(src => GetStatus(src)))//Repo seems to only care if WrittenOff. Found status Open, Closed, and Written Off
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.ClosedDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Category, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Classification, opt => opt.MapFrom(src => src.))//??
|
||||||
|
//.ForMember(dest => dest.MetroAcctType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.SMSA, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Officer, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OtherSecurity, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.NoteNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastMaintenance, opt => opt.MapFrom(src => src.))
|
||||||
|
#endregion
|
||||||
|
.ForMember(dest => dest.WrittenOffDate, opt => opt.MapFrom(src => src.CurrentAccountStatusDateTime))
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.CreditCardNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastCycleDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PropertyType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LegalDescription, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PurposeCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CollateralCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RefinanceCount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastRefinanceDate, opt => opt.MapFrom(src => src.))/
|
||||||
|
//.ForMember(dest => dest.LdcNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Messages, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OriginalAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OriginationDate, opt => opt.MapFrom(src => src.))
|
||||||
|
#endregion
|
||||||
|
.ForMember(dest => dest.Balance, opt => opt.MapFrom(src => src.Balance))
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.AvailableBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Limit, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Payoff, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.UnappliedFundsBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CashAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PurchaseAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ActiveAuthorizationAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowDividends, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PledgeType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge1, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge2, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge3, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode1, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode2, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode3, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestMemoed, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestAccruedDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentInterestDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PayoffInterestDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargeMethod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateCharge, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargeDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CashAdvance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Insurance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementLateCharges, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMiscFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementPurchaseAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCashAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCashAdvanceFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMiscDebits, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementTotalPayments, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCreditsPosted, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementAccruedInterest, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementPurchaseAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementEndingBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DelinquentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMonthlyMinimum, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementRequiredDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementRequiredPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ScheduledPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
#endregion
|
||||||
|
.ForMember(dest => dest.NextDueDate, opt => opt.MapFrom(src => src.LoanInfo.CurrentDueDate));
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.AvailableBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Limit, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Payoff, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.UnappliedFundsBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CashAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PurchaseAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ActiveAuthorizationAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowDividends, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PledgeType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge1, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge2, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscCharge3, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode1, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode2, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MiscChargeCode3, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestMemoed, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestAccruedDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentInterestDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PayoffInterestDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargeMethod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateCharge, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargeDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CashAdvance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Insurance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementLateCharges, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMiscFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementPurchaseAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCashAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCashAdvanceFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMiscDebits, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementTotalPayments, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCreditsPosted, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementAccruedInterest, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementPurchaseAdvanceBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementEndingBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DelinquentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMonthlyMinimum, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementRequiredDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementRequiredPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ScheduledPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PartialPaymentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PreviousDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentFrequency, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlignmentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentMethod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.SourceAccount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ProcessingGroup, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LoanCouponDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RequiredPaymentDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FirstPaymentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlternatePaymentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlternateBeginDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlternateEndDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentSkips, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FinalPaymentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FinalPaymentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CycleAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.VariableRatePaymentChange, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.VariableRateCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MinimumDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FrequencyPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PrincipalAndInterestPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentLoanDefinitionNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RateLoanDefinitionNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.VacationWeeks, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PayrollRepaidWeeklyPaymentCount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.BaseRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.TieredRateAdj, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ManualRateAdj, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Rate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ManualRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.APR, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OriginalInterestRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlternateInterestRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastRateChange, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RealEstateMargin, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Amortization, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AmortizationTerm, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MonthlyTerm, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.NumberOfPayments, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestPYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestDaily, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PrincipalYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PrincipalPYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargeYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LateChargePYTD, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentHistory, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentsPastDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DaysPastDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MonthsPastDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementLateCharges, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementMiscFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementPurchaseAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementCashAdvances, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementCashAdvanceFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementMiscDebits, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementTotalPayments, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurrentStatementTotalCredits, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DelinquentPaymentDueDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IsInactive, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.StatementFrequency, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AppraisedValue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LocCycleDay, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IgnorePledge, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OpenEndPlan, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OpenEndCategory, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PointsPaid, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurtailmentAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CurtailmentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InsuranceExpirationDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LifeInsuranceMI, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DisabilityInsuranceMI, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LifeActivityInsuranceCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DisabilityActivityInsuranceCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LoanCoupons, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaidbyGrace, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowAccount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EscrowInterestPaid, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.NextPaymentAdjustmentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EffectivePayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPurchaseDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastCashAdvanceDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.BlockCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ReclassCode, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OutstandingAuthCount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OutstandingAuthAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestType, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AlternateLoanNumber, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ArmIndex, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DeductionOption, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DelinquentPaymentSkips, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FirstPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InterestDue, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LoanLevelSkips, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PaymentReduction, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.WaiveLateCharge, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ExcessPaymentTargetAccountId, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ExcessPaymentMemberId, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CustRate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IntRateMethod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Margin, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Index, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RndFactPct, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RndFactOpt, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IntRateCeiling, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.IntRateFloor, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MaxDnRateChgLife, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MaxUpRateChgLife, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MaxDnRateChgPeriod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MaxUpRateChgPeriod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MinDnRateChgPeriod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MinUpRateChgPeriod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PmtAdjPeriod, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DaysPriorToPeriodicRateAdj, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DaysPriorToInitialRateAdjustment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.FirstAdjustmentIsEstimate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InitialAnalysisEstimateDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.EstimatePerformed, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.BalloonTerm, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PledgeTypeDescription, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.SystemApproved, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.VINList, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MortgageLoanOriginator, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentPrincipal, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentInterest, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentFees, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentLateCharges, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentEscrowImpound, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentCurtailment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastPaymentTotal, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.TransferDay, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.SourceMember, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AdjustPurchaseAccrual, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AnnualFee, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.AnnualFeeDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.BalaceLimit, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CloseOnZero, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.DrawDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.Form1098Option, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.MethodADelinquency, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.NumberofSkips, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OverlimitAmount, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.OverlimitDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PurchaseAdvBalance, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.SkipDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ToBeDelinquent, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.WaiveDelinquencyNotice, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.WaiveBillingNotice, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.WaiveInterest, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementMinimumPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.LastStatementCycleRequiredPayment, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ExemptNonResident, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.YTDNonresidentWithholding, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.PYTDNonresidentWithholding, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.InCollection, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.UniversalLoanId, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.RateLockDate, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ActiveStopPays, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.ErrorMessage, opt => opt.MapFrom(src => src.))
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
// It would seem that the Loan Officer is included in the Account Roles infos.
|
||||||
|
// We need to filter these out.
|
||||||
|
public int[] GetIndividualList(Account account)
|
||||||
|
{
|
||||||
|
var individualIds = new List<int>();
|
||||||
|
//TODO: Remove hopefully some day, Repo is using first in as primary so set first in to be primary owner.
|
||||||
|
individualIds.Add(account.ReportingForPersonNumber);
|
||||||
|
|
||||||
|
foreach (var accountRole in account.AccountRolesInfo)
|
||||||
|
{
|
||||||
|
if (accountRole.AccountRoleDescription == AccountRoleConstants.LoanOfficer ||
|
||||||
|
individualIds.Any(lo => lo == accountRole.PersonNumber))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
individualIds.Add(accountRole.PersonNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
return individualIds.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// It would seem that the Loan Officer is included in the Account Roles infos.
|
||||||
|
// We need to filter these out. It is also assumed that we are going to use Borrower as the main person
|
||||||
|
// on the account and the rest as Co-Borrower.
|
||||||
|
public List<LoanOwner> GetBorrowers(Account account)
|
||||||
|
{
|
||||||
|
var loanOwners = new List<LoanOwner>();
|
||||||
|
foreach (var accountRole in account.AccountRolesInfo)
|
||||||
|
{
|
||||||
|
if (accountRole.AccountRoleDescription == AccountRoleConstants.LoanOfficer ||
|
||||||
|
loanOwners.Any(lo => lo.IndividualId == accountRole.PersonNumber))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var loanOwner = new LoanOwner();
|
||||||
|
loanOwner.IndividualId = accountRole.PersonNumber;
|
||||||
|
loanOwner.Name = accountRole.RoleName;
|
||||||
|
var isBorrower = accountRole.PersonNumber == account.ReportingForPersonNumber;
|
||||||
|
loanOwner.Type = isBorrower ? AccountRoleConstants.Borrower : AccountRoleConstants.CoBorrower;
|
||||||
|
loanOwners.Add(loanOwner);
|
||||||
|
}
|
||||||
|
|
||||||
|
return loanOwners;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetStatus(Account account)
|
||||||
|
{
|
||||||
|
return account.CurrentAccountStatusDescription switch
|
||||||
|
{
|
||||||
|
AccountStatusConstants.CoreClosedAccount => AccountStatusConstants.ClosedStatus,
|
||||||
|
AccountStatusConstants.CoreActiveAccount => AccountStatusConstants.OpenStatus,
|
||||||
|
AccountStatusConstants.CoreChargeOffAccount => AccountStatusConstants.WrittenOffStatus,
|
||||||
|
_ => ""
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+75
@@ -0,0 +1,75 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class MemberMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The properties commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public MemberMapper()
|
||||||
|
{
|
||||||
|
CreateMap<Person, Member>()
|
||||||
|
.ForMember(dest => dest.MemberId, opt => opt.MapFrom(src => src.MemberNumber))
|
||||||
|
.ForMember(dest => dest.MemberName, opt => opt.MapFrom(src => src.NameFull))
|
||||||
|
.ForMember(dest => dest.PrimaryIndividualId, opt => opt.MapFrom(src => src.PersonNumber))
|
||||||
|
#region Commented out unused property mappings
|
||||||
|
//.ForMember(dest => dest.MemberType { get; set; }
|
||||||
|
//.ForMember(dest => dest.Affiliation { get; set; }
|
||||||
|
//.ForMember(dest => dest.MemberSince { get; set; }
|
||||||
|
//.ForMember(dest => dest.Miscellaneous1 { get; set; }
|
||||||
|
//.ForMember(dest => dest.Miscellaneous2 { get; set; }
|
||||||
|
//.ForMember(dest => dest.OriginalOpenBranch { get; set; }
|
||||||
|
//.ForMember(dest => dest.WithholdingCode { get; set; }
|
||||||
|
//.ForMember(dest => dest.ExpeditedFunds { get; set; }
|
||||||
|
//.ForMember(dest => dest.ExpeditedFundsDate { get; set; }
|
||||||
|
//.ForMember(dest => dest.AccessLevel { get; set; }
|
||||||
|
//.ForMember(dest => dest.StandardStatementCycle { get; set; }
|
||||||
|
//.ForMember(dest => dest.StandardStatementCode { get; set; }
|
||||||
|
//.ForMember(dest => dest.StandardStatementMethod { get; set; }
|
||||||
|
//.ForMember(dest => dest.CATFeeCounter { get; set; }
|
||||||
|
//.ForMember(dest => dest.CATFeeDate { get; set; }
|
||||||
|
//.ForMember(dest => dest.CreditCardStatementCycle { get; set; }
|
||||||
|
//.ForMember(dest => dest.CreditCardStatementCode { get; set; }
|
||||||
|
//.ForMember(dest => dest.CreditCardStatementMethod { get; set; }
|
||||||
|
//.ForMember(dest => dest.AccountCount { get; set; }
|
||||||
|
//.ForMember(dest => dest.AccountBalance { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoanCount { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoanBalance { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansDelinquentCount { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansDelinquent { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansWrittenOffCount { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansWrittenOff { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansInCollectionCount { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoansInCollection { get; set; }
|
||||||
|
//.ForMember(dest => dest.Password { get; set; }
|
||||||
|
//.ForMember(dest => dest.PinLock { get; set; }
|
||||||
|
//.ForMember(dest => dest.BranchId { get; set; }
|
||||||
|
//.ForMember(dest => dest.RelationshipPricingLevel { get; set; }
|
||||||
|
//.ForMember(dest => dest.RelationshipPricingLevelPermanent { get; set; }
|
||||||
|
//.ForMember(dest => dest.RelationshipPricingDescription { get; set; }
|
||||||
|
//.ForMember(dest => dest.PreviousRelationshipPricingLevel { get; set; }
|
||||||
|
//.ForMember(dest => dest.LastRelationshipPricingLevelAnalysisDate { get; set; }
|
||||||
|
//.ForMember(dest => dest.LastRelationshipPricingLevelChangeDate { get; set; }
|
||||||
|
//.ForMember(dest => dest.InhibitActivity { get; set; }
|
||||||
|
//.ForMember(dest => dest.WrittenOffLoan { get; set; }
|
||||||
|
//.ForMember(dest => dest.LoanInCollection { get; set; }
|
||||||
|
//.ForMember(dest => dest.PurgeMembership { get; set; }
|
||||||
|
#endregion
|
||||||
|
.ForMember(dest => dest.Address, opt => opt.MapFrom(src => src.PostalAddressList.FirstOrDefault(addr =>
|
||||||
|
addr.AddressUseCode == AddressConstants.PrimaryUseCode)));
|
||||||
|
|
||||||
|
CreateMap<Organization, Member>()
|
||||||
|
.ForMember(dest => dest.MemberId, opt => opt.MapFrom(src => src.MemberAgreementNumber))
|
||||||
|
.ForMember(dest => dest.MemberName, opt => opt.MapFrom(src => src.Name))
|
||||||
|
.ForMember(dest => dest.PrimaryIndividualId, opt => opt.MapFrom(src => src.OrganizationNumber))
|
||||||
|
.ForMember(dest => dest.Address, opt => opt.MapFrom(src => src.PostalAddressList.FirstOrDefault(addr =>
|
||||||
|
addr.AddressUseCode == AddressConstants.PrimaryUseCode))); ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Enums;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class MemberOwnerMapper : Profile
|
||||||
|
{
|
||||||
|
public MemberOwnerMapper()
|
||||||
|
{
|
||||||
|
CreateMap<Person, MemberOwner>()
|
||||||
|
.ForMember(dest => dest.IndividualId, opt => opt.MapFrom(src => src.PersonNumber))
|
||||||
|
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.NameFull))
|
||||||
|
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => CreateType(src)))
|
||||||
|
.ForMember(dest => dest.Address, opt => opt.MapFrom(src => CreatePrimaryAddress(src)))
|
||||||
|
.ForMember(dest => dest.TaxId, opt => opt.MapFrom(src => src.TaxId))
|
||||||
|
.ForMember(dest => dest.DriverLicense, opt => opt.MapFrom(src => CreateDriverLicense(src)))
|
||||||
|
.ForMember(dest => dest.BirthDate, opt => opt.MapFrom(src => src.BirthDate));
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: Need to find what types. I think that with DNA we only will know who is primary so it may have to be an either or situation.
|
||||||
|
// Going to assume "Secondary" for the time being as that was found in a Online Loan App unit test.
|
||||||
|
public string CreateType(Person person)
|
||||||
|
{
|
||||||
|
var isPrimaryPerson = person.MemberAgreement.PrimaryPersonNumber == person.PersonNumber;
|
||||||
|
return isPrimaryPerson ? "Primary" : "Secondary";
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreatePrimaryAddress(Person person)
|
||||||
|
{
|
||||||
|
var primaryAddress = person.PostalAddressList.FirstOrDefault(addr =>
|
||||||
|
addr.AddressUseCode == AddressConstants.PrimaryUseCode);
|
||||||
|
if(primaryAddress == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
var address2 = string.IsNullOrEmpty(primaryAddress.AddressLine2) ? "" : $" { primaryAddress.AddressLine2 }";
|
||||||
|
var address3 = string.IsNullOrEmpty(primaryAddress.AddressLine3) ? "" : $" { primaryAddress.AddressLine3 }";
|
||||||
|
stringBuilder.Append($"{primaryAddress.AddressLine1 }{ address2 }{ address3 },");
|
||||||
|
stringBuilder.Append($" {primaryAddress.CityName},");
|
||||||
|
var zipPlus = string.IsNullOrEmpty(primaryAddress.ZipPlus) ? "" : $"-{primaryAddress.ZipPlus}";
|
||||||
|
stringBuilder.Append($" {primaryAddress.CountrySubdivisionCode} {primaryAddress.PostalCode}{zipPlus}");
|
||||||
|
|
||||||
|
return stringBuilder.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreateDriverLicense(Person person)
|
||||||
|
{
|
||||||
|
var primaryIdentification = person.Identifications.FirstOrDefault(ident =>
|
||||||
|
ident.TypeCode == ((int)IdentificationTypeEnum.UnexpiredDriversLicense).ToString() &&
|
||||||
|
ident.CountryCode == AddressConstants.CountryUSA);
|
||||||
|
if(primaryIdentification == null)
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{primaryIdentification.StateCode} {primaryIdentification.IdNumber}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class OtherCollateralMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The properties commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public OtherCollateralMapper()
|
||||||
|
{
|
||||||
|
// Currently No OtherCollateral found in DNA
|
||||||
|
CreateMap<Property, OtherCollateral>();
|
||||||
|
//.ForMember(dest => dest.MiscellaneousInformation, opt => opt.MapFrom(src => src.));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using LcuModels = LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Phones;
|
||||||
|
using CoreModels = LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Phones;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class PhoneMapper : Profile
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// NOTE: The properties commented out either do not have an apparent match or have not been needed yet.
|
||||||
|
/// </summary>
|
||||||
|
public PhoneMapper()
|
||||||
|
{
|
||||||
|
CreateMap<CoreModels.Phone, LcuModels.Phone>()
|
||||||
|
//.ForMember(dest => dest.PhoneKey, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.IsPrimaryForType, opt => opt.MapFrom(src => src.IsPreferred))
|
||||||
|
//.ForMember(dest => dest.IsInternational, opt => opt.MapFrom(src => src.))
|
||||||
|
//.ForMember(dest => dest.CountryCode, opt => opt.MapFrom(src => src.))
|
||||||
|
.ForMember(dest => dest.AreaCode, opt => opt.MapFrom(src => src.AreaCode))
|
||||||
|
.ForMember(dest => dest.PhoneNumber, opt => opt.MapFrom(src => CreatePhoneNumber(src)));
|
||||||
|
//.ForMember(dest => dest.Extension, opt => opt.MapFrom(src => src.))
|
||||||
|
}
|
||||||
|
|
||||||
|
public string CreatePhoneNumber(CoreModels.Phone phone)
|
||||||
|
{
|
||||||
|
return $"{phone.Exchange}-{phone.PhoneNumber}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Mappers
|
||||||
|
{
|
||||||
|
public class VehicleMapper : Profile
|
||||||
|
{
|
||||||
|
public VehicleMapper()
|
||||||
|
{
|
||||||
|
// In DNA a vehicle is a type of Property.
|
||||||
|
CreateMap<Property, Vehicle>()
|
||||||
|
.ForMember(dest => dest.VIN, opt => opt.MapFrom(src => src.PropertyId))
|
||||||
|
.ForMember(dest => dest.Year, opt => opt.MapFrom(src => src.YearNumber))
|
||||||
|
.ForMember(dest => dest.Make, opt => opt.MapFrom(src => src.Make))
|
||||||
|
.ForMember(dest => dest.Model, opt => opt.MapFrom(src => src.Model))
|
||||||
|
.ForMember(dest => dest.BodyStyle, opt => opt.MapFrom(src => src.Color));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using Azure.Extensions.AspNetCore.Configuration.Secrets;
|
||||||
|
using Azure.Identity;
|
||||||
|
using Azure.Security.KeyVault.Secrets;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
CreateHostBuilder(args).Build().Run();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||||
|
Host.CreateDefaultBuilder(args)
|
||||||
|
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); })
|
||||||
|
.ConfigureAppConfiguration((context, builder) =>
|
||||||
|
{
|
||||||
|
builder.AddJsonFile("/app/config/environment-appsettings/appsettings.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/app/config/workload-appsettings/appsettings.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-core-api-wrapper-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-core-soap-api-wrapper-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-remote-deposit-capture-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-reserve-management-system-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-member-preferences-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-seq-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-data-cleanup-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-client-secret-id.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-environment-from-vault.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-temenos-action-handler-api-key.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-core-database-connection-string.json", optional: true, reloadOnChange: true);
|
||||||
|
builder.AddJsonFile("/vault/secrets/core-api-wrapper-core-relying-password.json", optional: true, reloadOnChange: true);
|
||||||
|
})
|
||||||
|
.UseSerilog();
|
||||||
|
}
|
||||||
|
}
|
||||||
+79
@@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AccessChannelPersonsService : IAccessChannelPersonsService
|
||||||
|
{
|
||||||
|
private readonly IAccessChannelPersonsDao _accessChannelPersonsDao;
|
||||||
|
|
||||||
|
public AccessChannelPersonsService(IAccessChannelPersonsDao accessChannelPersonsDao)
|
||||||
|
{
|
||||||
|
_accessChannelPersonsDao = accessChannelPersonsDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<AccessChannelPerson>>> GetAccessChannelPersonCoreApiResponseAsync(
|
||||||
|
AccessChannelPersonsByPersonRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
return await _accessChannelPersonsDao.FindAccessChannelPersonsByPerson(coreRequestParameters, request);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding AccessChannelPersons by Person Number. " +
|
||||||
|
$"PersonNumber: {request.PersonNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<AccessChannelPerson>>> GetAccessChannelPersonCoreApiResponseAsync(
|
||||||
|
AccessChannelPersonsByPersonRequest request, List<string> includes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
return await _accessChannelPersonsDao.FindAccessChannelPersonsByPerson(coreRequestParameters, request);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding AccessChannelPersons by Person Number. " +
|
||||||
|
$"PersonNumber: {request.PersonNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AccessChannelPerson> UpdateAccessChannelPersonAsync(AccessChannelPerson request, long updateKey)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreMessageHeader = new CoreMessageHeader(updateKey);
|
||||||
|
var coreApiMessage = new CoreApiMessage<AccessChannelPerson>(coreMessageHeader, request);
|
||||||
|
var result = await _accessChannelPersonsDao.UpdateAccessChannelPerson(coreApiMessage);
|
||||||
|
|
||||||
|
if(result == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"The result was null. There was an issue updating AccessChannelPerson. " +
|
||||||
|
$"PersonNumber:{request.PersonNumber}, " +
|
||||||
|
$"ChannelNumber:{request.ChannelNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating AccessChannelPerson by Person Number. " +
|
||||||
|
$"PersonNumber: {request.PersonNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AccessTypeService : IAccessTypeService
|
||||||
|
{
|
||||||
|
private readonly IAccessTypeDao _accessTypeDao;
|
||||||
|
|
||||||
|
public AccessTypeService(IAccessTypeDao accessTypeDao)
|
||||||
|
{
|
||||||
|
_accessTypeDao = accessTypeDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AccessType> UpdateAccessTypeAsync(AccessTypeUpdateRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreMessageHeader = new CoreMessageHeader(request.UpdateKey);
|
||||||
|
var coreApiMessage = new CoreApiMessage<AccessType>(coreMessageHeader, request.AccessType);
|
||||||
|
var result = await _accessTypeDao.UpdateAccessType(coreApiMessage, request.AccessChannelPersonId);
|
||||||
|
|
||||||
|
if(result == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"The result was null. There was an issue updating AccessType. " +
|
||||||
|
$"PersonNumber:{request.AccessType.PersonNumber}, " +
|
||||||
|
$"ChannelNumber:{request.AccessType.ChannelNumber}," +
|
||||||
|
$"AccessType:{request.AccessType.Id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating AccessType. " +
|
||||||
|
$"PersonNumber:{request.AccessType.PersonNumber}, " +
|
||||||
|
$"ChannelNumber:{request.AccessType.ChannelNumber}," +
|
||||||
|
$"AccessType:{request.AccessType.Id}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AccountHistoryService : IAccountHistoryService
|
||||||
|
{
|
||||||
|
public IAccountHistoryDao _accountHistoryDao { get; set; }
|
||||||
|
|
||||||
|
public AccountHistoryService(IAccountHistoryDao accountHistoryDao)
|
||||||
|
{
|
||||||
|
_accountHistoryDao = accountHistoryDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IEnumerable<DateTime>> GetChargeoffDateTimesByAccountNumber(string accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _accountHistoryDao.GetChargeoffDateTimesByAccountNumber(accountNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue Getting Chargeoff date. AccountNumber: {accountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+341
@@ -0,0 +1,341 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AccountService : IAccountService
|
||||||
|
{
|
||||||
|
private readonly IAccountDao _accountDao;
|
||||||
|
|
||||||
|
public AccountService(IAccountDao accountDao)
|
||||||
|
{
|
||||||
|
_accountDao = accountDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Account>> GetAccountsByMemberAgreementNumber(CoreRequestParameters coreRequestParameters,
|
||||||
|
MemberAgreeNbrRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindByMemberAgreeNbr(coreRequestParameters, request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding Accounts by Member agreement Number. MemberAgreementNumber: {request.MemberAgreeNbr}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Account> GetAccountDetailsByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
coreRequestParameters.PageSize = null;
|
||||||
|
var request = new AcctNbrRequest()
|
||||||
|
{
|
||||||
|
AcctNbr = accountNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetAccountDetails(coreRequestParameters, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Account> GetAccountDetails(CoreRequestParameters coreRequestParameters, AcctNbrRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindByAcctNbr(coreRequestParameters, request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding Account details. AccountNumber: {request.AcctNbr}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task PutAccountMaintenanceRequest(IEnumerable<AccountMaintenanceRequest> accountMaintenanceRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _accountDao.PutAccountMaintenanceRequest(accountMaintenanceRequests);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue updating Accounts with the following AccountMaintenanceRequests: {accountMaintenanceRequests}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<string>> GetAdminBranchCodeChangeAccountNumbers()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindAdminBranchCodeChangeAccountNumbers();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding Admin Branch Code accounts.");
|
||||||
|
throw new ServiceException($"There was an issue finding Admin Branch Code accounts.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<string>> GetVipSavingsToFund()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindVipSavingsToFund();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding Vip Savings Accounts to Fund.");
|
||||||
|
throw new ServiceException($"There was an issue finding Vip Savings Accounts to Fund.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<string>> GetAccountsForGroupAnalysisMaintenance()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindAccountsToUpdateAccountAnalysis();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, "There was an issue finding Account for Analysis Maintenance.");
|
||||||
|
throw new ServiceException("There was an issue finding Account for Analysis Maintenance.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountAnalysisMaintenance(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountAnalysis(accountAnalysisGroupMaintenanceRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating Accounts with the following AccountAnalysisGroupMaintenanceRequest: {accountAnalysisGroupMaintenanceRequest}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountBranch(AccountBranchUpdateRequest accountBranchUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountBranch(accountBranchUpdateRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating Accounts with the following AccountBranchUpdateRequest: {accountBranchUpdateRequest}");
|
||||||
|
throw new ServiceException($"There was an issue updating Accounts with the following AccountBranchUpdateRequest: {accountBranchUpdateRequest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountLoanToValue(AccountLtvUpdateRequest accountLtvUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountLoanToValue(accountLtvUpdateRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating Accounts with the following AccountLtvUpdateRequest: {accountLtvUpdateRequest}");
|
||||||
|
throw new ServiceException($"There was an issue updating Accounts with the following AccountLtvUpdateRequest: {accountLtvUpdateRequest}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<ActivityAccountDetails>> GetActivityAccountDetailsByAccountNumbers(
|
||||||
|
List<long> accountNumbers)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!accountNumbers.Any())
|
||||||
|
{
|
||||||
|
return new List<ActivityAccountDetails>();
|
||||||
|
}
|
||||||
|
return await _accountDao.GetActivityAccountDetailsByAccountNumbers(accountNumbers.Select(x => x.ToString()).ToList());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to get activity account details by account number: {accountNumbers}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountOwnership>> GetOwnersByAccountNumber(long accountNumber, DateTime creationDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindOwnersByAccountNumber(accountNumber, creationDate);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetOwnersByAccountNumber for AccountNumber: {accountNumber} with CreationDate: {creationDate.ToShortDateString()}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountOwnership>> GetPrimaryOwnersByOrganizationName(string organizationName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetOwnersByOrganizationName for OrganizationName: {organizationName}");
|
||||||
|
throw new ServiceException($"There was an issue finding owners by OrganizationName: {organizationName}.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountOwnership>> GetPrimaryOwnersByPersonName(string personName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.FindPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetOwnersByPersonName for PersonName: {personName}");
|
||||||
|
throw new ServiceException($"There was an issue finding owners by PersonName: {personName}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CreatedAccountResponse> AddPersonAccount(CreatePersonAccountRequest createPersonAccountRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.AddPersonAccount(createPersonAccountRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue creating an account " +
|
||||||
|
$"with the following CreatePersonAccountRequest: {JsonConvert.SerializeObject(createPersonAccountRequest)}");
|
||||||
|
throw new ServiceException($"There was an issue creating an account " +
|
||||||
|
$"with the following CreatePersonAccountRequest: {JsonConvert.SerializeObject(createPersonAccountRequest)}" +
|
||||||
|
$"ExceptionMessage: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CreatedAccountResponse> AddOrganizationAccount(CreateOrganizationAccountRequest createOrganizationAccountRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.AddOrganizationAccount(createOrganizationAccountRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue creating an account " +
|
||||||
|
$"with the following CreateOrganizationAccountRequest: {JsonConvert.SerializeObject(createOrganizationAccountRequest)}");
|
||||||
|
throw new ServiceException($"There was an issue creating an account " +
|
||||||
|
$"with the following CreateOrganizationAccountRequest: {JsonConvert.SerializeObject(createOrganizationAccountRequest)}" +
|
||||||
|
$"ExceptionMessage: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> PutOrganizationMaintenanceRequest(OrganizationMaintenanceRequest organizationMaintenanceRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.PutOrganizationMaintenanceRequest(organizationMaintenanceRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating organization " +
|
||||||
|
$"with the following OrganizationMaintenanceRequest: {JsonConvert.SerializeObject(organizationMaintenanceRequest)}");
|
||||||
|
throw new ServiceException($"There was an issue updating organization " +
|
||||||
|
$"with the following OrganizationMaintenanceRequest: {JsonConvert.SerializeObject(organizationMaintenanceRequest)}" +
|
||||||
|
$"ExceptionMessage: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountNickName(AccountNickNameUpdateRequest acountNickNameUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountNickName(acountNickNameUpdateRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating account " +
|
||||||
|
$"with the following AccountNickNameUpdateRequest: {JsonConvert.SerializeObject(acountNickNameUpdateRequest)}");
|
||||||
|
throw new ServiceException($"There was an issue updating account " +
|
||||||
|
$"with the following AccountNickNameUpdateRequest: {JsonConvert.SerializeObject(acountNickNameUpdateRequest)}" +
|
||||||
|
$"ExceptionMessage: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountCreditReportType(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountCreditReportType(accountCreditReportTypeUpdateRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating Accounts with the following AccountCreditReportTypeUpdateRequest: {JsonConvert.SerializeObject(accountCreditReportTypeUpdateRequest)}");
|
||||||
|
throw new ServiceException($"There was an issue updating Accounts with the following AccountCreditReportTypeUpdateRequest: {JsonConvert.SerializeObject(accountCreditReportTypeUpdateRequest)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdateAccountContractDate(AccountContractDateUpdateRequest accountContractDateUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.UpdateAccountContractDate(accountContractDateUpdateRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
var message = $"There was an issue updating account " +
|
||||||
|
$"with the following AccountContractDateUpdateRequest: {JsonConvert.SerializeObject(accountContractDateUpdateRequest)}.";
|
||||||
|
Log.Error(exception, message);
|
||||||
|
throw new ServiceException($"{message} ExceptionMessage: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountsByMajorMinorBranchAndStatusResponse>> GetAccountsByMajorMinorBranchAndStatus(AccountsByMajorMinorBranchAndStatusRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _accountDao.GetAccountsByMajorMinorBranchAndStatus(request);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue getting Accounts with the following AccountsByMajorMinorBranchAndStatusRequest: {JsonConvert.SerializeObject(request)}");
|
||||||
|
throw new ServiceException($"There was an issue getting Accounts with the following AccountsByMajorMinorBranchAndStatusRequest: {JsonConvert.SerializeObject(request)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountsByRecentTransactionsResponse>> GetAccountsByRecentTransactions(AccountsByRecentTransactionsRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
|
||||||
|
DateTime.ParseExact(request.StartDate.ToString(), DnaTimeFormat, System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
DateTime.ParseExact(request.EndDate.ToString(), DnaTimeFormat, System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
return await _accountDao.GetAccountsByRecentTransactions(request);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue getting Accounts with the following AccountsByRecentTransactionsRequest: {JsonConvert.SerializeObject(request)}");
|
||||||
|
throw new ServiceException($"There was an issue getting Accounts with the following AccountsByRecentTransactionsRequest: {JsonConvert.SerializeObject(request)}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AccountUserFieldService : IAccountUserFieldService
|
||||||
|
{
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
private readonly IAccountUserFieldDao _accountUserFieldDao;
|
||||||
|
|
||||||
|
public AccountUserFieldService(IAccountService accountService, IAccountUserFieldDao accountUserFieldDao)
|
||||||
|
{
|
||||||
|
_accountService = accountService;
|
||||||
|
_accountUserFieldDao = accountUserFieldDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<AccountUserField>>> GetAccountUserFieldsAsync(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>() { RequestIncludeConstants.Standard };
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
var account = await _accountService.GetAccountDetailsByAccountNumber(accountNumber);
|
||||||
|
return await _accountUserFieldDao.FindAccountUserFieldCoreApiResponseByAccountId(coreRequestParameters, account.Id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Accounts UserFields by id. AccountNumber: {accountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<AccountUserField>>> GetAccountUserFieldCoreApiResponseAsync(string accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>() { RequestIncludeConstants.Standard };
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
|
||||||
|
return await _accountUserFieldDao.FindAccountUserFieldCoreApiResponseByAccountId(coreRequestParameters, accountId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Accounts UserFields by id. AccountId: {accountId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AccountUserField> UpdateAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequest, long updateKey, string accountId, string userFieldId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var messageHeader = new CoreMessageHeader()
|
||||||
|
{
|
||||||
|
UpdateKey = updateKey
|
||||||
|
};
|
||||||
|
var coreApiMessage = new CoreApiMessage<AccountUserFieldRequest>(messageHeader, accountUserFieldUpdateRequest);
|
||||||
|
return await _accountUserFieldDao.UpdateAccountUserField(coreApiMessage, accountId, userFieldId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue updating an Accounts UserField. " +
|
||||||
|
$"AccountNumber:{accountUserFieldUpdateRequest.AccountNumber}, UserFieldId: {userFieldId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AccountUserField> InsertAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequest, string accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var messageHeader = new CoreMessageHeader() { };
|
||||||
|
var coreApiMessage = new CoreApiMessage<AccountUserFieldRequest>(messageHeader, accountUserFieldUpdateRequest);
|
||||||
|
return await _accountUserFieldDao.InsertAccountUserField(coreApiMessage, accountId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue inserting an AccountUserField. AccountNumber:{accountUserFieldUpdateRequest.AccountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountUserField>> UpdateAccountUserFieldsAsync(List<AccountUserFieldRequest> accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var accounts = new List<Account>();
|
||||||
|
var updatedAccountUserFields = new List<AccountUserField>();
|
||||||
|
|
||||||
|
foreach (var accountUserFieldUpdateRequest in accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
var account = accounts.FirstOrDefault(a => a.AccountNumber == accountUserFieldUpdateRequest.AccountNumber);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
account = await _accountService.GetAccountDetailsByAccountNumber(accountUserFieldUpdateRequest.AccountNumber);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Account was null and is required. AccountNumber: {accountUserFieldUpdateRequest.AccountNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
accounts.Add(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
var coreApiMessageAccountUserFields = await GetAccountUserFieldCoreApiResponseAsync(account.Id);
|
||||||
|
var existingUserField = coreApiMessageAccountUserFields?.MessageBody.
|
||||||
|
FirstOrDefault(auf => auf.UserFieldCode == accountUserFieldUpdateRequest.UserFieldCode &&
|
||||||
|
auf.AccountNumber == accountUserFieldUpdateRequest.AccountNumber);
|
||||||
|
if (existingUserField == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"An existing userfield was null and is required. " +
|
||||||
|
$"AccountNumber: {accountUserFieldUpdateRequest.AccountNumber}, " +
|
||||||
|
$"UserFieldcode:{accountUserFieldUpdateRequest.UserFieldCode}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var updatedUserField = await UpdateAccountUserFieldAsync(accountUserFieldUpdateRequest,
|
||||||
|
(long)coreApiMessageAccountUserFields.MessageHeader.UpdateKey,
|
||||||
|
account.Id,
|
||||||
|
existingUserField.Id);
|
||||||
|
if (updatedUserField == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Failure to update userfield. AccountNumber: {accountUserFieldUpdateRequest.AccountNumber}, " +
|
||||||
|
$"UserFieldcode:{existingUserField.UserFieldCode}");
|
||||||
|
}
|
||||||
|
|
||||||
|
updatedAccountUserFields.Add(updatedUserField);
|
||||||
|
}
|
||||||
|
|
||||||
|
return updatedAccountUserFields;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Failure to update account user fields.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AccountUserField>> InsertAccountUserFieldsAsync(List<AccountUserFieldRequest> accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var accounts = new List<Account>();
|
||||||
|
var createdAccountUserFields = new List<AccountUserField>();
|
||||||
|
|
||||||
|
foreach (var accountUserFieldUpdateRequest in accountUserFieldUpdateRequests)
|
||||||
|
{
|
||||||
|
var account = accounts.FirstOrDefault(a => a.AccountNumber == accountUserFieldUpdateRequest.AccountNumber);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
account = await _accountService.GetAccountDetailsByAccountNumber(accountUserFieldUpdateRequest.AccountNumber);
|
||||||
|
if (account == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Account was null and is required. AccountNumber: {accountUserFieldUpdateRequest.AccountNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
accounts.Add(account);
|
||||||
|
}
|
||||||
|
|
||||||
|
var createUserField = await InsertAccountUserFieldAsync(accountUserFieldUpdateRequest, account.Id);
|
||||||
|
if (createUserField == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Failure to insert userfield. AccountNumber: {accountUserFieldUpdateRequest.AccountNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
createdAccountUserFields.Add(createUserField);
|
||||||
|
}
|
||||||
|
|
||||||
|
return createdAccountUserFields;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, "Failure to insert account user fields.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+454
@@ -0,0 +1,454 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
using FailedToParseException = LCU.Library.Internal.CoreApiWrapperLib.Exceptions.FailedToParseException;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class ActivityService : IActivityService
|
||||||
|
{
|
||||||
|
private readonly IActivityDao _activityDao;
|
||||||
|
private readonly ITaxService _taxService;
|
||||||
|
|
||||||
|
public ActivityService(IActivityDao activityDao, ITaxService taxService)
|
||||||
|
{
|
||||||
|
_activityDao = activityDao;
|
||||||
|
_taxService = taxService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IReadOnlyCollection<NewCheckingAccountActivity>> GetNewCheckingAccountActivities(
|
||||||
|
string newerThanDateTime,
|
||||||
|
long? afterActivityNumber,
|
||||||
|
int limitAmount
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (afterActivityNumber == null && !string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewCheckingActivitiesNewerThanDate(newerThanDt, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newerThanDateTime == null && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
return _activityDao.GetNewCheckingActivitiesAfterActivityNbr((long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime) && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewCheckingActivities(newerThanDt, (long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime or in GetNewCheckingAccountActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetNewCheckingAccountActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewCheckingAccountActivities. newerThanDateTime: ${newerThanDateTime} afterActivityNumber: {afterActivityNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IReadOnlyCollection<NewCheckingAccountActivity>> GetNewDigitalBankingCheckingAccountActivities(
|
||||||
|
string newerThanDateTime,
|
||||||
|
long? afterActivityNumber,
|
||||||
|
int limitAmount
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (afterActivityNumber == null && !string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewDigitalBankingCheckingActivitiesNewerThanDate(newerThanDt, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newerThanDateTime == null && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
return _activityDao.GetNewDigitalBankingCheckingActivitiesAfterActivityNbr((long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime) && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewDigitalBankingCheckingActivities(newerThanDt, (long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime or in GetNewDigitalBankingCheckingAccountActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetNewDigitalBankingCheckingAccountActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewDigitalBankingCheckingAccountActivities. newerThanDateTime: ${newerThanDateTime} afterActivityNumber: {afterActivityNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IReadOnlyCollection<NewAtmCheckCardActivity>> GetNewAtmCheckCardActivities(
|
||||||
|
string newerThanDateTime,
|
||||||
|
long? afterActivityNumber,
|
||||||
|
int limitAmount
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (afterActivityNumber == null && !string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewAtmCheckCardActivitiesNewerThanDate(newerThanDt, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newerThanDateTime == null && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
return _activityDao.GetNewAtmCheckCardActivitiesAfterActivityNbr((long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime) && afterActivityNumber != null)
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return _activityDao.GetNewAtmCheckCardActivities(newerThanDt, (long)afterActivityNumber, limitAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime or in GetNewAtmCheckCardActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetNewAtmCheckCardActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewAtmCheckCardActivities. newerThanDateTime: ${newerThanDateTime} afterActivityNumber: {afterActivityNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IReadOnlyCollection<NewActivityManagerIncentiveReferral>> GetNewActivityManagerIncentiveReferrals(string newerThanOriginationDateTime,
|
||||||
|
long? afterActivityId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (afterActivityId == null && !string.IsNullOrWhiteSpace(newerThanOriginationDateTime))
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanOriginationDateTime);
|
||||||
|
return _activityDao.GetNewActivityManagerReferralsNewerThan(newerThanDt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newerThanOriginationDateTime == null && afterActivityId != null)
|
||||||
|
{
|
||||||
|
return _activityDao.GetNewActivityManagerReferralsAfterActivityId((long)afterActivityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanOriginationDateTime) && afterActivityId != null)
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanOriginationDateTime);
|
||||||
|
return _activityDao.GetNewActivityManagerReferrals(newerThanDt, (long)afterActivityId);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanOriginationDateTime or in GetNewAtmCheckCardActivities: ${newerThanOriginationDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanOriginationDateTime: ${newerThanOriginationDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanOriginationDateTime in GetNewAtmCheckCardActivities: ${newerThanOriginationDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanOriginationDateTime: ${newerThanOriginationDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewAtmCheckCardActivities. newerThanOriginationDateTime: ${newerThanOriginationDateTime} afterActivityId: {afterActivityId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewMortgageSaleActivities(string newerThanDateTime, long? afterActivityNbr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime? newerThanDt = null;
|
||||||
|
|
||||||
|
if (afterActivityNbr == null && string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _activityDao.GetNewMortgageSaleActivities(newerThanDt, afterActivityNbr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanOriginationDateTime or in GetNewMortgageSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse GetNewMortgageSaleActivities: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanOriginationDateTime in GetNewMortgageSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanOriginationDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewMortgageSaleActivities. newerThanOriginationDateTime: ${newerThanDateTime} afterActivityId: {afterActivityNbr}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewVehicleSaleActivities(
|
||||||
|
string newerThanDateTime, long? afterActivityNbr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime? newerThanDt = null;
|
||||||
|
|
||||||
|
if (afterActivityNbr == null && string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _activityDao.GetNewVehicleSaleActivities(newerThanDt, afterActivityNbr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error(
|
||||||
|
$"Failed to Parse newerThanOriginationDateTime in GetNewVehicleSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse GetNewMortgageSaleActivities: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error(
|
||||||
|
$"Failed to Parse null newerThanOriginationDateTime in GetNewVehicleSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanOriginationDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewVehicleSaleActivities. newerThanOriginationDateTime: ${newerThanDateTime} afterActivityId: {afterActivityNbr}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewDebtProtectedLoanSaleActivities(string newerThanDateTime, long? afterActivityNbr)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime? newerThanDt = null;
|
||||||
|
|
||||||
|
if (afterActivityNbr == null && string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
throw new Exception("Must filter on at least one query variable");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _activityDao.GetNewDebtProtectedLoanSaleActivities(newerThanDt, afterActivityNbr);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error(
|
||||||
|
$"Failed to Parse newerThanOriginationDateTime in GetNewDebtProtectedLoanSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException(
|
||||||
|
$"Failed to Parse GetNewDebtProtectedLoanSaleActivities: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error(
|
||||||
|
$"Failed to Parse null newerThanOriginationDateTime in GetNewDebtProtectedLoanSaleActivities: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException(
|
||||||
|
$"Failed to Parse newerThanOriginationDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetNewDebtProtectedLoanSaleActivities. newerThanOriginationDateTime: ${newerThanDateTime} afterActivityId: {afterActivityNbr}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyCollection<NewActivityManagerIncentiveReferral>> QueryActivityManagerActivity(ActivityQueryRequest request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!request.ActivityIds.Any())
|
||||||
|
{
|
||||||
|
return new List<NewActivityManagerIncentiveReferral>() { };
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _activityDao.QueryActivityManagerActivity(request);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to QueryActivityManagerActivity {request.ActivityIds}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IReadOnlyCollection<EStatementDeliveryMethod>> GetEStatementDeliveryActivity(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime? newerThanDt = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(newerThanDateTime))
|
||||||
|
{
|
||||||
|
newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _activityDao.GetEStatementDeliveryActivity(newerThanDt);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime or in GetEStatmentActivity: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse GetEStatmentActivity: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetEStatmentActivity: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetEStatmentActivity. newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonRecentActivityResponse> GetPersonActivityByPhoneNumber(string phoneNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var result = (await _activityDao.GetPersonActivityByPhoneNumber(phoneNumber))?.ToList();
|
||||||
|
|
||||||
|
if (result is null || !result.Any())
|
||||||
|
{
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "No member could be found for phone number. Please identify member by SSN instead."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.Count > 1)
|
||||||
|
{
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "Multiple member matches found for phone number. Please identify unique member by SSN instead."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = true,
|
||||||
|
PersonRecentActivity = result.First()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
var message = $"Failed to GetPersonActivityByPhoneNumber with Phone Number {phoneNumber}.";
|
||||||
|
Log.Error(exception, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonRecentActivityResponse> GetPersonActivityByTaxId(string taxId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var persons = (await _taxService.GetPersonsTaxIdData(taxId))?.ToList();
|
||||||
|
|
||||||
|
if (persons is null || !persons.Any())
|
||||||
|
{
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "No member could be found for TaxId."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (persons.Count > 1)
|
||||||
|
{
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "More than one member found with TaxId."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = await _activityDao.GetPersonActivityByPersonNumber(persons.FirstOrDefault()?.PersonNumber.ToString());
|
||||||
|
|
||||||
|
if (result is null)
|
||||||
|
{
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Message = "No member could be found for TaxId."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PersonRecentActivityResponse
|
||||||
|
{
|
||||||
|
Success = true,
|
||||||
|
PersonRecentActivity = result
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
var message = "Failed to GetPersonActivityByTaxId with TaxId.";
|
||||||
|
Log.Error(exception, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+186
@@ -0,0 +1,186 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AddressService : IAddressService
|
||||||
|
{
|
||||||
|
private readonly IAddressDao _addressDao;
|
||||||
|
|
||||||
|
public AddressService(IAddressDao addressDao)
|
||||||
|
{
|
||||||
|
_addressDao = addressDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<PersonPostalAddress>> GetByPersonNumberAndId(string personNumber, string id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.PersonAddressInformation
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
var personPostalAddress = await _addressDao.FindByPersonNumberAddressNumber(coreRequestParameters, personNumber, id);
|
||||||
|
return personPostalAddress;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding person's postal address. " +
|
||||||
|
$"PersonNumber: {personNumber}, " +
|
||||||
|
$"Id: {id}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IReadOnlyCollection<PersonPostalAddress>>> GetByPersonNumber(string personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.PersonAddressInformation
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
var personPostalAddress = await _addressDao.FindByPersonNumber(coreRequestParameters, personNumber);
|
||||||
|
return personPostalAddress;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding person's postal address. " +
|
||||||
|
$"PersonNumber: {personNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonPostalAddress> DeleteInsertPersonPostalAddress(PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var removeResponse = await RemovePersonPostalAddress(personPostalAddress);
|
||||||
|
var newPersonPostalAddress = await InsertPersonPostalAddress(personPostalAddress);
|
||||||
|
return newPersonPostalAddress;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Warning(exception, $"There was an issue deleteing/inserting person's postal address. " +
|
||||||
|
$"PersonNumber: { personPostalAddress.PersonNumber}" +
|
||||||
|
$"Id: {personPostalAddress.Id}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonPostalAddress> InsertPersonPostalAddress(PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//These properties are required to be empty/nulled out for insert.
|
||||||
|
personPostalAddress.AddressNumber = 0;
|
||||||
|
personPostalAddress.Id = null;
|
||||||
|
personPostalAddress.StartDayNumber = personPostalAddress.StartDayNumber <= 0 ? null : personPostalAddress.StartDayNumber;
|
||||||
|
personPostalAddress.StopDayNumber = personPostalAddress.StopDayNumber <= 0 ? null : personPostalAddress.StopDayNumber;
|
||||||
|
|
||||||
|
var response = await _addressDao.InsertPersonPostalAddress(personPostalAddress);
|
||||||
|
if(response == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"Insert Person Postal Address response was null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating Address by Person Number. " +
|
||||||
|
$"PersonNumber: {personPostalAddress.PersonNumber} ");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> RemovePersonPostalAddress(PersonPostalAddress personPostalAddress)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var personAddressesResponse = await GetByPersonNumber(personPostalAddress.PersonNumber.ToString());
|
||||||
|
if(personAddressesResponse.MessageBody == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"No addresses found for person. PersonNumber:{personPostalAddress.PersonNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var addressToBeRemoved = personAddressesResponse.MessageBody.FirstOrDefault(address => address.AddressNumber == personPostalAddress.AddressNumber);
|
||||||
|
var coreMessageHeader = new CoreMessageHeader(personAddressesResponse.MessageHeader.UpdateKey);
|
||||||
|
personPostalAddress.Id = addressToBeRemoved.Id;
|
||||||
|
|
||||||
|
var coreUpdateRequestAddress = new CoreApiMessage<PersonPostalAddress>(coreMessageHeader, personPostalAddress);
|
||||||
|
var response = await _addressDao.RemovePersonPostalAddress(coreUpdateRequestAddress);
|
||||||
|
if(!string.IsNullOrWhiteSpace(response))
|
||||||
|
{
|
||||||
|
throw new Exception($"Error while removing person's postal address. " +
|
||||||
|
$"PersonNumber:{addressToBeRemoved.PersonNumber}, " +
|
||||||
|
$"AddressNumber:{addressToBeRemoved.AddressNumber}, " +
|
||||||
|
$"Id: {addressToBeRemoved.Id}, " +
|
||||||
|
$"Response:{response}.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue removeing person's postal address. " +
|
||||||
|
$"PersonNumber: {personPostalAddress.PersonNumber} " +
|
||||||
|
$"Id: {personPostalAddress.Id}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonAddrLine> UpdatePersonAddrLine(PersonAddrLine personAddrLine)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var personAddressesResponse = await GetByPersonNumber(personAddrLine.PersonNumber.ToString());
|
||||||
|
if (personAddressesResponse.MessageBody == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"No addresses found for person. PersonNumber:{personAddrLine.PersonNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var addressToBeUpdated = personAddressesResponse.MessageBody.FirstOrDefault(address => address.AddressNumber == personAddrLine.AddressNumber);
|
||||||
|
if (addressToBeUpdated == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"No address found to update for person.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var coreMessageHeader = new CoreMessageHeader(personAddressesResponse.MessageHeader.UpdateKey);
|
||||||
|
var coreUpdateRequestAddress = new CoreApiMessage<PersonAddrLine>(coreMessageHeader, personAddrLine);
|
||||||
|
var response = await _addressDao.UpdatePersonAddrLine(coreUpdateRequestAddress);
|
||||||
|
|
||||||
|
if (response == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"Update PersonAddrLine response was null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
var exceptionLog = $"There was an issue updating Address by Person Number. " +
|
||||||
|
$"PersonNumber: {personAddrLine.PersonNumber}, AddressNumber: {personAddrLine.AddressNumber}. ";
|
||||||
|
|
||||||
|
if (exception.Message.Contains("StatusCode:UnprocessableEntity"))
|
||||||
|
{
|
||||||
|
exceptionLog += $"UnprocessableEntity exception thrown from DNA DB. There is a mismatch in data. Common issues include: " +
|
||||||
|
$"countrySubdivisionCode, addressUseCode, and postalCode";
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.Error(exception, exceptionLog);
|
||||||
|
throw new ServiceException(exceptionLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AgreePersonService : IAgreePersonService
|
||||||
|
{
|
||||||
|
private readonly IAgreePersonDao _agreePersonDao;
|
||||||
|
|
||||||
|
public AgreePersonService(IAgreePersonDao agreePersonDao)
|
||||||
|
{
|
||||||
|
_agreePersonDao = agreePersonDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AgreePerson> GetByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.FindByUserId(userId);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to GetByUserId. UserId: ${userId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreePerson>> GetAgreePersons(int fetchSize)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.FindAgreePersons(fetchSize);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to GetAgreePersons.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreePerson>> GetAgreePersonsWithHyphenatedUserId()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.FindAgreePersonsWithHyphenatedUserId();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to GetAgreePersonsWithHyphenatedUserId.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task<IEnumerable<string>> GetActiveCustodialAgreePersonNumbers()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.FindActiveCustodialAgreePersonNumbers();
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to GetActiveCustodialAgreePersonNumbers");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreePerson>> GetActiveCustodialVruCardAgreementAgreePersons()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.FindActiveCustodialVruCardAgreementAgreePersons();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to GetActiveCustodialVruCardAgreementAgreePersons");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreePersonDao.UpdatePersonAgreementDetailTypes(personAgreementDetailTypeRequest);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Failed to UpdatePersonAgreementDetailTypes");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+218
@@ -0,0 +1,218 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AgreeService : IAgreeService
|
||||||
|
{
|
||||||
|
private readonly IAgreeDao _agreeDao;
|
||||||
|
|
||||||
|
public AgreeService(IAgreeDao agreeDao)
|
||||||
|
{
|
||||||
|
_agreeDao = agreeDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreeUserAccount>> GetAgreeUsersByAccountNumbers(List<string> accountNumbers)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreeUsersByAccountNumbers(accountNumbers);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreeUsersByAccountNumbers for accountNumbers: {accountNumbers}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<string>> GetAgreeUsersByPersonNumber(long personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreeUserByPersonNumber(personNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreeUsersByPersonNumber for personNumber: {personNumber}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<string> GetAgreeUserByOrganizationNumber(long organizationNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreeUserByOrganizationNumber(organizationNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreeUserByOrganizationNumber for personNumber: {organizationNumber}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Agreement> GetAgreementByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreementByUserId(userId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementsByUserId for UserId: {userId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Agreement> GetAgreementByAgreementId(long agreementId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreementByAgreementId(agreementId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementByAgreementId for AgreementId: {agreementId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Agreement>> GetAgreementsByAccountId(long accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.FindAgreementsByAccountId(accountId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementsByAccountId for AccountId: {accountId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AgreementAccount> GetAgreementAccountByAccountId(long accountId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var agreementAccount = await _agreeDao.FindAgreementAccountByAccountId(accountId);
|
||||||
|
if (agreementAccount == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
agreementAccount.AccountOwner = await _agreeDao.FindAgreementOwnerByAccountNumber(agreementAccount.AccountNumber);
|
||||||
|
return agreementAccount;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementAccountByAccountId for AccountId: {accountId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreementAccount>> GetAgreementAccountsByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var agreementAccounts = await _agreeDao.FindAgreementAccountsByUserId(userId);
|
||||||
|
if (!agreementAccounts.Any())
|
||||||
|
{
|
||||||
|
return agreementAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await SetAccountOwnersForAgreementAccounts(agreementAccounts);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementAccountsByUserId for UserId: {userId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<AgreementAccount>> GetAgreementAccountsByOrganizationId(long organizationId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var agreementAccounts = await _agreeDao.FindAgreementAccountsByOrganizationId(organizationId);
|
||||||
|
if (!agreementAccounts.Any())
|
||||||
|
{
|
||||||
|
return agreementAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await SetAccountOwnersForAgreementAccounts(agreementAccounts);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Failed to GetAgreementAccountsByOrganizationId for OrganizationId: {organizationId}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IEnumerable<AgreementAccount>> SetAccountOwnersForAgreementAccounts(IEnumerable<AgreementAccount> agreementAccounts)
|
||||||
|
{
|
||||||
|
if (agreementAccounts == null || !agreementAccounts.Any())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var accountNumbers = agreementAccounts.Select(account => account.AccountNumber);
|
||||||
|
var accountOwners = await _agreeDao.FindAgreementOwnerByAccountNumbers(accountNumbers);
|
||||||
|
|
||||||
|
foreach (var account in agreementAccounts)
|
||||||
|
{
|
||||||
|
account.AccountOwner = accountOwners.FirstOrDefault(owner => owner.AccountNumber == account.AccountNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
return agreementAccounts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<long>> AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(
|
||||||
|
DateTime maintenanceDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(maintenanceDate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained for MaintenanceDate: {maintenanceDate} or later.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<long>> AuditOrganizationChangesByDateLastMaintained(DateTime maintenanceDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.AuditAccountOrganizationChangesByDateLastMaintained(maintenanceDate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to AuditOrganizationChangesByDateLastMaintained for MaintenanceDate: {maintenanceDate} or later.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<long>> AuditAgreementChangesByDateLastMaintained(DateTime maintenanceDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _agreeDao.AuditAccountAgreementChangesByDateLastMaintained(maintenanceDate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to AuditAgreementChangesByDateLastMaintained for MaintenanceDate: {maintenanceDate} or later.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+60
@@ -0,0 +1,60 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class ApplicationHistoryService : IApplicationHistoryService
|
||||||
|
{
|
||||||
|
private readonly IApplicationHistoryDao _applicationHistoryDao;
|
||||||
|
|
||||||
|
public ApplicationHistoryService(IApplicationHistoryDao applicationHistoryDao)
|
||||||
|
{
|
||||||
|
_applicationHistoryDao = applicationHistoryDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<ApplicationHistory>> GetApplicationHistory(List<string> applicationNumbers,
|
||||||
|
string effectiveDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var parsedEffectiveDate = DateTime.Parse(effectiveDate);
|
||||||
|
var applicationHistorys = await _applicationHistoryDao.FindApplicationHistory(applicationNumbers, parsedEffectiveDate);
|
||||||
|
var queueApplicationParameters = await _applicationHistoryDao.FindApplicationHistoryParameters(applicationNumbers, parsedEffectiveDate);
|
||||||
|
|
||||||
|
foreach (var applicationHistory in applicationHistorys)
|
||||||
|
{
|
||||||
|
applicationHistory.QueueApplicationParameters = queueApplicationParameters.Where(qap => qap.QueueNumber == applicationHistory.QueueNumber &&
|
||||||
|
qap.ApplicationNumber == applicationHistory.ApplicationNumber).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return applicationHistorys;
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to parse dates in GetApplicationHistory. " +
|
||||||
|
$"effectiveDate: {effectiveDate}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime. " +
|
||||||
|
$"effectiveDate: {effectiveDate}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to parse null newerThanDateTime in GetApplicationHistory. " +
|
||||||
|
$"effectiveDate: {effectiveDate}");
|
||||||
|
throw new FailedToParseException($"Failed to parse. EffectiveDate: {effectiveDate}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,$"Failed to GetApplicationHistory. EffectiveDate: {effectiveDate}, " +
|
||||||
|
$"applicationNumbers: {JsonConvert.SerializeObject(applicationNumbers)}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class AssociateService : IAssociateService
|
||||||
|
{
|
||||||
|
private readonly IAssociateDao _associateDao;
|
||||||
|
|
||||||
|
public AssociateService(IAssociateDao associateDao)
|
||||||
|
{
|
||||||
|
_associateDao = associateDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AssociateDetails> GetAssociateDetailsBySsn(string taxId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _associateDao.GetAssociateDetailsBySsn(taxId);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
var message = "There was an issue finding associate details by ssn.";
|
||||||
|
Log.Error(exception, message);
|
||||||
|
throw new ServiceException($"{message}. Exception Message: {exception.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Serilog;
|
||||||
|
using AutoMapper;
|
||||||
|
using LcuModels = LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Branches;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class BranchService : IBranchService
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly IBranchDao _branchDao;
|
||||||
|
|
||||||
|
public BranchService(IMapper mapper,
|
||||||
|
IBranchDao branchDao)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_branchDao = branchDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<LcuModels.Branch>> GetBranches()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreRequest = new CoreRequestParameters();
|
||||||
|
var results = await _branchDao.FindBranches(coreRequest);
|
||||||
|
|
||||||
|
return _mapper.Map<IEnumerable<LcuModels.Branch>>(results);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Branches.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAccessChannelPersonsService
|
||||||
|
{
|
||||||
|
Task<CoreApiMessage<IEnumerable<AccessChannelPerson>>> GetAccessChannelPersonCoreApiResponseAsync(
|
||||||
|
AccessChannelPersonsByPersonRequest request);
|
||||||
|
Task<CoreApiMessage<IEnumerable<AccessChannelPerson>>> GetAccessChannelPersonCoreApiResponseAsync(
|
||||||
|
AccessChannelPersonsByPersonRequest request, List<string> includes);
|
||||||
|
Task<AccessChannelPerson> UpdateAccessChannelPersonAsync(AccessChannelPerson request, long updateKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAccessTypeService
|
||||||
|
{
|
||||||
|
Task<AccessType> UpdateAccessTypeAsync(AccessTypeUpdateRequest request);
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAccountHistoryService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<DateTime>> GetChargeoffDateTimesByAccountNumber(string accountNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAccountService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Account>> GetAccountsByMemberAgreementNumber(CoreRequestParameters coreRequestParameters, MemberAgreeNbrRequest request);
|
||||||
|
Task<Account> GetAccountDetailsByAccountNumber(long accountNumber);
|
||||||
|
Task<Account> GetAccountDetails(CoreRequestParameters coreRequestParameters, AcctNbrRequest request);
|
||||||
|
Task PutAccountMaintenanceRequest(IEnumerable<AccountMaintenanceRequest> accountMaintenanceRequests);
|
||||||
|
Task<List<ActivityAccountDetails>> GetActivityAccountDetailsByAccountNumbers(List<long> accountNumbers);
|
||||||
|
Task<IEnumerable<string>> GetAdminBranchCodeChangeAccountNumbers();
|
||||||
|
Task<IEnumerable<string>> GetVipSavingsToFund();
|
||||||
|
Task<IEnumerable<string>> GetAccountsForGroupAnalysisMaintenance();
|
||||||
|
Task<BasicResponse> UpdateAccountBranch(AccountBranchUpdateRequest accountBranchUpdateRequest);
|
||||||
|
Task<BasicResponse> UpdateAccountLoanToValue(AccountLtvUpdateRequest accountLtvUpdateRequest);
|
||||||
|
Task<BasicResponse> UpdateAccountNickName(AccountNickNameUpdateRequest acountNickNameUpdateRequest);
|
||||||
|
Task<BasicResponse> UpdateAccountContractDate(AccountContractDateUpdateRequest accountContractDateUpdateRequest);
|
||||||
|
Task<IEnumerable<AccountOwnership>> GetOwnersByAccountNumber(long accountNumber, DateTime createdDate);
|
||||||
|
Task<IEnumerable<AccountOwnership>> GetPrimaryOwnersByOrganizationName(string organizationName);
|
||||||
|
Task<IEnumerable<AccountOwnership>> GetPrimaryOwnersByPersonName(string personName);
|
||||||
|
Task<BasicResponse> UpdateAccountAnalysisMaintenance(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest);
|
||||||
|
Task<CreatedAccountResponse> AddPersonAccount(CreatePersonAccountRequest createPersonAccountRequest);
|
||||||
|
Task<CreatedAccountResponse> AddOrganizationAccount(CreateOrganizationAccountRequest createOrganizationAccountRequest);
|
||||||
|
Task<BasicResponse> PutOrganizationMaintenanceRequest(OrganizationMaintenanceRequest organizationMaintenanceRequest);
|
||||||
|
Task<BasicResponse> UpdateAccountCreditReportType(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest);
|
||||||
|
Task<IEnumerable<AccountsByMajorMinorBranchAndStatusResponse>> GetAccountsByMajorMinorBranchAndStatus(AccountsByMajorMinorBranchAndStatusRequest request);
|
||||||
|
Task<IEnumerable<AccountsByRecentTransactionsResponse>> GetAccountsByRecentTransactions(AccountsByRecentTransactionsRequest request);
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAccountUserFieldService
|
||||||
|
{
|
||||||
|
Task<CoreApiMessage<IEnumerable<AccountUserField>>> GetAccountUserFieldsAsync(long accountNumber);
|
||||||
|
Task<CoreApiMessage<IEnumerable<AccountUserField>>> GetAccountUserFieldCoreApiResponseAsync(string accountId);
|
||||||
|
Task<AccountUserField> UpdateAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequests,
|
||||||
|
long updateKey,
|
||||||
|
string accountId,
|
||||||
|
string userFieldId);
|
||||||
|
Task<AccountUserField> InsertAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequests, string accountId);
|
||||||
|
Task<IEnumerable<AccountUserField>> InsertAccountUserFieldsAsync(List<AccountUserFieldRequest> accountUserFieldUpdateRequests);
|
||||||
|
Task<IEnumerable<AccountUserField>> UpdateAccountUserFieldsAsync(List<AccountUserFieldRequest> accountUserFieldUpdateRequests);
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IActivityService
|
||||||
|
{
|
||||||
|
Task<IReadOnlyCollection<NewCheckingAccountActivity>> GetNewCheckingAccountActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount);
|
||||||
|
Task<IReadOnlyCollection<NewCheckingAccountActivity>> GetNewDigitalBankingCheckingAccountActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount);
|
||||||
|
Task<IReadOnlyCollection<NewAtmCheckCardActivity>> GetNewAtmCheckCardActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount);
|
||||||
|
Task<IReadOnlyCollection<NewActivityManagerIncentiveReferral>> GetNewActivityManagerIncentiveReferrals(string newerThanOriginationDateTime, long? afterActivityId);
|
||||||
|
Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewMortgageSaleActivities(string newerThanOriginationDateTime,
|
||||||
|
long? afterActivityId);
|
||||||
|
Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewVehicleSaleActivities(string newerThanOriginationDateTime,
|
||||||
|
long? afterActivityId);
|
||||||
|
Task<IReadOnlyCollection<NewLoanSaleActivity>> GetNewDebtProtectedLoanSaleActivities(string newerThanDateTime,
|
||||||
|
long? afterActivityNbr);
|
||||||
|
Task<IReadOnlyCollection<NewActivityManagerIncentiveReferral>> QueryActivityManagerActivity(ActivityQueryRequest request);
|
||||||
|
Task<IReadOnlyCollection<EStatementDeliveryMethod>> GetEStatementDeliveryActivity(string newerThanOriginationDateTime);
|
||||||
|
Task<PersonRecentActivityResponse> GetPersonActivityByPhoneNumber(string phoneNumber);
|
||||||
|
Task<PersonRecentActivityResponse> GetPersonActivityByTaxId(string taxId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAddressService
|
||||||
|
{
|
||||||
|
Task<CoreApiMessage<PersonPostalAddress>> GetByPersonNumberAndId(string personNumber, string postalAddressId);
|
||||||
|
Task<CoreApiMessage<IReadOnlyCollection<PersonPostalAddress>>> GetByPersonNumber(string personNumber);
|
||||||
|
Task<PersonPostalAddress> DeleteInsertPersonPostalAddress(PersonPostalAddress personPostalAddress);
|
||||||
|
Task<bool> RemovePersonPostalAddress(PersonPostalAddress personPostalAddress);
|
||||||
|
Task<PersonPostalAddress> InsertPersonPostalAddress(PersonPostalAddress personPostalAddress);
|
||||||
|
Task<PersonAddrLine> UpdatePersonAddrLine(PersonAddrLine personAddrLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAgreePersonService
|
||||||
|
{
|
||||||
|
Task<AgreePerson> GetByUserId(string userId);
|
||||||
|
Task<IEnumerable<AgreePerson>> GetAgreePersons(int fetchSize);
|
||||||
|
Task<IEnumerable<AgreePerson>> GetAgreePersonsWithHyphenatedUserId();
|
||||||
|
Task<IEnumerable<string>> GetActiveCustodialAgreePersonNumbers();
|
||||||
|
Task<IEnumerable<AgreePerson>> GetActiveCustodialVruCardAgreementAgreePersons();
|
||||||
|
Task<BasicResponse> UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAgreeService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<AgreeUserAccount>> GetAgreeUsersByAccountNumbers(List<string> accountNumbers);
|
||||||
|
|
||||||
|
Task<IEnumerable<string>> GetAgreeUsersByPersonNumber(long personNumber);
|
||||||
|
|
||||||
|
Task<string> GetAgreeUserByOrganizationNumber(long organizationNumber);
|
||||||
|
|
||||||
|
Task<Agreement> GetAgreementByUserId(string userId);
|
||||||
|
|
||||||
|
Task<Agreement> GetAgreementByAgreementId(long agreementId);
|
||||||
|
|
||||||
|
Task<IEnumerable<Agreement>> GetAgreementsByAccountId(long accountId);
|
||||||
|
|
||||||
|
Task<IEnumerable<AgreementAccount>> GetAgreementAccountsByUserId(string userId);
|
||||||
|
|
||||||
|
Task<IEnumerable<AgreementAccount>> GetAgreementAccountsByOrganizationId(long organizationId);
|
||||||
|
|
||||||
|
Task<AgreementAccount> GetAgreementAccountByAccountId(long organizationId);
|
||||||
|
|
||||||
|
Task<IEnumerable<long>> AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime maintenanceDate);
|
||||||
|
|
||||||
|
Task<IEnumerable<long>> AuditOrganizationChangesByDateLastMaintained(DateTime maintenanceDate);
|
||||||
|
|
||||||
|
Task<IEnumerable<long>> AuditAgreementChangesByDateLastMaintained(DateTime maintenanceDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IApplicationHistoryService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<ApplicationHistory>> GetApplicationHistory(List<string> applicationNumbers,
|
||||||
|
string effectiveDate);
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IAssociateService
|
||||||
|
{
|
||||||
|
Task<AssociateDetails> GetAssociateDetailsBySsn(string taxId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Branches;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IBranchService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Branch>> GetBranches();
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IIndirectLoanService
|
||||||
|
{
|
||||||
|
Task<IndirectLoanDetail> GetIndirectLoanByAccountNumber(long accountNumber);
|
||||||
|
|
||||||
|
Task<IEnumerable<IndirectLoanDetail>> GetIndirectLoansByPostedDate(string newerThanDateTime);
|
||||||
|
|
||||||
|
Task<IEnumerable<ClosedIndirectLoan>> GetClosedIndirectLoansByPostedDate(string newerThanDateTime);
|
||||||
|
|
||||||
|
Task<IEnumerable<IndirectLoanDetail>> GetClosedIndirectLoansWithDetailByPostedDate(string newerThanDateTime);
|
||||||
|
|
||||||
|
Task<IEnumerable<UpdateDealerOriginalBalanceResponse>> UpdateDealerOriginalBalance (string accountNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Individuals;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IIndividualService
|
||||||
|
{
|
||||||
|
Task<Individual> GetIndividualByUserId(string userId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface ILoanService
|
||||||
|
{
|
||||||
|
Task<LoanDetail> GetLoanDetail(long accountNumber);
|
||||||
|
Task<IEnumerable<CollateralDetail>> GetCollateralDetails(long accountNumber);
|
||||||
|
Task<IEnumerable<Property>> GetPropertyInformation(long accountNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Mixed;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IMemberService
|
||||||
|
{
|
||||||
|
Task<Member> GetMemberDetails(long memberId);
|
||||||
|
Task<Member> GetMemberByAccountNumber(long accountNumber);
|
||||||
|
Task<IEnumerable<MemberOwner>> GetMemberOwner(long memberId);
|
||||||
|
Task<PersonOrganization> GetPersonOrOrganizationNumberByMemberId(long memberId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IOrganizationService
|
||||||
|
{
|
||||||
|
Task<Organization> GetMemberByMemberAgreeNbr(long memberAgreeNbr);
|
||||||
|
|
||||||
|
Task<IEnumerable<Organization>> GetOrganizationByOrganizationNumber(long organizationNumber);
|
||||||
|
Task<IEnumerable<Organization>> GetOrganizationByName(string name);
|
||||||
|
Task<long> CountOrganizationNumbersByName(string name);
|
||||||
|
Task<IEnumerable<Organization>> GetOrganizationByNameLike(string name, int? limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IPersonService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Person>> GetPersonsByName(CoreRequestParameters coreRequestParameters, PersonNameRequest personRequest);
|
||||||
|
Task<IEnumerable<Person>> GetPersonByPersonNumber(long personNumber);
|
||||||
|
Task<IEnumerable<Person>> GetPersonsBySearch(CoreRequestParameters coreRequestParameters, PersonSearchRequest personRequest);
|
||||||
|
Task<Person> GetPersonsByMemberAgreementNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest personRequest);
|
||||||
|
Task<Person> GetMemberByMemberAgreeNbr(long memberAgreeNbr);
|
||||||
|
Task<IEnumerable<Person>> GetPersonsByNameLike(PersonNameRequest personRequest, int? limit);
|
||||||
|
Task<long> CountPersonsByNameLike(PersonNameRequest personRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IPersonUserFieldService
|
||||||
|
{
|
||||||
|
Task<CoreApiMessage<IEnumerable<PersonUserField>>> GetPersonUserFieldsAsync(long personNumber);
|
||||||
|
Task<IEnumerable<PersonCheckHoldsUserField>> GetPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate);
|
||||||
|
Task<CoreApiMessage<IEnumerable<PersonUserField>>> GetPersonUserFieldCoreApiResponseAsync(int personId);
|
||||||
|
Task<PersonUserField> InsertPersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest);
|
||||||
|
Task<PersonUserField> UpdatePersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest);
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IPropertyService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Property>> GetAccountProperties(long accountNumber);
|
||||||
|
Task<Property> GetProperty(long propertyNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface IPropertyUserFieldService
|
||||||
|
{
|
||||||
|
Task<CoreApiMessage<IEnumerable<PropertyUserField>>> GetPropertyUserFieldsAsync(long propertyNumber);
|
||||||
|
Task<BasicResponse> UpdatePropertyUserFieldAsync(PropertyUserField propertyUserField);
|
||||||
|
Task<BasicResponse> InsertPropertyUserFieldAsync(PropertyUserField propertyUserField);
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Saf;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface ISafService
|
||||||
|
{
|
||||||
|
public Task<IEnumerable<SafUser>> GetAllSafUsersCoreInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface ITaxService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<PersonTaxIdDataResponse>> GetPersonsTaxIdData(string taxId);
|
||||||
|
Task<IEnumerable<OrganizationTaxIdDataResponse>> GetOrganizationsTaxIdData(string taxId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface ITransactionService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<MonetaryTransactionResponse>> AddMonetaryTransactionsAsync(List<GroupedMonetaryTransactionRequest> groupTransactions);
|
||||||
|
Task<IEnumerable<TransactionHistory>> GetTransactionHistory(long accountNumber, DateTime startDateRange, DateTime endDateRange, string[] transactionTypeCodes);
|
||||||
|
Task<IEnumerable<TransactionHistory>> GetTransactionHistoryById(string generatedAccountid, DateTime fromDate, DateTime thruDate);
|
||||||
|
Task<IEnumerable<ExternalDescription>> GetExternalDescriptionsWithSsn();
|
||||||
|
Task<List<BasicResponse>> PostFundsToAccount(List<FundsToAccountRequest> requests);
|
||||||
|
BasicResponse UpdateExternalDescription(ExternalDescription externalTransactionDescription);
|
||||||
|
Task<IEnumerable<TransactionAlertInfo>> GetTransactionsByDateSpan(DateTime startDateRange, DateTime endDateRange, string[] rtxnTypCdToExclude);
|
||||||
|
}
|
||||||
|
}
|
||||||
+123
@@ -0,0 +1,123 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class IndirectLoanService : IIndirectLoanService
|
||||||
|
{
|
||||||
|
private readonly IIndirectLoanDao _indirectLoanDao;
|
||||||
|
|
||||||
|
public IndirectLoanService(IIndirectLoanDao indirectLoanDao)
|
||||||
|
{
|
||||||
|
_indirectLoanDao = indirectLoanDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IndirectLoanDetail> GetIndirectLoanByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return (await _indirectLoanDao.FindByAccountNumber(accountNumber)).FirstOrDefault();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding indirect loans by account number {accountNumber.ToString()}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<IndirectLoanDetail>> GetIndirectLoansByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return await _indirectLoanDao.FindByPostedDate(newerThanDt);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime in GetIndirectLoansByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetIndirectLoansByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetIndirectLoansByPostedDate. newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<ClosedIndirectLoan>> GetClosedIndirectLoansByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return await _indirectLoanDao.FindClosedByPostedDate(newerThanDt);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime in GetClosedIndirectLoansByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetClosedIndirectLoansByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetClosedIndirectLoansByPostedDate. newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<IndirectLoanDetail>> GetClosedIndirectLoansWithDetailByPostedDate(string newerThanDateTime)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
DateTime newerThanDt = DateTime.Parse(newerThanDateTime);
|
||||||
|
return await _indirectLoanDao.FindClosedWithDetailByPostedDate(newerThanDt);
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse newerThanDateTime in GetClosedIndirectLoansWithDetailByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to Parse null newerThanDateTime in GetClosedIndirectLoansWithDetailByPostedDate: ${newerThanDateTime}");
|
||||||
|
throw new FailedToParseException($"Failed to Parse newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex,
|
||||||
|
$"Failed to GetClosedIndirectLoansWithDetailByPostedDate. newerThanDateTime: ${newerThanDateTime}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<UpdateDealerOriginalBalanceResponse>> UpdateDealerOriginalBalance(string accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _indirectLoanDao.UpdateDealerOriginalBalance(accountNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Unable to update accounts.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Individuals;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class IndividualService : IIndividualService
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly IPersonService _personService;
|
||||||
|
private readonly IAgreePersonService _agreePersonService;
|
||||||
|
|
||||||
|
public IndividualService(IMapper mapper,
|
||||||
|
IPersonService personService,
|
||||||
|
IAgreePersonService electronicAgreePersonService)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_personService = personService;
|
||||||
|
_agreePersonService = electronicAgreePersonService;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notes
|
||||||
|
// 1.) The parameter passed in is a UserId that is in the AgreePers table in DNA.
|
||||||
|
// This will be used to get the personnumber and the person data.
|
||||||
|
// 2.) Since Person Search returns a list of persons but the old ApiWrapper required a
|
||||||
|
// single Individual for this method we must convert this a single Individual.
|
||||||
|
public async Task<Individual> GetIndividualByUserId(string userId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var agreePerson = await _agreePersonService.GetByUserId(userId);
|
||||||
|
if (agreePerson == null)
|
||||||
|
{
|
||||||
|
Log.Error($"AgreePerson was null. UserId: {userId}");
|
||||||
|
throw new Exception($"AgreePerson was null. UserId: {userId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var coreRequest = new CoreRequestParameters();
|
||||||
|
var request = new PersonSearchRequest()
|
||||||
|
{
|
||||||
|
PersNbr = agreePerson.PersonNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _personService.GetPersonsBySearch(coreRequest, request);
|
||||||
|
var individuals = _mapper.Map<IEnumerable<Individual>>(results).ToList();
|
||||||
|
return individuals.FirstOrDefault(ind => ind.IndividualId == agreePerson.PersonNumber);
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"Error while trying to get Individuals by UserId. " +
|
||||||
|
$"UserId: {userId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.LoanPayoff;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public interface ILoanPayoffService
|
||||||
|
{
|
||||||
|
Task<IEnumerable<LoanPayoff>> GetLoanPayoffByAccountNumber(long AccountNumber);
|
||||||
|
Task<IEnumerable<LoanPayoff>> GetLoanPayoffByVIN(string VIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
+56
@@ -0,0 +1,56 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.LoanPayoff;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class LoanPayoffService : ILoanPayoffService
|
||||||
|
{
|
||||||
|
private readonly ILoanPayoffDao _LoanPayoffDao;
|
||||||
|
|
||||||
|
public LoanPayoffService(ILoanPayoffDao LoanPayoffDao)
|
||||||
|
{
|
||||||
|
_LoanPayoffDao = LoanPayoffDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<LoanPayoff>> GetLoanPayoffByAccountNumber(long AccountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dateRange = GetDate();
|
||||||
|
return await _LoanPayoffDao.GetLoanPayoffByAccountNumber(AccountNumber, dateRange);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding Accounts by Account Number. Account Number: {AccountNumber}");
|
||||||
|
throw new ServiceException($"Exception was thrown in GetLoanPayoffByAccountNumber." +
|
||||||
|
$"Account Number: {AccountNumber}" +
|
||||||
|
$"Exception Message: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<LoanPayoff>> GetLoanPayoffByVIN(string VIN)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var dateRange = GetDate();
|
||||||
|
return await _LoanPayoffDao.GetLoanPayoffByVIN(VIN, dateRange);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding Accounts by VIN: {VIN}");
|
||||||
|
throw new ServiceException($"Exception was thrown in GetLoanPayoffByVIN." +
|
||||||
|
$"VIN: {VIN}" +
|
||||||
|
$"Exception Message: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetDate() { return ((DateTime.Now)).ToString("yyyy-MM-dd"); }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+98
@@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class LoanService : ILoanService
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
private readonly IPropertyService _propertyService;
|
||||||
|
private readonly IAccountHistoryService _accountHistoryService;
|
||||||
|
|
||||||
|
public LoanService(IMapper mapper,
|
||||||
|
IAccountService accountService,
|
||||||
|
IPropertyService propertyService,
|
||||||
|
IAccountHistoryService accountHistoryService)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_accountService = accountService;
|
||||||
|
_propertyService = propertyService;
|
||||||
|
_accountHistoryService = accountHistoryService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<LoanDetail> GetLoanDetail(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.AddSpecialIncludesCharacter(RequestIncludeConstants.AccountAgreements),
|
||||||
|
RequestIncludeConstants.TheLoanAccount,
|
||||||
|
RequestIncludeConstants.AccountRolesInformation,
|
||||||
|
RequestIncludeConstants.Balances,
|
||||||
|
RequestIncludeConstants.AccountBalanceInformation,
|
||||||
|
RequestIncludeConstants.Standard
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new AcctNbrRequest()
|
||||||
|
{
|
||||||
|
AcctNbr = accountNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
var account = await _accountService.GetAccountDetails(coreRequestParameters, request);
|
||||||
|
|
||||||
|
if (account.CurrentAccountStatusDescription == AccountStatusConstants.CoreChargeOffAccount)
|
||||||
|
{
|
||||||
|
var writtenOffDates = await _accountHistoryService.GetChargeoffDateTimesByAccountNumber(account.AccountNumber.ToString());
|
||||||
|
account.CurrentAccountStatusDateTime = writtenOffDates.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _mapper.Map<LoanDetail>(account);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Loan Details by account number. AccountNumber: {accountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<CollateralDetail>> GetCollateralDetails(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var properties = await _propertyService.GetAccountProperties(accountNumber);
|
||||||
|
return _mapper.Map<IEnumerable<CollateralDetail>>(properties);
|
||||||
|
}
|
||||||
|
catch (ServiceException ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Collateral Details by account number. AccountNumber: {accountNumber}");
|
||||||
|
throw new ServiceException($"Error while trying to get Collateral Details by account number. AccountNumber: {accountNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Property>> GetPropertyInformation(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _propertyService.GetAccountProperties(accountNumber);
|
||||||
|
}
|
||||||
|
catch (ServiceException ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get property information by account number. AccountNumber: {accountNumber}");
|
||||||
|
throw new ServiceException($"Error while trying to get property information by account number. AccountNumber: {accountNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+157
@@ -0,0 +1,157 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using AutoMapper;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Mixed;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class MemberService : IMemberService
|
||||||
|
{
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
private readonly IPersonService _personService;
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
private readonly IOrganizationService _organizationService;
|
||||||
|
|
||||||
|
public MemberService(IMapper mapper,
|
||||||
|
IPersonService personService,
|
||||||
|
IAccountService accountService,
|
||||||
|
IOrganizationService organizationService)
|
||||||
|
{
|
||||||
|
_mapper = mapper;
|
||||||
|
_personService = personService;
|
||||||
|
_accountService = accountService;
|
||||||
|
_organizationService = organizationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Member> GetMemberDetails(long memberId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.PostalAddresses
|
||||||
|
};
|
||||||
|
var coreRequest = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new MemberNbrRequest()
|
||||||
|
{
|
||||||
|
MemberNbr = memberId
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await _personService.GetPersonsByMemberAgreementNbr(coreRequest, request);
|
||||||
|
return _mapper.Map<Member>(result);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Member by member id. MemberId: {memberId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Member> GetMemberByAccountNumber(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.AddSpecialIncludesCharacter(RequestIncludeConstants.AccountAgreements),
|
||||||
|
RequestIncludeConstants.AccountRolesInformation,
|
||||||
|
RequestIncludeConstants.Basic
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new AcctNbrRequest()
|
||||||
|
{
|
||||||
|
AcctNbr = accountNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
var account = await _accountService.GetAccountDetails(coreRequestParameters, request);
|
||||||
|
if (account.ReportingForPersonNumber == 0 && account.ReportingForOrganizationNumber > 0)
|
||||||
|
{
|
||||||
|
var result = await _organizationService.GetMemberByMemberAgreeNbr(account.MemberAgreementNumber);
|
||||||
|
return _mapper.Map<Member>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await GetMemberDetails(account.MemberAgreementNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Member by account Number. AccountNumber: {accountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Old ApiWrapper method returns a list of Member Owners. DNA only returns the single primary as
|
||||||
|
// it is to be believed that there can only be a single person on a MemberhsipAgreement.
|
||||||
|
// Converting to list to mimic the old api wrapper.
|
||||||
|
public async Task<IEnumerable<MemberOwner>> GetMemberOwner(long memberId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.PersonIds,
|
||||||
|
RequestIncludeConstants.PostalAddresses,
|
||||||
|
RequestIncludeConstants.PersonTypes,
|
||||||
|
RequestIncludeConstants.PersonInfo
|
||||||
|
};
|
||||||
|
var coreRequest = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new MemberNbrRequest()
|
||||||
|
{
|
||||||
|
MemberNbr = memberId
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await _personService.GetPersonsByMemberAgreementNbr(coreRequest, request);
|
||||||
|
var listOfResults = new List<Person>();
|
||||||
|
listOfResults.Add(result);
|
||||||
|
|
||||||
|
return _mapper.Map<IEnumerable<MemberOwner>>(listOfResults);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Error while trying to get Member owner by member id. MemberId: {memberId}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonOrganization> GetPersonOrOrganizationNumberByMemberId(long memberId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var person = await _personService.GetMemberByMemberAgreeNbr(memberId);
|
||||||
|
|
||||||
|
if (person.PersonNumber != 0)
|
||||||
|
{
|
||||||
|
return new PersonOrganization()
|
||||||
|
{
|
||||||
|
PersonNumber = person.PersonNumber.ToString(),
|
||||||
|
EntityName = person.FirstMiddleInitialLastSuffix
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var organization = await _organizationService.GetMemberByMemberAgreeNbr(memberId);
|
||||||
|
|
||||||
|
if (organization.OrganizationNumber != 0)
|
||||||
|
{
|
||||||
|
return new PersonOrganization()
|
||||||
|
{
|
||||||
|
OrganizationNumber = organization.OrganizationNumber.ToString(),
|
||||||
|
EntityName = organization.Name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) { }
|
||||||
|
|
||||||
|
throw new ArgumentNullException($"Person or Organization could not be found by MemberId: {memberId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+121
@@ -0,0 +1,121 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class OrganizationService : IOrganizationService
|
||||||
|
{
|
||||||
|
private readonly IOrganizationDao _organizationDao;
|
||||||
|
|
||||||
|
public OrganizationService(IOrganizationDao organizationDao)
|
||||||
|
{
|
||||||
|
_organizationDao = organizationDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Organization> GetMemberByMemberAgreeNbr(long memberAgreeNbr)
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.AllAddresses
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var organizationRequest = new MemberNbrRequest
|
||||||
|
{
|
||||||
|
MemberNbr = memberAgreeNbr,
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetOrganizationByMemberNumber(coreRequestParameters, organizationRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Organization> GetOrganizationByMemberNumber(CoreRequestParameters coreRequestParameters, MemberNbrRequest organizationRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _organizationDao.FindOrganizationByMemberAgreeNbr(coreRequestParameters, organizationRequest);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var message = $"There was an issue finding organization by Member Agreement Number. Exception Message: {ex.Message}";
|
||||||
|
Log.Error(ex, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Organization>> GetOrganizationByOrganizationNumber(long organizationNumber)
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
var organizationSearchRequest = new OrganizationSearchRequest
|
||||||
|
{
|
||||||
|
OrgNbr = organizationNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetOrganizationBySearch(coreRequestParameters, organizationSearchRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Organization>> GetOrganizationByName(string name)
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
var organizationSearchRequest = new OrganizationSearchRequest
|
||||||
|
{
|
||||||
|
OrgName = name
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetOrganizationBySearch(coreRequestParameters, organizationSearchRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<long> CountOrganizationNumbersByName(string name)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _organizationDao.CountOrganizationNumbersByName(name);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var message = $"There was an issue counting organization by name. Exception Message: {ex.Message}";
|
||||||
|
Log.Error(ex, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Organization>> GetOrganizationByNameLike(string name, int? limit = null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var orgNumbers = await _organizationDao.FindOrganizationNumbersByNameSearch(name, limit ?? 1000);
|
||||||
|
var organizations = await Task.WhenAll(orgNumbers.Select(GetOrganizationByOrganizationNumber));
|
||||||
|
|
||||||
|
return organizations.SelectMany(o => o);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var message = $"There was an issue finding organization by name. Exception Message: {ex.Message}";
|
||||||
|
Log.Error(ex, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<IEnumerable<Organization>> GetOrganizationBySearch(CoreRequestParameters coreRequestParameters, OrganizationSearchRequest searchRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _organizationDao.FindByOrganizationsSearch(coreRequestParameters, searchRequest);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
var message = $"There was an issue finding organizations by Search - OrgNbr: {searchRequest.OrgNbr}, OrgName: {searchRequest.OrgName}";
|
||||||
|
Log.Error(ex, message);
|
||||||
|
throw new ServiceException(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+106
@@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using Serilog;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class PersonService : IPersonService
|
||||||
|
{
|
||||||
|
private readonly IPersonDao _personDao;
|
||||||
|
|
||||||
|
public PersonService(IPersonDao personDao)
|
||||||
|
{
|
||||||
|
_personDao = personDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Person>> GetPersonsByName(CoreRequestParameters coreRequestParameters, PersonNameRequest personRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _personDao.FindByPersonsName(coreRequestParameters, personRequest);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, "There was an issue finding persons by Name.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Person>> GetPersonByPersonNumber(long personNumber)
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
var personRequest = new PersonSearchRequest
|
||||||
|
{
|
||||||
|
PersNbr = personNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetPersonsBySearch(coreRequestParameters, personRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Person>> GetPersonsBySearch(CoreRequestParameters coreRequestParameters, PersonSearchRequest personRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _personDao.FindByPersonsSearch(coreRequestParameters, personRequest);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, "There was an issue finding persons by Search.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Person> GetPersonsByMemberAgreementNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest personRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _personDao.FindByPersonMemberAgreementNbr(coreRequestParameters, personRequest);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, "There was an issue finding persons by Member Agreement Number.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Person> GetMemberByMemberAgreeNbr(long memberAgreeNbr)
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.PostalAddresses
|
||||||
|
};
|
||||||
|
var coreRequest = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new MemberNbrRequest()
|
||||||
|
{
|
||||||
|
MemberNbr = memberAgreeNbr
|
||||||
|
};
|
||||||
|
|
||||||
|
return await GetPersonsByMemberAgreementNbr(coreRequest, request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Person>> GetPersonsByNameLike(PersonNameRequest personRequest, int? limit)
|
||||||
|
{
|
||||||
|
var personNumbers = await _personDao.GetPersonNumbersByNameLike
|
||||||
|
(
|
||||||
|
personRequest.FirstName,
|
||||||
|
personRequest.MdlName,
|
||||||
|
personRequest.LastName,
|
||||||
|
limit ?? 1000
|
||||||
|
);
|
||||||
|
|
||||||
|
return (await Task.WhenAll(personNumbers.Select(GetPersonByPersonNumber))).SelectMany(p => p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<long> CountPersonsByNameLike(PersonNameRequest personRequest)
|
||||||
|
{
|
||||||
|
return _personDao.CountPersonsByNameLike(personRequest.FirstName, personRequest.MdlName, personRequest.LastName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+131
@@ -0,0 +1,131 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class PersonUserFieldService : IPersonUserFieldService
|
||||||
|
{
|
||||||
|
private readonly IPersonService _personService;
|
||||||
|
private readonly IPersonUserFieldDao _personUserFieldDao;
|
||||||
|
|
||||||
|
public PersonUserFieldService(IPersonService personService, IPersonUserFieldDao personUserFieldDao)
|
||||||
|
{
|
||||||
|
_personService = personService;
|
||||||
|
_personUserFieldDao = personUserFieldDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<PersonUserField>>> GetPersonUserFieldsAsync(long personNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>() { RequestIncludeConstants.Standard };
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
var person = await _personService.GetPersonByPersonNumber(personNumber);
|
||||||
|
return await _personUserFieldDao.FindPersonUserFieldCoreApiResponseByPersonId(coreRequestParameters, person.FirstOrDefault().PersonNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Persons UserFields by id. PersonNumber: {personNumber}");
|
||||||
|
throw new ServiceException($"There was an issue finding Persons UserFields by id. PersonNumber: {personNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<PersonCheckHoldsUserField>> GetPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _personUserFieldDao.FindPersonsForAtmCheckHolds(resetStartDate, resetEndDate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Person User Fields to Update.");
|
||||||
|
throw new ServiceException($"There was an issue finding Person User Fields to Update.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<PersonUserField>>> GetPersonUserFieldCoreApiResponseAsync(int personId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>() { RequestIncludeConstants.Standard };
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
|
||||||
|
return await _personUserFieldDao.FindPersonUserFieldCoreApiResponseByPersonId(coreRequestParameters, personId);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Persons UserFields by id. PersonId: {personId}");
|
||||||
|
throw new ServiceException($"There was an issue finding Persons UserFields by id. PersonId: {personId}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonUserField> InsertPersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var person = _personService.GetPersonByPersonNumber(personUserFieldUpdateRequest.PersonNumber).Result.FirstOrDefault();
|
||||||
|
|
||||||
|
if (person == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Person was null and is required. PersonNumber: {personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var messageHeader = new CoreMessageHeader() { };
|
||||||
|
var coreApiMessage = new CoreApiMessage<PersonUserFieldRequest>(messageHeader, personUserFieldUpdateRequest);
|
||||||
|
return await _personUserFieldDao.InsertPersonUserField(coreApiMessage, personUserFieldUpdateRequest.PersonNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue inserting a PersonUserField. PersonNumber:{personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
throw new ServiceException($"There was an issue inserting a PersonUserField. PersonNumber:{personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<PersonUserField> UpdatePersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var person = _personService.GetPersonByPersonNumber(personUserFieldUpdateRequest.PersonNumber).Result.FirstOrDefault();
|
||||||
|
if (person == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Person was null and is required. PersonNumber: {personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var coreApiMessagePersonUserField = await GetPersonUserFieldCoreApiResponseAsync(personUserFieldUpdateRequest.PersonNumber);
|
||||||
|
var existingUserField = coreApiMessagePersonUserField?.MessageBody.
|
||||||
|
FirstOrDefault(auf => auf.UserFieldCode == personUserFieldUpdateRequest.UserFieldCode &&
|
||||||
|
auf.PersonNumber == personUserFieldUpdateRequest.PersonNumber);
|
||||||
|
if (existingUserField == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"An existing userfield was null and is required. " +
|
||||||
|
$"PersonNumber: {personUserFieldUpdateRequest.PersonNumber}, " +
|
||||||
|
$"UserFieldcode:{personUserFieldUpdateRequest.UserFieldCode}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var messageHeader = new CoreMessageHeader()
|
||||||
|
{
|
||||||
|
UpdateKey = coreApiMessagePersonUserField.MessageHeader.UpdateKey
|
||||||
|
};
|
||||||
|
|
||||||
|
var coreApiMessage = new CoreApiMessage<PersonUserFieldRequest>(messageHeader, personUserFieldUpdateRequest);
|
||||||
|
return await _personUserFieldDao.UpdatePersonUserField(coreApiMessage, person.PersonNumber, existingUserField.Id);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue updating a Persons UserField. " +
|
||||||
|
$"PersonNumber:{personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
throw new ServiceException($"There was an issue updating a Persons UserField. " +
|
||||||
|
$"PersonNumber:{personUserFieldUpdateRequest.PersonNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+70
@@ -0,0 +1,70 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class PropertyService : IPropertyService
|
||||||
|
{
|
||||||
|
private readonly IPropertyDao _propertyDao;
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
|
||||||
|
public PropertyService(IPropertyDao propertyDao, IAccountService accountService)
|
||||||
|
{
|
||||||
|
_propertyDao = propertyDao;
|
||||||
|
_accountService = accountService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Property>> GetAccountProperties(long accountNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.Collateral
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new AcctNbrRequest()
|
||||||
|
{
|
||||||
|
AcctNbr = accountNumber
|
||||||
|
};
|
||||||
|
var account = await _accountService.GetAccountDetails(coreRequestParameters, request);
|
||||||
|
|
||||||
|
List<Property> properties = new List<Property>();
|
||||||
|
foreach (var accountProperties in account.Properties)
|
||||||
|
{
|
||||||
|
var property = await GetProperty(accountProperties.PropertyNumber);
|
||||||
|
if (property != null)
|
||||||
|
{
|
||||||
|
properties.Add(property);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding accounts properties.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Property> GetProperty(long propertyNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _propertyDao.FindProperty(propertyNumber);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding property by propertyNumber. PropertyNumber: {propertyNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+105
@@ -0,0 +1,105 @@
|
|||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using Serilog;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class PropertyUserFieldService : IPropertyUserFieldService
|
||||||
|
{
|
||||||
|
private readonly IPropertyService _propertyService;
|
||||||
|
private readonly IPropertyUserFieldDao _propertyUserFieldDao;
|
||||||
|
public PropertyUserFieldService(IPropertyService propertyService, IPropertyUserFieldDao propertyUserFieldDao)
|
||||||
|
{
|
||||||
|
_propertyService = propertyService;
|
||||||
|
_propertyUserFieldDao = propertyUserFieldDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<CoreApiMessage<IEnumerable<PropertyUserField>>> GetPropertyUserFieldsAsync(long propertyNumber)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var includes = new List<string>() { RequestIncludeConstants.Standard };
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(includes);
|
||||||
|
var property = await _propertyService.GetProperty(propertyNumber);
|
||||||
|
return await _propertyUserFieldDao.FindPropertyUserFieldCoreApiResponseByPersonId(coreRequestParameters, property.PropertyNumber);
|
||||||
|
}
|
||||||
|
catch(Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue finding Property UserFields by id. PropertyNumber: {propertyNumber}");
|
||||||
|
throw new ServiceException($"There was an issue finding Property UserFields by id. PropertyNumber: {propertyNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> InsertPropertyUserFieldAsync(PropertyUserField propertyUserField)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var property = await _propertyService.GetProperty(propertyUserField.PropertyNumber);
|
||||||
|
|
||||||
|
if (property == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Property was null and is required. PropertyNumber: {propertyUserField.PropertyNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
UserFieldRequest request = new UserFieldRequest()
|
||||||
|
{
|
||||||
|
PropertyNumber = propertyUserField.PropertyNumber,
|
||||||
|
UserFieldCode = propertyUserField.UserFieldCode,
|
||||||
|
Value = propertyUserField.Value
|
||||||
|
};
|
||||||
|
|
||||||
|
return await _propertyUserFieldDao.InsertPropertyUserField(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue inserting a PropertyUserField. PropertyNumber:{propertyUserField.PropertyNumber}");
|
||||||
|
throw new ServiceException($"There was an issue inserting a PropertyUserField. PropertyNumber:{propertyUserField.PropertyNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<BasicResponse> UpdatePropertyUserFieldAsync(PropertyUserField propertyUserField)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var property = await _propertyService.GetProperty(propertyUserField.PropertyNumber);
|
||||||
|
if (property == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"Person was null and is required. PersonNumber: {propertyUserField.PropertyNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
var existingPropertyUserField = await GetPropertyUserFieldsAsync(propertyUserField.PropertyNumber);
|
||||||
|
|
||||||
|
if (existingPropertyUserField == null)
|
||||||
|
{
|
||||||
|
throw new NullReferenceException($"An existing userfield was null and is required. " +
|
||||||
|
$"PropertyNumber: {propertyUserField.PropertyNumber}, " +
|
||||||
|
$"UserFieldcode:{propertyUserField.UserFieldCode}");
|
||||||
|
}
|
||||||
|
|
||||||
|
UserFieldRequest request = new UserFieldRequest()
|
||||||
|
{
|
||||||
|
PropertyNumber = propertyUserField.PropertyNumber,
|
||||||
|
UserFieldCode = propertyUserField.UserFieldCode,
|
||||||
|
Value = propertyUserField.Value
|
||||||
|
};
|
||||||
|
return await _propertyUserFieldDao.UpdatePropertyUserField(request);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue updating a Property UserField. " +
|
||||||
|
$"PropertyNumber:{propertyUserField.PropertyNumber}");
|
||||||
|
throw new ServiceException($"There was an issue updating a Property UserField. " +
|
||||||
|
$"PropertyNumber:{propertyUserField.PropertyNumber}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Saf;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class SafService : ISafService
|
||||||
|
{
|
||||||
|
private readonly ISafDao _safDao;
|
||||||
|
public SafService(ISafDao safDao)
|
||||||
|
{
|
||||||
|
_safDao = safDao;
|
||||||
|
}
|
||||||
|
public async Task<IEnumerable<SafUser>> GetAllSafUsersCoreInfo()
|
||||||
|
{
|
||||||
|
return await _safDao.GetAllSafUsersCoreInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class TaxService : ITaxService
|
||||||
|
{
|
||||||
|
private readonly ITaxDao _taxDao;
|
||||||
|
|
||||||
|
public TaxService(ITaxDao taxDao)
|
||||||
|
{
|
||||||
|
_taxDao = taxDao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<PersonTaxIdDataResponse>> GetPersonsTaxIdData(string taxId)
|
||||||
|
{
|
||||||
|
var coreRequestParams = new CoreRequestParameters();
|
||||||
|
return await _taxDao.GetPersonTaxIdData(coreRequestParams, taxId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<OrganizationTaxIdDataResponse>> GetOrganizationsTaxIdData(string taxId)
|
||||||
|
{
|
||||||
|
var coreRequestParams = new CoreRequestParameters();
|
||||||
|
return await _taxDao.GetOrganizationTaxIdData(coreRequestParams, taxId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+232
@@ -0,0 +1,232 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.Constants;
|
||||||
|
using LCU.Library.Internal.Exceptions;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper.Services
|
||||||
|
{
|
||||||
|
public class TransactionService : ITransactionService
|
||||||
|
{
|
||||||
|
private readonly ITransactionDao _transactionDao;
|
||||||
|
private readonly IAccountService _accountService;
|
||||||
|
|
||||||
|
public TransactionService(ITransactionDao transactionDao, IAccountService accountService)
|
||||||
|
{
|
||||||
|
_transactionDao = transactionDao;
|
||||||
|
_accountService = accountService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<MonetaryTransactionResponse>> AddMonetaryTransactionsAsync(List<GroupedMonetaryTransactionRequest> groupedTransactions)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _transactionDao.AddMonetaryTransactions(groupedTransactions);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"Unable to save monetary transactions.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<TransactionHistory>> GetTransactionHistory(long accountNumber,
|
||||||
|
DateTime startDateRange,
|
||||||
|
DateTime endDateRange,
|
||||||
|
string[] transactionTypeCodes)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var listOfIncludes = new List<string>()
|
||||||
|
{
|
||||||
|
RequestIncludeConstants.AddSpecialIncludesCharacter(RequestIncludeConstants.Basic),
|
||||||
|
};
|
||||||
|
var coreRequestParameters = new CoreRequestParameters(listOfIncludes);
|
||||||
|
var request = new AcctNbrRequest()
|
||||||
|
{
|
||||||
|
AcctNbr = accountNumber
|
||||||
|
};
|
||||||
|
|
||||||
|
var account = await _accountService.GetAccountDetails(coreRequestParameters, request);
|
||||||
|
|
||||||
|
|
||||||
|
if (account?.Id == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var transactionHistory = await GetTransactionHistoryById(account.Id, startDateRange, endDateRange);
|
||||||
|
|
||||||
|
if (transactionHistory == null)
|
||||||
|
{
|
||||||
|
return new List<TransactionHistory>();
|
||||||
|
}
|
||||||
|
|
||||||
|
transactionHistory =
|
||||||
|
(
|
||||||
|
from transactions in transactionHistory
|
||||||
|
group transactions by transactions.TransactionNumber
|
||||||
|
into aggregatedMultilineTransactions
|
||||||
|
select new TransactionHistory
|
||||||
|
{
|
||||||
|
AccountNumber = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).AccountNumber,
|
||||||
|
ActivityDateTime = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).ActivityDateTime,
|
||||||
|
AllowCustomerView = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).AllowCustomerView,
|
||||||
|
Amount = aggregatedMultilineTransactions.Select(x => Math.Abs(x.Amount ?? 0)).ToArray().Max(),
|
||||||
|
BalanceAccountNumber = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).BalanceAccountNumber,
|
||||||
|
BalanceTypeDescription = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.BalanceTypeDescription,
|
||||||
|
CurrTransactionStatusCode = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.CurrTransactionStatusCode,
|
||||||
|
DueDate = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.DueDate,
|
||||||
|
EffectiveDate = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.EffectiveDate,
|
||||||
|
ExternalTransactionDescription = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.ExternalTransactionDescription,
|
||||||
|
Id = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.Id,
|
||||||
|
IsDisputedTransaction = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).IsDisputedTransaction,
|
||||||
|
OnlineCheckTraceNumber = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).OnlineCheckTraceNumber,
|
||||||
|
PostingDate = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.PostingDate,
|
||||||
|
RunningBalance = aggregatedMultilineTransactions.Min(x => x.RunningBalance),
|
||||||
|
TimeUniqueNumber = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null).TimeUniqueNumber,
|
||||||
|
TransactionHistoryDetail = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.TransactionHistoryDetail,
|
||||||
|
TransactionNumber = aggregatedMultilineTransactions.Key,
|
||||||
|
TransactionReference = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.TransactionReference,
|
||||||
|
TransactionStatusDescription = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.TransactionStatusDescription,
|
||||||
|
TransactionTypeCode = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.TransactionTypeCode,
|
||||||
|
TransactionTypeDescription = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.TransactionTypeDescription,
|
||||||
|
Uid = aggregatedMultilineTransactions.FirstOrDefault(x => x.PostingDate != null)?.Uid
|
||||||
|
}
|
||||||
|
).ToList();
|
||||||
|
|
||||||
|
transactionHistory = transactionTypeCodes?.Length > 0
|
||||||
|
? transactionHistory.Where(x => transactionTypeCodes.Contains(x.TransactionTypeCode)).OrderByDescending(x => x.TransactionNumber)
|
||||||
|
: transactionHistory;
|
||||||
|
|
||||||
|
return transactionHistory;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex, $"There was an issue finding Accounts Transaction History. AccountNumber:{accountNumber}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets Transactions History based on a DNA generated Account ID.
|
||||||
|
/// NOTE: This Id is not the account number and must be retrieved by DNA.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="generatedAccountid"></param>
|
||||||
|
/// <param name="fromDate"></param>
|
||||||
|
/// <param name="thruDate"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<IEnumerable<TransactionHistory>> GetTransactionHistoryById(string generatedAccountid,
|
||||||
|
DateTime fromDate,
|
||||||
|
DateTime thruDate)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var coreRequestParameters = new CoreRequestParameters();
|
||||||
|
var transactionHistoryRequest = new TransactionHistoryRequest()
|
||||||
|
{
|
||||||
|
FromDate = fromDate.ToString("yyyy-MM-dd"),
|
||||||
|
ThruDate = thruDate.ToString("yyyy-MM-dd"),
|
||||||
|
OnlyCompletedYN = TransactionConstants.OnlyCompletedYN,
|
||||||
|
SearchDateOption = TransactionConstants.SearchDateOption
|
||||||
|
};
|
||||||
|
|
||||||
|
return await _transactionDao.FindTransactionHistoryById(coreRequestParameters, transactionHistoryRequest, generatedAccountid);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Warning(ex,
|
||||||
|
$"There was an issue finding Accounts Transaction History. FromDate: {fromDate}, ThruDate: {thruDate}.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<ExternalDescription>> GetExternalDescriptionsWithSsn()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _transactionDao.FindExternalDescriptionsWithSsn();
|
||||||
|
}
|
||||||
|
catch(Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue finding External Transaction Descriptions with SSN.");
|
||||||
|
throw new ServiceException($"There was an issue finding External Transaction Descriptions with SSN.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<List<BasicResponse>> PostFundsToAccount(List<FundsToAccountRequest> requests)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _transactionDao.PostFundsToAccount(requests);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue posting Funds to Account");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasicResponse UpdateExternalDescription(ExternalDescription externalTransactionDescription)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_transactionDao.UpdateExternalDescription(externalTransactionDescription);
|
||||||
|
return new BasicResponse()
|
||||||
|
{
|
||||||
|
Success = true,
|
||||||
|
Errors = new List<string>()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
Log.Error(exception, $"There was an issue updating External Transaction Description.");
|
||||||
|
return new BasicResponse()
|
||||||
|
{
|
||||||
|
Success = false,
|
||||||
|
Errors = new List<string>()
|
||||||
|
{
|
||||||
|
$"There was an issue updating External Transaction Description. ExceptionMessage: {exception.Message}"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<TransactionAlertInfo>> GetTransactionsByDateSpan(DateTime startDateRange, DateTime endDateRange, string[] rtxnTypCdToExclude)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var hasRtxnTypCds = rtxnTypCdToExclude != null && rtxnTypCdToExclude.Any();
|
||||||
|
string rtxnTypCdQueryParam = TransactionConstants.RtxnTypCdEmptyValue;
|
||||||
|
string rtxnTypeCdValidate = TransactionConstants.RtxnTypCdEmptyValue;
|
||||||
|
|
||||||
|
if(hasRtxnTypCds)
|
||||||
|
{
|
||||||
|
rtxnTypCdQueryParam = TransactionConstants.RtxnTypeCodeString.Replace(TransactionConstants.RtxnTypCdReplaceConstant,
|
||||||
|
string.Join("','", rtxnTypCdToExclude));
|
||||||
|
rtxnTypeCdValidate = TransactionConstants.RtxnTypeCodeString.Replace(TransactionConstants.RtxnTypCdReplaceConstant,
|
||||||
|
string.Join("", rtxnTypCdToExclude));
|
||||||
|
}
|
||||||
|
|
||||||
|
return await _transactionDao.GetTransactionsByDateSpan(startDateRange,
|
||||||
|
endDateRange,
|
||||||
|
rtxnTypCdQueryParam,
|
||||||
|
rtxnTypeCdValidate);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error(ex, $"There was an issue Getting Transactions by DateSpan");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,254 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using Microsoft.OpenApi.Models;
|
||||||
|
using Oracle.ManagedDataAccess.Client;
|
||||||
|
using Serilog;
|
||||||
|
using LCU.Library.Internal.ApiSecurity;
|
||||||
|
using LCU.Library.Internal.ApiSecurity.Constants;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.Configuration;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperLib.DataAccess;
|
||||||
|
using LCU.Library.Internal.LcuHttpClient;
|
||||||
|
using LCU.Library.Internal.Logging;
|
||||||
|
using LCU.Library.Internal.Logging.Middleware;
|
||||||
|
using LCU.Library.Internal.Logging.Models;
|
||||||
|
using LCU.Library.Internal.Status;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Configuration;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapper;
|
||||||
|
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
Configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfiguration Configuration { get; }
|
||||||
|
readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddHttpClient();
|
||||||
|
services.AddLCUHttpServices();
|
||||||
|
services.AddMemoryCache();
|
||||||
|
|
||||||
|
var coreConfiguration = new CoreConfiguration();
|
||||||
|
Configuration.GetSection("CoreConfiguration").Bind(coreConfiguration);
|
||||||
|
services.AddSingleton(coreConfiguration);
|
||||||
|
|
||||||
|
var appConfig = new CoreApiWrapperConfig();
|
||||||
|
Configuration.GetSection("Primary").Bind(appConfig);
|
||||||
|
services.AddSingleton(appConfig);
|
||||||
|
|
||||||
|
var loggerConfiguration = new LoggingConfiguration(appConfig.AppName, appConfig.SeqApiKey, appConfig.SeqUrl);
|
||||||
|
var lcuLogging = new LcuLogging(loggerConfiguration);
|
||||||
|
lcuLogging.UseLcuLogging();
|
||||||
|
|
||||||
|
services.AddScoped<IDbConnection, OracleConnection>(c =>
|
||||||
|
{
|
||||||
|
var conn = new OracleConnection(coreConfiguration.CoreDbConfiguration.ConnectionString);
|
||||||
|
conn.KeepAlive = true;
|
||||||
|
conn.KeepAliveTime = 30;
|
||||||
|
conn.KeepAliveInterval = 5;
|
||||||
|
return conn;
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddCors(options =>
|
||||||
|
{
|
||||||
|
options.AddPolicy(MyAllowSpecificOrigins,
|
||||||
|
builder =>
|
||||||
|
{
|
||||||
|
builder.WithOrigins(
|
||||||
|
appConfig.CorsAllowedOrigins
|
||||||
|
)
|
||||||
|
.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddLCUStatusServicesWithApiHealthCheck(Configuration);
|
||||||
|
services.AddAutoMapper(typeof(Startup).Assembly);
|
||||||
|
AddCoreApiWrapperServices(ref services);
|
||||||
|
AddCoreApiWrapperLib(ref services);
|
||||||
|
|
||||||
|
services.AddApiKeySecurity(Configuration);
|
||||||
|
|
||||||
|
services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
|
||||||
|
services.AddSwaggerGen(c =>
|
||||||
|
{
|
||||||
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = $"{appConfig.AppName}", Version = "v1" });
|
||||||
|
|
||||||
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Id = HeaderKeys.ApiKey, // Must match the "AddSecurityDefinition"
|
||||||
|
Type = ReferenceType.SecurityScheme
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new List<string>()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
c.AddSecurityRequirement(new OpenApiSecurityRequirement
|
||||||
|
{
|
||||||
|
{
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Reference = new OpenApiReference
|
||||||
|
{
|
||||||
|
Id = HeaderKeys.Client, // Must match the "AddSecurityDefinition"
|
||||||
|
Type = ReferenceType.SecurityScheme
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new List<string>()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
c.AddSecurityDefinition(HeaderKeys.ApiKey,
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Description = HeaderKeys.ApiKey,
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Name = HeaderKeys.ApiKey,
|
||||||
|
Type = SecuritySchemeType.ApiKey,
|
||||||
|
Scheme = "apikey"
|
||||||
|
});
|
||||||
|
|
||||||
|
c.AddSecurityDefinition(HeaderKeys.Client,
|
||||||
|
new OpenApiSecurityScheme
|
||||||
|
{
|
||||||
|
Description = HeaderKeys.Client,
|
||||||
|
In = ParameterLocation.Header,
|
||||||
|
Name = HeaderKeys.Client,
|
||||||
|
Type = SecuritySchemeType.ApiKey,
|
||||||
|
Scheme = "apikey"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddCoreApiWrapperServices(ref IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddScoped<IAccountService, AccountService>();
|
||||||
|
services.AddScoped<IAccountHistoryService, AccountHistoryService>();
|
||||||
|
services.AddScoped<IAccountUserFieldService, AccountUserFieldService>();
|
||||||
|
services.AddScoped<IAccessChannelPersonsService, AccessChannelPersonsService>();
|
||||||
|
services.AddScoped<IAccessTypeService, AccessTypeService>();
|
||||||
|
services.AddScoped<IActivityService, ActivityService>();
|
||||||
|
services.AddScoped<IAddressService, AddressService>();
|
||||||
|
services.AddScoped<IApplicationHistoryService, ApplicationHistoryService>();
|
||||||
|
services.AddScoped<IAssociateService, AssociateService>();
|
||||||
|
services.AddScoped<IBranchService, BranchService>();
|
||||||
|
services.AddScoped<IAgreeService, AgreeService>();
|
||||||
|
services.AddScoped<IAgreePersonService, AgreePersonService>();
|
||||||
|
services.AddScoped<IIndividualService, IndividualService>();
|
||||||
|
services.AddScoped<ILoanService, LoanService>();
|
||||||
|
services.AddScoped<IMemberService, MemberService>();
|
||||||
|
services.AddScoped<IPersonService, PersonService>();
|
||||||
|
services.AddScoped<IPropertyService, PropertyService>();
|
||||||
|
services.AddScoped<IIndirectLoanService, IndirectLoanService>();
|
||||||
|
services.AddScoped<ISafService, SafService>();
|
||||||
|
services.AddScoped<ITransactionService, TransactionService>();
|
||||||
|
services.AddScoped<IOrganizationService, OrganizationService>();
|
||||||
|
services.AddScoped<ITaxService, TaxService>();
|
||||||
|
services.AddScoped<IPersonUserFieldService, PersonUserFieldService>();
|
||||||
|
services.AddScoped<IPropertyUserFieldService, PropertyUserFieldService>();
|
||||||
|
services.AddScoped<ILoanPayoffService, LoanPayoffService>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddCoreApiWrapperLib(ref IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddScoped<ICoreUserConnection, CoreUserConnection>();
|
||||||
|
services.AddScoped<ICoreServiceConnection, CoreServiceConnection>();
|
||||||
|
services.AddScoped<ICoreRequest, CoreRequest>();
|
||||||
|
services.AddScoped<ICoreDbExecution, CoreDbExecution>();
|
||||||
|
AddCoreApiWrapperDataAccess(ref services);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddCoreApiWrapperDataAccess(ref IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddScoped<IAccountDao, AccountDao>();
|
||||||
|
services.AddScoped<IAccountUserFieldDao, AccountUserFieldDao>();
|
||||||
|
services.AddScoped<IAccessChannelPersonsDao, AccessChannelPersonsDao>();
|
||||||
|
services.AddScoped<IAccessTypeDao, AccessTypeDao>();
|
||||||
|
services.AddScoped<IActivityDao, ActivityDao>();
|
||||||
|
services.AddScoped<IAddressDao, AddressDao>();
|
||||||
|
services.AddScoped<IApplicationHistoryDao, ApplicationHistoryDao>();
|
||||||
|
services.AddScoped<IAssociateDao, AssociateDao>();
|
||||||
|
services.AddScoped<IBranchDao, BranchDao>();
|
||||||
|
services.AddScoped<IAgreeDao, AgreeDao>();
|
||||||
|
services.AddScoped<IAgreePersonDao, AgreePersonDao>();
|
||||||
|
services.AddScoped<IPersonDao, PersonDao>();
|
||||||
|
services.AddScoped<IPropertyDao, PropertyDao>();
|
||||||
|
services.AddScoped<IIndirectLoanDao, IndirectLoanDao>();
|
||||||
|
services.AddScoped<ISafDao, SafDao>();
|
||||||
|
services.AddScoped<ITransactionDao, TransactionDao>();
|
||||||
|
services.AddScoped<ITaxDao, TaxDao>();
|
||||||
|
services.AddScoped<IOrganizationDao, OrganizationDao>();
|
||||||
|
services.AddScoped<IPersonUserFieldDao, PersonUserFieldDao>();
|
||||||
|
services.AddScoped<IPropertyUserFieldDao, PropertyUserFieldDao>();
|
||||||
|
services.AddScoped<ILoanPayoffDao, LoanPayoffDao>();
|
||||||
|
services.AddScoped<IAccountHistoryDao, AccountHistoryDao>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||||
|
{
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseSwagger(options =>
|
||||||
|
{
|
||||||
|
options.PreSerializeFilters.Add((doc, request) =>
|
||||||
|
{
|
||||||
|
const string prefixHeader = "X-Forwarded-Prefix";
|
||||||
|
|
||||||
|
if (!request.Headers.ContainsKey(prefixHeader))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var serverUrl = request.Headers[prefixHeader];
|
||||||
|
|
||||||
|
doc.Servers = new List<OpenApiServer>()
|
||||||
|
{
|
||||||
|
new()
|
||||||
|
{
|
||||||
|
Description = serverUrl,
|
||||||
|
Url = serverUrl
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("v1/swagger.json", "LCU.Api.Internal.CoreApiWrapper v1"));
|
||||||
|
|
||||||
|
app.UseMiddleware<RequestResponseLoggingMiddleware>();
|
||||||
|
app.UseSerilogRequestLogging(options =>
|
||||||
|
{
|
||||||
|
options.EnrichDiagnosticContext = RequestResponseLoggingMiddleware.RequestDataParser.EnrichFromRequest;
|
||||||
|
});
|
||||||
|
|
||||||
|
app.UseRouting();
|
||||||
|
app.UseCors(MyAllowSpecificOrigins);
|
||||||
|
app.UseAuthorization();
|
||||||
|
|
||||||
|
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
{
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"Primary": {
|
||||||
|
"AppName": "Core Api Wrapper",
|
||||||
|
"SeqUrl": "http://localhost:5080",
|
||||||
|
"SeqApiKey": "9MQu0vLDwQ1LCFzGixZM",
|
||||||
|
"CorsAllowedOrigins": [
|
||||||
|
"http://localhost:3000",
|
||||||
|
"http://lcu-internal.com",
|
||||||
|
"https://lcu-internal.com",
|
||||||
|
"https://qa-api.lcu-internal.com",
|
||||||
|
"https://uat-api.lcu-internal.com",
|
||||||
|
"https://api.lcu-internal.com",
|
||||||
|
"https://qa-repomanage.lcu-internal.com",
|
||||||
|
"https://qa-repoapi.lcu-internal.com",
|
||||||
|
"https://uat-repomanage.lcu-internal.com",
|
||||||
|
"https://uat-repoapi.lcu-internal.com",
|
||||||
|
"https://repomanage.lcu-internal.com",
|
||||||
|
"https://repoapi.lcu-internal.com"
|
||||||
|
],
|
||||||
|
"FeatureFlags": {
|
||||||
|
"DisableCoreDBWrite": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ApiHealthCheckConfiguration": {
|
||||||
|
"VaultStatusConfiguration": {
|
||||||
|
"RunVaultStatusCheck": true,
|
||||||
|
"EnvironmentFromVault": "",
|
||||||
|
"EnvironmentFromConfigmap": "local"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CoreConfiguration": {
|
||||||
|
"CoreApiConfiguration": {
|
||||||
|
"HostUrl": "UATapi.dna.lcu-internal.com",
|
||||||
|
"HostPort": "10005",
|
||||||
|
"GrantType": "password",
|
||||||
|
"Scope": "offline_access",
|
||||||
|
"SeviceAccountId": "AService",
|
||||||
|
"DeviceName": "FULL",
|
||||||
|
"RelyingPassword": "Azure-Key-Vault",
|
||||||
|
"ServiceApiChannelId": "10E26C39135E40428929D7D3BA041214",
|
||||||
|
"ReTryLimit": 2,
|
||||||
|
"CoreEndPointConfiguration": {
|
||||||
|
"ServiceToken": "/StsIdentityServices/api/ServiceToken",
|
||||||
|
"StsToken": "/StsIdentityServices/api/saftoken/post",
|
||||||
|
"Prelogin": "/DNABusinessServices/Prelogin/execute?include=limited",
|
||||||
|
"DnaToken": "/DNABusinessservices/Login/Execute?Include=Standard",
|
||||||
|
"OrganizationQuerySearch": "/DNABusinessServices/Organizations/Query/OrganizationSearch",
|
||||||
|
"PersonsQueryName": "/DNABusinessServices/Persons/Query/Name",
|
||||||
|
"PersonsQuerySearch": "/DNABusinessServices/Persons/Query/PersonSearch",
|
||||||
|
"PersonsQueryMemberAgreementNbr": "/DNABusinessServices/Persons/Query/MemberAgreementNbr",
|
||||||
|
"PersonUserFields": "/DNABusinessServices/Persons/{PersonId}/UserFields",
|
||||||
|
"PropertyUserFields": "/DNABusinessServices/Properties/{PropertyId}/UserFields",
|
||||||
|
"PutPropertyUserField": "/DNABusinessServices/Properties/{PropertyId}/UserFields/{UserFieldId}",
|
||||||
|
"PutPersonUserField": "/DNABusinessServices/Persons/{PersonId}/UserFields/{UserFieldId}",
|
||||||
|
"AccountsQueryMemberAgreement": "/DNABusinessServices/Accounts/Query/MemberAgreement",
|
||||||
|
"AccountsQueryAccountDetail": "/DNABusinessServices/Accounts/Query/AccountDetail",
|
||||||
|
"AccountsTransactionHistoryQueryAccountNumber": "/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber",
|
||||||
|
"AccountsCollateral": "/DNABusinessServices/Accounts/{AccountId}/Collateral",
|
||||||
|
"PutAccountUserField": "/DNABusinessServices/Accounts/{AccountId}/UserFields/{UserFieldId}",
|
||||||
|
"AccountUserFields": "/DNABusinessServices/Accounts/{AccountId}/UserFields",
|
||||||
|
"GetAddressAddressId": "/DNABusinessServices/Addresses/{AddressId}",
|
||||||
|
"PutAddressAddressId": "/DNABusinessServices/Addresses/{AddressId}",
|
||||||
|
"AccessChannelPersonsByPerson": "/DNABusinessServices/AccessChannelPersons/Query/ByPerson",
|
||||||
|
"AccessChannelPersonsAccessChannelPersonId": "/DNABusinessServices/AccessChannelPersons/{AccessChannelPersonId}",
|
||||||
|
"AccessChannelPersonsAccessTypes": "/DNABusinessServices/AccessChannelPersons/{AccessChannelPersonId}/AccessTypes/{AccessTypeId}",
|
||||||
|
"PersonPostalAddress": "/DNABusinessServices/Persons/{PersonId}/PostalAddresses/{PostalAddressId}",
|
||||||
|
"PersonPostalAddresses": "/DNABusinessServices/Persons/{PersonId}/PostalAddresses",
|
||||||
|
"PersonAddressLine": "/DNABusinessServices/Persons/{PersonId}/PostalAddresses/{AddressUseCode}",
|
||||||
|
"PropertyById": "/DNABusinessServices/Properties/{PropertyId}",
|
||||||
|
"Branches": "/DNABusinessServices/Branches",
|
||||||
|
"OrganizationsQueryMemberAgreementNbr": "/DNABusinessServices/Organizations/Query/MemberAgreementNbr",
|
||||||
|
"GetPersonsDataByTaxId": "/DNABusinessServices/Persons/Query/TaxId",
|
||||||
|
"GetOrganizationsDataByTaxId": "/DNABusinessServices/Organizations/Query/TaxId"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CoreSoapApiConfiguration": {
|
||||||
|
"CoreSoapApiWrapperHost": "qa-core-soap-api-wrapper-api.apps.azure.lcu-internal.com",
|
||||||
|
"CoreSoapEndpointConfiguration": {
|
||||||
|
"PutAccountMaintenanceRequest": "/api/core/Account/AccountMaintenanceRequest",
|
||||||
|
"PostMonetaryTransactions": "/api/core/MonetaryTransaction/PostMonetaryTransactions",
|
||||||
|
"PostFundsToAccount": "/api/core/MonetaryTransaction/PostFundsToAccount",
|
||||||
|
"PutDealerOriginalBalance": "/api/core/IndirectLoan/PutDealerOriginalBalance",
|
||||||
|
"PutPersonAgreementsDetailTypes": "/api/core/PersonAgreement/PutPersonAgreementsDetailTypes",
|
||||||
|
"PutAccountBranchUpdateRequest": "/api/core/Account/AccountBranchUpdateRequest",
|
||||||
|
"PutAccountAnalysisGroupMaintenanceRequest": "/api/core/Account/AccountAnalysisGroupMaintenanceRequest",
|
||||||
|
"PutAccountLtvUpdateRequest": "/api/core/Account/AccountLtvUpdateRequest",
|
||||||
|
"PostPersonAccount": "/api/core/Account/PersonAccountRequest",
|
||||||
|
"PostOrganizationAccount": "/api/core/Account/OrganizationAccountRequest",
|
||||||
|
"PutOrganizationMaintenanceRequest": "/api/core/Account/OrganizationMaintenanceRequest",
|
||||||
|
"PutAccountNickNameUpdateRequest": "/api/core/Account/AccountNickNameUpdateRequest",
|
||||||
|
"PutAccountCreditReportTypeUpdateRequest": "/api/core/Account/AccountCreditReportTypeRequest",
|
||||||
|
"PostPropertyUserField": "/api/core/CollateralMaintenance/PostCollateralMaintenance",
|
||||||
|
"PutPropertyUserField": "/api/core/CollateralMaintenance/PutCollateralMaintenance",
|
||||||
|
"PutAccountContractDateUpdateRequest": "/api/core/Account/AccountContractDateUpdateRequest"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CoreDbconfiguration": {
|
||||||
|
"ConnectionString": "SECRET",
|
||||||
|
"CommandTimeout": 60
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ApiSecurityConfiguration": {
|
||||||
|
"ApiKeyAuthenticationFailureBehavior": "Error",
|
||||||
|
"ExternalApiKeySet": {
|
||||||
|
"DataCleanUp": "772e2926-78b5-4884-88da-73e2c23fad71",
|
||||||
|
"MembershipPreferences": "85c3f03b-f412-4f8d-bc1e-438a7a69cbbe",
|
||||||
|
"ReserveManagementSystem": "acc864cf-c05b-49c8-a4e6-1c53baed0503",
|
||||||
|
"RemoteDepositCapture": "e1417129-4c53-4133-a71e-c03e7924b18b",
|
||||||
|
"TemenosActionHandler": "5529dbfe-15a9-4e79-b7e1-16ab8ca0e657"
|
||||||
|
},
|
||||||
|
"InternalApiKeySet": {
|
||||||
|
"CoreApiWrapper": "66d55bb9-78e4-458d-b467-30cea0495fb9",
|
||||||
|
"CoreSoapApiWrapper": "55ffc97e-aead-4baf-acae-27723257db95"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<IsTestProject>true</IsTestProject>
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.4" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
|
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LCU.Library.Internal.CoreApiWrapperLib\LCU.Library.Internal.CoreApiWrapperLib.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="test_appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"AllowedHosts": "*",
|
||||||
|
"Primary": {
|
||||||
|
"AppName": "",
|
||||||
|
"SeqUrl": "",
|
||||||
|
"SeqApiKey": "",
|
||||||
|
"CorsAllowedOrigins": [
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"CoreConfiguration": {
|
||||||
|
"CoreApiConfiguration": {
|
||||||
|
"HostUrl": "",
|
||||||
|
"HostPort": "",
|
||||||
|
"GrantType": "",
|
||||||
|
"Scope": "",
|
||||||
|
"SeviceAccountId": "",
|
||||||
|
"DeviceName": "",
|
||||||
|
"RelyingPassword": "",
|
||||||
|
"ServiceApiChannelId": "",
|
||||||
|
"ReTryLimit": 2,
|
||||||
|
"CoreEndPointConfiguration": {
|
||||||
|
"ServiceToken": "/StsIdentityServices/api/ServiceToken",
|
||||||
|
"StsToken": "/StsIdentityServices/api/saftoken/post",
|
||||||
|
"Prelogin": "/DNABusinessServices/Prelogin/execute?include=limited",
|
||||||
|
"DnaToken": "/DNABusinessservices/Login/Execute?Include=Standard",
|
||||||
|
"PersonsQueryName": "/DNABusinessServices/Persons/Query/Name",
|
||||||
|
"PersonsQuerySearch": "/DNABusinessServices/Persons/Query/PersonSearch",
|
||||||
|
"PersonsQueryMemberAgreementNbr": "/DNABusinessServices/Persons/Query/MemberAgreementNbr",
|
||||||
|
"AccountsQueryMemberAgreement": "/DNABusinessServices/Accounts/Query/MemberAgreement",
|
||||||
|
"AccountsQueryAccountDetail": "/DNABusinessServices/Accounts/Query/AccountDetail",
|
||||||
|
"AccountsTransactionHistoryQueryAccountNumber": "/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber",
|
||||||
|
"AccountsCollateral": "/DNABusinessServices/Accounts/{AccountId}/Collateral",
|
||||||
|
"PutAccountUserField": "/DNABusinessServices/Accounts/{AccountId}/UserFields/{UserFieldId}",
|
||||||
|
"AccountUserFields": "/DNABusinessServices/Accounts/{AccountId}/UserFields",
|
||||||
|
"GetAddressAddressId": "/DNABusinessServices/Addresses/{AddressId}",
|
||||||
|
"PutAddressAddressId": "/DNABusinessServices/Addresses/{AddressId}",
|
||||||
|
"PropertyById": "/DNABusinessServices/Properties/{PropertyId}",
|
||||||
|
"Branches": "/DNABusinessServices/Branches"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CoreSoapApiConfiguration": {
|
||||||
|
"CoreSoapApiWrapperHost": "localhost:44329",
|
||||||
|
"CoreSoapEndpointConfiguration": {
|
||||||
|
"GetAccountByAccountNumber": "/api/core/Account/{AccountNumber}/GetAccountByAccountNumber"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"CoreDbconfiguration": {
|
||||||
|
"UserId": "",
|
||||||
|
"Password": "",
|
||||||
|
"Hostname": "",
|
||||||
|
"Port": "",
|
||||||
|
"Servicename": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+129
@@ -0,0 +1,129 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Controllers;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers
|
||||||
|
{
|
||||||
|
public class AccessChannelPersonsControllerTest
|
||||||
|
{
|
||||||
|
private AccessChannelPersonsController _accessChannelPersonsController;
|
||||||
|
private Mock<IAccessChannelPersonsService> _mockAccessChannelPersonsService;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_mockAccessChannelPersonsService = new Mock<IAccessChannelPersonsService>();
|
||||||
|
_accessChannelPersonsController = new AccessChannelPersonsController(_mockAccessChannelPersonsService.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccessChannelPersons_OK()
|
||||||
|
{
|
||||||
|
var response = new List<AccessChannelPerson>()
|
||||||
|
{
|
||||||
|
new AccessChannelPerson()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
UserId = "3"
|
||||||
|
},
|
||||||
|
new AccessChannelPerson()
|
||||||
|
{
|
||||||
|
ChannelNumber = 4,
|
||||||
|
PersonNumber = 25,
|
||||||
|
UserId = "6"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var coreMessageHeader = new CoreMessageHeader(323000000000);
|
||||||
|
var coreApiMessage = new CoreApiMessage<IEnumerable<AccessChannelPerson>>(coreMessageHeader, response);
|
||||||
|
|
||||||
|
_mockAccessChannelPersonsService.Setup(x => x.GetAccessChannelPersonCoreApiResponseAsync(It.IsAny<AccessChannelPersonsByPersonRequest>()))
|
||||||
|
.ReturnsAsync(coreApiMessage);
|
||||||
|
|
||||||
|
var request = new AccessChannelPersonsByPersonRequest()
|
||||||
|
{
|
||||||
|
PersonNumber = 2
|
||||||
|
};
|
||||||
|
var results = await _accessChannelPersonsController.Get(request);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccessChannelPersons_Exception()
|
||||||
|
{
|
||||||
|
_mockAccessChannelPersonsService.Setup(x => x.GetAccessChannelPersonCoreApiResponseAsync(It.IsAny<AccessChannelPersonsByPersonRequest>()))
|
||||||
|
.Throws(new Exception("Oops"));
|
||||||
|
|
||||||
|
var request = new AccessChannelPersonsByPersonRequest()
|
||||||
|
{
|
||||||
|
PersonNumber = 2
|
||||||
|
};
|
||||||
|
var results = await _accessChannelPersonsController.Get(request);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccessChannelPerson_OK()
|
||||||
|
{
|
||||||
|
var response = new AccessChannelPerson()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
UserId = "3"
|
||||||
|
};
|
||||||
|
_mockAccessChannelPersonsService.Setup(x => x.UpdateAccessChannelPersonAsync(It.IsAny<AccessChannelPerson>(),
|
||||||
|
It.IsAny<long>()))
|
||||||
|
.ReturnsAsync(response);
|
||||||
|
|
||||||
|
var request = new AccessChannelPerson()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
UserId = "3"
|
||||||
|
};
|
||||||
|
var results = await _accessChannelPersonsController.Put(request, 343432432400000000);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccessChannelPerson_Exception()
|
||||||
|
{
|
||||||
|
_mockAccessChannelPersonsService.Setup(x => x.UpdateAccessChannelPersonAsync(It.IsAny<AccessChannelPerson>(),
|
||||||
|
It.IsAny<long>()))
|
||||||
|
.Throws(new Exception("Oops"));
|
||||||
|
|
||||||
|
var request = new AccessChannelPerson()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
UserId = "3"
|
||||||
|
};
|
||||||
|
var results = await _accessChannelPersonsController.Put(request, 343432432400000000);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+86
@@ -0,0 +1,86 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Controllers;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers
|
||||||
|
{
|
||||||
|
public class AccessTypeControllerTest
|
||||||
|
{
|
||||||
|
private AccessTypeController _accessTypeController;
|
||||||
|
private Mock<IAccessTypeService> _mockAccessTypeService;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_mockAccessTypeService = new Mock<IAccessTypeService>();
|
||||||
|
_accessTypeController = new AccessTypeController(_mockAccessTypeService.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccessType_OK()
|
||||||
|
{
|
||||||
|
var response = new AccessType()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
Id = "WWW"
|
||||||
|
};
|
||||||
|
_mockAccessTypeService.Setup(x => x.UpdateAccessTypeAsync(It.IsAny<AccessTypeUpdateRequest>()))
|
||||||
|
.ReturnsAsync(response);
|
||||||
|
|
||||||
|
var request = new AccessTypeUpdateRequest()
|
||||||
|
{
|
||||||
|
AccessType = new AccessType()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
Id = "WWW"
|
||||||
|
},
|
||||||
|
UpdateKey = 12321312312,
|
||||||
|
AccessChannelPersonId = "1_2"
|
||||||
|
|
||||||
|
};
|
||||||
|
var results = await _accessTypeController.Put(request);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccessChannelPerson_Exception()
|
||||||
|
{
|
||||||
|
_mockAccessTypeService.Setup(x => x.UpdateAccessTypeAsync(It.IsAny<AccessTypeUpdateRequest>()))
|
||||||
|
.Throws(new Exception("Oops"));
|
||||||
|
|
||||||
|
var request = new AccessTypeUpdateRequest()
|
||||||
|
{
|
||||||
|
AccessType = new AccessType()
|
||||||
|
{
|
||||||
|
ChannelNumber = 1,
|
||||||
|
PersonNumber = 2,
|
||||||
|
Id = "WWW"
|
||||||
|
},
|
||||||
|
UpdateKey = 12321312312,
|
||||||
|
AccessChannelPersonId = "1_2"
|
||||||
|
|
||||||
|
};
|
||||||
|
var results = await _accessTypeController.Put(request);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+621
@@ -0,0 +1,621 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Controllers;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Account;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers
|
||||||
|
{
|
||||||
|
public class AccountControllerTest
|
||||||
|
{
|
||||||
|
private AccountController _accountController;
|
||||||
|
private Mock<IAccountService> _mockAccountService;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_mockAccountService = new Mock<IAccountService>();
|
||||||
|
_accountController = new AccountController(_mockAccountService.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountMaintenanceRequest_OK()
|
||||||
|
{
|
||||||
|
var accountMaintenanceRequest = new List<AccountMaintenanceRequest>
|
||||||
|
{
|
||||||
|
new() {
|
||||||
|
AccountNumber = 123,
|
||||||
|
DeliveryMethod = "PRNT"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _accountController.AccountMaintenanceRequest(accountMaintenanceRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.PutAccountMaintenanceRequest(accountMaintenanceRequest), Times.Once);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountMaintenanceRequest_Exception()
|
||||||
|
{
|
||||||
|
var accountMaintenanceRequest = new List<AccountMaintenanceRequest>
|
||||||
|
{
|
||||||
|
new() {
|
||||||
|
AccountNumber = 123,
|
||||||
|
DeliveryMethod = "PRNT"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.PutAccountMaintenanceRequest(accountMaintenanceRequest)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.AccountMaintenanceRequest(accountMaintenanceRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetActivityAccountDetailsByAccountNumber_OK()
|
||||||
|
{
|
||||||
|
_mockAccountService.Setup(x => x.GetActivityAccountDetailsByAccountNumbers(It.IsAny<List<long>>()))
|
||||||
|
.ReturnsAsync(new List<ActivityAccountDetails>()
|
||||||
|
{
|
||||||
|
new() { AccountNumber = 1 },
|
||||||
|
new() { AccountNumber = 1 },
|
||||||
|
new() { AccountNumber = 1 },
|
||||||
|
});
|
||||||
|
|
||||||
|
var res = await _accountController.GetActivityAccountDetailsByAccountNumber(new ActivityAccountDetailsRequest() { AccountNumbers = new List<long>(){1, 2, 3 }});
|
||||||
|
Assert.NotNull(res);
|
||||||
|
var okres = res as OkObjectResult;
|
||||||
|
Assert.NotNull(okres);
|
||||||
|
Assert.AreEqual(200, okres.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetActivityAccountDetailsByAccountNumber_Exception()
|
||||||
|
{
|
||||||
|
_mockAccountService.Setup(x => x.GetActivityAccountDetailsByAccountNumbers(It.IsAny<List<long>>())).ThrowsAsync(new Exception("Oops"));
|
||||||
|
var res = await _accountController.GetActivityAccountDetailsByAccountNumber(
|
||||||
|
(new ActivityAccountDetailsRequest() { AccountNumbers = new List<long>() { 1, 2, 3 } }));
|
||||||
|
Assert.NotNull(res);
|
||||||
|
var badRes = res as StatusCodeResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetOwnersByAccountNumber_OK()
|
||||||
|
{
|
||||||
|
var accountNumber = 12345;
|
||||||
|
var createdDate = new DateTime(1900, 1, 1);
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetOwnersByAccountNumber(accountNumber, createdDate)).ReturnsAsync(
|
||||||
|
new List<AccountOwnership>() {
|
||||||
|
new ()
|
||||||
|
{
|
||||||
|
IsPrimaryOwner = true,
|
||||||
|
PersonNumber = 12345,
|
||||||
|
ByOrgNbr = 45678
|
||||||
|
},
|
||||||
|
new ()
|
||||||
|
{
|
||||||
|
IsPrimaryOwner = false,
|
||||||
|
PersonNumber = 09876,
|
||||||
|
ByOrgNbr = 98765
|
||||||
|
},
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetOwnersByAccountNumber(accountNumber, createdDate.ToShortDateString());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
|
||||||
|
var result = okResult.Value as List<AccountOwnership>;
|
||||||
|
Assert.NotNull(result);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetOwnersByAccountNumber_NoContent()
|
||||||
|
{
|
||||||
|
var accountNumber = 12345;
|
||||||
|
var createdDate = new DateTime(1900, 1, 1);
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetOwnersByAccountNumber(accountNumber, createdDate)).ReturnsAsync((List<AccountOwnership>)null).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetOwnersByAccountNumber(accountNumber, createdDate.ToShortDateString());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var noContentResult = results as NoContentResult;
|
||||||
|
Assert.NotNull(noContentResult);
|
||||||
|
Assert.AreEqual(204, noContentResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetOwnersByAccountNumber_Error_StatusServerError()
|
||||||
|
{
|
||||||
|
var accountNumber = 12345;
|
||||||
|
var createdDate = new DateTime(1900, 1, 1);
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetOwnersByAccountNumber(accountNumber, createdDate)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetOwnersByAccountNumber(accountNumber, createdDate.ToShortDateString());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as StatusCodeResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetOwnersByAccountNumber_Null_BadRequest()
|
||||||
|
{
|
||||||
|
var accountNumber = 12345;
|
||||||
|
var createdDate = "Not a date";
|
||||||
|
|
||||||
|
var results = await _accountController.GetOwnersByAccountNumber(accountNumber, createdDate);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.GetOwnersByAccountNumber(It.IsAny<long>(), It.IsAny<DateTime>()), Times.Never());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRequest = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRequest);
|
||||||
|
Assert.AreEqual(400, badRequest.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByPersonName_OK()
|
||||||
|
{
|
||||||
|
var personName = "Pete Peterson";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByPersonName(personName)).ReturnsAsync(
|
||||||
|
new List<AccountOwnership>() {
|
||||||
|
new ()
|
||||||
|
{
|
||||||
|
IsPrimaryOwner = true,
|
||||||
|
FirstName = "Pete",
|
||||||
|
LastName = "Peterson"
|
||||||
|
}
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
|
||||||
|
var result = okResult.Value as List<AccountOwnership>;
|
||||||
|
Assert.NotNull(result);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByPersonName_NoContent()
|
||||||
|
{
|
||||||
|
var personName = "Pete Peterson";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByPersonName(personName)).ReturnsAsync((List<AccountOwnership>)null).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var noContentResult = results as NoContentResult;
|
||||||
|
Assert.NotNull(noContentResult);
|
||||||
|
Assert.AreEqual(204, noContentResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByPersonName_Error_StatusServerError()
|
||||||
|
{
|
||||||
|
var personName = "Pete Peterson";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByPersonName(personName)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as StatusCodeResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByPersonName_Null_BadRequest()
|
||||||
|
{
|
||||||
|
var personName = "";
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByPersonName(personName);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.GetPrimaryOwnersByPersonName(It.IsAny<string>()), Times.Never());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRequest = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRequest);
|
||||||
|
Assert.AreEqual(400, badRequest.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByOrganizationName_OK()
|
||||||
|
{
|
||||||
|
var organizationName = "The Big Company";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByOrganizationName(organizationName)).ReturnsAsync(
|
||||||
|
new List<AccountOwnership>() {
|
||||||
|
new ()
|
||||||
|
{
|
||||||
|
IsPrimaryOwner = true,
|
||||||
|
OrganizationName = "The Big Company"
|
||||||
|
}
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
|
||||||
|
var result = okResult.Value as List<AccountOwnership>;
|
||||||
|
Assert.NotNull(result);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByOrganizationName_NoContent()
|
||||||
|
{
|
||||||
|
var organizationName = "The Big Company";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByOrganizationName(organizationName)).ReturnsAsync((List<AccountOwnership>)null).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var noContentResult = results as NoContentResult;
|
||||||
|
Assert.NotNull(noContentResult);
|
||||||
|
Assert.AreEqual(204, noContentResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByOrganizationName_Error_StatusServerError()
|
||||||
|
{
|
||||||
|
var organizationName = "The Big Company";
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetPrimaryOwnersByOrganizationName(organizationName)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as StatusCodeResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPrimaryOwnersByOrganizationName_Null_BadRequest()
|
||||||
|
{
|
||||||
|
var organizationName = "";
|
||||||
|
|
||||||
|
var results = await _accountController.GetPrimaryOwnersByOrganizationName(organizationName);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.GetPrimaryOwnersByOrganizationName(It.IsAny<string>()), Times.Never());
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRequest = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRequest);
|
||||||
|
Assert.AreEqual(400, badRequest.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountsForGroupMaintenance_OK()
|
||||||
|
{
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountsForGroupAnalysisMaintenance()).ReturnsAsync(
|
||||||
|
new List<string>() {
|
||||||
|
"1111111",
|
||||||
|
"22222222"
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetAccountsForGroupAnalysisMaintenance();
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
|
||||||
|
var result = okResult.Value as List<string>;
|
||||||
|
Assert.NotNull(result);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountsForGroupMaintenance_Error_StatusServerError()
|
||||||
|
{
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountsForGroupAnalysisMaintenance()).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetAccountsForGroupAnalysisMaintenance();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task UpdateAccountGroupMaintenanceRequest_OK()
|
||||||
|
{
|
||||||
|
var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
IsGenerateAnalysisStatement = true,
|
||||||
|
IsPrintAnalysisStatement = true,
|
||||||
|
IsUseForServiceCharge = true
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _accountController.PutAccountAnalysisGroup(accountAnalysisGroupMaintenanceRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.UpdateAccountAnalysisMaintenance(accountAnalysisGroupMaintenanceRequest), Times.Once);
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task UpdateAccountGroupMaintenanceRequest_Exception()
|
||||||
|
{
|
||||||
|
var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
IsGenerateAnalysisStatement = true,
|
||||||
|
IsPrintAnalysisStatement = true,
|
||||||
|
IsUseForServiceCharge = true
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.UpdateAccountAnalysisMaintenance(accountAnalysisGroupMaintenanceRequest)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.PutAccountAnalysisGroup(accountAnalysisGroupMaintenanceRequest);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountNickNameUpdateRequest_OK()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountNickNameUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
AccountDescription = "TestOk"
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _accountController.PutAccountNickNameUpdateRequest(accountRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.UpdateAccountNickName(accountRequest), Times.Once);
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetPersonNumberByAccountNumber_OK()
|
||||||
|
{
|
||||||
|
long accountNumber = 1234;
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(accountNumber)).ReturnsAsync(
|
||||||
|
new Account() {
|
||||||
|
AccountNumber = 1234,
|
||||||
|
ReportingForPersonNumber = 5678
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
|
||||||
|
var results = await _accountController.GetAccountByAccountNumber(accountNumber);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.GetAccountDetailsByAccountNumber(accountNumber), Times.Once);
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountNickNameUpdateRequest_Exception()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountNickNameUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
AccountDescription = "TestError"
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.UpdateAccountNickName(accountRequest)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.PutAccountNickNameUpdateRequest(accountRequest);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountCreditReportTypeUpdateRequest_OK()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountCreditReportTypeUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
CreditReportType = "EXCL"
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _accountController.PutAccountCreditReportType(accountRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.UpdateAccountCreditReportType(accountRequest), Times.Once);
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountCreditReportTypeUpdateRequest_Exception()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountCreditReportTypeUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
CreditReportType = "EXCL"
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.UpdateAccountCreditReportType(accountRequest)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.PutAccountCreditReportType(accountRequest);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountByAccountNumber_Exception()
|
||||||
|
{
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(1000L)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.GetAccountByAccountNumber(1000L);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountByAccountNumber_Ok()
|
||||||
|
{
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(1000L)).ReturnsAsync(
|
||||||
|
new Account()
|
||||||
|
{
|
||||||
|
AccountNumber = 1000L,
|
||||||
|
|
||||||
|
}).Verifiable();
|
||||||
|
var results = await _accountController.GetAccountByAccountNumber(1000L);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var goodResult = results as ObjectResult;
|
||||||
|
Assert.NotNull(goodResult);
|
||||||
|
Assert.AreEqual(200, goodResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountByMajorMinorBranchAndStatus_Ok()
|
||||||
|
{
|
||||||
|
var request = new AccountsByMajorMinorBranchAndStatusRequest()
|
||||||
|
{
|
||||||
|
BranchCodes = new List<long>()
|
||||||
|
{
|
||||||
|
1234,
|
||||||
|
1235
|
||||||
|
},
|
||||||
|
AccountStatuses = new List<string>()
|
||||||
|
{
|
||||||
|
"Status"
|
||||||
|
},
|
||||||
|
MajorTypes = new List<string>()
|
||||||
|
{
|
||||||
|
"Major"
|
||||||
|
},
|
||||||
|
MinorTypes = new List<string>()
|
||||||
|
{
|
||||||
|
"MinorOne",
|
||||||
|
"MinorTwo"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountsByMajorMinorBranchAndStatus(request)).ReturnsAsync(
|
||||||
|
new List<AccountsByMajorMinorBranchAndStatusResponse>()
|
||||||
|
{
|
||||||
|
new AccountsByMajorMinorBranchAndStatusResponse()
|
||||||
|
{
|
||||||
|
AccountNumber = 123456789,
|
||||||
|
BranchCode = 1310,
|
||||||
|
Name = "Test Testerson"
|
||||||
|
}
|
||||||
|
}).Verifiable();
|
||||||
|
|
||||||
|
var results = await _accountController.GetAccountsByMajorMinorBranchAndStatus(request);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var goodResult = results as ObjectResult;
|
||||||
|
Assert.NotNull(goodResult);
|
||||||
|
Assert.AreEqual(200, goodResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task GetAccountByMajorMinorBranchAndStatus_Exception()
|
||||||
|
{
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.GetAccountsByMajorMinorBranchAndStatus(It.IsAny<AccountsByMajorMinorBranchAndStatusRequest>())).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.GetAccountsByMajorMinorBranchAndStatus(new AccountsByMajorMinorBranchAndStatusRequest());
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountContractDateUpdateRequest_OK()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountContractDateUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
ContractDate = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
var results = await _accountController.PutAccountContractDateUpdateRequest(accountRequest);
|
||||||
|
|
||||||
|
_mockAccountService.Verify(x => x.UpdateAccountContractDate(accountRequest), Times.Once);
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task AccountContractDateUpdateRequest_Exception()
|
||||||
|
{
|
||||||
|
var accountRequest = new AccountContractDateUpdateRequest
|
||||||
|
{
|
||||||
|
AccountNumber = 123,
|
||||||
|
ContractDate = DateTime.Now
|
||||||
|
};
|
||||||
|
|
||||||
|
_mockAccountService.Setup(x => x.UpdateAccountContractDate(accountRequest)).Throws(new Exception("Oops")).Verifiable();
|
||||||
|
var results = await _accountController.PutAccountContractDateUpdateRequest(accountRequest);
|
||||||
|
_mockAccountService.Verify();
|
||||||
|
|
||||||
|
var badRes = results as ObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(500, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+176
@@ -0,0 +1,176 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Moq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Controllers;
|
||||||
|
using LCU.Api.Internal.CoreApiWrapper.Services;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests;
|
||||||
|
using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts;
|
||||||
|
|
||||||
|
namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers
|
||||||
|
{
|
||||||
|
public class AccountUserFieldControllerTest
|
||||||
|
{
|
||||||
|
private AccountUserFieldController _accountUserFieldController;
|
||||||
|
private Mock<IAccountUserFieldService> _mockAccountUserFieldService;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
_mockAccountUserFieldService = new Mock<IAccountUserFieldService>();
|
||||||
|
_accountUserFieldController = new AccountUserFieldController(_mockAccountUserFieldService.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccountUserFields_OK()
|
||||||
|
{
|
||||||
|
var accountUserField1 = new AccountUserField()
|
||||||
|
{
|
||||||
|
Id = "TEST1",
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "N"
|
||||||
|
};
|
||||||
|
var accountUserField2 = new AccountUserField()
|
||||||
|
{
|
||||||
|
Id = "TEST2",
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "Y"
|
||||||
|
};
|
||||||
|
_mockAccountUserFieldService.Setup(x => x.UpdateAccountUserFieldsAsync(It.IsAny<List<AccountUserFieldRequest>>())).ReturnsAsync(
|
||||||
|
new List<AccountUserField>()
|
||||||
|
{
|
||||||
|
accountUserField1,
|
||||||
|
accountUserField2
|
||||||
|
});
|
||||||
|
|
||||||
|
var accountUserFieldUpdateRequest = new List<AccountUserFieldRequest>()
|
||||||
|
{
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "Y"
|
||||||
|
},
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "N"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var results = await _accountUserFieldController.Put(accountUserFieldUpdateRequest);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PutAccountUserFields_Exception()
|
||||||
|
{
|
||||||
|
_mockAccountUserFieldService.Setup(x => x.UpdateAccountUserFieldsAsync(It.IsAny<List<AccountUserFieldRequest>>())).Throws(new Exception("Oops"));
|
||||||
|
|
||||||
|
var accountUserFieldUpdateRequest = new List<AccountUserFieldRequest>()
|
||||||
|
{
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "Y"
|
||||||
|
},
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "N"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var results = await _accountUserFieldController.Put(accountUserFieldUpdateRequest);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PostAccountUserFields_OK()
|
||||||
|
{
|
||||||
|
var accountUserField1 = new AccountUserField()
|
||||||
|
{
|
||||||
|
Id = "TEST1",
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "N"
|
||||||
|
};
|
||||||
|
var accountUserField2 = new AccountUserField()
|
||||||
|
{
|
||||||
|
Id = "TEST2",
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "Y"
|
||||||
|
};
|
||||||
|
_mockAccountUserFieldService.Setup(x => x.InsertAccountUserFieldsAsync(It.IsAny<List<AccountUserFieldRequest>>())).ReturnsAsync(
|
||||||
|
new List<AccountUserField>()
|
||||||
|
{
|
||||||
|
accountUserField1,
|
||||||
|
accountUserField2
|
||||||
|
});
|
||||||
|
|
||||||
|
var accountUserFieldUpdateRequest = new List<AccountUserFieldRequest>()
|
||||||
|
{
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "Y"
|
||||||
|
},
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "N"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var results = await _accountUserFieldController.Post(accountUserFieldUpdateRequest);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var okResult = results as OkObjectResult;
|
||||||
|
Assert.NotNull(okResult);
|
||||||
|
Assert.AreEqual(200, okResult.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task PostAccountUserFields_Exception()
|
||||||
|
{
|
||||||
|
_mockAccountUserFieldService.Setup(x => x.InsertAccountUserFieldsAsync(It.IsAny<List<AccountUserFieldRequest>>())).Throws(new Exception("Oops"));
|
||||||
|
|
||||||
|
var accountUserFieldUpdateRequest = new List<AccountUserFieldRequest>()
|
||||||
|
{
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100001,
|
||||||
|
UserFieldCode = "TEST1",
|
||||||
|
Value = "Y"
|
||||||
|
},
|
||||||
|
new AccountUserFieldRequest()
|
||||||
|
{
|
||||||
|
AccountNumber = 100002,
|
||||||
|
UserFieldCode = "TEST2",
|
||||||
|
Value = "N"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var results = await _accountUserFieldController.Post(accountUserFieldUpdateRequest);
|
||||||
|
|
||||||
|
Assert.NotNull(results);
|
||||||
|
var badRes = results as BadRequestObjectResult;
|
||||||
|
Assert.NotNull(badRes);
|
||||||
|
Assert.AreEqual(400, badRes.StatusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user