diff --git a/LCU.Api.Internal.CoreApiWrapper/.dockerignore b/LCU.Api.Internal.CoreApiWrapper/.dockerignore new file mode 100644 index 0000000..8b63706 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/.dockerignore @@ -0,0 +1,17 @@ +**/*.bat +**/*.log +**/*.md +**/*.yml +**/.dockerignore +**/.editorconfig +**/.git +**/.gitattributes +**/.gitignore +**/.vs +**/.vscode +**/bin +**/dist +**/dockerfile +**/node_modules +**/obj +**/package-lock.json \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/.gitignore b/LCU.Api.Internal.CoreApiWrapper/.gitignore new file mode 100644 index 0000000..f28bcc8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/.gitignore @@ -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/** diff --git a/LCU.Api.Internal.CoreApiWrapper/Dockerfile b/LCU.Api.Internal.CoreApiWrapper/Dockerfile new file mode 100644 index 0000000..d214b2b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/Dockerfile @@ -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"] \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.sln b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.sln new file mode 100644 index 0000000..cc99f02 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.sln @@ -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 diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/CoreApiWrapperConfig.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/CoreApiWrapperConfig.cs new file mode 100644 index 0000000..9de0e99 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/CoreApiWrapperConfig.cs @@ -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; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/FeatureFlags.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/FeatureFlags.cs new file mode 100644 index 0000000..14d6586 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Configuration/FeatureFlags.cs @@ -0,0 +1,8 @@ +namespace LCU.Api.Internal.CoreApiWrapper.Configuration +{ + public class FeatureFlags + { + public bool DisableCoreDBWrite { get; set; } + public bool UseKeyVault { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessChannelPersonsController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessChannelPersonsController.cs new file mode 100644 index 0000000..b081596 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessChannelPersonsController.cs @@ -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 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 GetWithIncludes([FromQuery] AccessChannelPersonsByPersonRequest request, [FromQuery] List 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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessTypeController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessTypeController.cs new file mode 100644 index 0000000..0ad043e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccessTypeController.cs @@ -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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountController.cs new file mode 100644 index 0000000..27ec2bc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountController.cs @@ -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 AccountMaintenanceRequest([FromBody] List 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 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 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 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 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 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 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 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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 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 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 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 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 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 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 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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); + } + + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountUserFieldController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountUserFieldController.cs new file mode 100644 index 0000000..dc97b72 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AccountUserFieldController.cs @@ -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 Put([FromBody] List 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 Post([FromBody] List 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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ActivityController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ActivityController.cs new file mode 100644 index 0000000..4eedc4f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ActivityController.cs @@ -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; + } + + /// + /// Get New Checking Account Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// Limit number of records returned, defaults to 100 + /// + [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); + } + } + + /// + /// Get New Digital Banking Checking Account Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// Limit number of records returned, defaults to 100 + /// + [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); + } + } + + /// + /// Get New ATM and Check Card Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// Limit number of records returned, defaults to 100 + /// + [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); + } + } + + /// + /// Get New Mortgage Sale Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// + [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); + } + } + + /// + /// Get New Vehicle Sale Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// + [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); + } + } + + /// + /// Get New Loan Sales Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber For + /// Accounts that can have debt protection but are not incentivized + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// + [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); + } + } + + /// + /// Get New ATM and Check Card Activities After a specified (Inclusive) DateTime or (exclusive) ActivityNumber + /// + /// dateTime to begin search, inclusive + /// ActvNbr to search after, not inclusive + /// + [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 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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AddressController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AddressController.cs new file mode 100644 index 0000000..bb7349c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AddressController.cs @@ -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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreeController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreeController.cs new file mode 100644 index 0000000..fcf754c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreeController.cs @@ -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; + } + + /// GetAgreeUsersByAccount utilizes a query that will attempt to get a userId by account numbers. + /// + /// 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. + /// + /// + /// + // GET api/core/Agree/AgreeUsersByAccounts + [HttpGet("AgreeUsersByAccounts")] + public async Task GetAgreeUsersByAccounts([FromQuery] List 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); + } + } + + /// GetAgreeUsersByPersonNumber utilizes a query that will attempt to get a userId by a person number. + /// + /// + // GET api/core/Agree/AgreeUserByPersonNumber/{personNumber} + [HttpGet("AgreeUserByPersonNumber/{personNumber:long}")] + public async Task 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); + } + } + + /// GetAgreeUserByOrganizationNumber utilizes a query that will attempt to get a userId by an organization number. + /// + /// + // GET api/core/Agree/AgreeUserByOrganizationNumber/{organizationNumber} + [HttpGet("AgreeUserByOrganizationNumber/{organizationNumber:long}")] + public async Task 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 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 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(204)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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); + } + } + + + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreePersonController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreePersonController.cs new file mode 100644 index 0000000..5bcb7bd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AgreePersonController.cs @@ -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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ApplicationHistoryController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ApplicationHistoryController.cs new file mode 100644 index 0000000..55205f2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/ApplicationHistoryController.cs @@ -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; + } + + /// + /// Get list of application history by list of application numbers and between a date range + /// + /// + /// ApplicationHistoryRequest Properties: ApplicationNumbers, DateRangeStart, DateRangeEnd + /// + /// List + [HttpGet("GetApplicationHistory")] + [ProducesResponseType(201)] + [ProducesResponseType(typeof(List), 400)] + [ProducesResponseType(500)] + public async Task 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AssociateController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AssociateController.cs new file mode 100644 index 0000000..6846c95 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/AssociateController.cs @@ -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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/BranchController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/BranchController.cs new file mode 100644 index 0000000..553ba9a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/BranchController.cs @@ -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()); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndirectLoanController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndirectLoanController.cs new file mode 100644 index 0000000..6cc401a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndirectLoanController.cs @@ -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 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), 400)] + [ProducesResponseType(500)] + public async Task 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), 400)] + [ProducesResponseType(500)] + public async Task 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), 400)] + [ProducesResponseType(500)] + public async Task 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), 400)] + [ProducesResponseType(500)] + public async Task PutDealerOriginalBalance([FromBody] string accountNumber) + { + try + { + var result = await _indirectLoanService.UpdateDealerOriginalBalance(accountNumber); + return Ok(result); + } + catch (Exception) + { + return StatusCode(StatusCodes.Status500InternalServerError); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndividualController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndividualController.cs new file mode 100644 index 0000000..257c3d2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/IndividualController.cs @@ -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), 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanController.cs new file mode 100644 index 0000000..1688f1a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanController.cs @@ -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 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), 400)] + [ProducesResponseType(500)] + public async Task 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), 400)] + [ProducesResponseType(500)] + public async Task 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanPayoffController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanPayoffController.cs new file mode 100644 index 0000000..4cc5134 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/LoanPayoffController.cs @@ -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 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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/MemberController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/MemberController.cs new file mode 100644 index 0000000..62b82f7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/MemberController.cs @@ -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), 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 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), 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), 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), 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), 400)] + [ProducesResponseType(typeof(List), 404)] + [ProducesResponseType(500)] + public async Task 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/OrganizationController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/OrganizationController.cs new file mode 100644 index 0000000..2cc3f23 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/OrganizationController.cs @@ -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), 400)] + [ProducesResponseType(500)] + public async Task 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), 400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(500)] + public async Task 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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonController.cs new file mode 100644 index 0000000..7daa6ce --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonController.cs @@ -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), 400)] + [ProducesResponseType(500)] + public async Task 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), 200)] + [ProducesResponseType(400)] + [ProducesResponseType(500)] + public async Task 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 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), 400)] + [ProducesResponseType(500)] + public async Task 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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonUserFieldController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonUserFieldController.cs new file mode 100644 index 0000000..11399b4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PersonUserFieldController.cs @@ -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 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 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 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 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 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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PropertyUserFieldController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PropertyUserFieldController.cs new file mode 100644 index 0000000..2c33669 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/PropertyUserFieldController.cs @@ -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 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 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 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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/SafController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/SafController.cs new file mode 100644 index 0000000..56d7d1d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/SafController.cs @@ -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; + } + + /// + /// Returns a list of all SAF UserIDs with known Core PersonNbr and Employee Email + /// + [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()); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/StatusController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/StatusController.cs new file mode 100644 index 0000000..1c64b8e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/StatusController.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TaxController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TaxController.cs new file mode 100644 index 0000000..24f6f26 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TaxController.cs @@ -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 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 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); } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TransactionController.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TransactionController.cs new file mode 100644 index 0000000..fccd1c7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Controllers/TransactionController.cs @@ -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), 400)] + [ProducesResponseType(500)] + public async Task PostMonetaryTransactions([FromBody] List 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 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 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 PostFundsToAccount([FromBody] List 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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj new file mode 100644 index 0000000..695548e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper.csproj @@ -0,0 +1,80 @@ + + + + net8.0 + 2.9.3 + + 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 + + + 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 + + Linux + + + + + + + + + + + + + + + + + + + + + + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/AddressMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/AddressMapper.cs new file mode 100644 index 0000000..852f575 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/AddressMapper.cs @@ -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 + { + /// + /// NOTE: The properties commented out either do not have an apparent match or have not been needed yet. + /// + public AddressMapper() + { + CreateMap() + .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; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/BranchMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/BranchMapper.cs new file mode 100644 index 0000000..c53ce25 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/BranchMapper.cs @@ -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() + .ForMember(dest => dest.BranchId, opt => opt.MapFrom(src => src.BranchNumber)) + .ForMember(dest => dest.BranchName, opt => opt.MapFrom(src => src.BranchName)); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/CollateralDetailMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/CollateralDetailMapper.cs new file mode 100644 index 0000000..dcafe63 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/CollateralDetailMapper.cs @@ -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() + .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; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/IndividualMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/IndividualMapper.cs new file mode 100644 index 0000000..a466f63 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/IndividualMapper.cs @@ -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 + { + /// + /// NOTE: The properties commented out either do not have an apparent match or have not been needed yet. + /// + public IndividualMapper() + { + CreateMap() + .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; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/LoanDetailMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/LoanDetailMapper.cs new file mode 100644 index 0000000..5e6ca02 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/LoanDetailMapper.cs @@ -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 + { + /// + /// NOTE: The property mappings commented out either do not have an apparent match or have not been needed yet. + /// + public LoanDetailMapper() + { + CreateMap() + //.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(); + //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 GetBorrowers(Account account) + { + var loanOwners = new List(); + 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, + _ => "" + }; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberMapper.cs new file mode 100644 index 0000000..901390b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberMapper.cs @@ -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 + { + /// + /// NOTE: The properties commented out either do not have an apparent match or have not been needed yet. + /// + public MemberMapper() + { + CreateMap() + .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() + .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))); ; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberOwnerMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberOwnerMapper.cs new file mode 100644 index 0000000..ad031f8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/MemberOwnerMapper.cs @@ -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() + .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}"; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/OtherCollateralMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/OtherCollateralMapper.cs new file mode 100644 index 0000000..5391863 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/OtherCollateralMapper.cs @@ -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 + { + /// + /// NOTE: The properties commented out either do not have an apparent match or have not been needed yet. + /// + public OtherCollateralMapper() + { + // Currently No OtherCollateral found in DNA + CreateMap(); + //.ForMember(dest => dest.MiscellaneousInformation, opt => opt.MapFrom(src => src.)); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/PhoneMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/PhoneMapper.cs new file mode 100644 index 0000000..014b9ba --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/PhoneMapper.cs @@ -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 + { + /// + /// NOTE: The properties commented out either do not have an apparent match or have not been needed yet. + /// + public PhoneMapper() + { + CreateMap() + //.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}"; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/VehicleMapper.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/VehicleMapper.cs new file mode 100644 index 0000000..1e47b7c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Mappers/VehicleMapper.cs @@ -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() + .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)); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Program.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Program.cs new file mode 100644 index 0000000..556b754 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Program.cs @@ -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(); }) + .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(); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessChannelPersonsService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessChannelPersonsService.cs new file mode 100644 index 0000000..559ac7b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessChannelPersonsService.cs @@ -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>> 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>> GetAccessChannelPersonCoreApiResponseAsync( + AccessChannelPersonsByPersonRequest request, List 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 UpdateAccessChannelPersonAsync(AccessChannelPerson request, long updateKey) + { + try + { + var coreMessageHeader = new CoreMessageHeader(updateKey); + var coreApiMessage = new CoreApiMessage(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; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessTypeService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessTypeService.cs new file mode 100644 index 0000000..5e3e114 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccessTypeService.cs @@ -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 UpdateAccessTypeAsync(AccessTypeUpdateRequest request) + { + try + { + var coreMessageHeader = new CoreMessageHeader(request.UpdateKey); + var coreApiMessage = new CoreApiMessage(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; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountHistoryService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountHistoryService.cs new file mode 100644 index 0000000..076f3a6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountHistoryService.cs @@ -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> GetChargeoffDateTimesByAccountNumber(string accountNumber) + { + try + { + return _accountHistoryDao.GetChargeoffDateTimesByAccountNumber(accountNumber); + } + catch (Exception ex) + { + Log.Warning(ex, $"There was an issue Getting Chargeoff date. AccountNumber: {accountNumber}"); + throw; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountService.cs new file mode 100644 index 0000000..5414588 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountService.cs @@ -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> 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 GetAccountDetailsByAccountNumber(long accountNumber) + { + var coreRequestParameters = new CoreRequestParameters(); + coreRequestParameters.PageSize = null; + var request = new AcctNbrRequest() + { + AcctNbr = accountNumber + }; + + return await GetAccountDetails(coreRequestParameters, request); + } + + public async Task 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 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> 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> 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> 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 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 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 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> GetActivityAccountDetailsByAccountNumbers( + List accountNumbers) + { + try + { + if (!accountNumbers.Any()) + { + return new List(); + } + 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> 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> 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> 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 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 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 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 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 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 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> 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> 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)}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountUserFieldService.cs new file mode 100644 index 0000000..f77bd12 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AccountUserFieldService.cs @@ -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>> GetAccountUserFieldsAsync(long accountNumber) + { + try + { + var includes = new List() { 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>> GetAccountUserFieldCoreApiResponseAsync(string accountId) + { + try + { + var includes = new List() { 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 UpdateAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequest, long updateKey, string accountId, string userFieldId) + { + try + { + var messageHeader = new CoreMessageHeader() + { + UpdateKey = updateKey + }; + var coreApiMessage = new CoreApiMessage(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 InsertAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequest, string accountId) + { + try + { + var messageHeader = new CoreMessageHeader() { }; + var coreApiMessage = new CoreApiMessage(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> UpdateAccountUserFieldsAsync(List accountUserFieldUpdateRequests) + { + try + { + var accounts = new List(); + var updatedAccountUserFields = new List(); + + 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> InsertAccountUserFieldsAsync(List accountUserFieldUpdateRequests) + { + try + { + var accounts = new List(); + var createdAccountUserFields = new List(); + + 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; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ActivityService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ActivityService.cs new file mode 100644 index 0000000..464acbc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ActivityService.cs @@ -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> 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> 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> 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> 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> 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> 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> 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> QueryActivityManagerActivity(ActivityQueryRequest request) + { + try + { + if (!request.ActivityIds.Any()) + { + return new List() { }; + } + + var result = await _activityDao.QueryActivityManagerActivity(request); + return result; + } + catch (Exception ex) + { + Log.Error(ex, $"Failed to QueryActivityManagerActivity {request.ActivityIds}."); + throw; + } + } + + public async Task> 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 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 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AddressService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AddressService.cs new file mode 100644 index 0000000..0b7bc6c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AddressService.cs @@ -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> GetByPersonNumberAndId(string personNumber, string id) + { + try + { + var includes = new List() + { + 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>> GetByPersonNumber(string personNumber) + { + try + { + var includes = new List() + { + 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 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 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 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(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 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(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); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreePersonService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreePersonService.cs new file mode 100644 index 0000000..ecf33ef --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreePersonService.cs @@ -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 GetByUserId(string userId) + { + try + { + return await _agreePersonDao.FindByUserId(userId); + } + catch (Exception exception) + { + Log.Error(exception, $"Failed to GetByUserId. UserId: ${userId}"); + throw; + } + } + + public async Task> GetAgreePersons(int fetchSize) + { + try + { + return await _agreePersonDao.FindAgreePersons(fetchSize); + } + catch (Exception exception) + { + Log.Error(exception, $"Failed to GetAgreePersons."); + throw; + } + } + + public async Task> GetAgreePersonsWithHyphenatedUserId() + { + try + { + return await _agreePersonDao.FindAgreePersonsWithHyphenatedUserId(); + } + catch (Exception exception) + { + Log.Error(exception, $"Failed to GetAgreePersonsWithHyphenatedUserId."); + throw; + } + } + public async Task> GetActiveCustodialAgreePersonNumbers() + { + try + { + return await _agreePersonDao.FindActiveCustodialAgreePersonNumbers(); + } + catch(Exception exception) + { + Log.Error(exception, $"Failed to GetActiveCustodialAgreePersonNumbers"); + throw; + } + } + + public async Task> GetActiveCustodialVruCardAgreementAgreePersons() + { + try + { + return await _agreePersonDao.FindActiveCustodialVruCardAgreementAgreePersons(); + } + catch (Exception exception) + { + Log.Error(exception, $"Failed to GetActiveCustodialVruCardAgreementAgreePersons"); + throw; + } + } + + public async Task UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest) + { + try + { + return await _agreePersonDao.UpdatePersonAgreementDetailTypes(personAgreementDetailTypeRequest); + } + catch (Exception exception) + { + Log.Error(exception, $"Failed to UpdatePersonAgreementDetailTypes"); + throw; + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreeService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreeService.cs new file mode 100644 index 0000000..b0488fd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AgreeService.cs @@ -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> GetAgreeUsersByAccountNumbers(List accountNumbers) + { + try + { + return await _agreeDao.FindAgreeUsersByAccountNumbers(accountNumbers); + } + catch (Exception ex) + { + Log.Error(ex, $"Failed to GetAgreeUsersByAccountNumbers for accountNumbers: {accountNumbers}."); + throw; + } + } + + public async Task> 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 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 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 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> 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 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> 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> 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> SetAccountOwnersForAgreementAccounts(IEnumerable 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> 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> 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> AuditAgreementChangesByDateLastMaintained(DateTime maintenanceDate) + { + try + { + return await _agreeDao.AuditAccountAgreementChangesByDateLastMaintained(maintenanceDate); + } + catch (Exception ex) + { + Log.Error(ex, + $"Failed to AuditAgreementChangesByDateLastMaintained for MaintenanceDate: {maintenanceDate} or later."); + throw; + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ApplicationHistoryService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ApplicationHistoryService.cs new file mode 100644 index 0000000..439b47c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ApplicationHistoryService.cs @@ -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> GetApplicationHistory(List 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; + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AssociateService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AssociateService.cs new file mode 100644 index 0000000..2769767 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/AssociateService.cs @@ -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 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}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/BranchService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/BranchService.cs new file mode 100644 index 0000000..8a80a08 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/BranchService.cs @@ -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> GetBranches() + { + try + { + var coreRequest = new CoreRequestParameters(); + var results = await _branchDao.FindBranches(coreRequest); + + return _mapper.Map>(results); + } + catch (Exception ex) + { + Log.Error(ex, $"Error while trying to get Branches."); + throw; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessChannelPersonsService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessChannelPersonsService.cs new file mode 100644 index 0000000..e457488 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessChannelPersonsService.cs @@ -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>> GetAccessChannelPersonCoreApiResponseAsync( + AccessChannelPersonsByPersonRequest request); + Task>> GetAccessChannelPersonCoreApiResponseAsync( + AccessChannelPersonsByPersonRequest request, List includes); + Task UpdateAccessChannelPersonAsync(AccessChannelPerson request, long updateKey); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessTypeService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessTypeService.cs new file mode 100644 index 0000000..75f8e72 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccessTypeService.cs @@ -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 UpdateAccessTypeAsync(AccessTypeUpdateRequest request); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountHistoryService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountHistoryService.cs new file mode 100644 index 0000000..d6c93d0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountHistoryService.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using System; + +namespace LCU.Api.Internal.CoreApiWrapper.Services +{ + public interface IAccountHistoryService + { + Task> GetChargeoffDateTimesByAccountNumber(string accountNumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountService.cs new file mode 100644 index 0000000..31d2bea --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountService.cs @@ -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> GetAccountsByMemberAgreementNumber(CoreRequestParameters coreRequestParameters, MemberAgreeNbrRequest request); + Task GetAccountDetailsByAccountNumber(long accountNumber); + Task GetAccountDetails(CoreRequestParameters coreRequestParameters, AcctNbrRequest request); + Task PutAccountMaintenanceRequest(IEnumerable accountMaintenanceRequests); + Task> GetActivityAccountDetailsByAccountNumbers(List accountNumbers); + Task> GetAdminBranchCodeChangeAccountNumbers(); + Task> GetVipSavingsToFund(); + Task> GetAccountsForGroupAnalysisMaintenance(); + Task UpdateAccountBranch(AccountBranchUpdateRequest accountBranchUpdateRequest); + Task UpdateAccountLoanToValue(AccountLtvUpdateRequest accountLtvUpdateRequest); + Task UpdateAccountNickName(AccountNickNameUpdateRequest acountNickNameUpdateRequest); + Task UpdateAccountContractDate(AccountContractDateUpdateRequest accountContractDateUpdateRequest); + Task> GetOwnersByAccountNumber(long accountNumber, DateTime createdDate); + Task> GetPrimaryOwnersByOrganizationName(string organizationName); + Task> GetPrimaryOwnersByPersonName(string personName); + Task UpdateAccountAnalysisMaintenance(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest); + Task AddPersonAccount(CreatePersonAccountRequest createPersonAccountRequest); + Task AddOrganizationAccount(CreateOrganizationAccountRequest createOrganizationAccountRequest); + Task PutOrganizationMaintenanceRequest(OrganizationMaintenanceRequest organizationMaintenanceRequest); + Task UpdateAccountCreditReportType(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest); + Task> GetAccountsByMajorMinorBranchAndStatus(AccountsByMajorMinorBranchAndStatusRequest request); + Task> GetAccountsByRecentTransactions(AccountsByRecentTransactionsRequest request); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountUserFieldService.cs new file mode 100644 index 0000000..acfb49b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAccountUserFieldService.cs @@ -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>> GetAccountUserFieldsAsync(long accountNumber); + Task>> GetAccountUserFieldCoreApiResponseAsync(string accountId); + Task UpdateAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequests, + long updateKey, + string accountId, + string userFieldId); + Task InsertAccountUserFieldAsync(AccountUserFieldRequest accountUserFieldUpdateRequests, string accountId); + Task> InsertAccountUserFieldsAsync(List accountUserFieldUpdateRequests); + Task> UpdateAccountUserFieldsAsync(List accountUserFieldUpdateRequests); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IActivityService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IActivityService.cs new file mode 100644 index 0000000..9678328 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IActivityService.cs @@ -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> GetNewCheckingAccountActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount); + Task> GetNewDigitalBankingCheckingAccountActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount); + Task> GetNewAtmCheckCardActivities(string newerThanDateTime, long? afterActivityNumber, int limitAmount); + Task> GetNewActivityManagerIncentiveReferrals(string newerThanOriginationDateTime, long? afterActivityId); + Task> GetNewMortgageSaleActivities(string newerThanOriginationDateTime, + long? afterActivityId); + Task> GetNewVehicleSaleActivities(string newerThanOriginationDateTime, + long? afterActivityId); + Task> GetNewDebtProtectedLoanSaleActivities(string newerThanDateTime, + long? afterActivityNbr); + Task> QueryActivityManagerActivity(ActivityQueryRequest request); + Task> GetEStatementDeliveryActivity(string newerThanOriginationDateTime); + Task GetPersonActivityByPhoneNumber(string phoneNumber); + Task GetPersonActivityByTaxId(string taxId); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAddressService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAddressService.cs new file mode 100644 index 0000000..529719a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAddressService.cs @@ -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> GetByPersonNumberAndId(string personNumber, string postalAddressId); + Task>> GetByPersonNumber(string personNumber); + Task DeleteInsertPersonPostalAddress(PersonPostalAddress personPostalAddress); + Task RemovePersonPostalAddress(PersonPostalAddress personPostalAddress); + Task InsertPersonPostalAddress(PersonPostalAddress personPostalAddress); + Task UpdatePersonAddrLine(PersonAddrLine personAddrLine); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreePersonService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreePersonService.cs new file mode 100644 index 0000000..ac3c864 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreePersonService.cs @@ -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 GetByUserId(string userId); + Task> GetAgreePersons(int fetchSize); + Task> GetAgreePersonsWithHyphenatedUserId(); + Task> GetActiveCustodialAgreePersonNumbers(); + Task> GetActiveCustodialVruCardAgreementAgreePersons(); + Task UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreeService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreeService.cs new file mode 100644 index 0000000..cf05c71 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAgreeService.cs @@ -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> GetAgreeUsersByAccountNumbers(List accountNumbers); + + Task> GetAgreeUsersByPersonNumber(long personNumber); + + Task GetAgreeUserByOrganizationNumber(long organizationNumber); + + Task GetAgreementByUserId(string userId); + + Task GetAgreementByAgreementId(long agreementId); + + Task> GetAgreementsByAccountId(long accountId); + + Task> GetAgreementAccountsByUserId(string userId); + + Task> GetAgreementAccountsByOrganizationId(long organizationId); + + Task GetAgreementAccountByAccountId(long organizationId); + + Task> AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime maintenanceDate); + + Task> AuditOrganizationChangesByDateLastMaintained(DateTime maintenanceDate); + + Task> AuditAgreementChangesByDateLastMaintained(DateTime maintenanceDate); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IApplicationHistoryService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IApplicationHistoryService.cs new file mode 100644 index 0000000..373960f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IApplicationHistoryService.cs @@ -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> GetApplicationHistory(List applicationNumbers, + string effectiveDate); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAssociateService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAssociateService.cs new file mode 100644 index 0000000..ce14038 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IAssociateService.cs @@ -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 GetAssociateDetailsBySsn(string taxId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IBranchService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IBranchService.cs new file mode 100644 index 0000000..35f73ed --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IBranchService.cs @@ -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> GetBranches(); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndirectLoanService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndirectLoanService.cs new file mode 100644 index 0000000..75b591e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndirectLoanService.cs @@ -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 GetIndirectLoanByAccountNumber(long accountNumber); + + Task> GetIndirectLoansByPostedDate(string newerThanDateTime); + + Task> GetClosedIndirectLoansByPostedDate(string newerThanDateTime); + + Task> GetClosedIndirectLoansWithDetailByPostedDate(string newerThanDateTime); + + Task> UpdateDealerOriginalBalance (string accountNumber); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndividualService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndividualService.cs new file mode 100644 index 0000000..07af221 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IIndividualService.cs @@ -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 GetIndividualByUserId(string userId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ILoanService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ILoanService.cs new file mode 100644 index 0000000..b681c14 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ILoanService.cs @@ -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 GetLoanDetail(long accountNumber); + Task> GetCollateralDetails(long accountNumber); + Task> GetPropertyInformation(long accountNumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IMemberService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IMemberService.cs new file mode 100644 index 0000000..eb6436f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IMemberService.cs @@ -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 GetMemberDetails(long memberId); + Task GetMemberByAccountNumber(long accountNumber); + Task> GetMemberOwner(long memberId); + Task GetPersonOrOrganizationNumberByMemberId(long memberId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IOrganizationService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IOrganizationService.cs new file mode 100644 index 0000000..b100b80 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IOrganizationService.cs @@ -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 GetMemberByMemberAgreeNbr(long memberAgreeNbr); + + Task> GetOrganizationByOrganizationNumber(long organizationNumber); + Task> GetOrganizationByName(string name); + Task CountOrganizationNumbersByName(string name); + Task> GetOrganizationByNameLike(string name, int? limit); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonService.cs new file mode 100644 index 0000000..733dfe6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonService.cs @@ -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> GetPersonsByName(CoreRequestParameters coreRequestParameters, PersonNameRequest personRequest); + Task> GetPersonByPersonNumber(long personNumber); + Task> GetPersonsBySearch(CoreRequestParameters coreRequestParameters, PersonSearchRequest personRequest); + Task GetPersonsByMemberAgreementNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest personRequest); + Task GetMemberByMemberAgreeNbr(long memberAgreeNbr); + Task> GetPersonsByNameLike(PersonNameRequest personRequest, int? limit); + Task CountPersonsByNameLike(PersonNameRequest personRequest); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonUserFieldService.cs new file mode 100644 index 0000000..e3eb6bf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPersonUserFieldService.cs @@ -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>> GetPersonUserFieldsAsync(long personNumber); + Task> GetPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate); + Task>> GetPersonUserFieldCoreApiResponseAsync(int personId); + Task InsertPersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest); + Task UpdatePersonUserFieldAsync(PersonUserFieldRequest personUserFieldUpdateRequest); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyService.cs new file mode 100644 index 0000000..650f4f6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyService.cs @@ -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> GetAccountProperties(long accountNumber); + Task GetProperty(long propertyNumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyUserFieldService.cs new file mode 100644 index 0000000..5853db2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IPropertyUserFieldService.cs @@ -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>> GetPropertyUserFieldsAsync(long propertyNumber); + Task UpdatePropertyUserFieldAsync(PropertyUserField propertyUserField); + Task InsertPropertyUserFieldAsync(PropertyUserField propertyUserField); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ISafService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ISafService.cs new file mode 100644 index 0000000..0b3b9c0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ISafService.cs @@ -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> GetAllSafUsersCoreInfo(); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITaxService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITaxService.cs new file mode 100644 index 0000000..833a11c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITaxService.cs @@ -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> GetPersonsTaxIdData(string taxId); + Task> GetOrganizationsTaxIdData(string taxId); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITransactionService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITransactionService.cs new file mode 100644 index 0000000..1c1588b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/ITransactionService.cs @@ -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> AddMonetaryTransactionsAsync(List groupTransactions); + Task> GetTransactionHistory(long accountNumber, DateTime startDateRange, DateTime endDateRange, string[] transactionTypeCodes); + Task> GetTransactionHistoryById(string generatedAccountid, DateTime fromDate, DateTime thruDate); + Task> GetExternalDescriptionsWithSsn(); + Task> PostFundsToAccount(List requests); + BasicResponse UpdateExternalDescription(ExternalDescription externalTransactionDescription); + Task> GetTransactionsByDateSpan(DateTime startDateRange, DateTime endDateRange, string[] rtxnTypCdToExclude); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndirectLoanService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndirectLoanService.cs new file mode 100644 index 0000000..34aaef4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndirectLoanService.cs @@ -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 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> 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> 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> 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> UpdateDealerOriginalBalance(string accountNumber) + { + try + { + return await _indirectLoanDao.UpdateDealerOriginalBalance(accountNumber); + } + catch (Exception ex) + { + Log.Error(ex, $"Unable to update accounts."); + throw; + } + } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndividualService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndividualService.cs new file mode 100644 index 0000000..9c1c194 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/IndividualService.cs @@ -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 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>(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; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/ILoanPayoffService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/ILoanPayoffService.cs new file mode 100644 index 0000000..71d82cb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/ILoanPayoffService.cs @@ -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> GetLoanPayoffByAccountNumber(long AccountNumber); + Task> GetLoanPayoffByVIN(string VIN); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/LoanPayoffService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/LoanPayoffService.cs new file mode 100644 index 0000000..22bbf64 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanPayoff/LoanPayoffService.cs @@ -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> 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> 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"); } + + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanService.cs new file mode 100644 index 0000000..01b125c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/LoanService.cs @@ -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 GetLoanDetail(long accountNumber) + { + try + { + var listOfIncludes = new List() + { + 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(account); + } + catch (Exception ex) + { + Log.Error(ex, $"Error while trying to get Loan Details by account number. AccountNumber: {accountNumber}"); + throw; + } + } + + public async Task> GetCollateralDetails(long accountNumber) + { + try + { + var properties = await _propertyService.GetAccountProperties(accountNumber); + return _mapper.Map>(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> 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}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/MemberService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/MemberService.cs new file mode 100644 index 0000000..e3cc4bd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/MemberService.cs @@ -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 GetMemberDetails(long memberId) + { + try + { + var listOfIncludes = new List() + { + RequestIncludeConstants.PostalAddresses + }; + var coreRequest = new CoreRequestParameters(listOfIncludes); + var request = new MemberNbrRequest() + { + MemberNbr = memberId + }; + + var result = await _personService.GetPersonsByMemberAgreementNbr(coreRequest, request); + return _mapper.Map(result); + } + catch (Exception ex) + { + Log.Error(ex, $"Error while trying to get Member by member id. MemberId: {memberId}"); + throw; + } + } + + public async Task GetMemberByAccountNumber(long accountNumber) + { + try + { + var listOfIncludes = new List() + { + 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(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> GetMemberOwner(long memberId) + { + try + { + var listOfIncludes = new List() + { + 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(); + listOfResults.Add(result); + + return _mapper.Map>(listOfResults); + } + catch (Exception ex) + { + Log.Error(ex, $"Error while trying to get Member owner by member id. MemberId: {memberId}"); + throw; + } + } + + public async Task 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}"); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/OrganizationService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/OrganizationService.cs new file mode 100644 index 0000000..7e631d7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/OrganizationService.cs @@ -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 GetMemberByMemberAgreeNbr(long memberAgreeNbr) + { + var listOfIncludes = new List + { + RequestIncludeConstants.AllAddresses + }; + var coreRequestParameters = new CoreRequestParameters(listOfIncludes); + var organizationRequest = new MemberNbrRequest + { + MemberNbr = memberAgreeNbr, + }; + + return await GetOrganizationByMemberNumber(coreRequestParameters, organizationRequest); + } + + private async Task 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> GetOrganizationByOrganizationNumber(long organizationNumber) + { + var coreRequestParameters = new CoreRequestParameters(); + var organizationSearchRequest = new OrganizationSearchRequest + { + OrgNbr = organizationNumber + }; + + return await GetOrganizationBySearch(coreRequestParameters, organizationSearchRequest); + } + + public async Task> GetOrganizationByName(string name) + { + var coreRequestParameters = new CoreRequestParameters(); + var organizationSearchRequest = new OrganizationSearchRequest + { + OrgName = name + }; + + return await GetOrganizationBySearch(coreRequestParameters, organizationSearchRequest); + } + + public async Task 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> 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> 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); + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonService.cs new file mode 100644 index 0000000..0153e3f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonService.cs @@ -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> 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> GetPersonByPersonNumber(long personNumber) + { + var coreRequestParameters = new CoreRequestParameters(); + var personRequest = new PersonSearchRequest + { + PersNbr = personNumber + }; + + return await GetPersonsBySearch(coreRequestParameters, personRequest); + } + + public async Task> 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 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 GetMemberByMemberAgreeNbr(long memberAgreeNbr) + { + var listOfIncludes = new List() + { + RequestIncludeConstants.PostalAddresses + }; + var coreRequest = new CoreRequestParameters(listOfIncludes); + var request = new MemberNbrRequest() + { + MemberNbr = memberAgreeNbr + }; + + return await GetPersonsByMemberAgreementNbr(coreRequest, request); + } + + public async Task> 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 CountPersonsByNameLike(PersonNameRequest personRequest) + { + return _personDao.CountPersonsByNameLike(personRequest.FirstName, personRequest.MdlName, personRequest.LastName); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonUserFieldService.cs new file mode 100644 index 0000000..668061b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PersonUserFieldService.cs @@ -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>> GetPersonUserFieldsAsync(long personNumber) + { + try + { + var includes = new List() { 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> 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>> GetPersonUserFieldCoreApiResponseAsync(int personId) + { + try + { + var includes = new List() { 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 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(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 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(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}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyService.cs new file mode 100644 index 0000000..7366a4c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyService.cs @@ -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> GetAccountProperties(long accountNumber) + { + try + { + var listOfIncludes = new List() + { + RequestIncludeConstants.Collateral + }; + var coreRequestParameters = new CoreRequestParameters(listOfIncludes); + var request = new AcctNbrRequest() + { + AcctNbr = accountNumber + }; + var account = await _accountService.GetAccountDetails(coreRequestParameters, request); + + List properties = new List(); + 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 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; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyUserFieldService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyUserFieldService.cs new file mode 100644 index 0000000..9f856cb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/PropertyUserFieldService.cs @@ -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>> GetPropertyUserFieldsAsync(long propertyNumber) + { + try + { + var includes = new List() { 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 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 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}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/SafService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/SafService.cs new file mode 100644 index 0000000..c39ae18 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/SafService.cs @@ -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> GetAllSafUsersCoreInfo() + { + return await _safDao.GetAllSafUsersCoreInfo(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TaxService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TaxService.cs new file mode 100644 index 0000000..6a46145 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TaxService.cs @@ -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> GetPersonsTaxIdData(string taxId) + { + var coreRequestParams = new CoreRequestParameters(); + return await _taxDao.GetPersonTaxIdData(coreRequestParams, taxId); + } + + public async Task> GetOrganizationsTaxIdData(string taxId) + { + var coreRequestParams = new CoreRequestParameters(); + return await _taxDao.GetOrganizationTaxIdData(coreRequestParams, taxId); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TransactionService.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TransactionService.cs new file mode 100644 index 0000000..863b518 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Services/TransactionService.cs @@ -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> AddMonetaryTransactionsAsync(List groupedTransactions) + { + try + { + return await _transactionDao.AddMonetaryTransactions(groupedTransactions); + } + catch (Exception ex) + { + Log.Error(ex, $"Unable to save monetary transactions."); + throw; + } + } + + public async Task> GetTransactionHistory(long accountNumber, + DateTime startDateRange, + DateTime endDateRange, + string[] transactionTypeCodes) + { + try + { + var listOfIncludes = new List() + { + 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 = + ( + 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; + } + } + + /// + /// Gets Transactions History based on a DNA generated Account ID. + /// NOTE: This Id is not the account number and must be retrieved by DNA. + /// + /// + /// + /// + /// + public async Task> 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> 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> PostFundsToAccount(List 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() + }; + } + catch (Exception exception) + { + Log.Error(exception, $"There was an issue updating External Transaction Description."); + return new BasicResponse() + { + Success = false, + Errors = new List() + { + $"There was an issue updating External Transaction Description. ExceptionMessage: {exception.Message}" + } + }; + } + } + + public async Task> 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; + } + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Startup.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Startup.cs new file mode 100644 index 0000000..89dd5a3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/Startup.cs @@ -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(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() + } + }); + + c.AddSecurityRequirement(new OpenApiSecurityRequirement + { + { + new OpenApiSecurityScheme + { + Reference = new OpenApiReference + { + Id = HeaderKeys.Client, // Must match the "AddSecurityDefinition" + Type = ReferenceType.SecurityScheme + } + }, + new List() + } + }); + + 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(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + } + + public void AddCoreApiWrapperLib(ref IServiceCollection services) + { + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + AddCoreApiWrapperDataAccess(ref services); + } + + public void AddCoreApiWrapperDataAccess(ref IServiceCollection services) + { + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + } + + // 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() + { + new() + { + Description = serverUrl, + Url = serverUrl + } + }; + }); + }); + + app.UseSwaggerUI(c => c.SwaggerEndpoint("v1/swagger.json", "LCU.Api.Internal.CoreApiWrapper v1")); + + app.UseMiddleware(); + app.UseSerilogRequestLogging(options => + { + options.EnrichDiagnosticContext = RequestResponseLoggingMiddleware.RequestDataParser.EnrichFromRequest; + }); + + app.UseRouting(); + app.UseCors(MyAllowSpecificOrigins); + app.UseAuthorization(); + + app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/appsettings.json new file mode 100644 index 0000000..98e2c99 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapper/appsettings.json @@ -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" + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/LCU.Api.Internal.CoreApiWrapperIntegrationTest.csproj b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/LCU.Api.Internal.CoreApiWrapperIntegrationTest.csproj new file mode 100644 index 0000000..309c5f1 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/LCU.Api.Internal.CoreApiWrapperIntegrationTest.csproj @@ -0,0 +1,37 @@ + + + + net8.0 + true + false + Linux + + + + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + PreserveNewest + + + + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/test_appsettings.json b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/test_appsettings.json new file mode 100644 index 0000000..a5f4ac9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperIntegrationTest/test_appsettings.json @@ -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": "" + } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessChannelPersonsControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessChannelPersonsControllerTest.cs new file mode 100644 index 0000000..028a8d0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessChannelPersonsControllerTest.cs @@ -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 _mockAccessChannelPersonsService; + + [SetUp] + public void SetUp() + { + _mockAccessChannelPersonsService = new Mock(); + _accessChannelPersonsController = new AccessChannelPersonsController(_mockAccessChannelPersonsService.Object); + } + + [Test] + public async Task GetAccessChannelPersons_OK() + { + var response = new List() + { + 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>(coreMessageHeader, response); + + _mockAccessChannelPersonsService.Setup(x => x.GetAccessChannelPersonCoreApiResponseAsync(It.IsAny())) + .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())) + .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(), + It.IsAny())) + .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(), + It.IsAny())) + .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); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessTypeControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessTypeControllerTest.cs new file mode 100644 index 0000000..3fe00b4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccessTypeControllerTest.cs @@ -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 _mockAccessTypeService; + + [SetUp] + public void SetUp() + { + _mockAccessTypeService = new Mock(); + _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())) + .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())) + .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); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountControllerTest.cs new file mode 100644 index 0000000..4dae790 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountControllerTest.cs @@ -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 _mockAccountService; + + [SetUp] + public void SetUp() + { + _mockAccountService = new Mock(); + _accountController = new AccountController(_mockAccountService.Object); + } + + [Test] + public async Task AccountMaintenanceRequest_OK() + { + var accountMaintenanceRequest = new List + { + 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 + { + 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>())) + .ReturnsAsync(new List() + { + new() { AccountNumber = 1 }, + new() { AccountNumber = 1 }, + new() { AccountNumber = 1 }, + }); + + var res = await _accountController.GetActivityAccountDetailsByAccountNumber(new ActivityAccountDetailsRequest() { AccountNumbers = new List(){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>())).ThrowsAsync(new Exception("Oops")); + var res = await _accountController.GetActivityAccountDetailsByAccountNumber( + (new ActivityAccountDetailsRequest() { AccountNumbers = new List() { 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() { + 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; + 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)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(), It.IsAny()), 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() { + 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; + Assert.NotNull(result); + _mockAccountService.Verify(); + } + + [Test] + public async Task GetPrimaryOwnersByPersonName_NoContent() + { + var personName = "Pete Peterson"; + + _mockAccountService.Setup(x => x.GetPrimaryOwnersByPersonName(personName)).ReturnsAsync((List)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()), 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() { + 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; + Assert.NotNull(result); + _mockAccountService.Verify(); + } + + [Test] + public async Task GetPrimaryOwnersByOrganizationName_NoContent() + { + var organizationName = "The Big Company"; + + _mockAccountService.Setup(x => x.GetPrimaryOwnersByOrganizationName(organizationName)).ReturnsAsync((List)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()), 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() { + "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; + 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() + { + 1234, + 1235 + }, + AccountStatuses = new List() + { + "Status" + }, + MajorTypes = new List() + { + "Major" + }, + MinorTypes = new List() + { + "MinorOne", + "MinorTwo" + } + }; + + _mockAccountService.Setup(x => x.GetAccountsByMajorMinorBranchAndStatus(request)).ReturnsAsync( + new List() + { + 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())).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); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountUserFieldControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountUserFieldControllerTest.cs new file mode 100644 index 0000000..834a647 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AccountUserFieldControllerTest.cs @@ -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 _mockAccountUserFieldService; + + [SetUp] + public void SetUp() + { + _mockAccountUserFieldService = new Mock(); + _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>())).ReturnsAsync( + new List() + { + accountUserField1, + accountUserField2 + }); + + var accountUserFieldUpdateRequest = new List() + { + 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>())).Throws(new Exception("Oops")); + + var accountUserFieldUpdateRequest = new List() + { + 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>())).ReturnsAsync( + new List() + { + accountUserField1, + accountUserField2 + }); + + var accountUserFieldUpdateRequest = new List() + { + 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>())).Throws(new Exception("Oops")); + + var accountUserFieldUpdateRequest = new List() + { + 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); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ActivityControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ActivityControllerTest.cs new file mode 100644 index 0000000..5ee50d6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ActivityControllerTest.cs @@ -0,0 +1,577 @@ +using System; +using System.Collections.Generic; +using System.Linq; +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.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Phones; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class ActivityControllerTest + { + private ActivityController _activityController; + private Mock _mockActivityService; + + [SetUp] + public void SetUp() + { + _mockActivityService = new Mock(); + _activityController = new ActivityController(_mockActivityService.Object); + } + + [Test] + public void GetNewCheckingAccountActivities_OK() + { + _mockActivityService.Setup(x => x.GetNewCheckingAccountActivities(It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }); + + var results = _activityController.GetNewCheckingAccountActivities("2020-04-29T11:00:00", null); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewCheckingAccountActivities(null, 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewCheckingAccountActivities("2020-04-29T11:00:00", 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewCheckingAccountActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewCheckingAccountActivities(It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewCheckingAccountActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewCheckingAccountActivities_Exception() + { + _mockActivityService.Setup(x => x.GetNewCheckingAccountActivities(It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewCheckingAccountActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewAtmCheckCardActivities_OK() + { + _mockActivityService.Setup(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }); + + var results = _activityController.GetNewAtmCheckCardActivities("2020-04-29T11:00:00", null); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewAtmCheckCardActivities(null, 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewAtmCheckCardActivities("2020-04-29T11:00:00", 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewAtmCheckCardActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewAtmCheckCardActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewAtmCheckCardActivities_Exception() + { + _mockActivityService.Setup(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewAtmCheckCardActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewActivityManagerReferralActivities_OK() + { + _mockActivityService.Setup(x => x.GetNewActivityManagerIncentiveReferrals(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }); + + var results = _activityController.GetNewActivityManagerReferralActivities("2020-04-29T11:00:00", null); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewActivityManagerReferralActivities(null, 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewActivityManagerReferralActivities("2020-04-29T11:00:00", 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewActivityManagerReferralActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewActivityManagerIncentiveReferrals(It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewActivityManagerReferralActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewActivityManagerReferralActivities_Exception() + { + _mockActivityService.Setup(x => x.GetNewActivityManagerIncentiveReferrals(It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewActivityManagerReferralActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewMortgageAccountActivities_OK() + { + _mockActivityService.Setup(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }); + + var results = _activityController.GetNewMortgageAccountActivities("2020-04-29T11:00:00", null); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewMortgageAccountActivities(null, 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewMortgageAccountActivities("2020-04-29T11:00:00", 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewMortgageAccountActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewMortgageAccountActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewMortgageAccountActivities_Exception() + { + _mockActivityService.Setup(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewMortgageAccountActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewVehicleSaleActivities_OK() + { + _mockActivityService.Setup(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }); + + var results = _activityController.GetNewVehicleSaleActivities("2020-04-29T11:00:00", null); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewVehicleSaleActivities(null, 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetNewVehicleSaleActivities("2020-04-29T11:00:00", 5); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewVehicleSaleActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewVehicleSaleActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewVehicleSaleActivities_Exception() + { + _mockActivityService.Setup(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewVehicleSaleActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewDebtProtectedLoanSales_FailedToParse() + { + _mockActivityService.Setup(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetNewDebtProtectedLoanSaleActivities(">:O", 1); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewDebtProtectedLoanSales_Exception() + { + _mockActivityService.Setup(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetNewDebtProtectedLoanSaleActivities("2020-04-29T11:00:00", 4); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void QueryActivityManagerActivity_Exception() + { + _mockActivityService.Setup(x => x.QueryActivityManagerActivity(It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.QueryActivityManagerActivity(new ActivityQueryRequest()); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public void GetNewDebtProtectedLoanSales_OK() + { + _mockActivityService.Setup(x => x.QueryActivityManagerActivity(It.IsAny())) + .ReturnsAsync(new List() + { + new NewActivityManagerIncentiveReferral() + { + ActivityId = 5 + }, + new NewActivityManagerIncentiveReferral() + { + ActivityId = 4 + }, + }); + + var results = _activityController.QueryActivityManagerActivity(new ActivityQueryRequest()); + + Assert.NotNull(results); + var okRes = results as OkObjectResult; + Assert.NotNull(okRes); + Assert.AreEqual(200, okRes.StatusCode); + } + + [Test] + public void GetNewEStatementDeliverySaleActivities_OK() + { + _mockActivityService.Setup(x => x.GetEStatementDeliveryActivity(It.IsAny())).ReturnsAsync( + new List() + { + new EStatementDeliveryMethod() { ActivityNumber = 1 }, + new EStatementDeliveryMethod() { ActivityNumber = 2 }, + new EStatementDeliveryMethod() { ActivityNumber = 3 } + }); + + var results = _activityController.GetEStatementDeliveryActivity("2020-04-29T11:00:00"); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetEStatementDeliveryActivity(null); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + results = _activityController.GetEStatementDeliveryActivity("2020-04-29T11:00:00"); + + Assert.NotNull(results); + okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetNewEStatementDeliverySaleActivities_FailedToParse() + { + _mockActivityService.Setup(x => x.GetEStatementDeliveryActivity(It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + + var results = _activityController.GetEStatementDeliveryActivity(">:O"); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public void GetNewEStatementDeliverySaleActivities_Exception() + { + _mockActivityService.Setup(x => x.GetEStatementDeliveryActivity(It.IsAny())) + .Throws(new Exception("Oops")); + + + var results = _activityController.GetEStatementDeliveryActivity("2020-04-29T11:00:00"); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_OK() + { + var phoneNumber = Guid.NewGuid().ToString(); + var personRecentActivity = new PersonRecentActivity + { + HomePhone = phoneNumber + }; + var response = new PersonRecentActivityResponse + { + Success = true, + PersonRecentActivity = personRecentActivity + }; + + _mockActivityService.Setup(x => x.GetPersonActivityByPhoneNumber(phoneNumber)) + .ReturnsAsync(response).Verifiable(); + + var result = await _activityController.GetPersonActivityByPhoneNumber(phoneNumber); + Assert.NotNull(result); + var status = result as OkObjectResult; + Assert.NotNull(status); + Assert.AreEqual(200, status.StatusCode); + + var personRecentActivityResult = status.Value as PersonRecentActivityResponse; + Assert.NotNull(personRecentActivityResult); + Assert.AreEqual(phoneNumber, personRecentActivityResult.PersonRecentActivity?.HomePhone); + _mockActivityService.Verify(); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_InternalServerError() + { + var phoneNumber = Guid.NewGuid().ToString(); + _mockActivityService.Setup(x => x.GetPersonActivityByPhoneNumber(phoneNumber)) + .Throws(new Exception("Test")).Verifiable(); + + var result = await _activityController.GetPersonActivityByPhoneNumber(phoneNumber); + Assert.NotNull(result); + var status = result as StatusCodeResult; + Assert.NotNull(status); + Assert.AreEqual(500, status.StatusCode); + _mockActivityService.Verify(); + } + + [Test] + public async Task GetPersonActivityByTaxId_OK() + { + var taxId = Guid.NewGuid().ToString(); + var personNumber = DateTime.Now.Millisecond; + var personRecentActivity = new PersonRecentActivity + { + PersonNumber = personNumber + }; + var response = new PersonRecentActivityResponse + { + Success = true, + PersonRecentActivity = personRecentActivity + }; + + _mockActivityService.Setup(x => x.GetPersonActivityByTaxId(taxId)) + .ReturnsAsync(response).Verifiable(); + + var result = await _activityController.GetPersonActivityByTaxId(taxId); + Assert.NotNull(result); + var status = result as OkObjectResult; + Assert.NotNull(status); + Assert.AreEqual(200, status.StatusCode); + + var personRecentActivityResult = status.Value as PersonRecentActivityResponse; + Assert.NotNull(personRecentActivityResult); + Assert.AreEqual(personNumber, personRecentActivityResult.PersonRecentActivity?.PersonNumber); + _mockActivityService.Verify(); + } + + [Test] + public async Task GetPersonActivityByTaxId_BadRequest() + { + var taxId = string.Empty; + + var result = await _activityController.GetPersonActivityByTaxId(taxId); + Assert.NotNull(result); + var status = result as BadRequestObjectResult; + Assert.NotNull(status); + Assert.AreEqual(400, status.StatusCode); + } + + [Test] + public async Task GetPersonActivityByTaxId_InternalServerError() + { + var taxId = Guid.NewGuid().ToString(); + _mockActivityService.Setup(x => x.GetPersonActivityByTaxId(taxId)) + .Throws(new Exception("Test")).Verifiable(); + + var result = await _activityController.GetPersonActivityByTaxId(taxId); + Assert.NotNull(result); + var status = result as StatusCodeResult; + Assert.NotNull(status); + Assert.AreEqual(500, status.StatusCode); + _mockActivityService.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AgreeControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AgreeControllerTest.cs new file mode 100644 index 0000000..c66097a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AgreeControllerTest.cs @@ -0,0 +1,856 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using Microsoft.AspNetCore.Mvc; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Controllers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class AgreeControllerTest + { + private AgreeController _agreeController; + private Mock _mockAgreeService; + + [SetUp] + public void SetUp() + { + _mockAgreeService = new Mock(); + _agreeController = new AgreeController(_mockAgreeService.Object); + } + + [Test] + public async Task Get_OK() + { + _mockAgreeService.Setup(x => x.GetAgreeUsersByAccountNumbers(It.IsAny>())).ReturnsAsync( + new List() + { + new AgreeUserAccount() + { + AccountNumber = 100010, + AgreeNumber = 1000, + UserId = "101010" + }, + new AgreeUserAccount() + { + AccountNumber = 200020, + AgreeNumber = 2000, + UserId = "202020" + } + }); + + var accountNumbers = new List() + { + "100010", + "200020" + }; + var results = await _agreeController.GetAgreeUsersByAccounts(accountNumbers); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task Get_AccountNumbers_Null_BadRequest() + { + var results = await _agreeController.GetAgreeUsersByAccounts(null); + + _mockAgreeService.Verify(x => x.GetAgreeUsersByAccountNumbers(It.IsAny>()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task Get_AccountNumbers_EmptyList_BadRequest() + { + var results = await _agreeController.GetAgreeUsersByAccounts(new List()); + + _mockAgreeService.Verify(x => x.GetAgreeUsersByAccountNumbers(It.IsAny>()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task Get_Exception() + { + _mockAgreeService.Setup(x => x.GetAgreeUsersByAccountNumbers(It.IsAny>())) + .Throws(new Exception("Oops")); + + var accountNumbers = new List() + { + "100010", + "200020" + }; + var results = await _agreeController.GetAgreeUsersByAccounts(accountNumbers); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetAgreementByUserId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementByUserId("123")).ReturnsAsync( + new Agreement + { + AgreementNumber = 111111, + PersonNumber = 222222, + UserId = "101010" + }).Verifiable(); + + + var results = await _agreeController.GetAgreementByUserId("123"); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as Agreement; + Assert.NotNull(result); + Assert.AreEqual(111111, result.AgreementNumber); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementByUserId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementByUserId("123")).ReturnsAsync((Agreement)null).Verifiable(); + + var results = await _agreeController.GetAgreementByUserId("123"); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementByUserId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementByUserId(null); + + _mockAgreeService.Verify(x => x.GetAgreementByUserId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + + var result2 = await _agreeController.GetAgreementByUserId(""); + + _mockAgreeService.Verify(x => x.GetAgreementByUserId(It.IsAny()), Times.Never()); + + Assert.NotNull(result2); + var badRequest2 = result2 as BadRequestObjectResult; + Assert.NotNull(badRequest2); + Assert.AreEqual(400, badRequest2.StatusCode); + } + + [Test] + public async Task GetAgreementByUserId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementByUserId("123")).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementByUserId("123"); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetUserIdByPersonNumber_OK() + { + var personNumbers = new List { "5436", "44889" }; + _mockAgreeService.Setup(x => x.GetAgreeUsersByPersonNumber(123L)).ReturnsAsync(personNumbers).Verifiable(); + + var results = await _agreeController.GetAgreeUsersByPersonNumber(123L); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as List; + Assert.NotNull(result); + Assert.AreEqual("5436", result.FirstOrDefault()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetUserIdByPersonNumber_NoContent() + { + var personNumbers = new List {}; + _mockAgreeService.Setup(x => x.GetAgreeUsersByPersonNumber(123L)).ReturnsAsync(personNumbers).Verifiable(); + + var results = await _agreeController.GetAgreeUsersByPersonNumber(123L); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetUserIdByPersonNumber_empty_BadRequest() + { + var results = await _agreeController.GetAgreeUsersByPersonNumber(0); + + _mockAgreeService.Verify(x => x.GetAgreeUsersByPersonNumber(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetUserIdByPersonNumber_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreeUsersByPersonNumber(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreeUsersByPersonNumber(123L); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetUserIdByOrganizationNumber_OK() + { + _mockAgreeService.Setup(x => x.GetAgreeUserByOrganizationNumber(123L)).ReturnsAsync("5436").Verifiable(); + + var results = await _agreeController.GetAgreeUserByOrganizationNumber(123L); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as string; + Assert.NotNull(result); + Assert.AreEqual("5436", result); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetUserIdByOrganizationNumber_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreeUserByOrganizationNumber(123L)).ReturnsAsync((string)null).Verifiable(); + + var results = await _agreeController.GetAgreeUserByOrganizationNumber(123L); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetUserIdByOrganizationNumber_empty_BadRequest() + { + var results = await _agreeController.GetAgreeUserByOrganizationNumber(0); + + _mockAgreeService.Verify(x => x.GetAgreeUserByOrganizationNumber(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetUserIdByOrganizationNumber_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreeUserByOrganizationNumber(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreeUserByOrganizationNumber(123L); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementByAgreementId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementByAgreementId(123)).ReturnsAsync( + new Agreement + { + AgreementNumber = 111111, + PersonNumber = 222222, + UserId = "101010" + }).Verifiable(); + + + var results = await _agreeController.GetAgreementByAgreementId(123); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as Agreement; + Assert.NotNull(result); + Assert.AreEqual(111111, result.AgreementNumber); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementByAgreementId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementByAgreementId(123)).ReturnsAsync((Agreement)null).Verifiable(); + + var results = await _agreeController.GetAgreementByAgreementId(123); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementByAgreementId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementByAgreementId(0); + + _mockAgreeService.Verify(x => x.GetAgreementByAgreementId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementByAgreementId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementByAgreementId(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementByAgreementId(123); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementsByAccountId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementsByAccountId(123)).ReturnsAsync( + new List + { + new () + { + AgreementNumber = 111111, + PersonNumber = 222222, + UserId = "101010" + }, + new () + { + AgreementNumber = 111112, + PersonNumber = 222223, + UserId = "101011" + } + }).Verifiable(); + + + var results = await _agreeController.GetAgreementsByAccountId(123); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementsByAccountId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementsByAccountId(123)).ReturnsAsync((IEnumerable)null).Verifiable(); + + var results = await _agreeController.GetAgreementsByAccountId(123); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementsByAccountId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementsByAccountId(0); + + _mockAgreeService.Verify(x => x.GetAgreementsByAccountId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementsByAccountId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementsByAccountId(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementsByAccountId(123); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountByAccountId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountByAccountId(123)).ReturnsAsync( + new AgreementAccount + { + AccountNumber = 123 + }).Verifiable(); + + + var results = await _agreeController.GetAgreementAccountByAccountId(123); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as AgreementAccount; + Assert.NotNull(result); + Assert.AreEqual(123, result.AccountNumber); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountByAccountId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountByAccountId(123)).ReturnsAsync((AgreementAccount)null).Verifiable(); + + var results = await _agreeController.GetAgreementAccountByAccountId(123); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementAccountByAccountId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementAccountByAccountId(0); + + _mockAgreeService.Verify(x => x.GetAgreementAccountByAccountId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementAccountByAccountId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountByAccountId(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementAccountByAccountId(123); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsByUserId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByUserId("123")).ReturnsAsync( + new List + { + new () + { + AccountNumber = 123 + }, + new () + { + AccountNumber = 124 + } + }).Verifiable(); + + + var results = await _agreeController.GetAgreementAccountsByUserId("123"); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsByUserId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByUserId("123")).ReturnsAsync((IEnumerable)null).Verifiable(); + + var results = await _agreeController.GetAgreementAccountsByUserId("123"); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementAccountsByUserId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementAccountsByUserId(null); + + _mockAgreeService.Verify(x => x.GetAgreementAccountsByUserId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + + var result2 = await _agreeController.GetAgreementAccountsByUserId(""); + + _mockAgreeService.Verify(x => x.GetAgreementAccountsByUserId(It.IsAny()), Times.Never()); + + Assert.NotNull(result2); + var badRequest2 = result2 as BadRequestObjectResult; + Assert.NotNull(badRequest2); + Assert.AreEqual(400, badRequest2.StatusCode); + } + + [Test] + public async Task GetAgreementAccountsByUserId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByUserId("123")).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementAccountsByUserId("123"); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsByOrganizationId_OK() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByOrganizationId(123)).ReturnsAsync( + new List + { + new () + { + AccountNumber = 123 + }, + new () + { + AccountNumber = 124 + } + }).Verifiable(); + + + var results = await _agreeController.GetAgreementAccountsByOrganizationId(123); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsByOrganizationId_NoContent() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByOrganizationId(123)).ReturnsAsync((IEnumerable)null).Verifiable(); + + var results = await _agreeController.GetAgreementAccountsByOrganizationId(123); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetAgreementAccountsByOrganizationId_empty_BadRequest() + { + var results = await _agreeController.GetAgreementAccountsByOrganizationId(0); + + _mockAgreeService.Verify(x => x.GetAgreementAccountsByOrganizationId(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementAccountsByOrganizationId_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.GetAgreementAccountsByOrganizationId(123)).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementAccountsByOrganizationId(123); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsAuditFromDateLastMaintained_OK() + { + _mockAgreeService.Setup(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny())).ReturnsAsync( + new List + { + 123, + 124 + }).Verifiable(); + + + var results = await _agreeController.GetAgreementAccountsAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAccountsAuditFromDateLastMaintained_BadRequest() + { + var results = await _agreeController.GetAgreementAccountsAuditFromDateLastMaintained(null); + + _mockAgreeService.Verify(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + + var result2 = await _agreeController.GetAgreementAccountsAuditFromDateLastMaintained(""); + + _mockAgreeService.Verify(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(result2); + var badRequest2 = result2 as BadRequestObjectResult; + Assert.NotNull(badRequest2); + Assert.AreEqual(400, badRequest2.StatusCode); + + var resultParseError = await _agreeController.GetAgreementAccountsAuditFromDateLastMaintained("12"); + + _mockAgreeService.Verify(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(resultParseError); + var badRequestParseError = results as BadRequestObjectResult; + Assert.NotNull(badRequestParseError); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementAccountsAuditFromDateLastMaintained_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny())).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementAccountsAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAuditFromDateLastMaintained_OK() + { + _mockAgreeService.Setup(x => x.AuditAgreementChangesByDateLastMaintained(It.IsAny())).ReturnsAsync( + new List + { + 123, + 124 + }).Verifiable(); + + + var results = await _agreeController.GetAgreementAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetAgreementAuditFromDateLastMaintained_BadRequest() + { + var results = await _agreeController.GetAgreementAuditFromDateLastMaintained(null); + + _mockAgreeService.Verify(x => x.AuditAgreementChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + + var result2 = await _agreeController.GetAgreementAuditFromDateLastMaintained(""); + + _mockAgreeService.Verify(x => x.AuditAgreementChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(result2); + var badRequest2 = result2 as BadRequestObjectResult; + Assert.NotNull(badRequest2); + Assert.AreEqual(400, badRequest2.StatusCode); + + var resultParseError = await _agreeController.GetAgreementAuditFromDateLastMaintained("12"); + + _mockAgreeService.Verify(x => x.AuditAgreementChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(resultParseError); + var badRequestParseError = results as BadRequestObjectResult; + Assert.NotNull(badRequestParseError); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetAgreementAuditFromDateLastMaintained_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.AuditAgreementChangesByDateLastMaintained(It.IsAny())).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetAgreementAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetOrganizationAuditFromDateLastMaintained_OK() + { + _mockAgreeService.Setup(x => x.AuditOrganizationChangesByDateLastMaintained(It.IsAny())).ReturnsAsync( + new List + { + 123, + 124 + }).Verifiable(); + + + var results = await _agreeController.GetOrganizationAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockAgreeService.Verify(); + } + + [Test] + public async Task GetOrganizationAuditFromDateLastMaintained_BadRequest() + { + var results = await _agreeController.GetOrganizationAuditFromDateLastMaintained(null); + + _mockAgreeService.Verify(x => x.AuditOrganizationChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(results); + var badRequest = results as BadRequestObjectResult; + Assert.NotNull(badRequest); + Assert.AreEqual(400, badRequest.StatusCode); + + var result2 = await _agreeController.GetOrganizationAuditFromDateLastMaintained(""); + + _mockAgreeService.Verify(x => x.AuditOrganizationChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(result2); + var badRequest2 = result2 as BadRequestObjectResult; + Assert.NotNull(badRequest2); + Assert.AreEqual(400, badRequest2.StatusCode); + + var resultParseError = await _agreeController.GetOrganizationAuditFromDateLastMaintained("12"); + + _mockAgreeService.Verify(x => x.AuditOrganizationChangesByDateLastMaintained(It.IsAny()), Times.Never()); + + Assert.NotNull(resultParseError); + var badRequestParseError = results as BadRequestObjectResult; + Assert.NotNull(badRequestParseError); + Assert.AreEqual(400, badRequest.StatusCode); + } + + [Test] + public async Task GetOrganizationAuditFromDateLastMaintained_Error_StatusServerError() + { + _mockAgreeService.Setup(x => x.AuditOrganizationChangesByDateLastMaintained(It.IsAny())).ThrowsAsync(new Exception("Unit Test Exception")).Verifiable(); + + var results = await _agreeController.GetOrganizationAuditFromDateLastMaintained(DateTime.Now.ToString(CultureInfo.InvariantCulture)); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + _mockAgreeService.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ApplicationHistoryControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ApplicationHistoryControllerTest.cs new file mode 100644 index 0000000..bebae2c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/ApplicationHistoryControllerTest.cs @@ -0,0 +1,107 @@ +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.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class ApplicationHistoryControllerTest + { + private ApplicationHistoryController _applicationHistoryController; + private Mock _mockApplicationHistoryService; + + [SetUp] + public void SetUp() + { + _mockApplicationHistoryService = new Mock(); + _applicationHistoryController = new ApplicationHistoryController(_mockApplicationHistoryService.Object); + } + + [Test] + public async Task GetApplicationHistory_OK() + { + _mockApplicationHistoryService.Setup(x => x.GetApplicationHistory(It.IsAny>(), It.IsAny())).ReturnsAsync( + new List() + { + new ApplicationHistory() + { + ApplicationName = "Test", + ApplicationNumber = 1, + QueueNumber = 10, + StopDateTime = Convert.ToDateTime("1/1/2021") + }, + new ApplicationHistory() + { + ApplicationName = "Test2", + ApplicationNumber = 2, + QueueNumber = 20, + StopDateTime = Convert.ToDateTime("1/1/2021") + } + }); + + var applicationHistoryRequest = new ApplicationHistoryRequest() + { + ApplicationNumbers = new List() + { + "1", + "2" + }, + EffectiveDate = "1/1/2021" + }; + var results = await _applicationHistoryController.GetApplicationHistory(applicationHistoryRequest); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetApplicationHistory_FailedToParse() + { + _mockApplicationHistoryService.Setup(x => x.GetApplicationHistory(It.IsAny>(), + It.IsAny())) + .Throws(new FailedToParseException("Oops")); + + var applicationHistoryRequest = new ApplicationHistoryRequest() + { + ApplicationNumbers = null, + EffectiveDate = null + }; + var results = await _applicationHistoryController.GetApplicationHistory(applicationHistoryRequest); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public async Task GetApplicationHistory_Exception() + { + _mockApplicationHistoryService.Setup(x => x.GetApplicationHistory(It.IsAny>(), + It.IsAny())) + .Throws(new Exception("Oops")); + + var applicationHistoryRequest = new ApplicationHistoryRequest() + { + ApplicationNumbers = null, + EffectiveDate = null + }; + var results = await _applicationHistoryController.GetApplicationHistory(applicationHistoryRequest); + + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AssociateControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AssociateControllerTest.cs new file mode 100644 index 0000000..931f54e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/AssociateControllerTest.cs @@ -0,0 +1,92 @@ +using System; +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.Associate; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class AssociateControllerTest + { + private AssociateController _associateController; + private Mock _mockAssociateService; + + [SetUp] + public void SetUp() + { + _mockAssociateService = new Mock(); + _associateController = new AssociateController(_mockAssociateService.Object); + } + + [Test] + public async Task GetAssociateDetailsBySsn_OK() + { + var taxId = Guid.NewGuid().ToString(); + var associateDetails = new AssociateDetails() + { + PersonNumber = DateTime.Now.Millisecond + }; + + _mockAssociateService.Setup(x => x.GetAssociateDetailsBySsn(taxId)) + .ReturnsAsync(associateDetails).Verifiable(); + + var result = await _associateController.GetAssociateDetailsBySsn(taxId); + Assert.NotNull(result); + var status = result as OkObjectResult; + Assert.NotNull(status); + Assert.AreEqual(200, status.StatusCode); + + var associateDetailsResult = status.Value as AssociateDetails; + Assert.NotNull(associateDetails); + Assert.AreEqual(associateDetails.PersonNumber, associateDetailsResult?.PersonNumber); + _mockAssociateService.Verify(); + } + + [Test] + public async Task GetAssociateDetailsBySsn_NoContent() + { + var taxId = Guid.NewGuid().ToString(); + AssociateDetails associateDetails = null; + + _mockAssociateService.Setup(x => x.GetAssociateDetailsBySsn(taxId)) + .ReturnsAsync(associateDetails).Verifiable(); + + var result = await _associateController.GetAssociateDetailsBySsn(taxId); + Assert.NotNull(result); + var status = result as NoContentResult; + Assert.NotNull(status); + Assert.AreEqual(204, status.StatusCode); + _mockAssociateService.Verify(); + } + + [Test] + public async Task GetAssociateDetailsBySsn_BadRequest() + { + string taxId = null; + + var result = await _associateController.GetAssociateDetailsBySsn(taxId); + Assert.NotNull(result); + var status = result as BadRequestObjectResult; + Assert.NotNull(status); + Assert.AreEqual(400, status.StatusCode); + } + + [Test] + public async Task GetAssociateDetailsBySsn_InternalServerError() + { + var taxId = Guid.NewGuid().ToString(); + _mockAssociateService.Setup(x => x.GetAssociateDetailsBySsn(taxId)) + .Throws(new Exception("Test")).Verifiable(); + + var result = await _associateController.GetAssociateDetailsBySsn(taxId); + Assert.NotNull(result); + var status = result as StatusCodeResult; + Assert.NotNull(status); + Assert.AreEqual(500, status.StatusCode); + _mockAssociateService.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndirectLoanControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndirectLoanControllerTest.cs new file mode 100644 index 0000000..0584476 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndirectLoanControllerTest.cs @@ -0,0 +1,163 @@ +using LCU.Api.Internal.CoreApiWrapper.Controllers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan; +using Microsoft.AspNetCore.Mvc; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class IndirectLoanControllerTest + { + private IndirectLoanController _indirectLoanController; + private Mock _mockIndirectLoanService; + + [SetUp] + public void SetUp() + { + _mockIndirectLoanService = new Mock(); + _indirectLoanController = new IndirectLoanController(_mockIndirectLoanService.Object); + } + + [Test] + public async Task GetIndirectLoanByAccountNumber_OK() + { + _mockIndirectLoanService.Setup(x => x.GetIndirectLoanByAccountNumber(It.IsAny())).ReturnsAsync(new IndirectLoanDetail()); + + var result = await _indirectLoanController.GetIndirectLoanByAccountNumber(1234); + + Assert.NotNull(result); + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetIndirectLoanByAccountNumber_Exception() + { + _mockIndirectLoanService.Setup(x => x.GetIndirectLoanByAccountNumber(It.IsAny())) + .Throws(new Exception("Oops")); + + var result = await _indirectLoanController.GetIndirectLoanByAccountNumber(1234); + + Assert.NotNull(result); + var badResult = result as StatusCodeResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task GetIndirectLoanByPostedDate_OK() + { + _mockIndirectLoanService.Setup(x => x.GetIndirectLoansByPostedDate(It.IsAny())).ReturnsAsync(new List()); + + var result = await _indirectLoanController.GetIndirectLoansByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetIndirectLoanByPostedDate_Exception() + { + _mockIndirectLoanService.Setup(x => x.GetIndirectLoansByPostedDate(It.IsAny())) + .Throws(new Exception("Oops")); + + var result = await _indirectLoanController.GetIndirectLoansByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var badResult = result as StatusCodeResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task GetClosedIndirectLoanByPostedDate_OK() + { + _mockIndirectLoanService.Setup(x => x.GetClosedIndirectLoansByPostedDate(It.IsAny())).ReturnsAsync(new List()); + + var result = await _indirectLoanController.GetClosedIndirectLoansByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetClosedIndirectLoanByPostedDate_Exception() + { + _mockIndirectLoanService.Setup(x => x.GetClosedIndirectLoansByPostedDate(It.IsAny())) + .Throws(new Exception("Oops")); + + var result = await _indirectLoanController.GetClosedIndirectLoansByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var badResult = result as StatusCodeResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task GetClosedIndirectLoanWithDetailByPostedDate_OK() + { + _mockIndirectLoanService.Setup(x => x.GetClosedIndirectLoansWithDetailByPostedDate(It.IsAny())).ReturnsAsync(new List()); + + var result = await _indirectLoanController.GetClosedIndirectLoansWithDetailByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetClosedIndirectLoanWithDetailByPostedDate_Exception() + { + _mockIndirectLoanService.Setup(x => x.GetClosedIndirectLoansWithDetailByPostedDate(It.IsAny())) + .Throws(new Exception("Oops")); + + var result = await _indirectLoanController.GetClosedIndirectLoansWithDetailByPostedDate("5/1/2021"); + + Assert.NotNull(result); + var badResult = result as StatusCodeResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task PutDealerOriginalBalance_Ok() + + { + var accountNumber = "111111111111"; + _mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalance(It.IsAny())).ReturnsAsync( + new List() { }); + + var result = await _indirectLoanController.PutDealerOriginalBalance(accountNumber); + + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PutDealerOriginalBalance_Exception() + { + var accountNumber = "111111111111"; + _mockIndirectLoanService.Setup(x => x.UpdateDealerOriginalBalance(It.IsAny())) + .Throws(new Exception("Oops")); + + var results = await _indirectLoanController.PutDealerOriginalBalance(accountNumber); + + Assert.NotNull(results); + var badResult = results as StatusCodeResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndividualControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndividualControllerTest.cs new file mode 100644 index 0000000..396c79c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/IndividualControllerTest.cs @@ -0,0 +1,90 @@ +using System; +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.LcuModels; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Individuals; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class IndividualControllerTest + { + private IndividualController _individualController; + private Mock _mockIndividualService; + + [SetUp] + public void SetUp() + { + _mockIndividualService = new Mock(); + _individualController = new IndividualController(_mockIndividualService.Object); + } + + [Test] + public void GetIndividual_OK() + { + var testIndividual = new Individual() + { + IndividualId = 1 + }; + _mockIndividualService.Setup(x => x.GetIndividualByUserId(It.IsAny())).ReturnsAsync(testIndividual); + + var result = _individualController.GetIndividual("1"); + + Assert.NotNull(result); + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public void GetIndividual_EmptyString_BadRequest() + { + var testIndividual = new Individual() + { + IndividualId = 1 + }; + _mockIndividualService.Setup(x => x.GetIndividualByUserId(It.IsAny())).ReturnsAsync(testIndividual); + + var result = _individualController.GetIndividual(""); + + Assert.NotNull(result); + var badRes = result as BadRequestObjectResult; + Assert.AreEqual(400, badRes.StatusCode); + Assert.AreEqual("User Id must not be null or empty", badRes.Value); + } + + [Test] + public void GetIndividual_StringWithSpaces_BadRequest() + { + var testIndividual = new Individual() + { + IndividualId = 1 + }; + _mockIndividualService.Setup(x => x.GetIndividualByUserId(It.IsAny())).ReturnsAsync(testIndividual); + + var result = _individualController.GetIndividual(" "); + + Assert.NotNull(result); + var badRes = result as BadRequestObjectResult; + Assert.AreEqual(400, badRes.StatusCode); + Assert.AreEqual("User Id must not be null or empty", badRes.Value); + } + + [Test] + public void GetIndividual_Exception() + { + _mockIndividualService.Setup(x => x.GetIndividualByUserId(It.IsAny())) + .Throws(new Exception("Err")); + + var result = _individualController.GetIndividual("1"); + + Assert.NotNull(result); + var badRes = result as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + Assert.AreEqual("Err", badRes.Value); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/LoanControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/LoanControllerTest.cs new file mode 100644 index 0000000..f866745 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/LoanControllerTest.cs @@ -0,0 +1,136 @@ +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.LcuModels.Loans; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; +using System.Linq; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class LoanControllerTest + { + private LoanController _loanController; + private Mock _mockLoanService; + + [SetUp] + public void SetUp() + { + _mockLoanService = new Mock(); + _loanController = new LoanController(_mockLoanService.Object); + } + + [Test] + public async Task GetLoanDetails_OK() + { + _mockLoanService.Setup(x => x.GetLoanDetail(123334234324)).ReturnsAsync(new LoanDetail(){ LoanId = 1}).Verifiable(); + + var results = await _loanController.GetLoanDetails(123334234324); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as LoanDetail; + Assert.NotNull(result); + Assert.AreEqual(1, result.LoanId); + _mockLoanService.Verify(); + } + + [Test] + public async Task GetLoanDetails_Exception() + { + _mockLoanService.Setup(x => x.GetLoanDetail(It.IsAny())).Throws(new Exception("Oops")); + + var results = await _loanController.GetLoanDetails(1234555); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetLoanCollateral_OK() + { + var collateralResponse = new List() + { + new CollateralDetail() + { + CollateralId = 1 + }, + new CollateralDetail() + { + CollateralId = 2 + } + }; + + _mockLoanService.Setup(x => x.GetCollateralDetails(123334234324)).ReturnsAsync(collateralResponse).Verifiable(); + + var results = await _loanController.GetLoanCollateral(123334234324); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var resultsValue = okResult.Value as List; + Assert.NotNull(resultsValue); + Assert.AreEqual(2, resultsValue.Count); + _mockLoanService.Verify(); + } + + [Test] + public async Task GetLoanCollateral_Exception() + { + _mockLoanService.Setup(x => x.GetCollateralDetails(It.IsAny())).Throws(new Exception("Oops")); + + var results = await _loanController.GetLoanCollateral(1234555); + + Assert.NotNull(results); + var badRes = results as ObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPropertyInformation_Exception() + { + _mockLoanService.Setup(x => x.GetPropertyInformation(It.IsAny())).Throws(new Exception("Oops")); + + var results = await _loanController.GetPropertyInformation(1234555); + + Assert.NotNull(results); + var result = results as ObjectResult; + Assert.NotNull(result); + Assert.AreEqual(500, result.StatusCode); + } + + [Test] + public async Task GetPropertyInformation_Ok() + { + Property property = new Property() + { + PropertyNumber = 1000 + }; + + IEnumerable properties = new List() { property }; + + _mockLoanService.Setup(x => x.GetPropertyInformation(1000)).ReturnsAsync(properties); + + var results = await _loanController.GetPropertyInformation(1000); + + Assert.NotNull(results); + var goodRes = results as OkObjectResult; + Assert.NotNull(goodRes); + Assert.AreEqual(200, goodRes.StatusCode); + } + + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/MemberControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/MemberControllerTest.cs new file mode 100644 index 0000000..a754679 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/MemberControllerTest.cs @@ -0,0 +1,124 @@ +using System; +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.LcuModels.Members; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Mixed; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class MemberControllerTest + { + private MemberController _memberController; + private Mock _mockMemberService; + private Mock _mockLoanService; + + + [SetUp] + public void SetUp() + { + _mockMemberService = new Mock(); + _mockLoanService = new Mock(); + _memberController = new MemberController(_mockMemberService.Object, _mockLoanService.Object); + } + + [Test] + public async Task GetMemberByAccountNumber_OK() + { + _mockMemberService.Setup(x => x.GetMemberByAccountNumber(123334234324)).ReturnsAsync(new Member(){ MemberId = 1}).Verifiable(); + + var results = await _memberController.GetMemberByAccountNumber(123334234324); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as Member; + Assert.NotNull(result); + Assert.AreEqual(1, result.MemberId); + _mockLoanService.Verify(); + } + + [Test] + public async Task GetMemberByAccountNumber_Exception() + { + _mockMemberService.Setup(x => x.GetMemberByAccountNumber(It.IsAny())).Throws(new Exception("Oops")); + + var results = await _memberController.GetMemberByAccountNumber(1234555); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPersonOrOrganizationNumberByMemberNumber_PersonFound() + { + long personMemberNumber = 123; + string personName = "John E Jacob Jr"; + + var personOrOrganization = new PersonOrganization() + { + PersonNumber = personMemberNumber.ToString(), + EntityName = personName + }; + + _mockMemberService.Setup(x => x.GetPersonOrOrganizationNumberByMemberId(It.IsAny())).ReturnsAsync(personOrOrganization).Verifiable(); + + var result = await _memberController.GetPersonOrOrganizationNumberByMemberId(personMemberNumber); + var okResult = result as OkObjectResult; + var personOrOrganizationResult = okResult.Value as PersonOrganization; + + Assert.NotNull(result); + Assert.AreEqual(personMemberNumber.ToString(), personOrOrganizationResult.PersonNumber); + Assert.AreEqual(personName, personOrOrganizationResult.EntityName); + Assert.IsNull(personOrOrganizationResult.OrganizationNumber); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetPersonOrOrganizationNumberByMemberNumber_OrganizationFound() + { + long organizationMemberNumber = 123; + string organizationName = "John E Consulting LLC"; + + var personOrOrganization = new PersonOrganization() + { + OrganizationNumber = organizationMemberNumber.ToString(), + EntityName = organizationName + }; + + _mockMemberService.Setup(x => x.GetPersonOrOrganizationNumberByMemberId(It.IsAny())).ReturnsAsync(personOrOrganization).Verifiable(); + + var result = await _memberController.GetPersonOrOrganizationNumberByMemberId(organizationMemberNumber); + var okResult = result as OkObjectResult; + var personOrOrganizationResult = okResult.Value as PersonOrganization; + + Assert.NotNull(result); + Assert.AreEqual(organizationMemberNumber.ToString(), personOrOrganizationResult.OrganizationNumber); + Assert.AreEqual(organizationName, personOrOrganizationResult.EntityName); + Assert.IsNull(personOrOrganizationResult.PersonNumber); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetPersonOrOrganizationNumberByMemberNumber_NeitherFound_Exception() + { + long organizationMemberNumber = 123; + + _mockMemberService.Setup(x => x.GetPersonOrOrganizationNumberByMemberId(It.IsAny())).Throws(new ArgumentNullException()).Verifiable(); + + var result = await _memberController.GetPersonOrOrganizationNumberByMemberId(organizationMemberNumber); + var notFoundResult = result as StatusCodeResult; + + Assert.NotNull(result); + Assert.NotNull(notFoundResult); + Assert.AreEqual(404, notFoundResult.StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/OrganizationControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/OrganizationControllerTest.cs new file mode 100644 index 0000000..c0e6129 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/OrganizationControllerTest.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.Linq; +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.Organizations; +using LCU.Library.Internal.Exceptions; +using Microsoft.AspNetCore.Http; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class OrganizationControllerTest + { + private OrganizationController _organizationController; + private Mock _mockOrganizationService; + + [SetUp] + public void SetUp() + { + _mockOrganizationService = new Mock(); + + _organizationController = new OrganizationController(_mockOrganizationService.Object); + } + + [Test] + public async Task GetOrganizationByOrganizationNumber_OK() + { + const long organizationNumber = 123334234324; + var testOrganizationResult = new Organization + { + Name = "Test Organization" + }; + var testOrganizationsResult = new List { testOrganizationResult }; + + _mockOrganizationService.Setup(x => x.GetOrganizationByOrganizationNumber(organizationNumber)).ReturnsAsync(testOrganizationsResult).Verifiable(); + + var results = await _organizationController.GetOrganizationByOrganizationNumber(organizationNumber); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as List; + Assert.NotNull(result); + Assert.AreEqual(1, result.Count); + Assert.AreEqual(testOrganizationResult.Name, result.FirstOrDefault()?.Name); + _mockOrganizationService.Verify(); + } + + [Test] + public async Task GetOrganizationByOrganizationNumber_ExceptionThrown_ServerError() + { + const long organizationNumber = 123334234324; + + _mockOrganizationService.Setup(x => x.GetOrganizationByOrganizationNumber(organizationNumber)).ThrowsAsync(new Exception("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByOrganizationNumber(organizationNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetOrganizationByOrganizationNumber_ServiceExceptionThrown_ServerError() + { + const long organizationNumber = 123334234324; + + _mockOrganizationService.Setup(x => x.GetOrganizationByOrganizationNumber(organizationNumber)).ThrowsAsync(new ServiceException("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByOrganizationNumber(organizationNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetMemberByAccountNumber_ServiceException_ServerErrorReturned() + { + const long organizationNumber = 123334234324; + _mockOrganizationService.Setup(x => x.GetOrganizationByOrganizationNumber(organizationNumber)).ThrowsAsync(new ServiceException("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByOrganizationNumber(organizationNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetMemberByAccountNumber_Exception_ServerErrorReturned() + { + const long organizationNumber = 123334234324; + _mockOrganizationService.Setup(x => x.GetOrganizationByOrganizationNumber(organizationNumber)).ThrowsAsync(new Exception("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByOrganizationNumber(organizationNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetOrganizationByMemberAgreementNumber_OK() + { + const long memberNumber = 123334234324; + var testOrganizationResult = new Organization + { + Name = "Test Organization" + }; + + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ReturnsAsync(testOrganizationResult).Verifiable(); + + var results = await _organizationController.GetOrganizationByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as Organization; + Assert.NotNull(result); + Assert.AreEqual(testOrganizationResult.Name, result?.Name); + _mockOrganizationService.Verify(); + } + + [Test] + public async Task GetOrganizationByMemberAgreementNumber_ServiceException_ServerErrorReturned() + { + const long memberNumber = 123334234324; + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ThrowsAsync(new ServiceException("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetOrganizationByMemberAgreementNumber_Exception_ServerErrorReturned() + { + const long memberNumber = 123334234324; + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ThrowsAsync(new Exception("Thrown from unit test")).Verifiable(); + + var results = await _organizationController.GetOrganizationByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetOrganizationByOrganizationName_GetOrganizationByNameThrowsServiceException_Returns500() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(os => os.GetOrganizationByName(organizationName)) + .ThrowsAsync(new ServiceException(string.Empty)); + + var response = await _organizationController.GetOrganizationByOrganizationName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task GetOrganizationByOrganizationName_GetOrganizationByNameThrowsNonServiceException_500() + { + var exception = new Exception(); + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(os => os.GetOrganizationByName(organizationName)) + .ThrowsAsync(exception); + + var response = await _organizationController.GetOrganizationByOrganizationName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task GetOrganizationByOrganizationName_GetOrganizationByNameSucceeds_ReturnsOkAndResult() + { + var organizationName = Guid.NewGuid().ToString(); + var organizations = new[] { new Organization() }; + _mockOrganizationService + .Setup(os => os.GetOrganizationByName(organizationName)) + .ReturnsAsync(organizations); + + var response = await _organizationController.GetOrganizationByOrganizationName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreSame(organizations, ((OkObjectResult)response).Value); + } + + [Test] + public async Task GetOrganizationByOrganizationNameLike_ServiceCallReturns_ReturnsOkAndResults() + { + var organizationName = Guid.NewGuid().ToString(); + var limit = DateTime.Now.Millisecond; + var organizations = new []{ new Organization{ Name = organizationName } }; + _mockOrganizationService + .Setup(s => s.GetOrganizationByNameLike(organizationName, limit)) + .ReturnsAsync(organizations); + + var response = await _organizationController.GetOrganizationByOrganizationNameLike(organizationName, limit); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status200OK, ((OkObjectResult)response).StatusCode); + Assert.AreSame(organizations, ((OkObjectResult)response).Value); + } + + [Test] + public async Task GetOrganizationByOrganizationNameLike_ServiceThrowsServiceException_Returns500() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(s => s.GetOrganizationByNameLike(organizationName, It.IsAny())) + .ThrowsAsync(new ServiceException(string.Empty)); + + var response = await _organizationController.GetOrganizationByOrganizationNameLike(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task GetOrganizationByOrganizationNameLike_ServiceThrowsException_Returns500() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(s => s.GetOrganizationByNameLike(organizationName, It.IsAny())) + .ThrowsAsync(new Exception()); + + var response = await _organizationController.GetOrganizationByOrganizationNameLike(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task CountOrganizationNumbersByName_ServiceCallReturns_ReturnsOkAndResults() + { + var organizationName = Guid.NewGuid().ToString(); + var count = DateTime.Now.Millisecond; + _mockOrganizationService + .Setup(s => s.CountOrganizationNumbersByName(organizationName)) + .ReturnsAsync(count); + + var response = await _organizationController.CountOrganizationNumbersByName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status200OK, ((OkObjectResult)response).StatusCode); + Assert.AreEqual(count, ((OkObjectResult)response).Value); + } + + [Test] + public async Task CountOrganizationNumbersByName_ServiceThrowsServiceException_Returns500() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(s => s.CountOrganizationNumbersByName(organizationName)) + .ThrowsAsync(new ServiceException(string.Empty)); + + var response = await _organizationController.CountOrganizationNumbersByName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task CountOrganizationNumbersByName_ServiceThrowsException_Returns500() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationService + .Setup(s => s.CountOrganizationNumbersByName(organizationName)) + .ThrowsAsync(new Exception()); + + var response = await _organizationController.CountOrganizationNumbersByName(organizationName); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonControllerTest.cs new file mode 100644 index 0000000..2e51444 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonControllerTest.cs @@ -0,0 +1,254 @@ +using System; +using System.Collections.Generic; +using System.Linq; +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.Persons; +using LCU.Library.Internal.Exceptions; +using Microsoft.AspNetCore.Http; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class PersonControllerTest + { + private PersonController _personController; + private Mock _mockPersonService; + + [SetUp] + public void SetUp() + { + _mockPersonService = new Mock(); + _personController = new PersonController(_mockPersonService.Object); + } + + [Test] + public async Task GetPersonByPersonNumber_OK() + { + const long personNumber = 123334234324; + var testPersonResult = new Person + { + FirstName = "Tester" + }; + var testPersonsResult = new List { testPersonResult }; + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(personNumber)).ReturnsAsync(testPersonsResult).Verifiable(); + + var results = await _personController.GetPersonByPersonNumber(personNumber); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as List; + Assert.NotNull(result); + Assert.AreEqual(1, result.Count); + Assert.AreEqual(testPersonResult.FirstName, result.FirstOrDefault()?.FirstName); + _mockPersonService.Verify(); + } + + [Test] + public async Task GetPersonByPersonNumber_ServiceException_ServerErrorReturned() + { + const long personNumber = 123334234324; + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(personNumber)).ThrowsAsync(new ServiceException("Exception thrown from unit test")).Verifiable(); + + var results = await _personController.GetPersonByPersonNumber(personNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPersonByPersonNumber_Exception_ServerErrorReturned() + { + const long personNumber = 123334234324; + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(personNumber)).ThrowsAsync(new Exception("Thrown from unit test")).Verifiable(); + + var results = await _personController.GetPersonByPersonNumber(personNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetMemberByMemberAgreeNbr_OK() + { + const long memberNumber = 123334234324; + var testPersonResult = new Person + { + FirstName = "Tester" + }; + + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ReturnsAsync(testPersonResult).Verifiable(); + + var results = await _personController.GetPersonByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as Person; + Assert.NotNull(result); + Assert.AreEqual(testPersonResult.FirstName, result?.FirstName); + _mockPersonService.Verify(); + } + + [Test] + public async Task GetMemberByMemberAgreeNbr_ServiceException_ServerErrorReturned() + { + const long memberNumber = 123334234324; + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ThrowsAsync(new ServiceException("Thrown from unit test")).Verifiable(); + + var results = await _personController.GetPersonByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetMemberByMemberAgreeNbr_Exception_ServerErrorReturned() + { + const long memberNumber = 123334234324; + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(memberNumber)).ThrowsAsync(new Exception("Thrown from unit test")).Verifiable(); + + var results = await _personController.GetPersonByMemberAgreementNumber(memberNumber); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPersonNameLike_RequestModelInvalid_Returns400() + { + var modelErrorKey = Guid.NewGuid().ToString(); + var modelErrorMessage = Guid.NewGuid().ToString(); + _personController.ModelState.AddModelError(modelErrorKey, modelErrorMessage); + + var response = await _personController.GetPersonNameLike(new PersonNameRequest()); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status400BadRequest, ((BadRequestObjectResult)response).StatusCode); + } + + [Test] + public async Task GetPersonNameLike_ServiceThrowsServiceException_Returns500() + { + var request = new PersonNameRequest(); + var limit = DateTime.Now.Millisecond; + _mockPersonService + .Setup(s => s.GetPersonsByNameLike(request, limit)) + .ThrowsAsync(new ServiceException(string.Empty)); + + var response = await _personController.GetPersonNameLike(request, limit); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task GetPersonNameLike_ServiceThrowsException_Returns500() + { + var request = new PersonNameRequest(); + var limit = DateTime.Now.Millisecond; + _mockPersonService + .Setup(s => s.GetPersonsByNameLike(request, limit)) + .ThrowsAsync(new Exception()); + + var response = await _personController.GetPersonNameLike(request, limit); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task GetPersonNameLike_ServiceReturnsPeople_Returns200AndPeople() + { + var request = new PersonNameRequest(); + var limit = DateTime.Now.Millisecond; + var people = Enumerable.Repeat>(() => new Person(), limit).Select(f => f()).ToArray(); + _mockPersonService + .Setup(s => s.GetPersonsByNameLike(request, limit)) + .ReturnsAsync(people); + + var response = await _personController.GetPersonNameLike(request, limit); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status200OK, ((OkObjectResult)response).StatusCode); + Assert.AreEqual(people, ((OkObjectResult)response).Value); + } + + [Test] + public async Task CountPersonNameLike_RequestModelInvalid_Returns400() + { + var modelErrorKey = Guid.NewGuid().ToString(); + var modelErrorMessage = Guid.NewGuid().ToString(); + _personController.ModelState.AddModelError(modelErrorKey, modelErrorMessage); + + var response = await _personController.CountPersonNameLike(new PersonNameRequest()); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status400BadRequest, ((BadRequestObjectResult)response).StatusCode); + } + + [Test] + public async Task CountPersonNameLike_ServiceThrowsServiceException_Returns500() + { + var request = new PersonNameRequest(); + var limit = DateTime.Now.Millisecond; + _mockPersonService + .Setup(s => s.CountPersonsByNameLike(request)) + .ThrowsAsync(new ServiceException(string.Empty)); + + var response = await _personController.CountPersonNameLike(request); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task CountPersonNameLike_ServiceThrowsException_Returns500() + { + var request = new PersonNameRequest(); + var limit = DateTime.Now.Millisecond; + _mockPersonService + .Setup(s => s.CountPersonsByNameLike(request)) + .ThrowsAsync(new Exception()); + + var response = await _personController.CountPersonNameLike(request); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status500InternalServerError, ((StatusCodeResult)response).StatusCode); + } + + [Test] + public async Task CountPersonNameLike_ServiceReturnsPeople_Returns200AndCount() + { + var request = new PersonNameRequest(); + var count = DateTime.Now.Ticks; + _mockPersonService + .Setup(s => s.CountPersonsByNameLike(request)) + .ReturnsAsync(count); + + var response = await _personController.CountPersonNameLike(request); + + Assert.IsInstanceOf(response); + Assert.AreEqual(StatusCodes.Status200OK, ((OkObjectResult)response).StatusCode); + Assert.AreEqual(count, ((OkObjectResult)response).Value); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonUserFieldControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonUserFieldControllerTest.cs new file mode 100644 index 0000000..f598309 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PersonUserFieldControllerTest.cs @@ -0,0 +1,289 @@ +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.Persons; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class PersonUserFieldControllerTest + { + private PersonUserFieldController _personUserFieldController; + private Mock _mockPersonUserFieldService; + + [SetUp] + public void SetUp() + { + _mockPersonUserFieldService = new Mock(); + _personUserFieldController = new PersonUserFieldController(_mockPersonUserFieldService.Object); + } + + [Test] + public async Task PutPersonUserFieldsAtmCheckHolds_OK() + { + var personUserField1 = new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + + _mockPersonUserFieldService.Setup(x => x.UpdatePersonUserFieldAsync(It.IsAny())).ReturnsAsync(personUserField1); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PutPersonUserFieldForAtmCheckHolds(personUserFieldUpdateRequest); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PutPersonUserFieldsAtmCheckholds_Exception() + { + + _mockPersonUserFieldService.Setup(x => x.UpdatePersonUserFieldAsync(It.IsAny())).Throws(new NullReferenceException("Oops")); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PutPersonUserFieldForAtmCheckHolds(personUserFieldUpdateRequest); + _mockPersonUserFieldService.Verify(); + + var badRes = results as ObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task PostPersonUserFieldsAtmCheckhold_OK() + { + var personUserField1 = new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + + _mockPersonUserFieldService.Setup(x => x.InsertPersonUserFieldAsync(It.IsAny())).ReturnsAsync(personUserField1); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PostPersonUserFieldForAtmCheckHolds(personUserFieldUpdateRequest); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PostPersonUserFieldsAtmCHeckhold_Exception() + { + _mockPersonUserFieldService.Setup(x => x.InsertPersonUserFieldAsync(It.IsAny())).Throws(new NullReferenceException("Nope!")); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PostPersonUserFieldForAtmCheckHolds(personUserFieldUpdateRequest); + _mockPersonUserFieldService.Verify(); + + var badRes = results as ObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetPersonUserFieldsForAtmCheckHolds_OK() + { + var personUserField1 = new PersonCheckHoldsUserField() + { + PersonNumber = 100001, + OldestActiveEffectiveDate = DateTime.UtcNow, + RecentClosedEffectiveDate = DateTime.UtcNow, + UserFieldExists = true, + + }; + + var personUserField2 = new PersonCheckHoldsUserField() + { + PersonNumber = 200001, + OldestActiveEffectiveDate = DateTime.UtcNow, + RecentClosedEffectiveDate = DateTime.UtcNow, + UserFieldExists = false, + }; + + _mockPersonUserFieldService.Setup(x => x.GetPersonsForAtmCheckHolds(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + personUserField1, + personUserField2 + }); + + var results = await _personUserFieldController.GetPersonsForAtmCheckHolds(DateTime.Now, DateTime.Now, 0); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetPersonUserFieldsForAtmCheckHoldsLimit_OK() + { + var personUserField1 = new PersonCheckHoldsUserField() + { + PersonNumber = 100001, + OldestActiveEffectiveDate = DateTime.UtcNow, + RecentClosedEffectiveDate = DateTime.UtcNow, + UserFieldExists = true, + + }; + + var personUserField2 = new PersonCheckHoldsUserField() + { + PersonNumber = 200001, + OldestActiveEffectiveDate = DateTime.UtcNow, + RecentClosedEffectiveDate = DateTime.UtcNow, + UserFieldExists = false, + }; + + _mockPersonUserFieldService.Setup(x => x.GetPersonsForAtmCheckHolds(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + personUserField1 + }); + + var results = await _personUserFieldController.GetPersonsForAtmCheckHolds(DateTime.Now, DateTime.Now, 1); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PutPersonUserFieldsGeneric_OK() + { + var personUserField1 = new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + + _mockPersonUserFieldService.Setup(x => x.UpdatePersonUserFieldAsync(It.IsAny())).ReturnsAsync(personUserField1); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PutPersonUserField(personUserFieldUpdateRequest); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PutPersonUserFieldsGeneric_Exception() + { + + _mockPersonUserFieldService.Setup(x => x.UpdatePersonUserFieldAsync(It.IsAny())).Throws(new NullReferenceException("Oops")); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PutPersonUserField(personUserFieldUpdateRequest); + _mockPersonUserFieldService.Verify(); + + var badRes = results as ObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task PostPersonUserFieldsGeneric_OK() + { + var personUserField1 = new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + + _mockPersonUserFieldService.Setup(x => x.InsertPersonUserFieldAsync(It.IsAny())).ReturnsAsync(personUserField1); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PostPersonUserField(personUserFieldUpdateRequest); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PostPersonUserFieldsGeneric_Exception() + { + _mockPersonUserFieldService.Setup(x => x.InsertPersonUserFieldAsync(It.IsAny())).Throws(new NullReferenceException("Nope!")); + + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var results = await _personUserFieldController.PostPersonUserField(personUserFieldUpdateRequest); + _mockPersonUserFieldService.Verify(); + + var badRes = results as ObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PropertyUserFieldControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PropertyUserFieldControllerTest.cs new file mode 100644 index 0000000..d289542 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/PropertyUserFieldControllerTest.cs @@ -0,0 +1,145 @@ +using LCU.Api.Internal.CoreApiWrapper.Controllers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; +using Microsoft.AspNetCore.Mvc; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class PropertyUserFieldControllerTest + { + private PropertyUserFieldController _propertyUserFieldController; + private Mock _mockPropertyUserFieldService; + + [SetUp] + public void SetUp() + { + _mockPropertyUserFieldService = new Mock(); + _propertyUserFieldController = new PropertyUserFieldController(_mockPropertyUserFieldService.Object); + } + + [Test] + public async Task GetPropertyUserField_ExceptionAsync() + { + _mockPropertyUserFieldService.Setup(x => x.GetPropertyUserFieldsAsync(1000)).Throws(new Exception("Unit Test Failed")); + + var propertyUserField = new PropertyUserField() + { + Id = "TEST", + PropertyNumber = 1000, + UserFieldCode = "TEST", + Value = "TEST" + }; + + var results = await _propertyUserFieldController.GetPropertyUserField(1000); + + Assert.NotNull(results); + var badResult = results as ObjectResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task PostPropertyUserField_OkAsync() + { + var propertyUserField = new PropertyUserField() + { + Id = "TEST", + PropertyNumber = 1000, + UserFieldCode = "TEST", + Value = "TEST" + }; + + BasicResponse basicResponse = new BasicResponse() + { + Success = true, + }; + + _mockPropertyUserFieldService.Setup(x => x.InsertPropertyUserFieldAsync(It.IsAny())).ReturnsAsync(basicResponse); + + var results = await _propertyUserFieldController.PostPropertyUserField(propertyUserField); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PostPropertyUserField_ExceptionAsync() + { + _mockPropertyUserFieldService.Setup(x => x.InsertPropertyUserFieldAsync(It.IsAny())).Throws(new Exception("Unit Test Failed")); + + var propertyUserField = new PropertyUserField() + { + Id = "TEST", + PropertyNumber = 1000, + UserFieldCode = "TEST", + Value = "TEST" + }; + + var results = await _propertyUserFieldController.PostPropertyUserField(propertyUserField); + + Assert.NotNull(results); + var badResult = results as ObjectResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + + [Test] + public async Task PutPropertyUserField_OkAsync() + { + var propertyUserField = new PropertyUserField() + { + Id = "TEST", + PropertyNumber = 1000, + UserFieldCode = "TEST", + Value = "TEST" + }; + + BasicResponse basicResponse = new BasicResponse() + { + Success = true, + }; + + _mockPropertyUserFieldService.Setup(x => x.UpdatePropertyUserFieldAsync(It.IsAny())).ReturnsAsync(basicResponse); + + var results = await _propertyUserFieldController.PutPropertyUserField(propertyUserField); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task PutPropertyUserField_ExceptionAsync() + { + _mockPropertyUserFieldService.Setup(x => x.UpdatePropertyUserFieldAsync(It.IsAny())).Throws(new Exception("Unit Test Failed")); + + var propertyUserField = new PropertyUserField() + { + Id = "TEST", + PropertyNumber = 1000, + UserFieldCode = "TEST", + Value = "TEST" + }; + + var results = await _propertyUserFieldController.PutPropertyUserField(propertyUserField); + + Assert.NotNull(results); + var badResult = results as ObjectResult; + Assert.NotNull(badResult); + Assert.AreEqual(500, badResult.StatusCode); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TaxControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TaxControllerTest.cs new file mode 100644 index 0000000..ac42848 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TaxControllerTest.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.AspNetCore.Mvc; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Controllers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class TaxControllerTest + { + private TaxController _taxController; + private Mock _mockTaxService; + + [SetUp] + public void SetUp() + { + _mockTaxService = new Mock(); + _taxController = new TaxController(_mockTaxService.Object); + } + + [Test] + public async Task GetPersonsTaxIdData_OK() + { + var personTaxIdDataResponse = new List + { + new() { + FirstName = "Greg", + MiddleInitial = "H", + LastName = "Stevens", + Suffix = "Jr.", + NameFull = "Greg H. Stevens Jr.", + PersonNumber = 123 + } + }; + + _mockTaxService.Setup(service => service.GetPersonsTaxIdData("123")).ReturnsAsync(personTaxIdDataResponse).Verifiable(); + var results = await _taxController.GetPersonsTaxIdData("123"); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var dataResponse = okResult.Value as IEnumerable; + Assert.NotNull(dataResponse); + Assert.AreEqual(1, dataResponse.Count()); + var firstResponse = dataResponse.First(); + Assert.AreEqual("Greg",firstResponse.FirstName); + Assert.AreEqual("H", firstResponse.MiddleInitial); + Assert.AreEqual("Stevens", firstResponse.LastName); + Assert.AreEqual("Jr.", firstResponse.Suffix); + Assert.AreEqual("Greg H. Stevens Jr.", firstResponse.NameFull); + Assert.AreEqual(123, firstResponse.PersonNumber); + _mockTaxService.Verify(); + } + + [Test] + public async Task GetPersonsTaxIdData_EmptyString_BadRequest() + { + + var results = await _taxController.GetPersonsTaxIdData(""); + + Assert.NotNull(results); + var okResult = results as BadRequestObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(400, okResult.StatusCode); + + _mockTaxService.Verify(service => service.GetPersonsTaxIdData(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetPersonsTaxIdData_ErrorThrown_ServerError() + { + _mockTaxService.Setup(service => service.GetPersonsTaxIdData("123")).ThrowsAsync(new Exception("Thrown from unit test.")); + var results = await _taxController.GetPersonsTaxIdData("123"); + + Assert.NotNull(results); + var okResult = results as StatusCodeResult; + Assert.NotNull(okResult); + Assert.AreEqual(500, okResult.StatusCode); + _mockTaxService.Verify(); + } + + [Test] + public async Task GetOrganizationsTaxIdData_OK() + { + var organizationsTaxIdDataResponse = new List + { + new() { + Name = "Electric Company", + OrganizationNumber = 123 + } + }; + + _mockTaxService.Setup(service => service.GetOrganizationsTaxIdData("123")).ReturnsAsync(organizationsTaxIdDataResponse).Verifiable(); + var results = await _taxController.GetOrganizationsTaxIdData("123"); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var dataResponse = okResult.Value as IEnumerable; + Assert.NotNull(dataResponse); + Assert.AreEqual(1, dataResponse.Count()); + var firstResponse = dataResponse.First(); + Assert.AreEqual("Electric Company",firstResponse.Name); + Assert.AreEqual(123, firstResponse.OrganizationNumber); + _mockTaxService.Verify(); + } + + [Test] + public async Task GetOrganizationsTaxIdData_EmptyString_BadRequest() + { + + var results = await _taxController.GetOrganizationsTaxIdData(""); + + Assert.NotNull(results); + var okResult = results as BadRequestObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(400, okResult.StatusCode); + + _mockTaxService.Verify(service => service.GetOrganizationsTaxIdData(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetOrganizationsTaxIdData_ErrorThrown_ServerError() + { + _mockTaxService.Setup(service => service.GetOrganizationsTaxIdData("123")).ThrowsAsync(new Exception("Thrown from unit test.")); + var results = await _taxController.GetOrganizationsTaxIdData("123"); + + Assert.NotNull(results); + var okResult = results as StatusCodeResult; + Assert.NotNull(okResult); + Assert.AreEqual(500, okResult.StatusCode); + _mockTaxService.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TransactionControllerTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TransactionControllerTest.cs new file mode 100644 index 0000000..8d49910 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Controllers/TransactionControllerTest.cs @@ -0,0 +1,202 @@ +using LCU.Api.Internal.CoreApiWrapper.Configuration; +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.Transaction; +using Microsoft.AspNetCore.Mvc; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Controllers +{ + public class TransactionControllerTest + { + private TransactionController _transactionController; + private Mock _mockTransactionService; + private CoreApiWrapperConfig _coreApiWrapperConfig; + + [SetUp] + public void SetUp() + { + _mockTransactionService = new Mock(); + _coreApiWrapperConfig = new CoreApiWrapperConfig + { + FeatureFlags = new FeatureFlags + { + DisableCoreDBWrite = false + } + }; + _transactionController = new TransactionController(_mockTransactionService.Object, _coreApiWrapperConfig); + } + + [Test] + public async Task PostMonetaryTransactions_OK() + { + _mockTransactionService.Setup(x => x.AddMonetaryTransactionsAsync(It.IsAny>())).ReturnsAsync( + new List() { }); + + var groupRequest = new GroupedMonetaryTransactionRequest() + { + MonetaryTransactionRequests = new List() { + new MonetaryTransactionRequest() + { + AccountNumber = 19617805142, + TransactionAmount = -1.27, + ApprovalPersonNumber = 5225, + RequestNumber = "1", + OverrideCashBoxNumber = 800, + TransactionTypeCode = "DRIR", + Description = "", + BalanceTypes = new List { + new BalanceType1() { + BalanceCategoryCode = "UPFR", + BalanceTypeCode = "DLR", + BalanceTypeAmount = -1.27 + } + }, + Funds = new List { + new Fund() { + ClearingCategoryCode = "IMED", + FundAmount = -1.27, + FundTypeCode = "EL", + FundTypeDetailCode = "INTR", + NumberOfItems = 1 + } + } + } + } + }; + + var response = new MonetaryTransactionResponse() + { + WasSuccessful = false + }; + + var listResponse = new List { response }; + var listGroupRequest = new List { groupRequest }; + + var result = await _transactionController.PostMonetaryTransactions(listGroupRequest); + + var okResult = result as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + } + + [Test] + public async Task GetTransactionHistory_OK() + { + _mockTransactionService.Setup(x => x.GetTransactionHistory(123334234324, + Convert.ToDateTime("12/25/2020"), + Convert.ToDateTime("2/2/2021"), + null)).ReturnsAsync( + new List + { + new TransactionHistory() + { + AccountNumber = 123334234324, + ActivityDateTime = Convert.ToDateTime("1/1/2021") + }, + new TransactionHistory() + { + AccountNumber = 123334234324, + ActivityDateTime = Convert.ToDateTime("1/2/2021") + } + }).Verifiable(); + + var results = await _transactionController.GetTransactionHistory(123334234324, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021")); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + _mockTransactionService.Verify(); + } + + [Test] + public async Task GetTransactionHistory_Null_NotFoundException() + { + _mockTransactionService.Setup(x => x.GetTransactionHistory(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync((IEnumerable)null); + + var results = await _transactionController.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021")); + + Assert.NotNull(results); + var notFoundRes = results as NotFoundResult; + Assert.NotNull(notFoundRes); + Assert.AreEqual(404, notFoundRes.StatusCode); + } + + [Test] + public async Task GetTransactionHistory_EmptyList_NoContentException() + { + _mockTransactionService.Setup(x => x.GetTransactionHistory(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync(new List()); + + var results = await _transactionController.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021")); + + Assert.NotNull(results); + var noContentResult = results as NoContentResult; + Assert.NotNull(noContentResult); + Assert.AreEqual(204, noContentResult.StatusCode); + } + + [Test] + public async Task GetTransactionHistory_Exception() + { + _mockTransactionService.Setup(x => x.GetTransactionHistory(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new Exception("Oops")); + + var results = await _transactionController.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021")); + + Assert.NotNull(results); + var badRes = results as StatusCodeResult; + Assert.NotNull(badRes); + Assert.AreEqual(500, badRes.StatusCode); + } + + [Test] + public async Task GetTransactionsByDateSpan_OK() + { + _mockTransactionService.Setup(x => x.GetTransactionsByDateSpan(It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync(new List() { new TransactionAlertInfo() }); + + var results = await _transactionController.GetTransactionsByDateSpan(DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow, new string[1]); + + Assert.NotNull(results); + var okResult = results as OkObjectResult; + Assert.NotNull(okResult); + Assert.AreEqual(200, okResult.StatusCode); + + var result = okResult.Value as IEnumerable; + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + } + + [Test] + public async Task GetTransactionsByDateSpan_Exception_DateOrder() + { + var results = await _transactionController.GetTransactionsByDateSpan(DateTime.UtcNow, DateTime.UtcNow.AddMinutes(-1)); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + + [Test] + public async Task GetTransactionsByDateSpan_Exception_DateMinimum() + { + var results = await _transactionController.GetTransactionsByDateSpan(DateTime.MinValue, DateTime.UtcNow); + + Assert.NotNull(results); + var badRes = results as BadRequestObjectResult; + Assert.NotNull(badRes); + Assert.AreEqual(400, badRes.StatusCode); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/CoreApiUtilities/CoreRequestTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/CoreApiUtilities/CoreRequestTest.cs new file mode 100644 index 0000000..7ab7f0e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/CoreApiUtilities/CoreRequestTest.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.Net.Http; +using Moq; +using Newtonsoft.Json; +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; + +namespace LCU.Api.Internal.CoreApiWrapperTest.CoreApiUtilities +{ + public class CoreRequestTest + { + private readonly CoreRequest _coreRequest; + private readonly Mock _mockClientFactory; + private readonly Mock _mockCoreServiceConnection; + + public CoreRequestTest() + { + _mockClientFactory = new Mock(); + _mockCoreServiceConnection = new Mock(); + var coreConfiguration = new CoreConfiguration() + { + CoreApiConfiguration = new CoreApiConfiguration() + }; + + _coreRequest = new CoreRequest(_mockClientFactory.Object, + _mockCoreServiceConnection.Object, + coreConfiguration); + } + + [Test] + public void CreateHttpRequestMessage_NoBodyOrContent_CorrectUrl() + { + var testEndPoint = "endpoint/test"; + + var coreConfiguration = new CoreConfiguration() + { + CoreApiConfiguration = new CoreApiConfiguration() + { + HostUrl = "https://CoreTEST.com", + HostPort = "1111", + ApiChannelId = "TEST-afjksd9-0sakjf-klsdja-fpsjad" + } + }; + + var coreRequest = new CoreRequest(_mockClientFactory.Object, + _mockCoreServiceConnection.Object, + coreConfiguration); + + _mockCoreServiceConnection.Setup(x => x.GetAccessToken()).Returns("TESTAafjp07087jfjas0d908qj324"); + + var result = coreRequest.CreateHttpRequestMessage(testEndPoint, HttpMethod.Post); + + Assert.NotNull(result); + Assert.AreEqual("//CoreTEST.com:1111endpoint/test", result.RequestUri.AbsolutePath); + Assert.AreEqual("TESTAafjp07087jfjas0d908qj324", result.Headers.Authorization.Scheme); + Assert.IsNull(result.Content); + } + + [Test] + public void CreateHttpRequestMessage_BodyIsJson() + { + var testCompare = new Dictionary(); + testCompare.Add("FirstName", "Test"); + var jsonTestCompare = JsonConvert.SerializeObject(testCompare); + + var testEndPoint = "endpoint/test"; + + var coreConfiguration = new CoreConfiguration() + { + CoreApiConfiguration = new CoreApiConfiguration() + { + HostUrl = "https://CoreTEST.com", + HostPort = "1111" + } + }; + + var coreRequest = new CoreRequest(_mockClientFactory.Object, + _mockCoreServiceConnection.Object, + coreConfiguration); + + _mockCoreServiceConnection.Setup(x => x.GetAccessToken()).Returns("TESTAafjp07087jfjas0d908qj324"); + + var result = coreRequest.CreateHttpRequestMessage(testEndPoint, HttpMethod.Post, jsonTestCompare); + + Assert.NotNull(result); + Assert.AreEqual("//CoreTEST.com:1111endpoint/test", result.RequestUri.AbsolutePath); + Assert.AreEqual("TESTAafjp07087jfjas0d908qj324", result.Headers.Authorization.Scheme); + Assert.NotNull(result.Content); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AccountDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AccountDaoTest.cs new file mode 100644 index 0000000..65a4c0a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AccountDaoTest.cs @@ -0,0 +1,438 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +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.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class AccountDaoTest + { + private IAccountDao _accountDao; + private CoreConfiguration _coreConfiguration; + private ApiSecurityConfiguration _apiSecurityConfiguration; + private Mock _mockCoreRequest; + private Mock _mockCoreDbExecution; + private Mock _mockPostRequest; + private Mock _mockPutRequest; + + [SetUp] + public void SetUp() + { + _mockCoreDbExecution = new Mock(); + _mockCoreRequest = new Mock(); + _mockPostRequest = new Mock(); + _mockPutRequest = new Mock(); + + _coreConfiguration = new CoreConfiguration() + { + CoreSoapApiConfiguration = new CoreSoapApiConfiguration() + { + CoreSoapApiWrapperHost = "test.lcu-internal.com", + CoreSoapEndpointConfiguration = new CoreSoapEndpointConfiguration() + { + PutAccountAnalysisGroupMaintenanceRequest = "TEST/Account/AccountAnalysisGroupMaintenanceRequest" + } + } + }; + + _apiSecurityConfiguration = new ApiSecurityConfiguration() + { + InternalApiKeySet = new Dictionary() + { + ["CoreSoapApiWrapper"] = "TEST" + } + }; + + _accountDao = new AccountDao(_mockCoreRequest.Object, + _coreConfiguration, + _apiSecurityConfiguration, + _mockCoreDbExecution.Object, + _mockPostRequest.Object, + _mockPutRequest.Object); + } + + [Test] + public async Task GetActivityAccountDetailsByAccountNumbers_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new() {AccountNumber = 1}, + new() {AccountNumber = 2}, + new() {AccountNumber = 3} + }).Verifiable(); + + var results = await _accountDao.GetActivityAccountDetailsByAccountNumbers(new List() { "1", "2", "3" }); + Assert.NotNull(results); + Assert.AreEqual(3,results.Count); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains("ActivityAccountDetailsByAccountNbr") && str.Contains(":accountNumbers")), + It.IsAny())); + } + + [Test] + public async Task GetActivityAccountDetailsByAccountNumbers_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _accountDao.GetActivityAccountDetailsByAccountNumbers(new List() { "1", "2", "3" })); + + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains("ActivityAccountDetailsByAccountNbr") && str.Contains(":accountNumbers")), + It.IsAny())); + } + + [Test] + public async Task FindOwnersByAccountNumber_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List { new AccountOwnership() { FirstName = "Tim" } }).Verifiable(); + + var result = await _accountDao.FindOwnersByAccountNumber(12345, new DateTime()); + + Assert.NotNull(result); + var firstResult = result.First(); + Assert.AreEqual(firstResult.FirstName, "Tim"); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void FindOwnersByAccountNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Error thrown from unit test")); + + Assert.ThrowsAsync(async () => await _accountDao.FindOwnersByAccountNumber(12345, new DateTime())); + + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task FindOwnersByPersonName_OK() + { + var firstName = "Tim"; + var role = "OWN"; + + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List { new AccountOwnership() { FirstName = firstName, Role = role } }).Verifiable(); + + var result = await _accountDao.FindPrimaryOwnersByPersonName(firstName); + + Assert.NotNull(result); + var firstResult = result.First(); + Assert.AreEqual(firstResult.FirstName, firstName); + Assert.AreEqual(firstResult.Role, role); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void FindOwnersByPersonName_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Error thrown from unit test")); + + Assert.ThrowsAsync(async () => await _accountDao.FindPrimaryOwnersByPersonName("Tim")); + + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task FindOwnersByOrganizationName_OK() + { + var organizationName = "The Big Company"; + + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List { new AccountOwnership() { OrganizationName = organizationName } }).Verifiable(); + + var result = await _accountDao.FindPrimaryOwnersByOrganizationName(organizationName); + + Assert.NotNull(result); + var firstResult = result.First(); + Assert.AreEqual(firstResult.OrganizationName, organizationName); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void FindOwnersByOrganizationName_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Error thrown from unit test")); + + Assert.ThrowsAsync(async () => await _accountDao.FindPrimaryOwnersByOrganizationName("The Big Company")); + + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task FindAccountsForGroupAnalysisUpdate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny())) + .ReturnsAsync(new List { { "11111111" }, { "22222222" } }).Verifiable(); + + var result = await _accountDao.FindAccountsToUpdateAccountAnalysis(); + + Assert.NotNull(result); + Assert.AreEqual(result.First(), "11111111"); + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task FindAccountsForGroupAnalysisUpdate_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(null, null)) + .ThrowsAsync(new Exception("Error thrown from unit test")); + _mockCoreDbExecution.Verify(); + var result = await _accountDao.FindAccountsToUpdateAccountAnalysis(); + + Assert.IsEmpty(result); + } + + [Test] + public async Task UpdateAccountsForGroupAnalysisUpdate_OK() + { + var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest() + { + AccountNumber = 123, + IsGenerateAnalysisStatement = true, + IsPrintAnalysisStatement = true, + IsUseForServiceCharge = true + }; + + var basicResponse = new BasicResponse() + { + Success = true + }; + + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountAnalysisGroupMaintenanceRequest); + _mockPutRequest.Setup(x => x.Async(endpoint, + It.IsAny(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(basicResponse).Verifiable(); + + var result = await _accountDao.UpdateAccountAnalysis(accountAnalysisGroupMaintenanceRequest); + + Assert.NotNull(result); + Assert.AreEqual(result.Success, true); + } + + [Test] + public async Task UpdateAccountsForGroupAnalysisUpdate_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(null, null)) + .ThrowsAsync(new Exception("Error thrown from unit test")); + _mockCoreDbExecution.Verify(); + var result = await _accountDao.FindAccountsToUpdateAccountAnalysis(); + + Assert.IsEmpty(result); + } + + [Test] + public async Task UpdateAccountNickName_OK() + { + var accountRequest = new AccountNickNameUpdateRequest() + { + AccountNumber = 123, + AccountDescription = "TestOk" + }; + + var basicResponse = new BasicResponse() + { + Success = true + }; + + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountNickNameUpdateRequest); + _mockPutRequest.Setup(x => x.Async(endpoint, + It.IsAny(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(basicResponse).Verifiable(); + + var result = await _accountDao.UpdateAccountNickName(accountRequest); + + Assert.NotNull(result); + Assert.AreEqual(result.Success, true); + } + + [Test] + public async Task UpdateAccountNickName_Exception() + { + var accountRequest = new AccountNickNameUpdateRequest() + { + AccountNumber = 0, + AccountDescription = "TestError" + }; + var result = await _accountDao.UpdateAccountNickName(accountRequest); + + Assert.IsNull(result); + } + [Test] + public async Task UpdateAccountCreditReportType_OK() + { + var accountRequest = new AccountCreditReportTypeUpdateRequest() + { + AccountNumber = 123, + CreditReportType = "EXCL" + }; + + var basicResponse = new BasicResponse() + { + Success = true + }; + + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountCreditReportTypeUpdateRequest); + _mockPutRequest.Setup(x => x.Async(endpoint, + It.IsAny(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(basicResponse).Verifiable(); + + var result = await _accountDao.UpdateAccountCreditReportType(accountRequest); + + Assert.NotNull(result); + Assert.AreEqual(result.Success, true); + } + + [Test] + public async Task UpdateAccountCreditReportType_Exception() + { + var accountRequest = new AccountCreditReportTypeUpdateRequest() + { + AccountNumber = 0, + CreditReportType = "EXCL" + }; + var result = await _accountDao.UpdateAccountCreditReportType(accountRequest); + + Assert.IsNull(result); + } + + [Test] + public async Task GetAccountsByMajorMinorBranchAndStatus_OK() + { + var request = new AccountsByMajorMinorBranchAndStatusRequest() + { + BranchCodes = new List() + { + 1234, + 1235 + }, + AccountStatuses = new List() + { + "Status" + }, + MajorTypes = new List() + { + "Major" + }, + MinorTypes = new List() + { + "MinorOne", + "MinorTwo" + } + }; + + var response = new List() + { + new AccountsByMajorMinorBranchAndStatusResponse() + { + AccountNumber = 1234, + BranchCode = 987654321, + Name = "Test Name" + }, + new AccountsByMajorMinorBranchAndStatusResponse() + { + AccountNumber = 5678, + BranchCode = 987654321, + Name = "Test Name Two" + } + }; + + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountDao.GetAccountsByMajorMinorBranchAndStatus(request); + + Assert.NotNull(result); + var firstResult = result.First(); + Assert.AreEqual(firstResult.AccountNumber, 1234); + Assert.AreEqual(firstResult.Name, "Test Name"); + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task UpdateAccountContractDate_OK() + { + var accountRequest = new AccountContractDateUpdateRequest + { + AccountNumber = 123, + ContractDate = DateTime.Now + }; + + var basicResponse = new BasicResponse() + { + Success = true + }; + + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountContractDateUpdateRequest); + _mockPutRequest.Setup(x => x.Async(endpoint, + It.IsAny(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(basicResponse).Verifiable(); + + var result = await _accountDao.UpdateAccountContractDate(accountRequest); + + Assert.NotNull(result); + Assert.AreEqual(result.Success, true); + } + + [Test] + public async Task UpdateAccountContractDate_Exception() + { + var accountRequest = new AccountContractDateUpdateRequest + { + AccountNumber = 123, + ContractDate = DateTime.Now + }; + var result = await _accountDao.UpdateAccountContractDate(accountRequest); + + Assert.IsNull(result); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ActivityDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ActivityDaoTest.cs new file mode 100644 index 0000000..d8f3edd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ActivityDaoTest.cs @@ -0,0 +1,652 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Phones; +using Moq; +using NUnit.Framework; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class ActivityDaoTest + { + private ActivityDao _activityDao; + private Mock _mockCoreDbExecution; + + [SetUp] + public void SetUp() + { + _mockCoreDbExecution = new Mock(); + _activityDao = new ActivityDao(_mockCoreDbExecution.Object); + } + + [Test] + public async Task GetNewCheckingActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewCheckingActivities(DateTime.Parse("2020-04-02T11:00:00"), 1, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode() + .Equals(new { afterActivityNbr = "1", newerThanDateTime = "2020-04-02 11:00:00", limitAmount = "100" }.GetHashCode())))); + } + + [Test] + public async Task GetNewCheckingActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewCheckingActivities(DateTime.Parse("2020-04-02T11:00:00"), 1, 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewCheckingActivitiesNewerThanDate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewCheckingActivitiesNewerThanDate(DateTime.Parse("2020-04-02T11:00:00"), 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = (string)null, limitAmount = "100" } + .GetHashCode())))); + } + + [Test] + public async Task GetNewCheckingActivitiesNewerThanDate() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewCheckingActivitiesNewerThanDate(DateTime.Parse("2020-04-02T11:00:00"), 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = (string)null, limitAmount = "100" } + .GetHashCode())))); + } + + [Test] + public async Task GetNewCheckingActivitiesAfterActivityNbr_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewCheckingActivitiesAfterActivityNbr(1, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = (string)null, afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewCheckingActivitiesAfterActivityNbr_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewCheckingActivitiesAfterActivityNbr(1, 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = (string)null, afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewAtmCheckCardActivities(DateTime.Parse("2020-04-02T11:00:00"), 1, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode() + .Equals(new { afterActivityNbr = "1", newerThanDateTime = "2020-04-02 11:00:00", limitAmount = "100" }.GetHashCode())))); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewAtmCheckCardActivities(DateTime.Parse("2020-04-02T11:00:00"), 1, 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewAtmCheckCardActivitiesNewerThanDate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewAtmCheckCardActivitiesNewerThanDate(DateTime.Parse("2020-04-02T11:00:00"), 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = (string)null, limitAmount = "100" } + .GetHashCode())))); + } + + [Test] + public async Task GetNewAtmCheckCardActivitiesNewerThanDate() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewAtmCheckCardActivitiesNewerThanDate(DateTime.Parse("2020-04-02T11:00:00"), 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = (string)null, limitAmount = "100" } + .GetHashCode())))); + } + + [Test] + public async Task GetNewAtmCheckCardActivitiesAfterActivityNbr_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewAtmCheckCardActivitiesAfterActivityNbr(1, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = (string)null, afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewAtmCheckCardActivitiesAfterActivityNbr_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewAtmCheckCardActivitiesAfterActivityNbr(1, 100)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = (string)null, afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewActivityManagerReferrals_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewActivityManagerReferrals(DateTime.Parse("2020-04-02T11:00:00"), 1); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { afterActivityId = "1", newerThanOriginationDate = "2020-04-02 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetNewActivityManagerReferrals_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewActivityManagerReferrals(DateTime.Parse("2020-04-02T11:00:00"), 1)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanOriginationDate = "2020-04-02 11:00:00", afterActivityId = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewActivityManagerReferralsNewerThan_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewActivityManagerReferralsNewerThan(DateTime.Parse("2020-04-02T11:00:00")); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanOriginationDate = "2020-04-02 11:00:00", afterActivityId = (string)null }.GetHashCode())))); + } + + [Test] + public async Task GetNewActivityManagerReferralsNewerThan_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewActivityManagerReferralsNewerThan(DateTime.Parse("2020-04-02T11:00:00"))); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanOriginationDate = "2020-04-02 11:00:00", afterActivityId = (string)null }.GetHashCode())))); + } + + [Test] + public async Task GetNewActivityManagerReferralsAfterActivityId_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewActivityManagerReferralsAfterActivityId(1); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanOriginationDate = (string)null, afterActivityId = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewActivityManagerReferralsAfterActivityId_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewActivityManagerReferralsAfterActivityId(1)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanOriginationDate")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanOriginationDate = (string)null, afterActivityId = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewMortgageSaleActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewMortgageSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { afterActivityNbr = "1", newerThanDateTime = "2020-04-02 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetNewMortgageSaleActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewMortgageSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewVehicleSaleActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewVehicleSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { afterActivityNbr = "1", newerThanDateTime = "2020-04-02 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetNewVehicleSaleActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewVehicleSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewEDeliverySaleActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new EStatementDeliveryMethod() { ActivityNumber = 1 }, + new EStatementDeliveryMethod() { ActivityNumber = 2 }, + new EStatementDeliveryMethod() { ActivityNumber = 3 } + }).Verifiable(); + + var results = await _activityDao.GetEStatementDeliveryActivity(DateTime.Parse("2020-04-02T11:00:00")); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetNewEDeliverySaleActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Exception thrown")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetEStatementDeliveryActivity(null)); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + var results = await _activityDao.GetNewDebtProtectedLoanSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { afterActivityNbr = "1", newerThanDateTime = "2020-04-02 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _activityDao.GetNewDebtProtectedLoanSaleActivities(DateTime.Parse("2020-04-02T11:00:00"), 1)); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2020-04-02 11:00:00", afterActivityNbr = "1" }.GetHashCode()))), Times.Never); + } + + [Test] + public async Task QueryActivityManagerActivity_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new() { ActivityId = 1 }, + new() { ActivityId = 2 }, + new() { ActivityId = 3 } + }).Verifiable(); + + var results = await _activityDao.QueryActivityManagerActivity(new ActivityQueryRequest() + { + ActivityIds = new List() { 1, 2, 3 } + }); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + //Parameters are passed in using Anonymous Object, Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":activityIds")), It.IsAny())); + } + + [Test] + public async Task QueryActivityManagerActivity_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), + It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(async () => + await _activityDao.QueryActivityManagerActivity(new ActivityQueryRequest() + { + ActivityIds = new List() { 1, 2, 3 } + })); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_OK() + { + var phoneNumber = Guid.NewGuid().ToString(); + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new() { PersonNumber = DateTime.Now.Millisecond, HomePhone = phoneNumber } + }).Verifiable(); + + var result = await _activityDao.GetPersonActivityByPhoneNumber(phoneNumber); + + Assert.NotNull(result); + Assert.AreEqual(phoneNumber, result.FirstOrDefault()?.HomePhone); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void GetPersonActivityByPhoneNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), + It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(async () => + await _activityDao.GetPersonActivityByPhoneNumber(It.IsAny())); + } + + [Test] + public async Task GetPersonActivityByPersonNumber_OK() + { + var personNumber = DateTime.Now.Millisecond; + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List + { + new() { PersonNumber = personNumber } + }).Verifiable(); + + var result = await _activityDao.GetPersonActivityByPersonNumber(personNumber.ToString()); + + Assert.NotNull(result); + Assert.AreEqual(personNumber, result.PersonNumber); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void GetPersonActivityByPersonNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), + It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(async () => + await _activityDao.GetPersonActivityByPersonNumber(It.IsAny())); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreeDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreeDaoTest.cs new file mode 100644 index 0000000..63a390a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreeDaoTest.cs @@ -0,0 +1,127 @@ +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class AgreeDaoTest + { + private AgreeDao _agreeDao; + private Mock _mockCoreDbExecution; + + [SetUp] + public void SetUp() + { + _mockCoreDbExecution = new Mock(); + _agreeDao = new AgreeDao(_mockCoreDbExecution.Object); + } + + [Test] + public async Task FindAgreeUsersByAccountNumbers_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), + It.IsAny>())) + .ReturnsAsync(new List() + { + new() + { + AccountNumber = 20001, + AgreeNumber = 2000, + UserId = "12000" + } + }).Verifiable(); + + var testAccountNumbers = new List() { "20001" }; + var results = await _agreeDao.FindAgreeUsersByAccountNumbers(testAccountNumbers); + + Assert.NotNull(results); + var firstResult = results.FirstOrDefault(); + Assert.AreEqual(20001, firstResult.AccountNumber); + Assert.AreEqual(2000, firstResult.AgreeNumber); + Assert.AreEqual("12000", firstResult.UserId); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery>( + It.Is(str => str.Contains(":param0")), + It.IsAny>())); + } + + [Test] + public void FindByUserId_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), + It.IsAny>())) + .ThrowsAsync(new Exception("Ah oh Error")); + + + var testAccountNumbers = new List() { "20001" }; + Assert.ThrowsAsync(async () => + await _agreeDao.FindAgreeUsersByAccountNumbers(testAccountNumbers)); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery>( + It.Is(str => str.Contains(":param0")), + It.IsAny>())); + } + + [Test] + public async Task FindAgreeUserByPersonNumber_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List { "5436" }).Verifiable(); + + var result = await _agreeDao.FindAgreeUserByPersonNumber(12355L); + + Assert.NotNull(result); + Assert.AreEqual("5436", result.FirstOrDefault()); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void FindAgreeUserByPersonNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Error thrown from unit test")); + + Assert.ThrowsAsync(async () => await _agreeDao.FindAgreeUserByPersonNumber(123L)); + + _mockCoreDbExecution.Verify(); + } + + [Test] + public async Task FindAgreeUserByOrganizationNumber_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List { "5436" }).Verifiable(); + + var result = await _agreeDao.FindAgreeUserByOrganizationNumber(12355L); + + Assert.NotNull(result); + Assert.AreEqual("5436", result); + _mockCoreDbExecution.Verify(); + } + + [Test] + public void FindAgreeUserByOrganizationNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Error thrown from unit test")); + + Assert.ThrowsAsync(async () => await _agreeDao.FindAgreeUserByOrganizationNumber(123L)); + + _mockCoreDbExecution.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreePersonDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreePersonDaoTest.cs new file mode 100644 index 0000000..0b68acc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/AgreePersonDaoTest.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class AgreePersonDaoTest + { + private AgreePersonDao _agreePersonDao; + private Mock _mockCoreDbExecution; + private ApiSecurityConfiguration _apiSecurityConfiguration; + private Mock _mockPutRequest; + + [SetUp] + public void SetUp() + { + _mockCoreDbExecution = new Mock(); + _mockPutRequest = new Mock(); + + var coreConfiguration = new CoreConfiguration() + { + CoreSoapApiConfiguration = new CoreSoapApiConfiguration() + { + CoreSoapApiWrapperHost = "test.lcu-internal.com", + CoreSoapEndpointConfiguration = new CoreSoapEndpointConfiguration() + { + PutPersonAgreementsDetailTypes = "api/Test/core/PutThing" + } + } + }; + + _apiSecurityConfiguration = new ApiSecurityConfiguration() + { + InternalApiKeySet = new Dictionary() + { + ["CoreSoapApiWrapper"] = "TEST" + } + }; + + _agreePersonDao = new AgreePersonDao(_mockCoreDbExecution.Object, + coreConfiguration, + _apiSecurityConfiguration, + _mockPutRequest.Object); + } + + [Test] + public async Task FindByUserId_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1" + } + }).Verifiable(); + + var result = await _agreePersonDao.FindByUserId("1"); + + Assert.NotNull(result); + Assert.AreEqual(100, result.AgreeNumber); + Assert.AreEqual(10, result.PersonNumber); + Assert.AreEqual("1", result.UserId); + //Parameters are passed in using Anonymous Object, + // Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":userId")), + It.Is(obj => obj.GetHashCode().Equals(new { userId = "1"}.GetHashCode())))); + } + + [Test] + public void FindByUserId_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Ah oh Error")); + + Assert.ThrowsAsync(async () => + await _agreePersonDao.FindByUserId("1")); + + //Parameters are passed in using Anonymous Object, + // Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":userId")), + It.Is(obj => obj.GetHashCode().Equals(new { userId = "1"}.GetHashCode())))); + } + + [Test] + public async Task FindAgreePersonsWithHyphenatedUserId_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny())) + .ReturnsAsync(new List() + { + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1-1" + } + }).Verifiable(); + + var result = await _agreePersonDao.FindAgreePersonsWithHyphenatedUserId(); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + var singleResult = result.FirstOrDefault(); + Assert.NotNull(singleResult); + Assert.AreEqual(100, singleResult.AgreeNumber); + Assert.AreEqual(10, singleResult.PersonNumber); + Assert.AreEqual("1-1", singleResult.UserId); + } + + [Test] + public void FindAgreePersonsWithHyphenatedUserId_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny())) + .ThrowsAsync(new Exception("Ah oh Error")); + + Assert.ThrowsAsync(async () => + await _agreePersonDao.FindAgreePersonsWithHyphenatedUserId()); + } + + [Test] + public async Task FindActiveCustodialVruCardAgreementAgreePersons_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny())) + .ReturnsAsync(new List() + { + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "11" + } + }).Verifiable(); + + var result = await _agreePersonDao.FindActiveCustodialVruCardAgreementAgreePersons(); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + var singleResult = result.FirstOrDefault(); + Assert.NotNull(singleResult); + Assert.AreEqual(100, singleResult.AgreeNumber); + Assert.AreEqual(10, singleResult.PersonNumber); + Assert.AreEqual("11", singleResult.UserId); + } + + [Test] + public void FindActiveCustodialVruCardAgreementAgreePersons_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny())) + .ThrowsAsync(new Exception("Ah oh Error")); + + Assert.ThrowsAsync(async () => + await _agreePersonDao.FindActiveCustodialVruCardAgreementAgreePersons()); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ApplicationHistoryDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ApplicationHistoryDaoTest.cs new file mode 100644 index 0000000..2437fcb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/ApplicationHistoryDaoTest.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using System.Linq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class ApplicationHistoryDaoTest + { + private ApplicationHistoryDao _applicationHistoryDao; + private Mock _mockCoreDbExecution; + + [SetUp] + public void SetUp() + { + _mockCoreDbExecution = new Mock(); + _applicationHistoryDao = new ApplicationHistoryDao(_mockCoreDbExecution.Object); + } + + [Test] + public async Task FindApplicationHistory_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new ApplicationHistory() + { + ApplicationName = "Test", + ApplicationNumber = 1, + QueueNumber = 10, + StopDateTime = Convert.ToDateTime("1/1/2021"), + EffectiveDate = Convert.ToDateTime("1/1/2021") + }, + new ApplicationHistory() + { + ApplicationName = "Test2", + ApplicationNumber = 2, + QueueNumber = 20, + StopDateTime = Convert.ToDateTime("1/1/2021"), + EffectiveDate = Convert.ToDateTime("1/1/2021") + } + }).Verifiable(); + + var applicationTestNumbers = new List() + { + "1", + "2" + }; + var effectiveDate = Convert.ToDateTime("1/2/2021"); + var results = await _applicationHistoryDao.FindApplicationHistory(applicationTestNumbers, effectiveDate); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + Assert.True(resultsList.Any(x => x.ApplicationName == "Test")); + Assert.True(resultsList.Any(x => x.ApplicationName == "Test")); + Assert.True(resultsList.Any(x => x.ApplicationNumber == 1)); + Assert.True(resultsList.Any(x => x.ApplicationNumber == 2)); + Assert.True(resultsList.Any(x => x.QueueNumber == 10)); + Assert.True(resultsList.Any(x => x.QueueNumber == 20)); + Assert.True(resultsList.Any(x => x.StopDateTime == Convert.ToDateTime("1/1/2021"))); + Assert.True(resultsList.Any(x => x.EffectiveDate == Convert.ToDateTime("1/1/2021"))); + Assert.AreEqual(2, resultsList.Where(r => r.StopDateTime == Convert.ToDateTime("1/1/2021")).ToList().Count); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery( + It.Is(str => str.Contains(":param0") && str.Contains(":param1") && + str.Contains(":EffectiveDate")), + It.IsAny())); + } + + [Test] + public void FindApplicationHistory_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Ah oh Error")); + + var applicationTestNumbers = new List() + { + "1", + "2" + }; + var effectiveDate = Convert.ToDateTime("1/2/2021"); + + Assert.ThrowsAsync(async () => + await _applicationHistoryDao.FindApplicationHistory(applicationTestNumbers, effectiveDate)); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery( + It.Is(str => str.Contains(":param0") && str.Contains(":param1") && + str.Contains(":EffectiveDate")), + It.IsAny())); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/IndirectLoanDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/IndirectLoanDaoTest.cs new file mode 100644 index 0000000..a05b8c4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/IndirectLoanDaoTest.cs @@ -0,0 +1,275 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class IndirectLoanDaoTest + { + private IndirectLoanDao _indirectLoanDao; + private Mock _mockCoreDbExecution; + private CoreConfiguration _coreConfiguration; + private ApiSecurityConfiguration _apiSecurityConfiguration; + private Mock _mockPutRequest; + + [SetUp] + public void SetUp() + { + _mockPutRequest = new Mock(); + + _coreConfiguration = new CoreConfiguration() + { + CoreSoapApiConfiguration = new CoreSoapApiConfiguration() + { + CoreSoapEndpointConfiguration = new CoreSoapEndpointConfiguration() + { + PutDealerOriginalBalance = "TEST/IndirectLoan/PutDealerOriginalBalance" + } + } + }; + + _apiSecurityConfiguration = new ApiSecurityConfiguration() + { + InternalApiKeySet = new Dictionary() + { + ["CoreSoapApiWrapper"] = "TEST" + } + }; + + _mockCoreDbExecution = new Mock(); + _indirectLoanDao = new IndirectLoanDao(_mockCoreDbExecution.Object, + _coreConfiguration, + _apiSecurityConfiguration, + _mockPutRequest.Object); + } + + [Test] + public async Task GetIndirectLoanByAccountNumber_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new IndirectLoanDetail() {LoanNumber = "1234"} + }).Verifiable(); + + var results = await _indirectLoanDao.FindByAccountNumber(1234); + + Assert.NotNull(results); + Assert.AreEqual(1, results.Count()); + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":AcctNbr")), + It.Is(obj => + obj.GetHashCode().Equals(new { AcctNbr = 1234 }.GetHashCode())))); + } + + [Test] + public async Task GetIndirectLoanByAccountNumber_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _indirectLoanDao.FindByAccountNumber(1234)); + + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":AcctNbr")), + It.Is(obj => + obj.GetHashCode().Equals(new { AcctNbr = 1234 }.GetHashCode())))); + } + + [Test] + public async Task GetIndirectLoansByPostedDate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new IndirectLoanDetail { LoanNumber = "1" }, + new IndirectLoanDetail { LoanNumber = "2" }, + new IndirectLoanDetail { LoanNumber = "3" } + }).Verifiable(); + + var results = await _indirectLoanDao.FindByPostedDate(DateTime.Parse("2021-05-01T11:00:00")); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count()); + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetIndirectLoansByPostedDate_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _indirectLoanDao.FindByPostedDate(DateTime.Parse("2021-05-01T11:00:00"))); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetClosedIndirectLoansByPostedDate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new ClosedIndirectLoan { LoanNumber = "1" }, + new ClosedIndirectLoan { LoanNumber = "2" }, + new ClosedIndirectLoan { LoanNumber = "3" } + }).Verifiable(); + + var results = await _indirectLoanDao.FindClosedByPostedDate(DateTime.Parse("2021-05-01T11:00:00")); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count()); + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime") && str.Contains("CLS")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetClosedIndirectLoansByPostedDate_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _indirectLoanDao.FindClosedByPostedDate(DateTime.Parse("2021-05-01T11:00:00"))); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime") && str.Contains("CLS")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetClosedIndirectLoansWithDetailByPostedDate_OK() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ReturnsAsync(new List() + { + new IndirectLoanDetail { LoanNumber = "1" }, + new IndirectLoanDetail { LoanNumber = "2" }, + new IndirectLoanDetail { LoanNumber = "3" } + }).Verifiable(); + + var results = await _indirectLoanDao.FindClosedWithDetailByPostedDate(DateTime.Parse("2021-05-01T11:00:00")); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count()); + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime") && str.Contains("CLS")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task GetClosedIndirectLoansWithDetailByPostedDate_Exception() + { + _mockCoreDbExecution + .Setup(x => x.ExecuteQuery(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception("Yikes")); + + Assert.ThrowsAsync(async () => + await _indirectLoanDao.FindClosedWithDetailByPostedDate(DateTime.Parse("2021-05-01T11:00:00"))); + + //Parameters are passed in using Anonymous Object,Verify they are expected object using HashCode. Obj.Equals has issues with Anonymous Objects. + _mockCoreDbExecution.Verify(x => + x.ExecuteQuery(It.Is(str => str.Contains(":newerThanDateTime") && str.Contains("CLS")), + It.Is(obj => + obj.GetHashCode().Equals(new { newerThanDateTime = "2021-05-01 11:00:00" }.GetHashCode())))); + } + + [Test] + public async Task UpdateDealerOriginalBalance_Ok() + { + var accountNumber = "111111111111"; + var response = new UpdateDealerOriginalBalanceResponse(); + var responseList = new List { response }; //no errors in response + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutDealerOriginalBalance + $"?accountNumber={accountNumber}"); + _mockPutRequest.Setup(x => x.Async>(endpoint, + null, + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseList).Verifiable(); + + var results = await _indirectLoanDao.UpdateDealerOriginalBalance(accountNumber); + Assert.IsNotNull(results); + Assert.AreEqual("", results.ToList().Where(x => x.AccountNumber == "111111111111")); + _mockPutRequest.Verify(); + } + + [Test] + public async Task UpdateDealerOriginalBalance_Ok_WithErrors() + { + var accountNumber ="111111111111"; + var response = new UpdateDealerOriginalBalanceResponse() + { + AccountNumber = "111111111111", + ErrorMessage = "Error: This account is not valid for update." + }; + + var responseList = new List { response }; //error for second account + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutDealerOriginalBalance + $"?accountNumber={accountNumber}"); + _mockPutRequest.Setup(x => x.Async>(endpoint, + null, + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(responseList).Verifiable(); + + var results = await _indirectLoanDao.UpdateDealerOriginalBalance(accountNumber); + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + Assert.AreEqual("111111111111", results.ToList().Where(x => x.AccountNumber == "111111111111").FirstOrDefault().AccountNumber); + _mockPutRequest.Verify(); + } + + [Test] + public void UpdateDealerOriginalBalance_Exception() + { + var accountNumber = "111111111111"; + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutDealerOriginalBalance + $"?accountNumber={accountNumber}"); + _mockPutRequest.Setup(x => x.Async>(endpoint, + null, + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .Throws(new Exception("Error thrown in unit test.")).Verifiable(); + + Assert.ThrowsAsync(async () => await _indirectLoanDao.UpdateDealerOriginalBalance(accountNumber)); + _mockPutRequest.Verify(); + } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/OrganizationDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/OrganizationDaoTest.cs new file mode 100644 index 0000000..8d951ef --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/OrganizationDaoTest.cs @@ -0,0 +1,143 @@ +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.CoreApiWrapperLib.Utilities; +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 LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using Moq; +using Newtonsoft.Json; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class OrganizationDaoTest + { + private readonly OrganizationDao _organizationDao; + private readonly Mock _mockCoreRequest; + private readonly Mock _coreDb; + + public OrganizationDaoTest() + { + _mockCoreRequest = new Mock(); + _coreDb = new Mock(); + + var coreConfiguration = new CoreConfiguration + { + CoreApiConfiguration = new CoreApiConfiguration + { + CoreEndPointConfiguration = new CoreEndPointConfiguration + { + PersonsQueryName = "Test" + } + } + }; + + _organizationDao = new OrganizationDao + ( + _mockCoreRequest.Object, + coreConfiguration, + _coreDb.Object + ); + } + + [Test] + public async Task FindOrganizationByMemberAgreeNbr() + { + // Arrange + var listOfIncludes = new List + { + RequestIncludeConstants.AllAddresses + }; + var coreRequestParameters = new CoreRequestParameters(listOfIncludes); + var organizationRequest = new MemberNbrRequest + { + MemberNbr = 100, + }; + + var testPostalAddress = new PostalAddress + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11, + AddressLine1 = "Test Street", + AddressLine2 = "", + AddressLine3 = "", + CityName = "City Test", + PostalCode = "53183", + ZipPlus = "3123", + CountrySubdivisionCode = "WI" + }; + var testPostalAddressList = new List { testPostalAddress }; + var testOrganization = new Organization + { + MemberAgreementNumber = 111111111, + Name = "Test Organization Name", + OrganizationNumber = 123, + PostalAddressList = testPostalAddressList + }; + + var header = new CoreMessageHeader(); + CoreApiMessage organizationApiMessage = + new CoreApiMessage(header, testOrganization); + + var organizationJson = JsonConvert.SerializeObject(testOrganization); + + _mockCoreRequest.Setup(x => x.PostRequestObject>(It.IsAny(), + It.IsAny>(), + It.IsAny())).ReturnsAsync(organizationApiMessage); + + // Act + var results = _organizationDao.FindOrganizationByMemberAgreeNbr(coreRequestParameters, organizationRequest); + + // Assert + Assert.NotNull(results); + } + + [Test] + public async Task FindOrganizationNumbersByNameSearch_AllCases_ExecutesOrganizationNumberByNameLikeQueryWithNameAndLimitParameters() + { + var query = QueryUtilities.GetQuery("Organization/OrganizationNumberByNameLikeQuery"); + var name = Guid.NewGuid().ToString().ToUpperInvariant(); + var limit = DateTime.Now.Millisecond; + var resultSeries = new Random(DateTime.Now.Millisecond); + var results = new long[]{ resultSeries.Next(), resultSeries.Next(), resultSeries.Next() }; + _coreDb + .Setup(c => c.ExecuteQuery(query, It.Is(q => q.GetPropertyValue("organizationName") == name.ToLowerInvariant() && q.GetPropertyValue("limit") == limit))) + .Returns(Task.FromResult>(results)); + + var organizationNumbers = await _organizationDao.FindOrganizationNumbersByNameSearch(name, limit); + + Assert.AreSame(results, organizationNumbers); + } + + [Test] + public async Task CountOrganizationNumbersByName_AllCases_ExecutesOrganizationByNameLikeCountWithNameParameter() + { + var query = QueryUtilities.GetQuery("Organization/OrganizationByNameLikeCount"); + var name = Guid.NewGuid().ToString().ToUpperInvariant(); + var count = DateTime.Now.Millisecond; + var results = new long[]{ count }; + _coreDb + .Setup(c => c.ExecuteQuery(query, It.Is(q => q.GetPropertyValue("organizationName") == name.ToLowerInvariant()))) + .Returns(Task.FromResult>(results)); + + var organizationCount = await _organizationDao.CountOrganizationNumbersByName(name); + + Assert.AreEqual(count, organizationCount); + } + } +} + +public static class ObjectPropertyExtension +{ + public static T GetPropertyValue(this object obj, string propertyName) + { + return (T) obj.GetType().GetProperty(propertyName).GetValue(obj, null); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/PersonDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/PersonDaoTest.cs new file mode 100644 index 0000000..d23bf41 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/PersonDaoTest.cs @@ -0,0 +1,96 @@ +using System; +using System.Threading.Tasks; +using System.Collections.Generic; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class PersonDaoTest + { + private readonly PersonDao _personDao; + private readonly Mock _mockCoreRequest; + private readonly Mock _mockCoreDbExecution; + + public PersonDaoTest() + { + _mockCoreDbExecution = new Mock(); + _mockCoreRequest = new Mock(); + + var coreConfiguration = new CoreConfiguration + { + CoreApiConfiguration = new CoreApiConfiguration + { + CoreEndPointConfiguration = new CoreEndPointConfiguration + { + PersonsQueryName = "Test" + } + } + }; + + _personDao = new PersonDao(_mockCoreRequest.Object, + _mockCoreDbExecution.Object, + coreConfiguration); + } + + [Test] + public async Task FindPersons_Returns_Null() + { + var coreRequestParameters = new CoreRequestParameters(); + var personRequest = new PersonNameRequest(); + CoreApiMessage> personsJsonResponse = null; + + _mockCoreRequest.Setup(x => x.PostRequestObject>>(It.IsAny(), + It.IsAny>(), + It.IsAny())).ReturnsAsync(personsJsonResponse); + var result = await _personDao.FindByPersonsName(coreRequestParameters, personRequest); + + Assert.IsNull(result); + } + + [Test] + public async Task GetPersonNumbersByNameLike_AllCases_ExecutesPersonNumberByNameLikeQueryWithNameAndLimitParameters() + { + var query = QueryUtilities.GetQuery("Person/PersonNumberByNameLikeQuery"); + var firstName = Guid.NewGuid().ToString().ToUpperInvariant(); + var middleName = Guid.NewGuid().ToString().ToUpperInvariant(); + var lastName = Guid.NewGuid().ToString().ToUpperInvariant(); + var limit = DateTime.Now.Millisecond; + var resultSeries = new Random(DateTime.Now.Millisecond); + var results = new long[]{ resultSeries.Next(), resultSeries.Next(), resultSeries.Next() }; + _mockCoreDbExecution + .Setup(c => c.ExecuteQuery(query, It.Is(q => q.GetPropertyValue("firstName") == firstName.ToLowerInvariant() && q.GetPropertyValue("middleName") == middleName.ToLowerInvariant() && q.GetPropertyValue("lastName") == lastName.ToLowerInvariant() && q.GetPropertyValue("limit") == limit))) + .Returns(Task.FromResult>(results)); + + var organizationNumbers = await _personDao.GetPersonNumbersByNameLike(firstName, middleName, lastName, limit); + + Assert.AreSame(results, organizationNumbers); + } + + [Test] + public async Task CountPersonsByNameLike_AllCases_ExecutesPersonByNameLikeCountWithNameParameters() + { + var query = QueryUtilities.GetQuery("Person/PersonByNameLikeCount"); + var firstName = Guid.NewGuid().ToString().ToUpperInvariant(); + var middleName = Guid.NewGuid().ToString().ToUpperInvariant(); + var lastName = Guid.NewGuid().ToString().ToUpperInvariant(); + var count = DateTime.Now.Millisecond; + var results = new long[]{ count }; + _mockCoreDbExecution + .Setup(c => c.ExecuteQuery(query, It.Is(q => q.GetPropertyValue("firstName") == firstName.ToLowerInvariant() && q.GetPropertyValue("middleName") == middleName.ToLowerInvariant() && q.GetPropertyValue("lastName") == lastName.ToLowerInvariant()))) + .Returns(Task.FromResult>(results)); + + var organizationCount = await _personDao.CountPersonsByNameLike(firstName, middleName, lastName); + + Assert.AreEqual(count, organizationCount); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TaxDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TaxDaoTest.cs new file mode 100644 index 0000000..495b346 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TaxDaoTest.cs @@ -0,0 +1,96 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Linq; +using Moq; +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class TaxDaoTest + { + private TaxDao _taxDao; + private Mock _mockCoreRequest; + private CoreConfiguration _coreConfiguration; + + [SetUp] + public void SetUp() + { + _mockCoreRequest = new Mock(); + + _coreConfiguration = new CoreConfiguration + { + CoreApiConfiguration = new CoreApiConfiguration + { + CoreEndPointConfiguration = new CoreEndPointConfiguration + { + GetOrganizationsDataByTaxId = "test/Organization/Query/TaxId", + GetPersonsDataByTaxId = "test/Person/Query/TaxId" + } + } + }; + + _taxDao = new TaxDao(_mockCoreRequest.Object, _coreConfiguration); + } + + [Test] + public async Task GetPersonTaxIdData_Returns_Success() + { + var header = new CoreMessageHeader + { + UpdateKey = null, + MessageId = null + }; + + var body = new List{ + new() + { + FirstName = "Greg", + MiddleInitial = "H", + LastName = "Stevens", + Suffix = "Jr.", + NameFull = "Greg H. Stevens Jr.", + PersonNumber = 123 + } + }; + var personTaxIdDataResponse = new CoreApiMessage>(header, body); + + _mockCoreRequest.Setup(x => x.PostRequestObject>>(It.Is(url => url.Equals("test/Person/Query/TaxId")), It.IsAny>() ,It.Is(x => x.Contains("123")))).ReturnsAsync(personTaxIdDataResponse).Verifiable(); + + var results = await _taxDao.GetPersonTaxIdData(new CoreRequestParameters(), "123"); + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + _mockCoreRequest.Verify(); + } + + [Test] + public async Task GetOrganizationTaxIdData_Returns_Success() + { + var header = new CoreMessageHeader + { + UpdateKey = null, + MessageId = null + }; + + var body = new List{ + new() + { + Name = "Organization", + OrganizationNumber = 123 + } + }; + var personTaxIdDataResponse = new CoreApiMessage>(header, body); + + _mockCoreRequest.Setup(x => x.PostRequestObject>>(It.Is(url => url.Equals("test/Organization/Query/TaxId")), It.IsAny>() ,It.Is(url => url.Contains("123")))).ReturnsAsync(personTaxIdDataResponse).Verifiable(); + + var results = await _taxDao.GetOrganizationTaxIdData(new CoreRequestParameters(), "123"); + Assert.IsNotNull(results); + Assert.AreEqual(1, results.Count()); + _mockCoreRequest.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TransactionDaoTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TransactionDaoTest.cs new file mode 100644 index 0000000..bee4a74 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/DataAccess/TransactionDaoTest.cs @@ -0,0 +1,233 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Library.Internal.ApiSecurity.Models; +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.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Api.Internal.CoreApiWrapperTest.DataAccess +{ + public class TransactionDaoTest + { + private TransactionDao _transactionDao; + private Mock _mockCoreRequest; + private CoreConfiguration _coreConfiguration; + private ApiSecurityConfiguration _apiSecurityConfiguration; + private Mock _mockCoreDbExecution; + private Mock _mockPostRequest; + + [SetUp] + public void SetUp() + { + _mockCoreRequest = new Mock(); + _mockCoreDbExecution = new Mock(); + _mockPostRequest = new Mock(); + + _coreConfiguration = new CoreConfiguration() + { + CoreSoapApiConfiguration = new CoreSoapApiConfiguration() + { + CoreSoapEndpointConfiguration = new CoreSoapEndpointConfiguration() + { + PostMonetaryTransactions = "TEST/MonetaryTransaction/PostMonetaryTransactions" + } + }, + CoreApiConfiguration = new CoreApiConfiguration() + { + CoreEndPointConfiguration = new CoreEndPointConfiguration() + { + AccountsTransactionHistoryQueryAccountNumber = "test/AccountsTransactionHistoryQueryAccountNumber" + } + } + }; + + _apiSecurityConfiguration = new ApiSecurityConfiguration() + { + InternalApiKeySet = new Dictionary() + { + ["CoreSoapApiWrapper"] = "TEST" + } + }; + + _transactionDao = new TransactionDao(_mockCoreRequest.Object, + _coreConfiguration, + _apiSecurityConfiguration, + _mockCoreDbExecution.Object, + _mockPostRequest.Object); + } + + [Test] + public async Task AddMonetaryTransactions_Returns_Two() + { + var response = new List() + { + new() + { + WasSuccessful = true + }, + new() + { + WasSuccessful = true + } + }; + + _mockPostRequest.Setup(x => x.Async, List>(It.IsAny(), + It.IsAny>(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(response).Verifiable(); + + var groupRequest = new GroupedMonetaryTransactionRequest() + { + ParentRequestNumber = "1", + MonetaryTransactionRequests = + [ + new MonetaryTransactionRequest() + { + AccountNumber = 19617805142, + ApprovalPersonNumber = 5225, + RequestNumber = "1", + OverrideCashBoxNumber = 800, + TransactionTypeCode = "DEXP", + Description = "", + BalanceTypes = + [ + new BalanceType1() + { + BalanceCategoryCode = "UPFR", + BalanceTypeCode = "DLR", + BalanceTypeAmount = 1.27 + } + ], + FundBalanceTypes = + [ + new FundBalanceType() + { + FundBalanceAmount = 1.27, + FundTypeCode = "EL", + FundTypeDetailCode = "IMED" + } + ], + Funds = + [ + new Fund() + { + ClearingCategoryCode = "IMED", + FundAmount = 1.27, + FundTypeCode = "EL", + FundTypeDetailCode = "INTR", + NumberOfItems = 1 + } + ] + }, + new MonetaryTransactionRequest() + { + AccountNumber = 19617805142, + TransactionAmount = -1.27, + ApprovalPersonNumber = 5225, + RequestNumber = "2", + ParentRequestNumber = "1", + OverrideCashBoxNumber = 800, + TransactionTypeCode = "DRIR", + Description = "", + BalanceTypes = + [ + new() + { + BalanceCategoryCode = "UPFR", + BalanceTypeCode = "DLR", + BalanceTypeAmount = -1.27 + } + ], + Funds = + [ + new Fund() + { + ClearingCategoryCode = "IMED", + FundAmount = -1.27, + FundTypeCode = "EL", + FundTypeDetailCode = "INTR", + NumberOfItems = 1 + } + ] + } + ] + }; + var listGroupRequest = new List { groupRequest }; + + var results = await _transactionDao.AddMonetaryTransactions(listGroupRequest); + Assert.IsNotNull(results); + Assert.AreEqual(2, results.Count); + _mockPostRequest.Verify(); + } + + [Test] + public void AddMonetaryTransactions_Exception() + { + var listGroupRequest = new List { new() }; + var endpoint = HttpUtilities.BuildHttpsUri(_coreConfiguration.CoreSoapApiConfiguration.CoreSoapApiWrapperHost, + _coreConfiguration.CoreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostMonetaryTransactions); + + _mockPostRequest.Setup(x => x.Async, List>(endpoint, + It.IsAny>(), + It.IsAny>(), + It.IsAny(), + It.IsAny())) + .Throws(new Exception("Error thrown in unit test.")).Verifiable(); + + Assert.ThrowsAsync(async () => await _transactionDao.AddMonetaryTransactions(listGroupRequest)); + _mockPostRequest.Verify(); + } + + [Test] + public async Task FindTransactionHistoryById_Return_Two() + { + var messageBody = new List() + { + new TransactionHistory() + { + AccountNumber = 1234555, + ActivityDateTime = Convert.ToDateTime("1/1/2021") + }, + new TransactionHistory() + { + AccountNumber = 1234555, + ActivityDateTime = Convert.ToDateTime("1/2/2021") + } + }; + + var messageHeader = new CoreMessageHeader() { }; + var returnValue = new CoreApiMessage>(messageHeader, messageBody); + + _mockCoreRequest + .Setup(x => x.PostRequestObject>>(It.IsAny(), + It.IsAny>(), + It.IsAny())) + .ReturnsAsync(returnValue).Verifiable(); + + + var coreRequestParameters = new CoreRequestParameters() { }; + var transactionHistoryRequest = new TransactionHistoryRequest() { }; + + var results = await _transactionDao.FindTransactionHistoryById(coreRequestParameters, transactionHistoryRequest, "dfasdfasdp-adfsdafafd-asfsadf"); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + Assert.True(resultsList.Any(x => x.AccountNumber == 1234555)); + + _mockCoreRequest.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj new file mode 100644 index 0000000..fa84a32 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/LCU.Api.Internal.CoreApiWrapperTest.csproj @@ -0,0 +1,31 @@ + + + + net8.0 + + false + + Linux + + + + + + + + + + + + + + + + + + + Always + + + + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Models/CoreRequestParametersTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Models/CoreRequestParametersTest.cs new file mode 100644 index 0000000..ba0f958 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Models/CoreRequestParametersTest.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Utilities +{ + public class CoreRequestParametersTest + { + [Test] + public void CreateCoreRequestParameters_BasicCreation_NullIncludes() + { + var result = new CoreRequestParameters(); + Assert.NotNull(result); + Assert.AreEqual(null, result.Include); + } + + [Test] + public void CreateCoreRequestParameters_EmptyList_NullIncludes() + { + var emptyList = new List(); + var result = new CoreRequestParameters(emptyList); + Assert.NotNull(result); + Assert.AreEqual("", result.Include); + } + + [Test] + public void CreateCoreRequestParameters_Returns_CommaDelimitedString() + { + var testStringList = new List() + { + "Testing1", + "Testing2" + }; + var result = new CoreRequestParameters(testStringList); + Assert.NotNull(result); + Assert.AreEqual("Testing1,Testing2", result.Include); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Queries/TEST_Query.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Queries/TEST_Query.sql new file mode 100644 index 0000000..5e27e0c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Queries/TEST_Query.sql @@ -0,0 +1,3 @@ +select TEST +from TEST +where TEST like TEST \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessChannelPersonsServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessChannelPersonsServiceTest.cs new file mode 100644 index 0000000..7c68e5c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessChannelPersonsServiceTest.cs @@ -0,0 +1,125 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AccessChannelPersonsServiceTest + { + private readonly AccessChannelPersonsService _accessChannelPersonsService; + private readonly Mock _mockAccessChannelPersonsDao; + + public AccessChannelPersonsServiceTest() + { + _mockAccessChannelPersonsDao = new Mock(); + _accessChannelPersonsService = new AccessChannelPersonsService(_mockAccessChannelPersonsDao.Object); + } + + [Test] + public void GetAccessChannelPersonCoreApiResponseAsync_ExceptionThrown() + { + _mockAccessChannelPersonsDao.Setup(x => x.FindAccessChannelPersonsByPerson(It.IsAny(), + It.IsAny())) + .Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _accessChannelPersonsService.GetAccessChannelPersonCoreApiResponseAsync(new AccessChannelPersonsByPersonRequest())); + } + + [Test] + public async Task GetAccessChannelPersonCoreApiResponseAsync_UserFieldsReturned() + { + var accessChannelPersons = new List() + { + new AccessChannelPerson() + { + ChannelNumber = 1, + PersonNumber = 2, + UserId = "3" + }, + new AccessChannelPerson() + { + ChannelNumber = 4, + PersonNumber = 5, + UserId = "6" + } + }; + var coreMessageheader = new CoreMessageHeader(); + var coreApiResponse = new CoreApiMessage>(coreMessageheader, accessChannelPersons); + _mockAccessChannelPersonsDao.Setup(x => x.FindAccessChannelPersonsByPerson(It.IsAny(), + It.IsAny())) + .ReturnsAsync(coreApiResponse); + + + var accessChannelPersonsByPersonRequest = new AccessChannelPersonsByPersonRequest(); + + var result = await _accessChannelPersonsService.GetAccessChannelPersonCoreApiResponseAsync(accessChannelPersonsByPersonRequest); + Assert.NotNull(result); + Assert.AreEqual(2, result.MessageBody.Count()); + } + + [Test] + public void UpdateAccountChannelPersonAsync_ExceptionThrown() + { + _mockAccessChannelPersonsDao.Setup(x => x.UpdateAccessChannelPerson(It.IsAny>())) + .Throws(new Exception("Oops")); + + var request = new AccessChannelPerson() + { + ChannelNumber = 1, + PersonNumber = 2, + UserId = "3" + }; + Assert.ThrowsAsync(async () => + await _accessChannelPersonsService.UpdateAccessChannelPersonAsync(request, 10002312312)); + } + + [Test] + public void UpdateAccountChannelPersonAsync_NullResult_ExceptionThrown() + { + AccessChannelPerson response = null; + _mockAccessChannelPersonsDao.Setup(x => x.UpdateAccessChannelPerson(It.IsAny>())) + .ReturnsAsync(response); + + var request = new AccessChannelPerson() + { + ChannelNumber = 1, + PersonNumber = 2, + UserId = "3" + }; + Assert.ThrowsAsync(async () => + await _accessChannelPersonsService.UpdateAccessChannelPersonAsync(request, 10002312312)); + } + + [Test] + public async Task UpdateAccountChannelPersonAsync_UpdatedUserFieldsReturned() + { + var response = new AccessChannelPerson() + { + ChannelNumber = 1, + PersonNumber = 2, + UserId = "3" + }; + _mockAccessChannelPersonsDao.Setup(x => x.UpdateAccessChannelPerson(It.IsAny>())) + .ReturnsAsync(response); + + var request = new AccessChannelPerson() + { + ChannelNumber = 1, + PersonNumber = 2, + UserId = "3" + }; + var result = await _accessChannelPersonsService.UpdateAccessChannelPersonAsync(request, 10002312312); + Assert.NotNull(result); + Assert.AreEqual(response, result); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessTypeServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessTypeServiceTest.cs new file mode 100644 index 0000000..357fcee --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccessTypeServiceTest.cs @@ -0,0 +1,98 @@ +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AccessTypeServiceTest + { + private readonly AccessTypeService _accessTypeService; + private readonly Mock _mockAccessTypeDao; + + public AccessTypeServiceTest() + { + _mockAccessTypeDao = new Mock(); + _accessTypeService = new AccessTypeService(_mockAccessTypeDao.Object); + } + + [Test] + public void UpdateAccountTypeAsync_ExceptionThrown() + { + _mockAccessTypeDao.Setup(x => x.UpdateAccessType(It.IsAny>(), It.IsAny())) + .Throws(new Exception("Oops")); + + var accessType = new AccessType() + { + ChannelNumber = 1, + PersonNumber = 2, + Id = "WWW" + }; + var request = new AccessTypeUpdateRequest() + { + AccessType = accessType, + AccessChannelPersonId = "1_2", + UpdateKey = 123213131 + }; + Assert.ThrowsAsync(async () => + await _accessTypeService.UpdateAccessTypeAsync(request)); + } + + [Test] + public void UpdateAccountUserFieldAsync_NullResult_ExceptionThrown() + { + AccessType response = null; + _mockAccessTypeDao.Setup(x => x.UpdateAccessType(It.IsAny>(), It.IsAny())) + .ReturnsAsync(response); + + var accessType = new AccessType() + { + ChannelNumber = 1, + PersonNumber = 2, + Id = "WWW" + }; + var request = new AccessTypeUpdateRequest() + { + AccessType = accessType, + AccessChannelPersonId = "1_2", + UpdateKey = 123213131 + }; + Assert.ThrowsAsync(async () => + await _accessTypeService.UpdateAccessTypeAsync(request)); + } + + [Test] + public async Task UpdateAccountUserFieldAsync_UpdatedUserFieldsReturned() + { + var response = new AccessType() + { + ChannelNumber = 1, + PersonNumber = 2, + Id = "WWW" + }; + _mockAccessTypeDao.Setup(x => x.UpdateAccessType(It.IsAny>(), It.IsAny())) + .ReturnsAsync(response); + + var accessType = new AccessType() + { + ChannelNumber = 1, + PersonNumber = 2, + Id = "WWW" + }; + var request = new AccessTypeUpdateRequest() + { + AccessType = accessType, + AccessChannelPersonId = "1_2", + UpdateKey = 123213131 + }; + var result = await _accessTypeService.UpdateAccessTypeAsync(request); + Assert.NotNull(result); + Assert.AreEqual(response, result); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountServiceTest.cs new file mode 100644 index 0000000..6b1f6d6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountServiceTest.cs @@ -0,0 +1,743 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.Exceptions; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses; +using LCU.Api.Internal.CoreApiWrapper.Services; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AccountServiceTest + { + private readonly AccountService _accountService; + private readonly Mock _mockAccountDao; + + public AccountServiceTest() + { + _mockAccountDao = new Mock(); + _accountService = new AccountService(_mockAccountDao.Object); + } + + [Test] + public async Task GetAccountDetailsByAccountNumber_Returns_AccountDetails() + { + var testAccount = new Account() + { + Id = "fasd;fljqer8-3418-3824-8dsfjas;djf", + ContractDate = "1/1/2021" + }; + _mockAccountDao.Setup(x => x.FindByAcctNbr(It.IsAny(), It.IsAny())).ReturnsAsync(testAccount); + var testAccountNumber = 1000143; + var result = await _accountService.GetAccountDetailsByAccountNumber(testAccountNumber); + + Assert.NotNull(result); + Assert.AreEqual("fasd;fljqer8-3418-3824-8dsfjas;djf", result.Id); + Assert.AreEqual("1/1/2021", result.ContractDate); + } + + [Test] + public async Task PutAccountMaintenanceRequest_UpdateSuccessful() + { + var accountMaintenanceRequest = new List + { + new() { + AccountNumber = 123, + DeliveryMethod = "PRNT" + } + }; + + await _accountService.PutAccountMaintenanceRequest(accountMaintenanceRequest); + _mockAccountDao.Verify(x => x.PutAccountMaintenanceRequest(accountMaintenanceRequest), Times.Once); + } + + [Test] + public void PutAccountMaintenanceRequest_ExceptionThrown() + { + var accountMaintenanceRequest = new List + { + new() { + AccountNumber = 123, + DeliveryMethod = "PRNT" + } + }; + + _mockAccountDao.Setup(x => x.PutAccountMaintenanceRequest(accountMaintenanceRequest)).ThrowsAsync(new AccountMaintenanceRequestException("Test exception")); + + Assert.ThrowsAsync(async () => await _accountService.PutAccountMaintenanceRequest(accountMaintenanceRequest)); + } + + [Test] + public async Task GetActivityAccountDetailsByAccountNumbers_OK() + { + _mockAccountDao.Setup(x => x.GetActivityAccountDetailsByAccountNumbers(It.IsAny>())) + .ReturnsAsync(new List() + { + new ActivityAccountDetails() + { + AccountNumber = 12345, + MinorAccountType = "DV01", + CurrentAccountStatus = "ACT" + }, + new ActivityAccountDetails() + { + AccountNumber = 6789, + MinorAccountType = "DV01", + CurrentAccountStatus = "ACT" + } + }); + + var results = + await _accountService.GetActivityAccountDetailsByAccountNumbers(new List() { 12345, 6789 }); + Assert.NotNull(results); + Assert.AreEqual(2, results.Count); + _mockAccountDao.Verify(x => + x.GetActivityAccountDetailsByAccountNumbers(It.Is>(x => + x.Contains("12345") && x.Contains("6789")))); + } + + [Test] + public async Task GetActivityAccountDetailsByAccountNumbers_NoSearch_OK() + { + _mockAccountDao.Setup(x => x.GetActivityAccountDetailsByAccountNumbers(It.IsAny>())) + .ReturnsAsync(new List() + { + new() + { + AccountNumber = 12345, + MinorAccountType = "DV01", + CurrentAccountStatus = "ACT" + }, + new() + { + AccountNumber = 6789, + MinorAccountType = "DV01", + CurrentAccountStatus = "ACT" + } + }); + + var results = await _accountService.GetActivityAccountDetailsByAccountNumbers(new List() { }); + Assert.NotNull(results); + Assert.AreEqual(0, results.Count); + } + + [Test] + public async Task GetActivityAccountDetailsByAccountNumbers_Exception_OK() + { + _mockAccountDao.Setup(x => x.GetActivityAccountDetailsByAccountNumbers(It.IsAny>())) + .ThrowsAsync(new Exception("Boo")); + + Assert.ThrowsAsync(async () => + await _accountService.GetActivityAccountDetailsByAccountNumbers(new List() { 1, 2, 3 })); + _mockAccountDao.Verify(x => + x.GetActivityAccountDetailsByAccountNumbers(It.Is>(x => + x.Contains("1") && x.Contains("2") && x.Contains("3")))); + } + + [Test] + public async Task GetOwnersByAccountNumber_OK() + { + var returnedAccountNumbers = new List + { + new AccountOwnership + { + FirstName = "Pete", + LastName = "Peterson", + PersonNumber = 12345, + IsPrimaryOwner = true + }, + new AccountOwnership + { + FirstName = "Bill", + LastName = "Billson", + PersonNumber = 98765, + } + }; + + _mockAccountDao + .Setup(x => x.FindOwnersByAccountNumber(It.IsAny(), It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var result = await _accountService.GetOwnersByAccountNumber(12345, DateTime.Now); + Assert.NotNull(result); + + Assert.AreEqual(result.First().PersonNumber, 12345); + Assert.AreEqual(result.First().IsPrimaryOwner, true); + Assert.AreEqual(result.Last().PersonNumber, 98765); + Assert.AreEqual(result.Last().IsPrimaryOwner, false); + Assert.AreEqual(result.Count(), 2); + + _mockAccountDao.Verify(); + } + + [Test] + public void GetOwnersByAccountNumber_Exception() + { + _mockAccountDao.Setup(x => x.FindOwnersByAccountNumber(It.IsAny(), It.IsAny())) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.GetOwnersByAccountNumber(12345, DateTime.Now)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task GetPrimaryOwnersByPersonName_OK() + { + var personName = "Peterson"; + + var returnedAccountNumbers = new List + { + new AccountOwnership + { + FirstName = "Pete", + LastName = "Peterson", + PersonNumber = 12345, + IsPrimaryOwner = true + }, + new AccountOwnership + { + FirstName = "Paul", + LastName = "Peterson", + PersonNumber = 98765, + } + }; + + _mockAccountDao + .Setup(x => x.FindPrimaryOwnersByPersonName(It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var result = await _accountService.GetPrimaryOwnersByPersonName(personName); + Assert.NotNull(result); + + var firstNameConcat = returnedAccountNumbers.First().FirstName + " " + returnedAccountNumbers.First().LastName; + var secondNameConcat = returnedAccountNumbers.Last().FirstName + " " + returnedAccountNumbers.Last().LastName; + Assert.IsTrue(firstNameConcat.Contains(personName)); + Assert.IsTrue(secondNameConcat.Contains(personName)); + Assert.AreEqual(result.First().IsPrimaryOwner, true); + Assert.AreEqual(result.Last().PersonNumber, 98765); + Assert.AreEqual(result.Last().IsPrimaryOwner, false); + Assert.AreEqual(result.Count(), 2); + + _mockAccountDao.Verify(); + } + + [Test] + public void GetPrimaryOwnersByPersonName_Exception() + { + var personName = "Pete Peterson"; + + _mockAccountDao.Setup(x => x.FindPrimaryOwnersByPersonName(It.IsAny())) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.GetPrimaryOwnersByPersonName(personName)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task GetPrimaryOwnersByOrganizationName_OK() + { + var organizationName = "The Big Company"; + + var returnedAccountNumbers = new List + { + new AccountOwnership + { + OrganizationName = organizationName, + ByOrgNbr = 12345, + IsPrimaryOwner = true + } + }; + + _mockAccountDao + .Setup(x => x.FindPrimaryOwnersByOrganizationName(It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var result = await _accountService.GetPrimaryOwnersByOrganizationName(organizationName); + Assert.NotNull(result); + + Assert.AreEqual(result.First().OrganizationName, organizationName); + Assert.AreEqual(result.First().IsPrimaryOwner, true); + + _mockAccountDao.Verify(); + } + + [Test] + public void GetPrimaryOwnersByOrganizationName_Exception() + { + var organizationName = "The Big Company"; + + _mockAccountDao.Setup(x => x.FindPrimaryOwnersByOrganizationName(It.IsAny())) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.GetPrimaryOwnersByOrganizationName(organizationName)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task GetAccountsForAccoutGroupMaintenance_OK() + { + + IEnumerable returnedAccountNumbers = new List + { + "22", + "44" + }; + + _mockAccountDao.Setup(x => x.FindAccountsToUpdateAccountAnalysis()) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + IEnumerable result = await _accountService.GetAccountsForGroupAnalysisMaintenance(); + Assert.NotNull(result); + Assert.IsTrue(result.ToList().Count > 1); + _mockAccountDao.Verify(); + } + + [Test] + public void GetAccountsForAccoutGroupMaintenance_Exception() + { + _mockAccountDao.Setup(x => x.FindAccountsToUpdateAccountAnalysis()) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.GetAccountsForGroupAnalysisMaintenance()); + _mockAccountDao.Verify(); + } + + [Test] + public async Task UpdateAccountsForAccoutGroupMaintenance_OK() + { + var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest() + { + AccountNumber = 123, + IsGenerateAnalysisStatement = true, + IsPrintAnalysisStatement = true, + IsUseForServiceCharge = true + }; + + var returnedAccountNumbers = new List + { + "22", + "44" + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.UpdateAccountAnalysis(accountAnalysisGroupMaintenanceRequest)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.UpdateAccountAnalysisMaintenance(accountAnalysisGroupMaintenanceRequest); + Assert.NotNull(result); + + Assert.AreEqual(result.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void UpdateAccountsForAccoutGroupMaintenance_Exception() + { + var accountAnalysisGroupMaintenanceRequest = new AccountAnalysisGroupMaintenanceRequest() + { + AccountNumber = 123, + IsGenerateAnalysisStatement = true, + IsPrintAnalysisStatement = true, + IsUseForServiceCharge = true + }; + _mockAccountDao.Setup(x => x.UpdateAccountAnalysis(accountAnalysisGroupMaintenanceRequest)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.UpdateAccountAnalysisMaintenance(accountAnalysisGroupMaintenanceRequest)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task PostAccountsForPerson_OK() + { + var request = new CreatePersonAccountRequest() + { + PersonNumber = 1, + FirstName = "Test", + LastName = "Test" + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new CreatedAccountResponse() + { + AccountNumber = returnedAccountNumbers[0], + BasicResponse = new BasicResponse() { Success = true } + }; + + _mockAccountDao + .Setup(x => x.AddPersonAccount(request)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.AddPersonAccount(request); + Assert.NotNull(result); + + Assert.AreEqual(result.BasicResponse.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void PostAccountsForPerson_Exception() + { + var request = new CreatePersonAccountRequest() + { + PersonNumber = 1, + FirstName = "Test", + LastName = "Test" + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new CreatedAccountResponse() + { + AccountNumber = returnedAccountNumbers[0], + BasicResponse = new BasicResponse() { Success = true } + }; + + _mockAccountDao + .Setup(x => x.AddPersonAccount(request)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.AddPersonAccount(request)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task PostAccountsForOrganization_OK() + { + var request = new CreateOrganizationAccountRequest() + { + OrganizationNumber = 1 + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new CreatedAccountResponse() + { + AccountNumber = returnedAccountNumbers[0], + BasicResponse = new BasicResponse() { Success = true } + }; + + _mockAccountDao + .Setup(x => x.AddOrganizationAccount(request)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.AddOrganizationAccount(request); + Assert.NotNull(result); + + Assert.AreEqual(result.BasicResponse.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void PostAccountsForOrganization_Exception() + { + var request = new CreateOrganizationAccountRequest() + { + OrganizationNumber = 1 + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new CreatedAccountResponse() + { + AccountNumber = returnedAccountNumbers[0], + BasicResponse = new BasicResponse() { Success = true } + }; + + _mockAccountDao + .Setup(x => x.AddOrganizationAccount(request)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.AddOrganizationAccount(request)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task AddControlPersonOrgMaintenance_OK() + { + var request = new OrganizationMaintenanceRequest() + { + ControllingPersonNumber = 1, + OrganizationNumber = 12 + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.PutOrganizationMaintenanceRequest(request)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.PutOrganizationMaintenanceRequest(request); + Assert.NotNull(result); + + Assert.AreEqual(result.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void AddControlPersonOrgMaintenance_Exception() + { + var request = new OrganizationMaintenanceRequest() + { + ControllingPersonNumber = 1, + OrganizationNumber = 12 + }; + + var returnedAccountNumbers = new List + { + 22 + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.PutOrganizationMaintenanceRequest(request)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.PutOrganizationMaintenanceRequest(request)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task AccountNickNameUpdateRequest_OK() + { + var accountRequest = new AccountNickNameUpdateRequest() + { + AccountNumber = 123, + AccountDescription = "TestOK" + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.UpdateAccountNickName(accountRequest)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.UpdateAccountNickName(accountRequest); + Assert.NotNull(result); + + Assert.AreEqual(result.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void AccountNickNameUpdateRequest_Exception() + { + var accountRequest = new AccountNickNameUpdateRequest() + { + AccountNumber = 123, + AccountDescription = "TestException" + }; + + _mockAccountDao.Setup(x => x.UpdateAccountNickName(accountRequest)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.UpdateAccountNickName(accountRequest)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task AccountCreditReportTypeUpdateRequest_OK() + { + var accountRequest = new AccountCreditReportTypeUpdateRequest() + { + AccountNumber = 123, + CreditReportType = "EXCL" + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.UpdateAccountCreditReportType(accountRequest)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.UpdateAccountCreditReportType(accountRequest); + Assert.NotNull(result); + + Assert.AreEqual(result.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void AccountCreditReportTypeUpdateRequest_Exception() + { + var accountRequest = new AccountCreditReportTypeUpdateRequest() + { + AccountNumber = 123, + CreditReportType = "EXCL" + }; + + _mockAccountDao.Setup(x => x.UpdateAccountCreditReportType(accountRequest)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.UpdateAccountCreditReportType(accountRequest)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task GetAccountsByMajorMinorBranchAndStatus_Ok() + { + var request = new AccountsByMajorMinorBranchAndStatusRequest() + { + BranchCodes = new List() + { + 1234, + 1235 + }, + AccountStatuses = new List() + { + "Status" + }, + MajorTypes = new List() + { + "Major" + }, + MinorTypes = new List() + { + "MinorOne", + "MinorTwo" + } + }; + + var response = new List() + { + new AccountsByMajorMinorBranchAndStatusResponse() + { + AccountNumber = 1234, + BranchCode = 987654321, + Name = "Test Name" + }, + new AccountsByMajorMinorBranchAndStatusResponse() + { + AccountNumber = 5678, + BranchCode = 987654321, + Name = "Test Name Two" + } + }; + + _mockAccountDao.Setup(x => x.GetAccountsByMajorMinorBranchAndStatus(request)).ReturnsAsync(response).Verifiable(); + + var result = await _accountService.GetAccountsByMajorMinorBranchAndStatus(request); + Assert.NotNull(result); + + Assert.AreEqual(result.Count(), 2); + Assert.AreEqual(result.FirstOrDefault().AccountNumber, 1234); + _mockAccountDao.Verify(); + } + + [Test] + public async Task GetAccountsByMajorMinorBranchAndStatus_Exception() + { + var request = new AccountsByMajorMinorBranchAndStatusRequest() + { + BranchCodes = new List() + { + 1234, + 1235 + }, + AccountStatuses = new List() + { + "Status" + }, + MajorTypes = new List() + { + "Major" + }, + MinorTypes = new List() + { + "MinorOne", + "MinorTwo" + } + }; + + _mockAccountDao.Setup(x => x.GetAccountsByMajorMinorBranchAndStatus(request)).Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.GetAccountsByMajorMinorBranchAndStatus(request)); + _mockAccountDao.Verify(); + } + + [Test] + public async Task AccountContractDateUpdateRequest_OK() + { + var accountRequest = new AccountContractDateUpdateRequest + { + AccountNumber = 123, + ContractDate = DateTime.Now + }; + + var response = new BasicResponse() + { + Success = true + }; + + _mockAccountDao + .Setup(x => x.UpdateAccountContractDate(accountRequest)) + .ReturnsAsync(response).Verifiable(); + + var result = await _accountService.UpdateAccountContractDate(accountRequest); + Assert.NotNull(result); + + Assert.AreEqual(result.Success, true); + _mockAccountDao.Verify(); + } + + [Test] + public void AccountContractDateUpdateRequest_Exception() + { + var accountRequest = new AccountContractDateUpdateRequest + { + AccountNumber = 123, + ContractDate = DateTime.Now + }; + + _mockAccountDao.Setup(x => x.UpdateAccountContractDate(accountRequest)) + .Throws(new ServiceException("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _accountService.UpdateAccountContractDate(accountRequest)); + _mockAccountDao.Verify(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountUserFieldServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountUserFieldServiceTest.cs new file mode 100644 index 0000000..a531b41 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AccountUserFieldServiceTest.cs @@ -0,0 +1,419 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AccountUserFieldServiceTest + { + private readonly AccountUserFieldService _accountUserFieldService; + private readonly Mock _mockAccountService; + private readonly Mock _mockAccountUserFieldDao; + + public AccountUserFieldServiceTest() + { + _mockAccountService = new Mock(); + _mockAccountUserFieldDao = new Mock(); + _accountUserFieldService = new AccountUserFieldService(_mockAccountService.Object,_mockAccountUserFieldDao.Object); + } + + [Test] + public void GetAccountUserFieldCoreApiResponseAsync_ExceptionThrown() + { + _mockAccountUserFieldDao.Setup(x => x.FindAccountUserFieldCoreApiResponseByAccountId(It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _accountUserFieldService.GetAccountUserFieldCoreApiResponseAsync("testaccountiddsafasfsadfsdfsdafsd")); + } + + [Test] + public async Task GetAccountUserFieldCoreApiResponseAsync_UserFieldsReturned() + { + var accountUserFields = new List() + { + new AccountUserField() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new AccountUserField() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + } + }; + var coreMessageheader = new CoreMessageHeader(); + var accountUserFieldCoreApiResponse = new CoreApiMessage>(coreMessageheader, accountUserFields); + _mockAccountUserFieldDao.Setup(x => x.FindAccountUserFieldCoreApiResponseByAccountId(It.IsAny(), It.IsAny())).ReturnsAsync(accountUserFieldCoreApiResponse); + + + var result = await _accountUserFieldService.GetAccountUserFieldCoreApiResponseAsync("testaccountidasfasdfsdfsadfsdfsdf"); + Assert.NotNull(result); + Assert.AreEqual(2, result.MessageBody.Count()); + } + + [Test] + public void UpdateAccountUserFieldAsync_ExceptionThrown() + { + _mockAccountUserFieldDao.Setup(x => x.UpdateAccountUserField(It.IsAny>(), It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + var accountUserUpdateRequest = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _accountUserFieldService.UpdateAccountUserFieldAsync(accountUserUpdateRequest, 10002312312, "testaccountidfdafdfasfdsf", "TEST1")); + } + + [Test] + public async Task UpdateAccountUserFieldAsync_UpdatedUserFieldsReturned() + { + var updatedAccountUserField = new AccountUserField() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + _mockAccountUserFieldDao.Setup(x => x.UpdateAccountUserField(It.IsAny>(), + It.IsAny(), + It.IsAny())).ReturnsAsync(updatedAccountUserField); + + var accountUserUpdateRequest = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _accountUserFieldService.UpdateAccountUserFieldAsync(accountUserUpdateRequest, 10002312312, "testaccountidfdafdfasfdsf", "TEST1"); + Assert.NotNull(result); + Assert.AreEqual(updatedAccountUserField, result); + } + + [Test] + public void InsertAccountUserFieldAsync_ExceptionThrown() + { + _mockAccountUserFieldDao.Setup(x => x.InsertAccountUserField(It.IsAny>(), It.IsAny())).Throws(new Exception("Oops")); + + var accountUserUpdateRequest = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _accountUserFieldService.InsertAccountUserFieldAsync(accountUserUpdateRequest, "testaccountidfdafdfasfdsf")); + } + + [Test] + public async Task InsertAccountUserFieldAsync_InsertUserFieldsReturned() + { + var createdAccountUserField = new AccountUserField() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + _mockAccountUserFieldDao.Setup(x => x.InsertAccountUserField(It.IsAny>(), + It.IsAny())).ReturnsAsync(createdAccountUserField); + + var accountUserUpdateRequest = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _accountUserFieldService.InsertAccountUserFieldAsync(accountUserUpdateRequest, "testaccountidfdafdfasfdsf"); + Assert.NotNull(result); + Assert.AreEqual(createdAccountUserField, result); + } + + [Test] + public void UpdateAccountUserFieldsAsync_AccountNull_NullExceptionThrown() + { + var accountUserFieldUpdateRequests = new List() + { + new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new AccountUserFieldRequest() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + } + }; + Account testAccount = null; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + Assert.ThrowsAsync(async () => + await _accountUserFieldService.UpdateAccountUserFieldsAsync(accountUserFieldUpdateRequests)); + } + + [Test] + public void UpdateAccountUserFieldsAsync_ExistingUserFieldNull_NullExceptionThrown() + { + var accountUserFieldUpdateRequests = new List() + { + new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new AccountUserFieldRequest() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + } + }; + Account testAccount = new Account() + { + Id = "TEST-adsfasdfas[]djfas" + }; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + IEnumerable accountUserFields = new List(); + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(); + CoreApiMessage> coreApiMessageAccountUserFields = new CoreApiMessage>(coreMessageHeader, accountUserFields); + _mockAccountUserFieldDao.Setup(x => x.FindAccountUserFieldCoreApiResponseByAccountId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessageAccountUserFields); + + Assert.ThrowsAsync(async () => + await _accountUserFieldService.UpdateAccountUserFieldsAsync(accountUserFieldUpdateRequests)); + } + + [Test] + public void UpdateAccountUserFieldsAsync_UpdateUserFieldNull_NullExceptionThrown() + { + var accountUserFieldUpdateRequests = new List() + { + new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new AccountUserFieldRequest() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + } + }; + Account testAccount = new Account() + { + Id = "TEST-adsfasdfas[]djfas" + }; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + IEnumerable accountUserFields = new List() + { + new AccountUserField() + { + Id = "TEST1", + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }, + new AccountUserField() + { + Id = "TEST2", + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "Y" + } + }; + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(1122000321); + CoreApiMessage> coreApiMessageAccountUserFields = new CoreApiMessage>(coreMessageHeader, accountUserFields); + _mockAccountUserFieldDao.Setup(x => x.FindAccountUserFieldCoreApiResponseByAccountId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessageAccountUserFields); + + AccountUserField updatedAccountUserField = null; + _mockAccountUserFieldDao.Setup(x => x.UpdateAccountUserField(It.IsAny>(), + It.IsAny(), + It.IsAny())).ReturnsAsync(updatedAccountUserField); + + Assert.ThrowsAsync(async () => + await _accountUserFieldService.UpdateAccountUserFieldsAsync(accountUserFieldUpdateRequests)); + } + + [Test] + public async Task UpdateAccountUserFieldsAsync_ListofUpdateduserfields() + { + var request1 = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }; + var request2 = new AccountUserFieldRequest() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + }; + + var accountUserFieldUpdateRequests = new List() + { + request1, + request2 + }; + + Account testAccount = new Account() + { + Id = "TEST-adsfasdfas[]djfas" + }; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + + var accountUserField1 = new AccountUserField() + { + Id = "TEST1", + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + var accountUserField2 = new AccountUserField() + { + Id = "TEST2", + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "Y" + }; + + IEnumerable accountUserFields = new List() + { + accountUserField1, + accountUserField2 + }; + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(1122000321); + CoreApiMessage> coreApiMessageAccountUserFields = new CoreApiMessage>(coreMessageHeader, accountUserFields); + _mockAccountUserFieldDao.Setup(x => x.FindAccountUserFieldCoreApiResponseByAccountId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessageAccountUserFields); + + AccountUserField updatedAccountUserField1 = new AccountUserField() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + _mockAccountUserFieldDao.Setup(x => x.UpdateAccountUserField(It.IsAny>(), + It.IsAny(), + accountUserField1.Id)).ReturnsAsync(updatedAccountUserField1); + + AccountUserField updatedAccountUserField2 = new AccountUserField() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + }; + _mockAccountUserFieldDao.Setup(x => x.UpdateAccountUserField(It.IsAny>(), + It.IsAny(), + accountUserField2.Id)).ReturnsAsync(updatedAccountUserField2); + + var result = await _accountUserFieldService.UpdateAccountUserFieldsAsync(accountUserFieldUpdateRequests); + + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + var result1 = result.FirstOrDefault(r => r.UserFieldCode == "TEST1"); + Assert.NotNull(result1); + Assert.AreEqual("Y", result1.Value); + Assert.AreEqual(100001, result1.AccountNumber); + + var result2 = result.FirstOrDefault(r => r.UserFieldCode == "TEST2"); + Assert.NotNull(result2); + Assert.AreEqual("N", result2.Value); + Assert.AreEqual(100002, result2.AccountNumber); + } + + [Test] + public void InsertAccountUserFieldsAsync_AccountNull_NullExceptionThrown() + { + var accountUserFieldUpdateRequests = new List() + { + new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new AccountUserFieldRequest() + { + AccountNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + } + }; + Account testAccount = null; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + Assert.ThrowsAsync(async () => + await _accountUserFieldService.InsertAccountUserFieldsAsync(accountUserFieldUpdateRequests)); + } + + [Test] + public async Task InsertAccountUserFieldsAsync_ListofInsertedUserfields() + { + + var testAccount = new Account() + { + Id = "TEST-adsfasdfas[]djfas" + }; + _mockAccountService.Setup(x => x.GetAccountDetailsByAccountNumber(It.IsAny())).ReturnsAsync(testAccount); + + var messageHeader = new CoreMessageHeader() { }; + var accountUserFieldRequest1 = new AccountUserFieldRequest() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var coreApiMessage = new CoreApiMessage(messageHeader, accountUserFieldRequest1); + var createdAccountUserField1 = new AccountUserField() + { + AccountNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + _mockAccountUserFieldDao.Setup(x => x.InsertAccountUserField(It.IsAny>(), + testAccount.Id)).ReturnsAsync(createdAccountUserField1); + + var accountUserFieldUpdateRequests = new List() + { + accountUserFieldRequest1 + }; + var result = await _accountUserFieldService.InsertAccountUserFieldsAsync(accountUserFieldUpdateRequests); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + var result1 = result.FirstOrDefault(r => r.UserFieldCode == "TEST1"); + Assert.NotNull(result1); + Assert.AreEqual("Y", result1.Value); + Assert.AreEqual(100001, result1.AccountNumber); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ActivityServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ActivityServiceTest.cs new file mode 100644 index 0000000..85494be --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ActivityServiceTest.cs @@ -0,0 +1,909 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity; +using LCU.Library.Internal.Exceptions; +using Moq; +using NUnit.Framework; +using FailedToParseException = LCU.Library.Internal.CoreApiWrapperLib.Exceptions.FailedToParseException; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class ActivityServiceTest + { + private ActivityService _activityService; + private Mock _mockTaxService; + private Mock _mockActivityDao; + + [SetUp] + public void SetUp() + { + _mockActivityDao = new Mock(); + _mockTaxService = new Mock(); + _activityService = new ActivityService(_mockActivityDao.Object, _mockTaxService.Object); + + _mockActivityDao.Setup(x => x.GetNewCheckingActivities(It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewCheckingActivitiesNewerThanDate(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + + _mockActivityDao.Setup(x => x.GetNewCheckingActivitiesAfterActivityNbr(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewCheckingAccountActivity() { ActivityNbr = 1 }, + new NewCheckingAccountActivity() { ActivityNbr = 2 }, + new NewCheckingAccountActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewAtmCheckCardActivitiesNewerThanDate(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + + _mockActivityDao.Setup(x => x.GetNewAtmCheckCardActivitiesAfterActivityNbr(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewAtmCheckCardActivity() { ActivityNbr = 1 }, + new NewAtmCheckCardActivity() { ActivityNbr = 2 }, + new NewAtmCheckCardActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewActivityManagerReferrals(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.QueryActivityManagerActivity(It.IsAny())).ReturnsAsync( + new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewActivityManagerReferralsNewerThan(It.IsAny())).ReturnsAsync( + new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + + _mockActivityDao.Setup(x => x.GetNewActivityManagerReferralsAfterActivityId(It.IsAny())).ReturnsAsync( + new List() + { + new NewActivityManagerIncentiveReferral() { ActivityId = 1 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 2 }, + new NewActivityManagerIncentiveReferral() { ActivityId = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny())).ReturnsAsync( + new List() + { + new NewLoanSaleActivity() { ActivityNbr = 1 }, + new NewLoanSaleActivity() { ActivityNbr = 2 }, + new NewLoanSaleActivity() { ActivityNbr = 3 } + }).Verifiable(); + + _mockActivityDao.Setup(x => x.GetEStatementDeliveryActivity(It.IsAny())).ReturnsAsync( + new List() + { + new EStatementDeliveryMethod() { ActivityNumber = 1 }, + new EStatementDeliveryMethod() { ActivityNumber = 2 }, + new EStatementDeliveryMethod() { ActivityNumber = 3 } + }).Verifiable(); + } + + [Test] + public async Task GetNewCheckingAccountActivities_Both_Ok() + { + var results = await _activityService.GetNewCheckingAccountActivities("2020-04-15T11:00:00", 5, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewCheckingActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5), 100)); + + _mockActivityDao.Verify(x => x.GetNewCheckingActivities(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + _mockActivityDao.Verify(x => x.GetNewCheckingActivitiesAfterActivityNbr(It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewCheckingActivitiesNewerThanDate(It.IsAny(), It.IsAny()), Times.Never); + } + + [Test] + public async Task GetNewCheckingAccountActivities_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewCheckingAccountActivities("2020-04-15T11:00:00", null, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewCheckingActivitiesNewerThanDate( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), 100)); + + _mockActivityDao.Verify(x => x.GetNewCheckingActivities(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewCheckingActivitiesAfterActivityNbr(It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewCheckingActivitiesNewerThanDate(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewCheckingAccountActivities_No_Date_Ok() + { + var results = await _activityService.GetNewCheckingAccountActivities(null, 5, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewCheckingActivitiesAfterActivityNbr(It.Is(nbr => nbr == 5), 100)); + } + + [Test] + public async Task GetNewCheckingAccountActivities_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewCheckingAccountActivities(null, null, 100)); + } + + [Test] + public async Task GetNewCheckingAccountActivities_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewCheckingAccountActivities("DateTimes are a Devs Best Friend", 1, 100)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewCheckingAccountActivities("DateTimes are a Devs Best Friend", null, 100)); + } + + [Test] + public async Task GetNewCheckingAccountActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetNewCheckingActivities(It.IsAny(), It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewCheckingAccountActivities("2020-04-15T11:00:00", 10, 100)); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_Both_Ok() + { + var results = await _activityService.GetNewAtmCheckCardActivities("2020-04-15T11:00:00", 5, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewAtmCheckCardActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5), 100)); + + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny()), Times.Once); + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivitiesAfterActivityNbr(It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivitiesNewerThanDate(It.IsAny(), It.IsAny()), Times.Never); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewAtmCheckCardActivities("2020-04-15T11:00:00", null, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewAtmCheckCardActivitiesNewerThanDate( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), 100)); + + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivitiesAfterActivityNbr(It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivitiesNewerThanDate(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_No_Date_Ok() + { + var results = await _activityService.GetNewAtmCheckCardActivities(null, 5, 100); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewAtmCheckCardActivitiesAfterActivityNbr(It.Is(nbr => nbr == 5), 100)); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewAtmCheckCardActivities(null, null, 100)); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewAtmCheckCardActivities("DateTimes are a Devs Best Friend", 1, 100)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewAtmCheckCardActivities("DateTimes are a Devs Best Friend", null, 100)); + } + + [Test] + public async Task GetNewAtmCheckCardActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetNewAtmCheckCardActivities(It.IsAny(), It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewAtmCheckCardActivities("2020-04-15T11:00:00", 10, 100)); + } + + [Test] + public async Task GetNewEDeliveryStatementSaleActivities_Ok() + { + var results = await _activityService.GetEStatementDeliveryActivity("2020-04-15T11:00:00"); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNumber == 1)); + Assert.True(results.Any(x => x.ActivityNumber == 2)); + Assert.True(results.Any(x => x.ActivityNumber == 3)); + + _mockActivityDao.Verify(x => + x.GetEStatementDeliveryActivity( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0) + )); + + _mockActivityDao.Verify(x => x.GetEStatementDeliveryActivity(It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewEDeliveryStatementSaleActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetEStatementDeliveryActivity(It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetEStatementDeliveryActivity("2020-04-15T11:00:00")); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_Both_Ok() + { + var results = await _activityService.GetNewActivityManagerIncentiveReferrals("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityId == 1)); + Assert.True(results.Any(x => x.ActivityId == 2)); + Assert.True(results.Any(x => x.ActivityId == 3)); + + _mockActivityDao.Verify(x => + x.GetNewActivityManagerReferrals( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferrals(It.IsAny(), It.IsAny()), Times.Once); + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferralsAfterActivityId(It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferralsNewerThan(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewActivityManagerIncentiveReferrals("2020-04-15T11:00:00", null); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityId == 1)); + Assert.True(results.Any(x => x.ActivityId == 2)); + Assert.True(results.Any(x => x.ActivityId == 3)); + + _mockActivityDao.Verify(x => + x.GetNewActivityManagerReferralsNewerThan( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0))); + + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferrals(It.IsAny(), It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferralsAfterActivityId(It.IsAny()), Times.Never); + _mockActivityDao.Verify(x => x.GetNewActivityManagerReferralsNewerThan(It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_No_Date_Ok() + { + var results = await _activityService.GetNewActivityManagerIncentiveReferrals(null, 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityId == 1)); + Assert.True(results.Any(x => x.ActivityId == 2)); + Assert.True(results.Any(x => x.ActivityId == 3)); + + _mockActivityDao.Verify(x => + x.GetNewActivityManagerReferralsAfterActivityId( + It.Is(nbr => nbr == 5))); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewActivityManagerIncentiveReferrals(null, null)); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewActivityManagerIncentiveReferrals("DateTimes are a Devs Best Friend", 1)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewActivityManagerIncentiveReferrals("DateTimes are a Devs Best Friend", null)); + } + + [Test] + public async Task GetNewActivityManagerIncentiveReferrals_Exception() + { + _mockActivityDao.Setup(x => x.GetNewActivityManagerReferrals(It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewActivityManagerIncentiveReferrals("2020-04-15T11:00:00", 10)); + } + + [Test] + public async Task GetNewMortgageSalesActivities_Ok() + { + var results = await _activityService.GetNewMortgageSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewMortgageSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewMortgageSaleActivities_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewMortgageSaleActivities("2020-04-15T11:00:00", null); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.Is(x => x == null)), Times.Once); + } + + [Test] + public async Task GetNewMortgageSaleActivities_No_Date_Ok() + { + var results = await _activityService.GetNewMortgageSaleActivities(null, 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewMortgageSaleActivities(It.Is(x => x.HasValue == false), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewMortgageSaleActivities_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewMortgageSaleActivities(null, null)); + } + + [Test] + public async Task GetNewMortgageSaleActivities_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewMortgageSaleActivities("DateTimes are a Devs Best Friend", 1)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewMortgageSaleActivities("DateTimes are a Devs Best Friend", null)); + } + + [Test] + public async Task GetNewMortgageSaleActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewMortgageSaleActivities("2020-04-15T11:00:00", 10)); + } + + [Test] + public async Task GetNewMortgageSaleActivities_Both_Ok() + { + var results = await _activityService.GetNewMortgageSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewMortgageSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewMortgageSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewVehicleSaleActivities_Ok() + { + var results = await _activityService.GetNewVehicleSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewVehicleSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewVehicleSaleActivities_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewVehicleSaleActivities("2020-04-15T11:00:00", null); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.Is(x => x == null)), Times.Once); + } + + [Test] + public async Task GetNewVehicleSaleActivities_No_Date_Ok() + { + var results = await _activityService.GetNewVehicleSaleActivities(null, 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewVehicleSaleActivities(It.Is(x => x.HasValue == false), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewVehicleSaleActivities_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewVehicleSaleActivities(null, null)); + } + + [Test] + public async Task GetNewVehicleSaleActivities_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewVehicleSaleActivities("DateTimes are a Devs Best Friend", 1)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewVehicleSaleActivities("DateTimes are a Devs Best Friend", null)); + } + + [Test] + public async Task GetNewVehicleSaleActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewVehicleSaleActivities("2020-04-15T11:00:00", 10)); + } + + [Test] + public async Task GetNewVehicleSaleActivities_Both_Ok() + { + var results = await _activityService.GetNewVehicleSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewVehicleSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewVehicleSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_Ok() + { + var results = await _activityService.GetNewDebtProtectedLoanSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewDebtProtectedLoanSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_No_ActvNbr_Ok() + { + var results = await _activityService.GetNewDebtProtectedLoanSaleActivities("2020-04-15T11:00:00", null); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.Is(x => x == null)), Times.Once); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_No_Date_Ok() + { + var results = await _activityService.GetNewDebtProtectedLoanSaleActivities(null, 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => x.GetNewDebtProtectedLoanSaleActivities(It.Is(x => x.HasValue == false), It.IsAny()), Times.Once); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_No_Params_Exception() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewDebtProtectedLoanSaleActivities(null, null)); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_FailedToParse_BadDateTime() + { + Assert.ThrowsAsync(async () => + await _activityService.GetNewDebtProtectedLoanSaleActivities("DateTimes are a Devs Best Friend", 1)); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewDebtProtectedLoanSaleActivities("DateTimes are a Devs Best Friend", null)); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_Exception() + { + _mockActivityDao.Setup(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny())).Throws(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.GetNewDebtProtectedLoanSaleActivities("2020-04-15T11:00:00", 10)); + } + + [Test] + public async Task GetNewDebtProtectedLoanSaleActivities_Both_Ok() + { + var results = await _activityService.GetNewDebtProtectedLoanSaleActivities("2020-04-15T11:00:00", 5); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityNbr == 1)); + Assert.True(results.Any(x => x.ActivityNbr == 2)); + Assert.True(results.Any(x => x.ActivityNbr == 3)); + + _mockActivityDao.Verify(x => + x.GetNewDebtProtectedLoanSaleActivities( + It.Is(dt => dt.CompareTo(DateTime.Parse("2020-04-15T11:00:00")) == 0), + It.Is(actvnbr => actvnbr == 5))); + + _mockActivityDao.Verify(x => x.GetNewDebtProtectedLoanSaleActivities(It.IsAny(), It.IsAny()), Times.Once); + } + + [Test] + public async Task QueryActivityManagerActivity_Ok() + { + var results = await _activityService.QueryActivityManagerActivity(new ActivityQueryRequest() + { + ActivityIds = new List() { 1, 2, 3 } + }); + + Assert.NotNull(results); + Assert.AreEqual(3, results.Count); + Assert.True(results.Any(x => x.ActivityId == 1)); + Assert.True(results.Any(x => x.ActivityId == 2)); + Assert.True(results.Any(x => x.ActivityId == 3)); + + _mockActivityDao.Verify(x => + x.QueryActivityManagerActivity(It.IsAny())); + } + + [Test] + public async Task QueryActivityManagerActivity_Exception() + { + _mockActivityDao.Setup(x => x.QueryActivityManagerActivity(It.IsAny())).ThrowsAsync(new Exception("Oops")); + + Assert.ThrowsAsync(async () => + await _activityService.QueryActivityManagerActivity(new ActivityQueryRequest() + { + ActivityIds = new List() { 1, 2, 3, 4, 5, 6, 7 } + })); + + _mockActivityDao.Verify(x => + x.QueryActivityManagerActivity(It.IsAny())); + } + + [Test] + public async Task QueryActivityManagerActivity_DontHitCoreWhenEmpty() + { + _mockActivityDao.Setup(x => x.QueryActivityManagerActivity(It.IsAny())).ThrowsAsync(new Exception("Oops")); + + + var result = await _activityService.QueryActivityManagerActivity(new ActivityQueryRequest() + { + ActivityIds = new List() + }); + + Assert.NotNull(result); + + _mockActivityDao.Verify(x => + x.QueryActivityManagerActivity(It.IsAny()), Times.Never()); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_OK() + { + var phoneNumber = Guid.NewGuid().ToString(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPhoneNumber(It.IsAny())) + .ReturnsAsync(new List + { + new () { PersonNumber = DateTime.Now.Millisecond, HomePhone = phoneNumber } + }).Verifiable(); + + var result = await _activityService.GetPersonActivityByPhoneNumber(phoneNumber); + + Assert.NotNull(result); + Assert.IsTrue(result.Success); + Assert.AreEqual(phoneNumber, result.PersonRecentActivity?.HomePhone); + _mockActivityDao.Verify(x => x.GetPersonActivityByPhoneNumber(It.IsAny()), Times.Once); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_MultipleReturn() + { + var phoneNumber = Guid.NewGuid().ToString(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPhoneNumber(It.IsAny())) + .ReturnsAsync(new List + { + new () { PersonNumber = DateTime.Now.Millisecond, HomePhone = phoneNumber }, + new () { PersonNumber = DateTime.Now.Millisecond, HomePhone = phoneNumber } + }).Verifiable(); + + var result = await _activityService.GetPersonActivityByPhoneNumber(phoneNumber); + + Assert.NotNull(result); + Assert.IsFalse(result.Success); + Assert.IsNotNull(result.Message); + Assert.IsNull(result.PersonRecentActivity); + _mockActivityDao.Verify(x => x.GetPersonActivityByPersonNumber(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetPersonActivityByPhoneNumber_NoContent() + { + var phoneNumber = Guid.NewGuid().ToString(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPhoneNumber(It.IsAny())) + .ReturnsAsync(new List()).Verifiable(); + + var result = await _activityService.GetPersonActivityByPhoneNumber(phoneNumber); + + Assert.NotNull(result); + Assert.IsFalse(result.Success); + Assert.IsNotNull(result.Message); + Assert.IsNull(result.PersonRecentActivity); + _mockActivityDao.Verify(x => x.GetPersonActivityByPersonNumber(It.IsAny()), Times.Never); + } + + [Test] + public void GetPersonActivityByPhoneNumber_Exception() + { + _mockActivityDao + .Setup(x => x.GetPersonActivityByPhoneNumber(It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(async () => + await _activityService.GetPersonActivityByPhoneNumber(It.IsAny())); + } + + [Test] + public async Task GetPersonActivityByTaxId_OK() + { + var personNumber = DateTime.Now.Millisecond; + var taxId = Guid.NewGuid().ToString(); + var persons = new List + { + new() + { + PersonNumber = personNumber + } + }; + _mockTaxService.Setup(x => x.GetPersonsTaxIdData(It.IsAny())) + .ReturnsAsync(persons).Verifiable(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPersonNumber(It.IsAny())) + .ReturnsAsync(new PersonRecentActivity + { + PersonNumber = personNumber + }).Verifiable(); + + var result = await _activityService.GetPersonActivityByTaxId(taxId); + + Assert.NotNull(result); + Assert.IsTrue(result.Success); + Assert.NotNull(result.PersonRecentActivity); + Assert.AreEqual(personNumber, result.PersonRecentActivity?.PersonNumber); + _mockActivityDao.Verify(x => x.GetPersonActivityByPersonNumber(It.IsAny()), Times.Once); + _mockTaxService.Verify(x => x.GetPersonsTaxIdData(It.IsAny()), Times.Once); + } + + [Test] + public async Task GetPersonActivityByTaxId_MultipleReturn() + { + var personNumber = DateTime.Now.Millisecond; + var taxId = Guid.NewGuid().ToString(); + var persons = new List + { + new() { PersonNumber = personNumber }, + new() { PersonNumber = personNumber } + }; + _mockTaxService.Setup(x => x.GetPersonsTaxIdData(It.IsAny())) + .ReturnsAsync(persons).Verifiable(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPersonNumber(It.IsAny())) + .ReturnsAsync(new PersonRecentActivity + { + PersonNumber = personNumber + }).Verifiable(); + + var result = await _activityService.GetPersonActivityByTaxId(taxId); + + Assert.NotNull(result); + Assert.IsFalse(result.Success); + Assert.IsNotNull(result.Message); + Assert.IsNull(result.PersonRecentActivity); + _mockTaxService.Verify(x => x.GetPersonsTaxIdData(It.IsAny()), Times.Once); + _mockActivityDao.Verify(x => x.GetPersonActivityByPersonNumber(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetPersonActivityByTaxId_NoContent() + { + var personNumber = DateTime.Now.Millisecond; + var taxId = Guid.NewGuid().ToString(); + var persons = new List(); + _mockTaxService.Setup(x => x.GetPersonsTaxIdData(It.IsAny())) + .ReturnsAsync(persons).Verifiable(); + _mockActivityDao + .Setup(x => x.GetPersonActivityByPersonNumber(It.IsAny())) + .ReturnsAsync(new PersonRecentActivity + { + PersonNumber = personNumber + }).Verifiable(); + + var result = await _activityService.GetPersonActivityByTaxId(taxId); + + Assert.NotNull(result); + Assert.IsFalse(result.Success); + Assert.IsNotNull(result.Message); + Assert.IsNull(result.PersonRecentActivity); + _mockTaxService.Verify(x => x.GetPersonsTaxIdData(It.IsAny()), Times.Once); + _mockActivityDao.Verify(x => x.GetPersonActivityByPersonNumber(It.IsAny()), Times.Never); + } + + [Test] + public void GetPersonActivityByTaxId_Exception() + { + _mockTaxService + .Setup(x => x.GetPersonsTaxIdData(It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(async () => + await _activityService.GetPersonActivityByTaxId(It.IsAny())); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AddressServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AddressServiceTest.cs new file mode 100644 index 0000000..048d2e4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AddressServiceTest.cs @@ -0,0 +1,177 @@ +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using LCU.Library.Internal.Exceptions; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AddressServiceTest + { + private AddressService _addressService; + private Mock _mockAddressDao; + private PersonAddrLine _updatedPersonAddrLineOneAddressLine = new PersonAddrLine() + { + PersonNumber = 111, + AddressNumber = 222, + AddressUseCode = "PRI", + AddressLine1 = "1 Imaginary Street", + AddressLineTypeCode1 = "ST", + CityName = "Milwaukee", + PostalCode = "53220", + CountrySubdivisionCode = "WI", + CountryCode = "USA", + }; + + [SetUp] + public void SetUp() + { + _mockAddressDao = new Mock(); + _addressService = new AddressService(_mockAddressDao.Object); + + } + + [Test] + public async Task UpdateAddrLine_ok() + { + _mockAddressDao.Setup(x => x.UpdatePersonAddrLine(It.IsAny>())).ReturnsAsync( + _updatedPersonAddrLineOneAddressLine).Verifiable(); + + var personpostal = new PersonPostalAddress() + { + PersonNumber = 111, + AddressNumber = 222 + }; + + var header = new CoreMessageHeader() + { + UpdateKey = 123456 + }; + + var personList = new List() + { + personpostal + } + .AsReadOnly(); + + var response = new CoreApiMessage>(header, personList); + + _mockAddressDao.Setup(x => x.FindByPersonNumber(It.IsAny(), It.IsAny())).ReturnsAsync( + response); + + var personAddrLine = _updatedPersonAddrLineOneAddressLine; + + var result = await _addressService.UpdatePersonAddrLine(personAddrLine); + + _mockAddressDao.Verify(x => x.FindByPersonNumber(It.IsAny(), It.IsAny()), Times.Once); + _mockAddressDao.Verify(x => x.UpdatePersonAddrLine(It.IsAny>()), Times.Once); + Assert.AreEqual(_updatedPersonAddrLineOneAddressLine, result); + } + + [Test] + public async Task UpdateAddrLine_Fail_WrongPersonId() + { + _mockAddressDao.Setup(x => x.UpdatePersonAddrLine(It.IsAny>())).ReturnsAsync( + _updatedPersonAddrLineOneAddressLine).Verifiable(); + + var personpostal = new PersonPostalAddress() + { + PersonNumber = 999, + AddressNumber = 888 + }; + + var header = new CoreMessageHeader() + { + UpdateKey = 123456 + }; + + var personList = new List() + { + personpostal + } + .AsReadOnly(); + + var response = new CoreApiMessage>(header, personList); + + _mockAddressDao.Setup(x => x.FindByPersonNumber(It.IsAny(), It.IsAny())).ReturnsAsync( + response); + + var personAddrLine = _updatedPersonAddrLineOneAddressLine; + + Assert.ThrowsAsync(async () => await _addressService.UpdatePersonAddrLine(personAddrLine)); + + _mockAddressDao.Verify(x => x.FindByPersonNumber(It.IsAny(), It.IsAny()), Times.Once); + _mockAddressDao.Verify(x => x.UpdatePersonAddrLine(It.IsAny>()), Times.Never); + } + + [Test] + public async Task UpdateAddrLine_Fail_NullPerson() + { + _mockAddressDao.Setup(x => x.UpdatePersonAddrLine(It.IsAny>())).ReturnsAsync( + _updatedPersonAddrLineOneAddressLine).Verifiable(); + + var header = new CoreMessageHeader() + { + UpdateKey = 123456 + }; + + var personList = new List().AsReadOnly(); + + var response = new CoreApiMessage>(header, personList); + + _mockAddressDao.Setup(x => x.FindByPersonNumber(It.IsAny(), It.IsAny())).ReturnsAsync( + response); + + var personAddrLine = _updatedPersonAddrLineOneAddressLine; + + Assert.ThrowsAsync(async () => await _addressService.UpdatePersonAddrLine(personAddrLine)); + + _mockAddressDao.Verify(x => x.FindByPersonNumber(It.IsAny(), It.IsAny()), Times.Once); + _mockAddressDao.Verify(x => x.UpdatePersonAddrLine(It.IsAny>()), Times.Never); + } + + [Test] + public async Task UpdateAddrLine_Fail_NullResponse() + { + _mockAddressDao.Setup(x => x.UpdatePersonAddrLine(It.IsAny>())).Returns( + Task.FromResult((PersonAddrLine)null)).Verifiable(); + + var personpostal = new PersonPostalAddress() + { + PersonNumber = 111, + AddressNumber = 222 + }; + + var header = new CoreMessageHeader() + { + UpdateKey = 123456 + }; + + var personList = new List() + { + personpostal + } + .AsReadOnly(); + + var response = new CoreApiMessage>(header, personList); + + _mockAddressDao.Setup(x => x.FindByPersonNumber(It.IsAny(), It.IsAny())).ReturnsAsync( + response); + + var personAddrLine = _updatedPersonAddrLineOneAddressLine; + + + Assert.ThrowsAsync(async () => await _addressService.UpdatePersonAddrLine(personAddrLine)); + + _mockAddressDao.Verify(x => x.FindByPersonNumber(It.IsAny(), It.IsAny()), Times.Once); + _mockAddressDao.Verify(x => x.UpdatePersonAddrLine(It.IsAny>()), Times.Once); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreePersonServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreePersonServiceTest.cs new file mode 100644 index 0000000..3a4e470 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreePersonServiceTest.cs @@ -0,0 +1,190 @@ +using System; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Linq; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AgreePersonServiceTest + { + private AgreePersonService _agreePersonService; + private Mock _mockAgreePersonDao; + + [SetUp] + public void SetUp() + { + _mockAgreePersonDao = new Mock(); + _agreePersonService = new AgreePersonService(_mockAgreePersonDao.Object); + } + + [Test] + public async Task GetByUserId_OK() + { + _mockAgreePersonDao.Setup(x => x.FindByUserId(It.IsAny())).ReturnsAsync( + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1" + }).Verifiable(); + + var result = await _agreePersonService.GetByUserId("1"); + + Assert.NotNull(result); + Assert.AreEqual(100, result.AgreeNumber); + Assert.AreEqual(10, result.PersonNumber); + Assert.AreEqual("1", result.UserId); + } + + [Test] + public void GetByUserId_Exception() + { + _mockAgreePersonDao.Setup(x => x.FindByUserId(It.IsAny())).Throws(new Exception("Dang")); + + Assert.ThrowsAsync(async () => + await _agreePersonService.GetByUserId("1")); + } + + [Test] + public async Task GetAgreePersonsWithHyphenatedUserId_OK() + { + _mockAgreePersonDao.Setup(x => x.FindAgreePersonsWithHyphenatedUserId()).ReturnsAsync( + new List() + { + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1-1" + }, + new AgreePerson() + { + AgreeNumber = 200, + PersonNumber = 20, + UserId = "2-2" + } + }).Verifiable(); + + var results = await _agreePersonService.GetAgreePersonsWithHyphenatedUserId(); + + Assert.NotNull(results); + Assert.AreEqual(2, results.Count()); + var result1 = results.FirstOrDefault(); + Assert.AreEqual(100, result1.AgreeNumber); + Assert.AreEqual(10, result1.PersonNumber); + Assert.AreEqual("1-1", result1.UserId); + } + + [Test] + public void GetAgreePersonsWithHyphenatedUserId_Exception() + { + _mockAgreePersonDao.Setup(x => x.FindAgreePersonsWithHyphenatedUserId()) + .Throws(new Exception("Dang")); + + Assert.ThrowsAsync(async () => + await _agreePersonService.GetAgreePersonsWithHyphenatedUserId()); + } + + [Test] + public async Task GetActiveCustodialVruCardAgreementAgreePersons_OK() + { + _mockAgreePersonDao.Setup(x => x.FindActiveCustodialVruCardAgreementAgreePersons()).ReturnsAsync( + new List() + { + new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "11" + }, + new AgreePerson() + { + AgreeNumber = 200, + PersonNumber = 20, + UserId = null + } + }).Verifiable(); + + var results = await _agreePersonService.GetActiveCustodialVruCardAgreementAgreePersons(); + + Assert.NotNull(results); + Assert.AreEqual(2, results.Count()); + var result1 = results.FirstOrDefault(); + Assert.AreEqual(100, result1.AgreeNumber); + Assert.AreEqual(10, result1.PersonNumber); + Assert.AreEqual("11", result1.UserId); + } + + [Test] + public void GetActiveCustodialVruCardAgreementAgreePersons_Exception() + { + _mockAgreePersonDao.Setup(x => x.FindActiveCustodialVruCardAgreementAgreePersons()) + .Throws(new Exception("Dang")); + + Assert.ThrowsAsync(async () => + await _agreePersonService.GetActiveCustodialVruCardAgreementAgreePersons()); + } + + [Test] + public async Task UpdatePersonAgreementDetailTypes_OK() + { + _mockAgreePersonDao.Setup(x => x.UpdatePersonAgreementDetailTypes(It.IsAny())).ReturnsAsync( + new BasicResponse + { + Success = true, + Errors = new List() + }).Verifiable(); + + var personAgreementDetailTypeRequest = new PersonAgreementDetailTypeRequest() + { + PersonNumber = 1, + AgreeNumber = 2, + AgreeTypeCode = "VRUTEST", + DetailTypes = new List() + { + new DetailType() + { + DetailTypeCode = "STATUSTEST", + DetailValue = "CLOSTEST" + } + } + }; + var result = await _agreePersonService.UpdatePersonAgreementDetailTypes(personAgreementDetailTypeRequest); + + Assert.NotNull(result); + Assert.IsTrue(result.Success); + Assert.IsEmpty(result.Errors); + } + + [Test] + public void UpdatePersonAgreementDetailTypes_Exception() + { + _mockAgreePersonDao.Setup(x => x.UpdatePersonAgreementDetailTypes(It.IsAny())) + .Throws(new Exception("Dang")); + + var personAgreementDetailTypeRequest = new PersonAgreementDetailTypeRequest() + { + PersonNumber = 1, + AgreeNumber = 2, + AgreeTypeCode = "VRUTEST", + DetailTypes = new List() + { + new DetailType() + { + DetailTypeCode = "STATUSTEST", + DetailValue = "CLOSTEST" + } + } + }; + Assert.ThrowsAsync(async () => + await _agreePersonService.UpdatePersonAgreementDetailTypes(personAgreementDetailTypeRequest)); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreeServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreeServiceTest.cs new file mode 100644 index 0000000..eccf083 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AgreeServiceTest.cs @@ -0,0 +1,547 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AgreeServiceTest + { + private AgreeService _agreeService; + private Mock _mockAgreeDao; + + [SetUp] + public void SetUp() + { + _mockAgreeDao = new Mock(); + _agreeService = new AgreeService(_mockAgreeDao.Object); + } + + [Test] + public async Task GetAgreeUsersByAccountNumbers_OK() + { + _mockAgreeDao + .Setup(x => x.FindAgreeUsersByAccountNumbers(It.IsAny>())) + .ReturnsAsync( + new List() + { + new AgreeUserAccount() + { + AccountNumber = 100010, + AgreeNumber = 1000, + UserId = "101010" + }, + new AgreeUserAccount() + { + AccountNumber = 200020, + AgreeNumber = 2000, + UserId = "202020" + } + }) + .Verifiable(); + + var accountNumbers = new List() + { + "100010", + "200020" + }; + var results = await _agreeService.GetAgreeUsersByAccountNumbers(accountNumbers); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + Assert.True(resultsList.Any(x => x.AccountNumber == 100010)); + Assert.True(resultsList.Any(x => x.AccountNumber == 200020)); + Assert.True(resultsList.Any(x => x.AgreeNumber == 1000)); + Assert.True(resultsList.Any(x => x.AgreeNumber == 2000)); + Assert.True(resultsList.Any(x => x.UserId == "101010")); + Assert.True(resultsList.Any(x => x.UserId == "202020")); + + _mockAgreeDao.Verify(x => + x.FindAgreeUsersByAccountNumbers( + It.Is>(ls => ls.Count == 2 && ls.Contains("100010") && ls.Contains("200020")))); + } + + [Test] + public void GetAgreeUsersByAccountNumbers_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreeUsersByAccountNumbers(It.IsAny>())) + .Throws(new Exception("Ohh nooo")); + + var accountNumbers = new List() + { + "100010", + "200020" + }; + Assert.ThrowsAsync(async () => + await _agreeService.GetAgreeUsersByAccountNumbers(accountNumbers)); + } + + [Test] + public async Task GetAgreeUsersByPersonNumber_OK() + { + var personNumbers = new List { "5436", "44889" }; + _mockAgreeDao + .Setup(x => x.FindAgreeUserByPersonNumber(123L)) + .ReturnsAsync(personNumbers).Verifiable(); + + var result = await _agreeService.GetAgreeUsersByPersonNumber(123L); + + Assert.NotNull(result); + Assert.AreEqual("5436", result.FirstOrDefault()); + _mockAgreeDao.Verify(); + } + + [Test] + public void GetAgreeUsersByPersonNumber_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreeUserByPersonNumber(123L)) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreeUsersByPersonNumber(123L)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetAgreeUserByOrganizationNumber_OK() + { + _mockAgreeDao + .Setup(x => x.FindAgreeUserByOrganizationNumber(123L)) + .ReturnsAsync("5436").Verifiable(); + + var result = await _agreeService.GetAgreeUserByOrganizationNumber(123L); + + Assert.NotNull(result); + Assert.AreEqual("5436", result); + _mockAgreeDao.Verify(); + } + + [Test] + public void GetAgreeUserByOrganizationNumber_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreeUserByOrganizationNumber(123L)) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreeUserByOrganizationNumber(123L)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetEAgreementsByAccountId_OK() + { + var returnedEAgreements = new List() + { + new() + { + UserId = "101010", + AgreementNumber = 123, + PersonNumber = 1234, + FirstName = "John", + MiddleName = "Doe", + MiddleInitial = "D", + LastName = "Smith", + Suffix = "Jr.", + }, + new() + { + UserId = "101011" + } + }; + + _mockAgreeDao + .Setup(x => x.FindAgreementsByAccountId(123)) + .ReturnsAsync(returnedEAgreements).Verifiable(); + + var results = await _agreeService.GetAgreementsByAccountId(123); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult.AgreementNumber, 123L); + Assert.AreEqual(firstResult.UserId, "101010"); + Assert.AreEqual(firstResult.PersonNumber, 1234L); + Assert.AreEqual(firstResult.FirstName, "John"); + Assert.AreEqual(firstResult.MiddleName, "Doe"); + Assert.AreEqual(firstResult.MiddleInitial, "D"); + Assert.AreEqual(firstResult.LastName, "Smith"); + Assert.AreEqual(firstResult.Suffix, "Jr."); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult.UserId, "101011"); + _mockAgreeDao.Verify(); + } + + [Test] + public void GetEAgreementsByAccountId_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreementsByAccountId(123)) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreementsByAccountId(123)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetEAgreementByUserId_OK() + { + var returnedEAgreement = new Agreement() + { + UserId = "101010", + AgreementNumber = 123, + PersonNumber = 1234, + FirstName = "John", + MiddleName = "Doe", + MiddleInitial = "D", + LastName = "Smith", + Suffix = "Jr.", + }; + + _mockAgreeDao + .Setup(x => x.FindAgreementByUserId("123")) + .ReturnsAsync(returnedEAgreement).Verifiable(); + + var result = await _agreeService.GetAgreementByUserId("123"); + + Assert.NotNull(result); + + Assert.AreEqual(result.AgreementNumber, 123L); + Assert.AreEqual(result.UserId, "101010"); + Assert.AreEqual(result.PersonNumber, 1234L); + Assert.AreEqual(result.FirstName, "John"); + Assert.AreEqual(result.MiddleName, "Doe"); + Assert.AreEqual(result.MiddleInitial, "D"); + Assert.AreEqual(result.LastName, "Smith"); + Assert.AreEqual(result.Suffix, "Jr."); + } + + [Test] + public void GetEAgreementByUserId_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreementByUserId("123")) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreementByUserId("123")); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetEAgreementByAgreementId_OK() + { + var returnedEAgreement = new Agreement + { + UserId = "101010", + AgreementNumber = 123, + PersonNumber = 1234, + FirstName = "John", + MiddleName = "Doe", + MiddleInitial = "D", + LastName = "Smith", + Suffix = "Jr.", + }; + + _mockAgreeDao + .Setup(x => x.FindAgreementByAgreementId(123)) + .ReturnsAsync(returnedEAgreement).Verifiable(); + + var result = await _agreeService.GetAgreementByAgreementId(123); + + Assert.NotNull(result); + + Assert.AreEqual(result.AgreementNumber, 123L); + Assert.AreEqual(result.UserId, "101010"); + Assert.AreEqual(result.PersonNumber, 1234L); + Assert.AreEqual(result.FirstName, "John"); + Assert.AreEqual(result.MiddleName, "Doe"); + Assert.AreEqual(result.MiddleInitial, "D"); + Assert.AreEqual(result.LastName, "Smith"); + Assert.AreEqual(result.Suffix, "Jr."); + } + + [Test] + public void GetEAgreementByAgreementId_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreementByAgreementId(123)) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreementByAgreementId(123)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetEAgreementAccountsByUserId_OK() + { + var returnedAgreementAccounts = new List + { + new() + { + AccountDescription = "Test Account", + AccountNumber = 12345, + TaxReportForPersonNumber = 12345666, + TaxReportForOrgNumber = null, + OvrDeliveryMethCD = "PRNT" + }, + new() + { + AccountDescription = "Test Account 2", + AccountNumber = 12346, + TaxReportForPersonNumber = null, + TaxReportForOrgNumber = 12345666, + OvrDeliveryMethCD = "WWW" + } + }; + + var returnedAccountOwners = new List + { + new() + { + AccountNumber = 12345, + PersonNumber = 123, + UserId = "111" + }, + new() + { + AccountNumber = 12346, + PersonNumber = 124, + UserId = "222" + } + }; + + _mockAgreeDao + .Setup(x => x.FindAgreementAccountsByUserId("123")) + .ReturnsAsync(returnedAgreementAccounts).Verifiable(); + + _mockAgreeDao + .Setup(x => x.FindAgreementOwnerByAccountNumbers(It.Is>(x => x.Contains(12345L) && x.Contains(12346L)))) + .ReturnsAsync(returnedAccountOwners).Verifiable(); + + var results = await _agreeService.GetAgreementAccountsByUserId("123"); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult.AccountNumber, 12345L); + Assert.AreEqual(firstResult.AccountDescription, "Test Account"); + Assert.AreEqual(firstResult.TaxReportForPersonNumber, 12345666); + Assert.IsNull(firstResult.TaxReportForOrgNumber); + Assert.AreEqual(firstResult.OvrDeliveryMethCD, "PRNT"); + Assert.AreEqual(firstResult.AccountOwner.PersonNumber, 123); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult.AccountNumber, 12346L); + Assert.AreEqual(secondResult.AccountDescription, "Test Account 2"); + Assert.AreEqual(secondResult.TaxReportForOrgNumber, 12345666); + Assert.IsNull(secondResult.TaxReportForPersonNumber); + Assert.AreEqual(secondResult.OvrDeliveryMethCD, "WWW"); + Assert.AreEqual(secondResult.AccountOwner.PersonNumber, 124); + + _mockAgreeDao.Verify(); + } + + [Test] + public async Task GetEAgreementAccountsByOrganizationId_OK() + { + var returnedAgreementAccounts = new List + { + new() + { + AccountDescription = "Test Account", + AccountNumber = 12345, + TaxReportForPersonNumber = null, + TaxReportForOrgNumber = 12345666, + OvrDeliveryMethCD = "PRNT" + }, + new() + { + AccountDescription = "Test Account 2", + AccountNumber = 12346, + TaxReportForPersonNumber = null, + TaxReportForOrgNumber = 12345667, + OvrDeliveryMethCD = "WWW" + } + }; + + var returnedAccountOwners = new List + { + new() + { + AccountNumber = 12345, + PersonNumber = 123, + UserId = "111" + } + }; + + _mockAgreeDao + .Setup(x => x.FindAgreementAccountsByOrganizationId(123)) + .ReturnsAsync(returnedAgreementAccounts).Verifiable(); + + _mockAgreeDao + .Setup(x => x.FindAgreementOwnerByAccountNumbers(It.Is>(x => x.Contains(12345L) && x.Contains(12346L)))) + .ReturnsAsync(returnedAccountOwners).Verifiable(); + + var results = await _agreeService.GetAgreementAccountsByOrganizationId(123); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult.AccountNumber, 12345L); + Assert.AreEqual(firstResult.AccountDescription, "Test Account"); + Assert.IsNull(firstResult.TaxReportForPersonNumber); + Assert.AreEqual(firstResult.TaxReportForOrgNumber, 12345666L); + Assert.AreEqual(firstResult.OvrDeliveryMethCD, "PRNT"); + Assert.AreEqual(firstResult.AccountOwner.PersonNumber, 123); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult.AccountNumber, 12346L); + Assert.AreEqual(secondResult.AccountDescription, "Test Account 2"); + Assert.IsNull(secondResult.TaxReportForPersonNumber); + Assert.AreEqual(secondResult.TaxReportForOrgNumber, 12345667L); + Assert.AreEqual(secondResult.OvrDeliveryMethCD, "WWW"); + Assert.IsNull(secondResult.AccountOwner); + + _mockAgreeDao.Verify(); + } + + [Test] + public void GetEAgreementAccountsByOrganizationId_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreementAccountsByOrganizationId(123)) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreementAccountsByOrganizationId(123)); + _mockAgreeDao.Verify(); + } + + [Test] + public void GetEAgreementAccountsByUserId_Exception() + { + _mockAgreeDao.Setup(x => x.FindAgreementAccountsByUserId("123")) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.GetAgreementAccountsByUserId("123")); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained_OK() + { + var returnedAccountNumbers = new List + { + 12345, + 12346 + }; + + _mockAgreeDao + .Setup(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var results = await _agreeService.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime.Now); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult, 12345L); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult, 12346L); + _mockAgreeDao.Verify(); + } + + [Test] + public void AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained_Exception() + { + _mockAgreeDao.Setup(x => x.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(It.IsAny())) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime.Now)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task AuditOrganizationChangesByDateLastMaintained_OK() + { + var returnedAccountNumbers = new List + { + 12345, + 12346 + }; + + _mockAgreeDao + .Setup(x => x.AuditAccountOrganizationChangesByDateLastMaintained(It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var results = await _agreeService.AuditOrganizationChangesByDateLastMaintained(DateTime.Now); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult, 12345L); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult, 12346L); + _mockAgreeDao.Verify(); + } + + [Test] + public void AuditOrganizationChangesByDateLastMaintained_Exception() + { + _mockAgreeDao.Setup(x => x.AuditAccountOrganizationChangesByDateLastMaintained(It.IsAny())) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.AuditOrganizationChangesByDateLastMaintained(DateTime.Now)); + _mockAgreeDao.Verify(); + } + + [Test] + public async Task AuditAgreementChangesByDateLastMaintained_OK() + { + var returnedAccountNumbers = new List + { + 12345, + 12346 + }; + + _mockAgreeDao + .Setup(x => x.AuditAccountAgreementChangesByDateLastMaintained(It.IsAny())) + .ReturnsAsync(returnedAccountNumbers).Verifiable(); + + var results = await _agreeService.AuditAgreementChangesByDateLastMaintained(DateTime.Now); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + + var firstResult = resultsList.First(); + Assert.AreEqual(firstResult, 12345L); + + var secondResult = resultsList.Last(); + Assert.AreEqual(secondResult, 12346L); + _mockAgreeDao.Verify(); + } + + [Test] + public void AuditAgreementChangesByDateLastMaintained_Exception() + { + _mockAgreeDao.Setup(x => x.AuditAccountAgreementChangesByDateLastMaintained(It.IsAny())) + .Throws(new Exception("Exception from unit test")).Verifiable(); + + Assert.ThrowsAsync(async () => await _agreeService.AuditAgreementChangesByDateLastMaintained(DateTime.Now)); + _mockAgreeDao.Verify(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ApplicationHistoryServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ApplicationHistoryServiceTest.cs new file mode 100644 index 0000000..8d84a62 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/ApplicationHistoryServiceTest.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class ApplicationHistoryServiceTest + { + private ApplicationHistoryService _applicationHistoryService; + private Mock _mockApplicationHistoryDao; + + [SetUp] + public void SetUp() + { + _mockApplicationHistoryDao = new Mock(); + _applicationHistoryService = new ApplicationHistoryService(_mockApplicationHistoryDao.Object); + } + + [Test] + public async Task GetApplicationHistory_OK() + { + _mockApplicationHistoryDao + .Setup(x => x.FindApplicationHistory(It.IsAny>(), It.IsAny())) + .ReturnsAsync( + new List() + { + new ApplicationHistory() + { + ApplicationName = "Test", + ApplicationNumber = 1, + QueueNumber = 10, + StopDateTime = Convert.ToDateTime("1/1/2021") + }, + new ApplicationHistory() + { + ApplicationName = "Test2", + ApplicationNumber = 2, + QueueNumber = 20, + StopDateTime = Convert.ToDateTime("1/1/2021") + } + }) + .Verifiable(); + + var applicationTestNumbers = new List() + { + "1", + "2" + }; + var results = await _applicationHistoryService.GetApplicationHistory(applicationTestNumbers, "1/2/2021"); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + Assert.True(resultsList.Any(x => x.ApplicationName == "Test")); + Assert.True(resultsList.Any(x => x.ApplicationName == "Test")); + Assert.True(resultsList.Any(x => x.ApplicationNumber == 1)); + Assert.True(resultsList.Any(x => x.ApplicationNumber == 2)); + Assert.True(resultsList.Any(x => x.QueueNumber == 10)); + Assert.True(resultsList.Any(x => x.QueueNumber == 20)); + Assert.True(resultsList.Any(x => x.StopDateTime == Convert.ToDateTime("1/1/2021"))); + Assert.AreEqual(2, resultsList.Where(r => r.StopDateTime == Convert.ToDateTime("1/1/2021")).ToList().Count); + + _mockApplicationHistoryDao.Verify(x => + x.FindApplicationHistory( It.Is>( ls => ls.Count == 2 && ls.Contains("1") && ls.Contains("2")), + It.Is(dt => dt.CompareTo(DateTime.Parse("1/2/2021")) == 0))); + } + + [Test] + public void GetApplicationHistory_FailedToParse_Null() + { + _mockApplicationHistoryDao + .Setup(x => x.FindApplicationHistory(It.IsAny>(), It.IsAny())) + .ReturnsAsync( + new List() + { + new ApplicationHistory() + { + ApplicationName = "Test", + ApplicationNumber = 1, + QueueNumber = 10, + StopDateTime = Convert.ToDateTime("1/1/2021") + }, + new ApplicationHistory() + { + ApplicationName = "Test2", + ApplicationNumber = 2, + QueueNumber = 20, + StopDateTime = Convert.ToDateTime("1/1/2021") + } + }) + .Verifiable(); + + Assert.ThrowsAsync(async () => + await _applicationHistoryService.GetApplicationHistory(null, null)); + } + + [Test] + public void GetApplicationHistory_FailedToParse_BadDateTime() + { + _mockApplicationHistoryDao + .Setup(x => x.FindApplicationHistory(It.IsAny>(), It.IsAny())) + .ReturnsAsync( + new List() + { + new ApplicationHistory() + { + ApplicationName = "Test", + ApplicationNumber = 1, + QueueNumber = 10, + StopDateTime = Convert.ToDateTime("1/1/2021") + }, + new ApplicationHistory() + { + ApplicationName = "Test2", + ApplicationNumber = 2, + QueueNumber = 20, + StopDateTime = Convert.ToDateTime("1/1/2021") + } + }) + .Verifiable(); + + Assert.ThrowsAsync(async () => + await _applicationHistoryService.GetApplicationHistory(null, ":-)")); + } + + [Test] + public void GetApplicationHistory_Exception() + { + _mockApplicationHistoryDao + .Setup(x => x.FindApplicationHistory(It.IsAny>(), + It.IsAny())).Throws(new Exception("Ohh nooo")); + + var applicationTestNumbers = new List() + { + "1", + "2" + }; + Assert.ThrowsAsync(async () => + await _applicationHistoryService.GetApplicationHistory(applicationTestNumbers, "1/2/2021")); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AssociateServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AssociateServiceTest.cs new file mode 100644 index 0000000..6533294 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/AssociateServiceTest.cs @@ -0,0 +1,52 @@ +using System; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate; +using LCU.Library.Internal.Exceptions; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class AssociateServiceTest + { + private readonly AssociateService _associateService; + private readonly Mock _mockAssociateDao; + + public AssociateServiceTest() + { + _mockAssociateDao = new Mock(); + _associateService = new AssociateService(_mockAssociateDao.Object); + } + + [Test] + public void GetAssociateDetailsBySsn_Exception_Returns_Null() + { + var taxId = Guid.NewGuid().ToString(); + + _mockAssociateDao.Setup(x => x.GetAssociateDetailsBySsn(It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _associateService.GetAssociateDetailsBySsn(taxId)); + } + + [Test] + public async Task GetAssociateDetailsBySsn_Returns_PersonAssociateDetails() + { + var taxId = Guid.NewGuid().ToString(); + + var associateDetails = new AssociateDetails + { + PersonNumber = DateTime.Now.Millisecond + }; + + _mockAssociateDao.Setup(x => x.GetAssociateDetailsBySsn(It.IsAny())).ReturnsAsync(associateDetails).Verifiable(); + + var result = await _associateService.GetAssociateDetailsBySsn(taxId); + + Assert.NotNull(result); + Assert.AreEqual(associateDetails.PersonNumber, result.PersonNumber); + _mockAssociateDao.Verify(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/BranchServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/BranchServiceTest.cs new file mode 100644 index 0000000..f3ce4f4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/BranchServiceTest.cs @@ -0,0 +1,73 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using AutoMapper; +using Moq; +using LCU.Api.Internal.CoreApiWrapper.Mappers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class BranchServiceTest + { + private readonly BranchService _branchService; + private readonly IMapper _mapper; + private readonly Mock _mockBranchDao; + + public BranchServiceTest() + { + + if (_mapper == null) + { + var mappingConfig = new MapperConfiguration(mc => + { + mc.AddProfile(new BranchMapper()); + }); + IMapper mapper = mappingConfig.CreateMapper(); + _mapper = mapper; + } + + _mockBranchDao = new Mock(); + _branchService = new BranchService(_mapper, _mockBranchDao.Object); + } + + [Test] + public async Task GetBranches_Returns_FilledOutBranches() + { + var testBranch = new List() + { + new Branch() + { + BranchNumber = 1, + BranchName = "Test Branch One" + }, + new Branch() + { + BranchNumber = 2, + BranchName = "Test Branch Two" + } + }; + _mockBranchDao.Setup(x => x.FindBranches(It.IsAny())).ReturnsAsync(testBranch); + + var result = await _branchService.GetBranches(); + + Assert.NotNull(result); + Assert.AreEqual(2, result.Count()); + Assert.AreEqual(1, result.FirstOrDefault().BranchId); + Assert.AreEqual("Test Branch One", result.FirstOrDefault().BranchName); + } + + [Test] + public void GetBranches_Exception() + { + _mockBranchDao.Setup(x => x.FindBranches(It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _branchService.GetBranches()); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/IndividualServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/IndividualServiceTest.cs new file mode 100644 index 0000000..0048233 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/IndividualServiceTest.cs @@ -0,0 +1,154 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using AutoMapper; +using Moq; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Mappers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.EmailAddress; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Phones; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class IndividualServiceTest + { + private readonly IndividualService _individualService; + private readonly IMapper _mapper; + private readonly Mock _mockPersonService; + private readonly Mock _mockAgreePersonService; + + public IndividualServiceTest() + { + if (_mapper == null) + { + var mappingConfig = new MapperConfiguration(mc => + { + mc.AddProfile(new IndividualMapper()); + mc.AddProfile(new AddressMapper()); + mc.AddProfile(new PhoneMapper()); + }); + IMapper mapper = mappingConfig.CreateMapper(); + _mapper = mapper; + } + _mockPersonService = new Mock(); + _mockAgreePersonService = new Mock(); + + _individualService = new IndividualService(_mapper, + _mockPersonService.Object, + _mockAgreePersonService.Object); + } + + [Test] + public async Task GetIndividual_Returns_FilledOutIndividual() + { + var agreePerson = new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1" + }; + _mockAgreePersonService.Setup(x => x.GetByUserId(It.IsAny())).ReturnsAsync(agreePerson); + + var testPostalAddress = new PostalAddress() + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11 + }; + var testPostalAddressList = new List() { testPostalAddress }; + + var email1 = new Email() + { + EmailAddress = "TestEmail1@test.com" + }; + var email2 = new Email() + { + EmailAddress = "TestEmail2@test.com" + }; + var testEmailAddressList = new List() { email1, email2 }; + + var phone1 = new Phone() + { + IsPreferred = true, + AreaCode = "262", + Exchange = "789", + PhoneNumber = "3321" + }; + var phone2 = new Phone() + { + IsPreferred = false, + AreaCode = "626", + Exchange = "987", + PhoneNumber = "1123" + }; + var testPhoneList = new List() { phone1, phone2 }; + + var testPersonResult = new Person() + { + PersonNumber = 10, + FirstName = "Tester", + MiddleName = "Person", + MiddleInitial = "P", + LastName = "Guy", + Suffix = "Jr", + TaxId = "1231232132", + BirthDate = "1/1/2021", + PostalAddressList = testPostalAddressList, + IsEmployee = true, + EmailAddressList = testEmailAddressList, + Phones = testPhoneList + }; + var testPersonsResult = new List(); + testPersonsResult.Add(testPersonResult); + _mockPersonService.Setup(x => x.GetPersonsBySearch(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonsResult); + + var result = await _individualService.GetIndividualByUserId("1111"); + + Assert.NotNull(result); + Assert.AreEqual(10, result.IndividualId); + Assert.AreEqual("Tester", result.FirstName); + Assert.AreEqual("P", result.MiddleName); + Assert.AreEqual("Guy", result.LastName); + Assert.AreEqual("Jr", result.NameSuffix); + Assert.AreEqual("1231232132", result.TaxId); + Assert.AreEqual(Convert.ToDateTime("1/1/2021"), result.BirthDate); + Assert.AreEqual(11, result.PrimaryAddressId); + Assert.IsTrue(result.IsEmployee); + Assert.AreEqual(1, result.Address.Count); + Assert.AreEqual("TestEmail1@test.com", result.Email1); + Assert.AreEqual(2, result.Phone.Count); + } + + [Test] + public void GetPersonsByMemberAgreementNbr_Exception_InGetByUserId() + { + _mockAgreePersonService.Setup(x => x.GetByUserId(It.IsAny())).Throws(new Exception()); + var testId = "1"; + Assert.ThrowsAsync(() => _individualService.GetIndividualByUserId(testId)); + } + + [Test] + public void GetPersonsByMemberAgreementNbr_Exception_InGetPersonBySearch() + { + var agreePerson = new AgreePerson() + { + AgreeNumber = 100, + PersonNumber = 10, + UserId = "1" + }; + _mockAgreePersonService.Setup(x => x.GetByUserId(It.IsAny())).ReturnsAsync(agreePerson); + _mockPersonService.Setup(x => x.GetPersonsBySearch(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + var testId = "1"; + Assert.ThrowsAsync(() => _individualService.GetIndividualByUserId(testId)); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/LoanServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/LoanServiceTest.cs new file mode 100644 index 0000000..fc35fc3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/LoanServiceTest.cs @@ -0,0 +1,274 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using AutoMapper; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Mappers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Loans; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class LoanServiceTest + { + private readonly LoanService _loanService; + private readonly IMapper _mapper; + private readonly Mock _mockAccountService; + private readonly Mock _mockPropertyService; + private readonly Mock _mockAccountHistoryService; + + public LoanServiceTest() + { + + if (_mapper == null) + { + var mappingConfig = new MapperConfiguration(mc => + { + mc.AddProfile(new LoanDetailMapper()); + mc.AddProfile(new CollateralDetailMapper()); + mc.AddProfile(new OtherCollateralMapper()); + mc.AddProfile(new VehicleMapper()); + }); + IMapper mapper = mappingConfig.CreateMapper(); + _mapper = mapper; + } + + _mockAccountService = new Mock(); + _mockPropertyService = new Mock(); + _mockAccountHistoryService = new Mock(); + _loanService = new LoanService(_mapper, _mockAccountService.Object, _mockPropertyService.Object, _mockAccountHistoryService.Object); + } + + [Test] + public async Task GetLoanDetail_Returns_FilledOutAccount_WrittenOffStatus() + { + var testAccountRolesInfos = new List() + { + new AccountRolesInfo() + { + AccountRoleDescription = AccountRoleConstants.LoanOfficer + }, + new AccountRolesInfo() + { + PersonNumber = 1, + RoleName = "Tester One" + }, + new AccountRolesInfo() + { + PersonNumber = 2, + RoleName = "Tester Two" + } + }; + + var testLoanInfo = new LoanInfo() + { + NextDueDate = Convert.ToDateTime("1/1/2021"), + CurrentDueDate = Convert.ToDateTime("1/1/2020") + }; + + var account = new Account() + { + MemberAgreementNumber = 100, + AccountNumber = 1000143, + ReportingForPersonNumber = 1, + CurrentAccountStatusDescription = AccountStatusConstants.CoreChargeOffAccount, + CurrentAccountStatusDateTime = Convert.ToDateTime("1/1/2021"), + Balance = 100.10M, + AccountRolesInfo = testAccountRolesInfos, + LoanInfo = testLoanInfo + + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(account); + + _mockAccountHistoryService.Setup(x => x.GetChargeoffDateTimesByAccountNumber(It.IsAny())).ReturnsAsync(new List() { Convert.ToDateTime("1/1/2021") }); + + var testLoanId = 1000143; + var result = await _loanService.GetLoanDetail(testLoanId); + + Assert.NotNull(result); + Assert.AreEqual(2, result.IndividualId.Length); + Assert.AreEqual(1, result.IndividualId[0]); + Assert.AreEqual(2, result.Borrowers.Count); + Assert.AreEqual(AccountRoleConstants.Borrower, result.Borrowers.FirstOrDefault().Type); + Assert.AreEqual(1, result.Borrowers.FirstOrDefault().IndividualId); + Assert.AreEqual("Tester One", result.Borrowers.FirstOrDefault().Name); + Assert.AreEqual(AccountStatusConstants.WrittenOffStatus, result.Status); + Assert.AreEqual(Convert.ToDateTime("1/1/2021"), result.WrittenOffDate); + Assert.AreEqual(Convert.ToDateTime("1/1/2020"), result.NextDueDate); + } + + [Test] + public async Task GetLoanDetail_Returns_FilledOutAccount_OpenStatus() + { + var testAccountRolesInfos = new List() + { + new AccountRolesInfo() + { + AccountRoleDescription = AccountRoleConstants.LoanOfficer + }, + new AccountRolesInfo() + { + PersonNumber = 1, + RoleName = "Tester One" + }, + new AccountRolesInfo() + { + PersonNumber = 2, + RoleName = "Tester Two" + } + }; + + var testLoanInfo = new LoanInfo() + { + NextDueDate = Convert.ToDateTime("1/1/2021"), + CurrentDueDate = Convert.ToDateTime("1/1/2020") + }; + + var account = new Account() + { + MemberAgreementNumber = 100, + AccountNumber = 1000143, + ReportingForPersonNumber = 1, + CurrentAccountStatusDescription = AccountStatusConstants.CoreActiveAccount, + Balance = 100.10M, + AccountRolesInfo = testAccountRolesInfos, + LoanInfo = testLoanInfo + + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(account); + + var testLoanId = 1000143; + var result = await _loanService.GetLoanDetail(testLoanId); + + Assert.NotNull(result); + Assert.AreEqual(2, result.IndividualId.Length); + Assert.AreEqual(1, result.IndividualId[0]); + Assert.AreEqual(2, result.Borrowers.Count); + Assert.AreEqual(AccountRoleConstants.Borrower, result.Borrowers.FirstOrDefault().Type); + Assert.AreEqual(1, result.Borrowers.FirstOrDefault().IndividualId); + Assert.AreEqual("Tester One", result.Borrowers.FirstOrDefault().Name); + Assert.AreEqual(AccountStatusConstants.OpenStatus, result.Status); + Assert.AreEqual(DateTime.MinValue, result.WrittenOffDate); + Assert.AreEqual(Convert.ToDateTime("1/1/2020"), result.NextDueDate); + } + + [Test] + public void GetLoanDetail_Exception() + { + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + var testLoanId = 1000143; + Assert.ThrowsAsync(async () => await _loanService.GetLoanDetail(testLoanId)); + } + + [Test] + public async Task GetCollateralDetails_Returns_CollateralDetails_OneVehicle_OneNoneVehicle() + { + var testProperty1 = new Property() + { + TypeCode= "AUTU", + Value = 100, + Make ="Test Make", + Model = "Test Model", + PropertyNumber = 1, + PropertyId = "dfjadf12083213" + }; + var testProperty2 = new Property() + { + TypeCode = "TEST", + Value = 1000, + PropertyId = "2" + }; + List testProperties = new List() { testProperty1, testProperty2 }; + _mockPropertyService.Setup(x => x.GetAccountProperties(It.IsAny())).ReturnsAsync(testProperties); + + var testLoanId = 1000143; + var results = await _loanService.GetCollateralDetails(testLoanId); + + Assert.NotNull(results); + Assert.AreEqual(2, results.Count()); + var resultVehicle = results.FirstOrDefault(p => p.Vehicle != null); + Assert.NotNull(resultVehicle); + Assert.AreEqual("Test Make", resultVehicle.Vehicle.Make); + Assert.AreEqual("Test Model", resultVehicle.Vehicle.Model); + Assert.AreEqual("dfjadf12083213", resultVehicle.Vehicle.VIN); + Assert.AreEqual(1, resultVehicle.CollateralId); + } + + [Test] + public async Task GetCollateralDetails_Returns_CollateralDetails_AllNoneVehicle() + { + var testProperty1 = new Property() + { + TypeCode = "TEST 1", + Value = 10001.99, + PropertyId = "1" + }; + var testProperty2 = new Property() + { + TypeCode = "TEST 2", + Value = 10002.01, + PropertyId = "2" + }; + List testProperties = new List() { testProperty1, testProperty2 }; + _mockPropertyService.Setup(x => x.GetAccountProperties(It.IsAny())).ReturnsAsync(testProperties); + + var testLoanId = 1000143; + var results = await _loanService.GetCollateralDetails(testLoanId); + + Assert.NotNull(results); + Assert.AreEqual(2, results.Count()); + var resultVehicle = results.FirstOrDefault(p => p.Vehicle != null); + Assert.Null(resultVehicle); + } + + [Test] + public void GetCollateralDetails_Exception() + { + _mockPropertyService.Setup(x => x.GetAccountProperties(It.IsAny())).Throws(new Exception()); + + var testLoanId = 1000143; + Assert.ThrowsAsync(async () => await _loanService.GetCollateralDetails( testLoanId)); + } + + [Test] + public async Task GetPropertyInformation_OkAsync() + { + var testProperty1 = new Property() + { + PropertyNumber = 1000 + }; + var testProperty2 = new Property() + { + PropertyNumber = 1001 + }; + List testProperties = new List() { testProperty1, testProperty2 }; + _mockPropertyService.Setup(x => x.GetAccountProperties(It.IsAny())).ReturnsAsync(testProperties); + + var testLoanId = 1000143; + var results = await _loanService.GetPropertyInformation(testLoanId); + + Assert.NotNull(results); + Assert.AreEqual(2, results.Count()); + } + + [Test] + public void GetPropertyInformation_Exception() + { + _mockPropertyService.Setup(x => x.GetAccountProperties(It.IsAny())).Throws(new Exception()); + + var testaccountId = 1000; + Assert.ThrowsAsync(async () => await _loanService.GetPropertyInformation(testaccountId)); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/MemberServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/MemberServiceTest.cs new file mode 100644 index 0000000..97f17cc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/MemberServiceTest.cs @@ -0,0 +1,408 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using AutoMapper; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Mappers; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.Enums; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Identifications; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Phones; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Mixed; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class MemberServiceTest + { + private readonly MemberService _memberService; + private readonly IMapper _mapper; + private readonly Mock _mockPersonService; + private readonly Mock _mockAccountService; + private readonly Mock _mockOrganizationService; + + public MemberServiceTest() + { + if (_mapper == null) + { + var mappingConfig = new MapperConfiguration(mc => + { + mc.AddProfile(new MemberOwnerMapper()); + mc.AddProfile(new MemberMapper()); + mc.AddProfile(new AddressMapper()); + }); + IMapper mapper = mappingConfig.CreateMapper(); + _mapper = mapper; + } + _mockPersonService = new Mock(); + _mockAccountService = new Mock(); + _mockOrganizationService = new Mock(); + + _memberService = new MemberService(_mapper, + _mockPersonService.Object, + _mockAccountService.Object, + _mockOrganizationService.Object); + } + + [Test] + public async Task GetMember_Returns_FilledOutMember() + { + var testPostalAddress = new PostalAddress() + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11, + AddressLine1 = "Test Street", + AddressLine2 = "", + AddressLine3 = "", + CityName = "City Test", + PostalCode = "53183", + ZipPlus = "3123", + CountrySubdivisionCode = "WI" + }; + var testPostalAddressList = new List() { testPostalAddress }; + + var testId = 100; + var testPersonResult = new Person() + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021", + MemberNumber = 111111111, + PostalAddressList = testPostalAddressList + }; + + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonResult); + + var result = await _memberService.GetMemberDetails(testId); + + Assert.NotNull(result); + Assert.AreEqual("Tester Person Guy", result.MemberName); + Assert.AreEqual(111111111, result.MemberId); + Assert.AreEqual("Test Street", result.Address.Line1); + Assert.AreEqual("WI", result.Address.State); + _mockOrganizationService.Verify(x => x.GetMemberByMemberAgreeNbr(111111111), Times.Never()); + } + + [Test] + public void GetMemberDetails_Return_Exception() + { + var testId = 100; + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _memberService.GetMemberDetails(testId)); + } + + [Test] + public async Task GetMemberByAccountNumber_Person_Returns_FilledOutMember() + { + var testAccountResult = new Account() + { + MemberAgreementNumber = 111111111, + ReportingForPersonNumber = 1 + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(testAccountResult); + + var testPostalAddress = new PostalAddress() + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11, + AddressLine1 = "Test Street", + AddressLine2 = "", + AddressLine3 = "", + CityName = "City Test", + PostalCode = "53183", + ZipPlus = "3123", + CountrySubdivisionCode = "WI" + }; + var testPostalAddressList = new List() { testPostalAddress }; + + var testId = 100; + var testPersonResult = new Person() + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021", + MemberNumber = 111111111, + PostalAddressList = testPostalAddressList + }; + + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonResult); + + var result = await _memberService.GetMemberByAccountNumber(testId); + + Assert.NotNull(result); + Assert.AreEqual("Tester Person Guy", result.MemberName); + Assert.AreEqual(111111111, result.MemberId); + Assert.AreEqual("Test Street", result.Address.Line1); + Assert.AreEqual("WI", result.Address.State); + } + + [Test] + public void GetMemberDetailsByAccountNumber_Return_Exception_OnGetAccountDetails() + { + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).Throws(new Exception()); + var testId = 100; + Assert.ThrowsAsync(() => _memberService.GetMemberByAccountNumber(testId)); + } + + + [Test] + public void GetMemberDetailsByAccountNumber_Return_Exception_OnGetPersonsByMemberAgreementNbr() + { + var testAccountResult = new Account() + { + MemberAgreementNumber = 111111111 + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(testAccountResult); + var testId = 100; + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _memberService.GetMemberByAccountNumber(testId)); + } + + [Test] + public async Task GetMemberOwner_Returns_FilledOutMemberOwner() + { + var testPostalAddress = new PostalAddress() + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11, + AddressLine1 = "Test Street", + AddressLine2 = "", + AddressLine3 = "", + CityName = "City Test", + PostalCode = "53183", + ZipPlus = "3123", + CountrySubdivisionCode = "WI" + }; + var testPostalAddressList = new List() { testPostalAddress }; + + var identification = new Identification() + { + TypeCode = ((int)IdentificationTypeEnum.UnexpiredDriversLicense).ToString(), + CountryCode = AddressConstants.CountryUSA, + StateCode = "WI", + IdNumber = "A3243208fj213aupasdf" + }; + var identificationList = new List() { identification }; + + + var phone1 = new Phone() + { + IsPreferred = true, + AreaCode = "262", + Exchange = "789", + PhoneNumber = "3321" + }; + var testMemberAgreement = new MemberAgreement() + { + PrimaryPersonNumber = 1 + }; + + var testId = 100; + var testPersonResult = new Person() + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021", + PostalAddressList = testPostalAddressList, + IsEmployee = true, + MemberAgreement = testMemberAgreement, + Identifications = identificationList + }; + + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonResult); + + var results = await _memberService.GetMemberOwner(testId); + + Assert.NotNull(results); + Assert.AreEqual(1, results.ToList().Count); + var result = results.FirstOrDefault(); + + Assert.AreEqual(1, result.IndividualId); + Assert.AreEqual("Tester Person Guy", result.Name); + Assert.AreEqual("1231232132", result.TaxId); + Assert.AreEqual("1/1/2021", result.BirthDate); + Assert.AreEqual("Primary", result.Type); + Assert.AreEqual("Test Street, City Test, WI 53183-3123", result.Address); + Assert.AreEqual("WI A3243208fj213aupasdf", result.DriverLicense); + } + + [Test] + public void GetMemberOwner_Return_Exception() + { + var testId = 100; + _mockPersonService.Setup(x => x.GetPersonsByMemberAgreementNbr(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _memberService.GetMemberOwner(testId)); + } + + [Test] + public async Task GetMemberByAccountNumber_Organization_Returns_FilledOutMember() + { + // Arrange + var testAccountResult = new Account() + { + MemberAgreementNumber = 111111111, + ReportingForOrganizationNumber = 1 + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(testAccountResult); + + var testPostalAddress = new PostalAddress() + { + AddressUseCode = AddressConstants.PrimaryUseCode, + AddressNumber = 11, + AddressLine1 = "Test Street", + AddressLine2 = "", + AddressLine3 = "", + CityName = "City Test", + PostalCode = "53183", + ZipPlus = "3123", + CountrySubdivisionCode = "WI" + }; + var testPostalAddressList = new List() { testPostalAddress }; + var testOrganization = new Organization + { + MemberAgreementNumber = 111111111, + Name = "Test Organization Name", + OrganizationNumber = 123, + PostalAddressList = testPostalAddressList + }; + + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ReturnsAsync(testOrganization); + + // Act + var result = await _memberService.GetMemberByAccountNumber(1); + + // ASsert + Assert.IsNotNull(result); + Assert.AreEqual(result.MemberId, 111111111); + Assert.AreEqual(result.MemberName, "Test Organization Name"); + Assert.AreEqual(result.PrimaryIndividualId, 123); + Assert.AreEqual("Test Street", result.Address.Line1); + Assert.AreEqual("WI", result.Address.State); + _mockPersonService.Verify(x => x.GetPersonsByMemberAgreementNbr(new CoreRequestParameters(), new MemberNbrRequest()), Times.Never()); + } + + [Test] + public async Task GetPersonOrOrganizationNumberByMemberId_PersonFound() + { + // Arrange + _mockOrganizationService.Invocations.Clear(); + + long personMemberNumber = 123; + var personName = "John E Jacob Jr"; + + var person = new Person() + { + PersonNumber = (int)personMemberNumber, + FirstMiddleInitialLastSuffix = personName + }; + + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ReturnsAsync(person).Verifiable(); + + // Act + var result = await _memberService.GetPersonOrOrganizationNumberByMemberId(personMemberNumber); + + // Assert + Assert.IsNotNull(result); + Assert.AreEqual(result.PersonNumber, personMemberNumber.ToString()); + Assert.AreEqual(result.EntityName, personName); + Assert.IsNull(result.OrganizationNumber); + _mockOrganizationService.Verify(x => x.GetMemberByMemberAgreeNbr(It.IsAny()), Times.Never); + } + + [Test] + public async Task GetPersonOrOrganizationNumberByMemberId_OrganizationFound() + { + // Arrange + _mockPersonService.Invocations.Clear(); + _mockOrganizationService.Invocations.Clear(); + + long organizationMemberNumber = 123; + var organizationName = "John E Consulting LLC"; + + var organization = new Organization() + { + OrganizationNumber = organizationMemberNumber, + Name = organizationName + }; + + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ThrowsAsync(new Exception()); + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ReturnsAsync(organization).Verifiable(); + + // Act + var result = await _memberService.GetPersonOrOrganizationNumberByMemberId(organizationMemberNumber); + + // Assert + Assert.IsNotNull(result); + Assert.AreEqual(result.OrganizationNumber, organizationMemberNumber.ToString()); + Assert.AreEqual(result.EntityName, organizationName); + Assert.IsNull(result.PersonNumber); + _mockPersonService.Verify(x => x.GetMemberByMemberAgreeNbr(It.IsAny()), Times.Once); + _mockOrganizationService.Verify(x => x.GetMemberByMemberAgreeNbr(It.IsAny()), Times.Once); + } + + [Test] + public void GetPersonOrOrganizationNumberByMemberId_NeitherFound_Exception() + { + // Arrange + _mockPersonService.Invocations.Clear(); + _mockOrganizationService.Invocations.Clear(); + + var person = new Person() + { + PersonNumber = 0 + }; + + var organization = new Organization() + { + OrganizationNumber = 0 + }; + + _mockPersonService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ReturnsAsync(person).Verifiable(); + _mockOrganizationService.Setup(x => x.GetMemberByMemberAgreeNbr(It.IsAny())).ReturnsAsync(organization).Verifiable(); + + // Act + + // Assert + Assert.ThrowsAsync(async () => await _memberService.GetPersonOrOrganizationNumberByMemberId(0)); + _mockPersonService.Verify(x => x.GetMemberByMemberAgreeNbr(It.IsAny()), Times.Once); + _mockOrganizationService.Verify(x => x.GetMemberByMemberAgreeNbr(It.IsAny()), Times.Once); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/OrganizationServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/OrganizationServiceTest.cs new file mode 100644 index 0000000..bea822f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/OrganizationServiceTest.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations; +using LCU.Library.Internal.Exceptions; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class OrganizationServiceTest + { + private readonly IOrganizationService _organizationService; + private readonly Mock _mockOrganizationDao; + + public OrganizationServiceTest() + { + _mockOrganizationDao = new Mock(); + + _organizationService = new OrganizationService(_mockOrganizationDao.Object); + } + + [Test] + public async Task GetOrganizationByOrganizationNumber_Returns_Organization() + { + var testOrganizationResult = OrganizationFactory(); + var testOrganizationsResult = new List { testOrganizationResult }; + + _mockOrganizationDao.Setup(x => x.FindByOrganizationsSearch(It.IsAny(), + It.Is(request => request.OrgNbr == 1234))).ReturnsAsync(testOrganizationsResult).Verifiable(); + + var results = await _organizationService.GetOrganizationByOrganizationNumber(1234); + + Assert.NotNull(results); + var organizations = results.ToList(); + Assert.AreEqual(1, organizations.Count); + var result = organizations.FirstOrDefault(); + + Assert.AreEqual(testOrganizationResult.Name, result?.Name); + _mockOrganizationDao.Verify(); + } + + [Test] + public void GetOrganizationByOrganizationNumber_Exception_ThrowsServiceException() + { + + _mockOrganizationDao.Setup(x => x.FindByOrganizationsSearch(It.IsAny(), + It.Is(request => request.OrgNbr == 1234))).ThrowsAsync(new Exception("Exception thrown from unit test.")).Verifiable(); + + Assert.ThrowsAsync(() => _organizationService.GetOrganizationByOrganizationNumber(1234)); + _mockOrganizationDao.Verify(); + } + + [Test] + public async Task GetOrganizationByMemberAgreementNbr_Returns_Organization() + { + var testOrganizationResult = OrganizationFactory(); + + _mockOrganizationDao.Setup(x => x.FindOrganizationByMemberAgreeNbr(It.IsAny(), + It.Is(request => request.MemberNbr == 12345))).ReturnsAsync(testOrganizationResult).Verifiable(); + + var result = await _organizationService.GetMemberByMemberAgreeNbr(12345); + + Assert.NotNull(result); + Assert.AreEqual(testOrganizationResult.Name, result.Name); + _mockOrganizationDao.Verify(); + } + + [Test] + public void GetOrganizationByMemberAgreementNbr_Exception_ThrowsServiceException() + { + _mockOrganizationDao.Setup(x => x.FindOrganizationByMemberAgreeNbr(It.IsAny(), + It.Is(request => request.MemberNbr == 12345))).ThrowsAsync(new Exception("Exception thrown from unit test")).Verifiable(); + + Assert.ThrowsAsync(() => _organizationService.GetMemberByMemberAgreeNbr(12345)); + _mockOrganizationDao.Verify(); + } + + [Test] + public void GetOrganizationByName_SearchThrowsException_ThrowsServiceException() + { + var organizationName = Guid.NewGuid().ToString(); + var searchException = new Exception(Guid.NewGuid().ToString()); + _mockOrganizationDao + .Setup(o => o.FindByOrganizationsSearch + ( + It.IsAny(), + It.Is(r => r.OrgName == organizationName) + )) + .ThrowsAsync(searchException); + + var thrownException = Assert.ThrowsAsync(() => _organizationService.GetOrganizationByName(organizationName)); + + StringAssert.Contains(organizationName, thrownException.Message); + } + + [Test] + public async Task GetOrganizationByName_SearchSucceeds_ReturnsResults() + { + var organizationName = Guid.NewGuid().ToString(); + var actualOrganizations = new[] + { + OrganizationFactory() + }; + _mockOrganizationDao + .Setup(o => o.FindByOrganizationsSearch + ( + It.IsAny(), + It.Is(r => r.OrgName == organizationName) + )) + .ReturnsAsync(actualOrganizations); + + var organizations = await _organizationService.GetOrganizationByName(organizationName); + + Assert.AreSame(actualOrganizations, organizations); + } + + [Test] + public async Task GetOrganizationByNameLike_DaoReturnsOrgNumbersAndOrgsForNumbers_ReturnsOrganizations() + { + var organizationName = Guid.NewGuid().ToString(); + var partialName = organizationName[5..^5]; + var organizations = new [] + { + OrganizationFactory(organizationName), + OrganizationFactory(), + OrganizationFactory(organizationName) + }; + var nameMatchedOrganizations = organizations + .Where(o => o.Name == organizationName) + .ToArray(); + var limit = nameMatchedOrganizations.Length / 2; + _mockOrganizationDao + .Setup(dao => dao.FindOrganizationNumbersByNameSearch(It.IsAny(), It.IsAny())) + .Returns((name, count) => Task.FromResult(organizations.Where(o => o.Name.Contains(name)).Take(count).Select(o => o.OrganizationNumber))); + _mockOrganizationDao + .Setup(dao => dao.FindByOrganizationsSearch(It.IsAny(), It.IsAny())) + .Returns((_, search) => Task.FromResult(nameMatchedOrganizations.Where(o => search.OrgNbr == o.OrganizationNumber))); + + var foundOrganizations = await _organizationService.GetOrganizationByNameLike(partialName, limit); + + CollectionAssert.AreEquivalent(nameMatchedOrganizations.Take(limit), foundOrganizations); + } + + [Test] + public void GetOrganizationByNameLike_DaoThrowsFromFindOrganizationNumbersByNameSearch_ThrowsServiceException() + { + var organizationName = Guid.NewGuid().ToString(); + var limit = DateTime.Now.Millisecond; + _mockOrganizationDao + .Setup(dao => dao.FindOrganizationNumbersByNameSearch(organizationName, limit)) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(() => _organizationService.GetOrganizationByNameLike(organizationName, limit)); + } + + [Test] + public void GetOrganizationByNameLike_DaoThrowsFromFindByOrganizationsSearch_ThrowsServiceException() + { + var organizationName = Guid.NewGuid().ToString(); + var limit = DateTime.Now.Millisecond; + var organizations = new [] + { + OrganizationFactory(organizationName), + OrganizationFactory(), + OrganizationFactory(organizationName) + }; + _mockOrganizationDao + .Setup(dao => dao.FindOrganizationNumbersByNameSearch(It.IsAny(), It.IsAny())) + .Returns((name, count) => Task.FromResult(organizations.Where(o => o.Name.Contains(name)).Take(count).Select(o => o.OrganizationNumber))); + _mockOrganizationDao + .Setup(dao => dao.FindByOrganizationsSearch(It.IsAny(), It.IsAny())) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(() => _organizationService.GetOrganizationByNameLike(organizationName, limit)); + } + + [Test] + public async Task CountOrganizationNumbersByName_DaoReturnsCount_ReturnsCount() + { + var organizationName = Guid.NewGuid().ToString(); + var partialName = organizationName[5..^5]; + var organizations = new [] + { + OrganizationFactory(organizationName), + OrganizationFactory(), + OrganizationFactory(organizationName) + }; + var nameMatchedOrganizations = organizations + .Where(o => o.Name == organizationName) + .ToArray(); + _mockOrganizationDao + .Setup(dao => dao.CountOrganizationNumbersByName(It.IsAny())) + .Returns(name => Task.FromResult(organizations.Count(o => o.Name.Contains(name)))); + + var count = await _organizationService.CountOrganizationNumbersByName(partialName); + + Assert.AreEqual(count, nameMatchedOrganizations.Length); + } + + [Test] + public void CountOrganizationNumbersByName_DaoThrowsFromCountOrganizationNumbersByName_ThrowsServiceException() + { + var organizationName = Guid.NewGuid().ToString(); + _mockOrganizationDao + .Setup(dao => dao.CountOrganizationNumbersByName(organizationName)) + .ThrowsAsync(new Exception()); + + Assert.ThrowsAsync(() => _organizationService.CountOrganizationNumbersByName(organizationName)); + } + + private static Random _organizationNumberSeries = new Random(DateTime.Now.Millisecond); + + private static Organization OrganizationFactory(string name = null, long? number = null) + { + return new Organization + { + Name = name ?? "Test Organization", + OrganizationNumber = number ?? _organizationNumberSeries.Next() + }; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonServiceTest.cs new file mode 100644 index 0000000..810a959 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonServiceTest.cs @@ -0,0 +1,269 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.Exceptions; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class PersonServiceTest + { + private readonly PersonService _personService; + private readonly Mock _mockPersonDao; + + public PersonServiceTest() + { + _mockPersonDao = new Mock(); + _personService = new PersonService(_mockPersonDao.Object); + } + + [Test] + public async Task GetPersonsByName_Returns_Person() + { + var coreRequestParameters = new CoreRequestParameters(); + var personNameRequest = new PersonNameRequest + { + FirstName = "Tester" + }; + + var testPersonResult = new Person + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021" + }; + var testPersonsResult = new List { testPersonResult }; + + _mockPersonDao.Setup(x => x.FindByPersonsName(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonsResult); + + var results = await _personService.GetPersonsByName(coreRequestParameters, personNameRequest); + + Assert.NotNull(results); + Assert.AreEqual(1, results.ToList().Count); + var result = results.FirstOrDefault(); + + Assert.AreEqual(1, result.PersonNumber); + Assert.AreEqual("Tester", result.FirstName); + Assert.AreEqual("Person", result.MiddleName); + Assert.AreEqual("Guy", result.LastName); + Assert.AreEqual("1231232132", result.TaxId); + Assert.AreEqual("1/1/2021", result.BirthDate); + } + + [Test] + public void GetPersonsByName_Exception_Returns_Null() + { + var coreRequestParameters = new CoreRequestParameters(); + var personNameRequest = new PersonNameRequest + { + FirstName = "Tester" + }; + + _mockPersonDao.Setup(x => x.FindByPersonsName(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _personService.GetPersonsByName(coreRequestParameters, personNameRequest)); + } + + [Test] + public async Task GetPersonsBySearch_Returns_Person() + { + var coreRequestParameters = new CoreRequestParameters(); + var personSearchRequest = new PersonSearchRequest + { + PersNbr = 1 + }; + + var testPersonResult = new Person + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021" + }; + var testPersonsResult = new List { testPersonResult }; + + _mockPersonDao.Setup(x => x.FindByPersonsSearch(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonsResult); + + var results = await _personService.GetPersonsBySearch(coreRequestParameters, personSearchRequest); + + Assert.NotNull(results); + Assert.AreEqual(1, results.ToList().Count); + var result = results.FirstOrDefault(); + + Assert.AreEqual(1, result.PersonNumber); + Assert.AreEqual("Tester", result.FirstName); + Assert.AreEqual("Person", result.MiddleName); + Assert.AreEqual("Guy", result.LastName); + Assert.AreEqual("1231232132", result.TaxId); + Assert.AreEqual("1/1/2021", result.BirthDate); + } + + [Test] + public void GetPersonsBySearch_Exception_Returns_Null() + { + var coreRequestParameters = new CoreRequestParameters(); + var personSearchRequest = new PersonSearchRequest + { + FirstName = "Tester" + }; + + _mockPersonDao.Setup(x => x.FindByPersonsSearch(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _personService.GetPersonsBySearch(coreRequestParameters, personSearchRequest)); + } + + + [Test] + public async Task GetPersonsByMemberAgreementNbr_Returns_Person() + { + var coreRequestParameters = new CoreRequestParameters(); + var personMemberAgreementNbrRequest = new MemberNbrRequest + { + MemberNbr = 100 + }; + + var testPersonResult = new Person + { + PersonNumber = 1, + FirstName = "Tester", + MiddleName = "Person", + LastName = "Guy", + NameFull = "Tester Person Guy", + Suffix = "", + TaxId = "1231232132", + BirthDate = "1/1/2021" + }; + + _mockPersonDao.Setup(x => x.FindByPersonMemberAgreementNbr(It.IsAny(), + It.IsAny())).ReturnsAsync(testPersonResult); + + var result = await _personService.GetPersonsByMemberAgreementNbr(coreRequestParameters, personMemberAgreementNbrRequest); + + Assert.NotNull(result); + + Assert.AreEqual(1, result.PersonNumber); + Assert.AreEqual("Tester", result.FirstName); + Assert.AreEqual("Person", result.MiddleName); + Assert.AreEqual("Guy", result.LastName); + Assert.AreEqual("1231232132", result.TaxId); + Assert.AreEqual("1/1/2021", result.BirthDate); + } + + [Test] + public void GetPersonsByMemberAgreementNbr_Exception_Returns_Null() + { + var coreRequestParameters = new CoreRequestParameters(); + var personMemberAgreementNbrRequest = new MemberNbrRequest + { + MemberNbr = 100 + }; + + _mockPersonDao.Setup(x => x.FindByPersonMemberAgreementNbr(It.IsAny(), + It.IsAny())).Throws(new Exception()); + + Assert.ThrowsAsync(() => _personService.GetPersonsByMemberAgreementNbr(coreRequestParameters, personMemberAgreementNbrRequest)); + } + + [Test] + public async Task GetPersonByMemberAgreementNbr_Returns_Person() + { + var testPersonResult = PersonFactory(); + + _mockPersonDao.Setup(x => x.FindByPersonMemberAgreementNbr(It.IsAny(), + It.Is(request => request.MemberNbr == 12345))).ReturnsAsync(testPersonResult).Verifiable(); + + var result = await _personService.GetMemberByMemberAgreeNbr(12345); + + Assert.NotNull(result); + Assert.AreEqual(testPersonResult.FirstName, result.FirstName); + _mockPersonDao.Verify(); + } + + [Test] + public async Task GetPersonsByNameLike_LimitSupplied_GetsUpToLimitPersons() + { + var request = PersonNameRequestFactory(); + var limit = DateTime.Now.Millisecond; + var people = Enumerable.Repeat>(PersonFactory, limit).Select(f => f()).ToArray(); + _mockPersonDao + .Setup(d => d.GetPersonNumbersByNameLike(request.FirstName, request.MdlName, request.LastName, limit)) + .ReturnsAsync(people.Select(p => (long)p.PersonNumber)); + _mockPersonDao + .Setup(d => d.FindByPersonsSearch(It.IsAny(), It.IsAny())) + .Returns((_, search) => Task.FromResult(people.Where(p => search.PersNbr == p.PersonNumber))); + + var actualPeople = await _personService.GetPersonsByNameLike(request, limit); + + CollectionAssert.AreEquivalent(people, actualPeople); + } + + [Test] + public async Task GetPersonsByNameLike_LimitNotSupplied_GetsUpTo1000Persons() + { + var request = PersonNameRequestFactory(); + var people = Enumerable.Repeat>(PersonFactory, 1000).Select(f => f()).ToArray(); + _mockPersonDao + .Setup(d => d.GetPersonNumbersByNameLike(request.FirstName, request.MdlName, request.LastName, 1000)) + .ReturnsAsync(people.Select(p => (long)p.PersonNumber)); + _mockPersonDao + .Setup(d => d.FindByPersonsSearch(It.IsAny(), It.IsAny())) + .Returns((_, search) => Task.FromResult(people.Where(p => search.PersNbr == p.PersonNumber))); + + var actualPeople = await _personService.GetPersonsByNameLike(request, null); + + CollectionAssert.AreEquivalent(people, actualPeople); + } + + [Test] + public async Task CountPersonsByNameLike_AllCases_ReturnsPersonDaoCount() + { + var request = PersonNameRequestFactory(); + var count = DateTime.Now.Millisecond; + _mockPersonDao + .Setup(d => d.CountPersonsByNameLike(request.FirstName, request.MdlName, request.LastName)) + .ReturnsAsync(count); + + var actualCount = await _personService.CountPersonsByNameLike(request); + + Assert.AreEqual(count, actualCount); + } + + private static PersonNameRequest PersonNameRequestFactory() + => new() + { + FirstName = Guid.NewGuid().ToString(), + MdlName = Guid.NewGuid().ToString(), + LastName = Guid.NewGuid().ToString() + }; + + private static Random _personNumberSeries = new(DateTime.Now.Millisecond); + private static Person PersonFactory() + { + return new Person + { + FirstName = "Test Organization", + PersonNumber = _personNumberSeries.Next() + }; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonUserFieldServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonUserFieldServiceTest.cs new file mode 100644 index 0000000..54a3ca7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PersonUserFieldServiceTest.cs @@ -0,0 +1,402 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.Exceptions; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class PersonUserFieldServiceTest + { + private readonly PersonUserFieldService _personUserFieldService; + private readonly Mock _mockPersonService; + private readonly Mock _mockPersonUserFieldDao; + + public PersonUserFieldServiceTest() + { + _mockPersonService = new Mock(); + _mockPersonUserFieldDao = new Mock(); + _personUserFieldService = new PersonUserFieldService(_mockPersonService.Object, _mockPersonUserFieldDao.Object); + } + + [Test] + public void GetPersonUserFieldCoreApiResponseAsync_ExceptionThrown() + { + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(), It.IsAny())).Throws(new ServiceException("Nope")); + + Assert.ThrowsAsync(async () => + await _personUserFieldService.GetPersonUserFieldCoreApiResponseAsync(00000000)); + } + + [Test] + public async Task GetPersonUserFieldCoreApiResponseAsync_UserFieldsReturned() + { + var personUserFields = new List() + { + new PersonUserField() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }, + new PersonUserField() + { + PersonNumber = 200001, + UserFieldCode = "TEST2", + Value = "N" + } + }; + var coreMessageheader = new CoreMessageHeader(); + var personUserFieldCoreApiResponse = new CoreApiMessage>(coreMessageheader, personUserFields); + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(), It.IsAny())).ReturnsAsync(personUserFieldCoreApiResponse); + + + var result = await _personUserFieldService.GetPersonUserFieldCoreApiResponseAsync(100001); + Assert.NotNull(result); + Assert.AreEqual(2, result.MessageBody.Count()); + } + + [Test] + public void UpdatePersonUserFieldAsync_ExceptionThrown() + { + _mockPersonUserFieldDao.Setup(x => x.UpdatePersonUserField(It.IsAny>(), It.IsAny(), It.IsAny())).Throws(new ServiceException("Nope")); + + var personUserUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _personUserFieldService.UpdatePersonUserFieldAsync(personUserUpdateRequest)); + } + + [Test] + public async Task UpdatePersonUserFieldAsync_UpdatedUserFieldsReturned() + { + var testPerson = new Person() + { + PersonNumber = 100001 + }; + + var updatedPersonUserField = new PersonUserField() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + + var listexistingPersonUserField = new List() + { + new PersonUserField() + { + PersonNumber = 100001, + Id = updatedPersonUserField.Id, + UserFieldCode = "TEST1", + Value = "N", + LastMaintained = Convert.ToDateTime("8/1/2001") + } + }; + var coreMessageheader = new CoreMessageHeader(); + var coreApiResponse = new CoreApiMessage>(coreMessageheader, listexistingPersonUserField); + + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(),It.IsAny())).ReturnsAsync(coreApiResponse); + + _mockPersonUserFieldDao.Setup(x => x.UpdatePersonUserField(It.IsAny>(), + It.IsAny(), + It.IsAny())).ReturnsAsync(updatedPersonUserField); + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(new List() { testPerson }); + + var personUserUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _personUserFieldService.UpdatePersonUserFieldAsync(personUserUpdateRequest); + Assert.NotNull(result); + Assert.AreEqual(updatedPersonUserField, result); + } + + [Test] + public void InsertPersonUserFieldAsync_ExceptionThrown() + { + _mockPersonUserFieldDao.Setup(x => x.InsertPersonUserField(It.IsAny>(), It.IsAny())).Throws(new ServiceException("Oops")); + + var personUserUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _personUserFieldService.InsertPersonUserFieldAsync(personUserUpdateRequest)); + } + + [Test] + public async Task InsertPersonUserFieldAsync_InsertUserFieldsReturned() + { + var person = new Person() + { + Id = "TEST-adsfasdfas[]djfas" + }; + + var personList = new List { person }; + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + var createdPersonUserField = new PersonUserField() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + _mockPersonUserFieldDao.Setup(x => x.InsertPersonUserField(It.IsAny>(), + It.IsAny())).ReturnsAsync(createdPersonUserField); + + var personUserUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _personUserFieldService.InsertPersonUserFieldAsync(personUserUpdateRequest); + Assert.NotNull(result); + Assert.AreEqual(createdPersonUserField, result); + } + + [Test] + public void UpdatePersonUserFieldsAsync_NullPerson_ExceptionThrown() + { + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }; + + var personList = new List(); + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + Assert.ThrowsAsync(async () => + await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest)); + } + + [Test] + public void UpdatePersonUserFieldsAsync_ExistingUserFieldNull_NullExceptionThrown() + { + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }; + + var person = new Person() + { + Id = "TEST-adsfasdfas[]djfas" + }; + + var personList = new List { person }; + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + IEnumerable PersonUserFields = new List(); + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(); + CoreApiMessage> coreApiMessagePersonUserFields = new CoreApiMessage>(coreMessageHeader, PersonUserFields); + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessagePersonUserFields); + + Assert.ThrowsAsync(async () => + await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest)); + } + + [Test] + public void UpdatePersonUserFieldsAsync_UpdateUserFieldNull_NullExceptionThrown() + { + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }; + + var personList = new List(); + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + IEnumerable PersonUserFields = new List() + { + new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }, + new PersonUserField() + { + Id = "TEST2", + PersonNumber = 100002, + UserFieldCode = "TEST2", + Value = "Y" + } + }; + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(1122000321); + CoreApiMessage> coreApiMessagePersonUserFields = new CoreApiMessage>(coreMessageHeader, PersonUserFields); + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessagePersonUserFields); + + PersonUserField updatedPersonUserField = null; + _mockPersonUserFieldDao.Setup(x => x.UpdatePersonUserField(It.IsAny>(), + It.IsAny(), + It.IsAny())).ReturnsAsync(updatedPersonUserField); + + Assert.ThrowsAsync(async () => + await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest)); + } + + [Test] + public async Task UpdatePersonUserFieldsAsync_UpdatedUserField() + { + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + + }; + + var person = new Person() + { + Id = "TEST-adsfasdfas[]djfas" + }; + + var personList = new List { person }; + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + + var personUserField1 = new PersonUserField() + { + Id = "TEST1", + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "N" + }; + var personUserField2 = new PersonUserField() + { + Id = "TEST2", + PersonNumber = 100002, + UserFieldCode = "TEST2", + Value = "Y" + }; + + IEnumerable personUserFields = new List() + { + personUserField1, + personUserField2 + }; + CoreMessageHeader coreMessageHeader = new CoreMessageHeader(1122000321); + CoreApiMessage> coreApiMessagePersonUserFields = new CoreApiMessage>(coreMessageHeader, personUserFields); + _mockPersonUserFieldDao.Setup(x => x.FindPersonUserFieldCoreApiResponseByPersonId(It.IsAny(), + It.IsAny())).ReturnsAsync(coreApiMessagePersonUserFields); + + PersonUserField updatedPersonUserField1 = new PersonUserField() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + _mockPersonUserFieldDao.Setup(x => x.UpdatePersonUserField(It.IsAny>(), + It.IsAny(), + personUserField1.Id)).ReturnsAsync(updatedPersonUserField1); + + PersonUserField updatedPersonUserField2 = new PersonUserField() + { + PersonNumber = 100002, + UserFieldCode = "TEST2", + Value = "N" + }; + _mockPersonUserFieldDao.Setup(x => x.UpdatePersonUserField(It.IsAny>(), + It.IsAny(), + personUserField2.Id)).ReturnsAsync(updatedPersonUserField2); + + var result = await _personUserFieldService.UpdatePersonUserFieldAsync(personUserFieldUpdateRequest); + + Assert.NotNull(result); + Assert.AreEqual("Y", result.Value); + Assert.AreEqual(100001, result.PersonNumber); + } + + [Test] + public void InsertPersonUserFieldsAsync_NullPerson_ExceptionThrown() + { + var personUserFieldUpdateRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + + var personList = new List(); + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + Assert.ThrowsAsync(async () => + await _personUserFieldService.InsertPersonUserFieldAsync(personUserFieldUpdateRequest)); + } + + [Test] + public async Task InsertPersonUserFieldsAsync_InsertedUserField() + { + + var person = new Person() + { + Id = "TEST-adsfasdfas[]djfas" + }; + + var personList = new List { person }; + + _mockPersonService.Setup(x => x.GetPersonByPersonNumber(It.IsAny())).ReturnsAsync(personList); + + var messageHeader = new CoreMessageHeader() { }; + var personUserFieldRequest = new PersonUserFieldRequest() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + var coreApiMessage = new CoreApiMessage(messageHeader, personUserFieldRequest); + var createdPersonUserField1 = new PersonUserField() + { + PersonNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + _mockPersonUserFieldDao.Setup(x => x.InsertPersonUserField(It.IsAny>(), + personUserFieldRequest.PersonNumber)).ReturnsAsync(createdPersonUserField1); + + + var result = await _personUserFieldService.InsertPersonUserFieldAsync(personUserFieldRequest); + + Assert.NotNull(result); + Assert.AreEqual("Y", result.Value); + Assert.AreEqual(100001, result.PersonNumber); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PropertyUserFieldServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PropertyUserFieldServiceTest.cs new file mode 100644 index 0000000..dce7c1b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/PropertyUserFieldServiceTest.cs @@ -0,0 +1,157 @@ +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +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 LCU.Library.Internal.Exceptions; +using Moq; +using NUnit.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class PropertyUserFieldServiceTest + { + private readonly PropertyUserFieldService _propertyUserFieldService; + private readonly Mock _mockPropertyService; + private readonly Mock _mockPropertyUserFieldDao; + + public PropertyUserFieldServiceTest() + { + _mockPropertyService = new Mock(); + _mockPropertyUserFieldDao = new Mock(); + _propertyUserFieldService = new PropertyUserFieldService(_mockPropertyService.Object, _mockPropertyUserFieldDao.Object); + } + + [Test] + public void GetPropertyUserFieldCoreApiResponseAsync_ExceptionThrown() + { + _mockPropertyUserFieldDao.Setup(x => x.FindPropertyUserFieldCoreApiResponseByPersonId(It.IsAny(), It.IsAny())).Throws(new ServiceException("Nope")); + + Assert.ThrowsAsync(async () => + await _propertyUserFieldService.GetPropertyUserFieldsAsync(0)); + } + + [Test] + public void UpdatePropertyUserFieldAsync_ExceptionThrown() + { + _mockPropertyUserFieldDao.Setup(x => x.UpdatePropertyUserField(It.IsAny())).Throws(new ServiceException("Unit Test Failed")); + + var propertyUserUpdateRequest = new PropertyUserField() + { + PropertyNumber = 100001, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _propertyUserFieldService.UpdatePropertyUserFieldAsync(propertyUserUpdateRequest)); + } + + [Test] + public async Task UpdatePropertyUserFieldAsync_Ok() + { + var testProperty = new Property() + { + PropertyNumber = 1000 + }; + + var updatedPropertyUserField = new PropertyUserField() + { + PropertyNumber = 1000L, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + + var listExistingPropertyUserField = new List() + { + new PropertyUserField() + { + PropertyNumber = 1000L, + Id = updatedPropertyUserField.Id, + UserFieldCode = "TEST1", + Value = "N", + LastMaintained = Convert.ToDateTime("8/1/2001") + } + }; + var coreMessageheader = new CoreMessageHeader(); + var coreApiResponse = new CoreApiMessage>(coreMessageheader, listExistingPropertyUserField); + + BasicResponse response = new BasicResponse() + { + Success = true + }; + + _mockPropertyUserFieldDao.Setup(x => x.FindPropertyUserFieldCoreApiResponseByPersonId(It.IsAny(), It.IsAny())).ReturnsAsync(coreApiResponse); + + _mockPropertyUserFieldDao.Setup(x => x.UpdatePropertyUserField(It.IsAny())).ReturnsAsync(response); + + _mockPropertyService.Setup(x => x.GetProperty(It.IsAny())).ReturnsAsync(testProperty); + + var propertyUserUpdateRequest = new PropertyUserField() + { + PropertyNumber = 1000L, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _propertyUserFieldService.UpdatePropertyUserFieldAsync(propertyUserUpdateRequest); + Assert.NotNull(result); + Assert.AreEqual(response.Success, result.Success); + } + + [Test] + public void InsertPersonUserFieldAsync_ExceptionThrown() + { + _mockPropertyUserFieldDao.Setup(x => x.InsertPropertyUserField(It.IsAny())).Throws(new ServiceException("Oops")); + + var propertyUserUpdateRequest = new PropertyUserField() + { + PropertyNumber = 1000, + UserFieldCode = "TEST1", + Value = "Y" + }; + Assert.ThrowsAsync(async () => + await _propertyUserFieldService.InsertPropertyUserFieldAsync(propertyUserUpdateRequest)); + } + + [Test] + public async Task InsertPropertyUserFieldAsync_InsertUserFieldsReturned() + { + var property = new Property() + { + PropertyNumber = 1000 + }; + + _mockPropertyService.Setup(x => x.GetProperty(1000)).ReturnsAsync(property); + + var createdPropertyUserField = new PropertyUserField() + { + PropertyNumber = 1000L, + UserFieldCode = "TEST1", + Value = "Y", + LastMaintained = Convert.ToDateTime("9/1/2001") + }; + BasicResponse response = new BasicResponse() + { + Success = true, + }; + _mockPropertyUserFieldDao.Setup(x => x.InsertPropertyUserField(It.IsAny())).ReturnsAsync(response); + + var personUserUpdateRequest = new PropertyUserField() + { + PropertyNumber = 1000, + UserFieldCode = "TEST1", + Value = "Y" + }; + var result = await _propertyUserFieldService.InsertPropertyUserFieldAsync(personUserUpdateRequest); + Assert.NotNull(result); + Assert.AreEqual(response.Success, result.Success); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TaxServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TaxServiceTest.cs new file mode 100644 index 0000000..9b7b83d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TaxServiceTest.cs @@ -0,0 +1,76 @@ +using System.Linq; +using System.Collections.Generic; +using System.Threading.Tasks; +using NUnit.Framework; +using Moq; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class TaxServiceTest + { + private readonly TaxService _taxService; + private readonly Mock _mockTaxDao; + + public TaxServiceTest() + { + _mockTaxDao = new Mock(); + _taxService = new TaxService(_mockTaxDao.Object); + } + + [Test] + public async Task GetPersonsTaxIdData_Returns_PersonTaxIdData() + { + var personTaxIdDataResponse = new List + { + new() { + FirstName = "Greg", + MiddleInitial = "H", + LastName = "Stevens", + Suffix = "Jr.", + NameFull = "Greg H. Stevens Jr.", + PersonNumber = 123 + } + }; + + _mockTaxDao.Setup(x => x.GetPersonTaxIdData(It.IsAny(), It.Is(x => x == "123"))).ReturnsAsync(personTaxIdDataResponse).Verifiable(); + var result = await _taxService.GetPersonsTaxIdData("123"); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + var firstResponse = result.First(); + Assert.AreEqual("Greg",firstResponse.FirstName); + Assert.AreEqual("H", firstResponse.MiddleInitial); + Assert.AreEqual("Stevens", firstResponse.LastName); + Assert.AreEqual("Jr.", firstResponse.Suffix); + Assert.AreEqual("Greg H. Stevens Jr.", firstResponse.NameFull); + Assert.AreEqual(123, firstResponse.PersonNumber); + _mockTaxDao.Verify(); + } + + [Test] + public async Task GetOrganizationsTaxIdData_Returns_OrganizationTaxIdData() + { + var organizationsTaxIdDataResponse = new List + { + new() { + Name = "Electric Company", + OrganizationNumber = 123 + } + }; + + _mockTaxDao.Setup(x => x.GetOrganizationTaxIdData(It.IsAny(), It.Is(x => x == "123"))).ReturnsAsync(organizationsTaxIdDataResponse).Verifiable(); + var result = await _taxService.GetOrganizationsTaxIdData("123"); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count()); + var firstResponse = result.First(); + Assert.AreEqual("Electric Company",firstResponse.Name); + Assert.AreEqual(123, firstResponse.OrganizationNumber); + _mockTaxDao.Verify(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TransactionServiceTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TransactionServiceTest.cs new file mode 100644 index 0000000..a69ed4d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Service/TransactionServiceTest.cs @@ -0,0 +1,202 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Castle.Core.Internal; +using Moq; +using NUnit.Framework; +using LCU.Api.Internal.CoreApiWrapper.Services; +using LCU.Library.Internal.CoreApiWrapperLib.DataAccess; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Service +{ + public class TransactionServiceTest + { + private TransactionService _transactionService; + private Mock _mockTransactionDao; + private Mock _mockAccountService; + + [SetUp] + public void SetUp() + { + _mockTransactionDao = new Mock(); + _mockAccountService = new Mock(); + _transactionService = new TransactionService(_mockTransactionDao.Object, _mockAccountService.Object); + } + + [Test] + public async Task GetTransactionHistory_Return_Two() + { + var setupAccountNumber = 8675309143; + + var accountResponse = new Account() + { + Id="fasdfsda;fjsdipfu0-231231" + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(accountResponse).Verifiable(); + + _mockTransactionDao + .Setup(x => x.FindTransactionHistoryById(It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync( + new List() + { + new TransactionHistory() + { + AccountNumber = setupAccountNumber, + ActivityDateTime = Convert.ToDateTime("1/1/2021"), + AllowCustomerView = true, + Amount = 220, + BalanceAccountNumber = 2, + BalanceTypeDescription = "Note Interest (Excess)", + CurrTransactionStatusCode = "C", + DueDate = null, + EffectiveDate = "2021-10-14", + ExternalTransactionDescription = null, + Id = "22", + IsDisputedTransaction = false, + OnlineCheckTraceNumber = 0, + PostingDate = "2021-10-15", + RunningBalance = (decimal?)3529.53, + TimeUniqueNumber = 86570239, + TransactionNumber = 22, + TransactionReference = $"{setupAccountNumber} - 22", + TransactionStatusDescription = "Completed", + TransactionTypeCode = "SPMT", + TransactionTypeDescription = "Regular Payment LandmarkCU TRANSFER 12345", + Uid = "abcd77299_sABCDMD]MYo5crdZyPN3s2QAHx[CHxgigabcdeYuALuVGL9Jklm_22" + }, + new TransactionHistory() + { + AccountNumber = setupAccountNumber, + ActivityDateTime = Convert.ToDateTime("1/2/2021"), + AllowCustomerView = true, + Amount = 30, + BalanceAccountNumber = 2, + BalanceTypeDescription = "Note Interest (Excess)", + CurrTransactionStatusCode = "C", + DueDate = null, + EffectiveDate = "2021-10-14", + ExternalTransactionDescription = null, + Id = "23", + IsDisputedTransaction = false, + OnlineCheckTraceNumber = 0, + PostingDate = "2021-10-15", + RunningBalance = (decimal?)3559.53, + TimeUniqueNumber = 86570239, + TransactionNumber = 23, + TransactionReference = $"{setupAccountNumber} - 23", + TransactionStatusDescription = "Completed", + TransactionTypeCode = "SPMT", + TransactionTypeDescription = "Regular Payment LandmarkCU TRANSFER 12346", + Uid = "abcd77299_sABCDMD]MYo5crdZyPN3s2QAHx[CHxgigabcdeYuALuVGL9Jklm_23" + } + }) + .Verifiable(); + + var results = await _transactionService.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021"), null); + + var resultsList = results.ToList(); + Assert.NotNull(results); + Assert.AreEqual(2, resultsList.Count); + Assert.True(resultsList.Any(x => x.AccountNumber == setupAccountNumber)); + + _mockAccountService.Verify(); + _mockTransactionDao.Verify(); + } + + [Test] + public async Task GetTransactionHistory_NullTransactions_EmptyList() + { + var setupAccountNumber = 8675309143; + + var accountResponse = new Account() + { + Id="fasdfsda;fjsdipfu0-231231" + }; + + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(accountResponse).Verifiable(); + + _mockTransactionDao + .Setup(x => x.FindTransactionHistoryById(It.IsAny(), It.IsAny(), It.IsAny())) + .ReturnsAsync((IEnumerable)null) + .Verifiable(); + + var results = await _transactionService.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021"), null); + Assert.NotNull(results); + var resultsList = results.ToList(); + Assert.IsEmpty(resultsList); + + _mockAccountService.Verify(); + _mockTransactionDao.Verify(); + } + + [Test] + public async Task GetTransactionHistory_NoAccount_ReturnNull() + { + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync((Account)null).Verifiable(); + + var results = await _transactionService.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021"), null); + + Assert.Null(results); + + _mockAccountService.Verify(); + _mockTransactionDao.Verify( x => x.FindTransactionHistoryById(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + } + + [Test] + public void GetTransactionHistory_TransactionDao_Exception() + { + var accountResponse = new Account() + { + Id = "fasdfsda;fjsdipfu0-231231" + }; + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).ReturnsAsync(accountResponse).Verifiable(); + _mockTransactionDao.Setup(x => x.FindTransactionHistoryById(It.IsAny(), It.IsAny(), It.IsAny())) + .Throws(new Exception("Ohh nooo")); + + Assert.ThrowsAsync(async () => + await _transactionService.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021"), null)); + _mockAccountService.Verify(); + } + + [Test] + public void GetTransactionHistory_AccountService_Exception() + { + _mockAccountService.Setup(x => x.GetAccountDetails(It.IsAny(), + It.IsAny())).Throws(new Exception("Ohh nooo")); + + Assert.ThrowsAsync(async () => + await _transactionService.GetTransactionHistory(1234555, Convert.ToDateTime("12/25/2020"), Convert.ToDateTime("2/2/2021"), null)); + _mockAccountService.Verify(); + } + + [Test] + public async Task GetTransactionsByDateSpan_OK() + { + _mockTransactionDao.Setup(x => x.GetTransactionsByDateSpan(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ReturnsAsync(new List() { new TransactionAlertInfo() }); + + var results = await _transactionService.GetTransactionsByDateSpan(DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow, new string[1]); + + Assert.NotNull(results); + var resultsList = results.ToList(); + Assert.AreEqual(1, resultsList.Count); + } + + [Test] + public async Task GetTransactionsByDateSpan_Exception() + { + _mockTransactionDao.Setup(x => x.GetTransactionsByDateSpan(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).ThrowsAsync(new Exception("Exception!")); + + Assert.ThrowsAsync(async () => + await _transactionService.GetTransactionsByDateSpan(DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow, new string[1])); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/HttpUtilitiesTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/HttpUtilitiesTest.cs new file mode 100644 index 0000000..bb42378 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/HttpUtilitiesTest.cs @@ -0,0 +1,194 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json; +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Utilities +{ + public class HttpUtilitiesTest + { + [Test] + public void BuildJsonBody_Returns_FullUri() + { + var testHost = "test.com"; + var testEndpoint = "test/endpoint"; + + var result = HttpUtilities.BuildHttpsUri(testHost, testEndpoint); + + var testCompare = new Uri($"https://{testHost}{testEndpoint}"); + + Assert.NotNull(result); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void BuildJsonBody_Returns_UriWithouEndpoint() + { + var testHost = "test.com"; + var testEndpoint = ""; + + var result = HttpUtilities.BuildHttpsUri(testHost, testEndpoint); + + var testCompare = new Uri($"https://{testHost}"); + + Assert.NotNull(result); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void BuildEndPointWithParams_Returns_EndpointWith_TwoParams() + { + var testEndpoint = "test/endpoint"; + var paramDictionary = new Dictionary(); + paramDictionary.Add("testparam1", "test1"); + paramDictionary.Add("testparam2", "test2"); + + var result = HttpUtilities.BuildEndPointWithParams(testEndpoint, paramDictionary); + + var testCompare = $"{testEndpoint}?testparam1=test1&testparam2=test2"; + + Assert.NotNull(result); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void BuildEndPointWithParams_Returns_EndpointWith_NoParams() + { + var testEndpoint = "test/endpoint"; + var paramDictionary = new Dictionary(); + + var result = HttpUtilities.BuildEndPointWithParams(testEndpoint, paramDictionary); + + var testCompare = $"{testEndpoint}"; + + Assert.NotNull(result); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void ReplaceRootParameter_Returns_RootParamReplaced() + { + var testEndpoint = "test/{Test}/endpoint"; + var testPlaceholder = "{Test}"; + var testValue = "dasdwerwqer-1321dsaffew423"; + + var result = HttpUtilities.ReplaceRootParameter(testEndpoint, testPlaceholder, testValue); + + Assert.NotNull(result); + Assert.AreEqual("test/dasdwerwqer-1321dsaffew423/endpoint", result); + } + + [Test] + public void ReplaceRootParameter_RootParamPlaceHolder_DoesNotExist_Return_EndPoint() + { + var testEndpoint = "test/endpoint"; + var testPlaceholder = "{Test}"; + var testValue = "dasdwerwqer-1321dsaffew423"; + + var result = HttpUtilities.ReplaceRootParameter(testEndpoint, testPlaceholder, testValue); + + Assert.NotNull(result); + Assert.AreEqual("test/endpoint", result); + } + + [Test] + public void BuildDictionaryOfValues_Returns_OneProperty_InDictionary() + { + var personRequest = new PersonNameRequest() + { + FirstName = "Test" + }; + + var testCompare = new Dictionary(); + testCompare.Add("FirstName", "Test"); + + var result = HttpUtilities.BuildDictionaryOfNonNullValues(personRequest); + + Assert.NotNull(result); + Assert.AreEqual(1, result.Count); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void BuildDictionaryOfValues_Returns_TwoProperty_InDictionary() + { + var personRequest = new PersonNameRequest() + { + FirstName = "Test", + LastName = "Test Last" + }; + + var testCompare = new Dictionary(); + testCompare.Add("FirstName", "Test"); + testCompare.Add("LastName", "Test Last"); + + var result = HttpUtilities.BuildDictionaryOfNonNullValues(personRequest); + + Assert.NotNull(result); + Assert.AreEqual(2, result.Count); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void BuildDictionaryOfValues_Returns_EmptyDictionary() + { + var personRequest = new PersonNameRequest(); + + var result = HttpUtilities.BuildDictionaryOfNonNullValues(personRequest); + + Assert.NotNull(result); + Assert.Zero(result.Count); + } + + [Test] + public void BuildJsonBody_Returns_OneProperty_JsonWithout_NullFields() + { + var personRequest = new PersonNameRequest() + { + FirstName = "Test" + }; + + var testCompare = new Dictionary(); + testCompare.Add("FirstName", "Test"); + var jsonTestCompare = JsonConvert.SerializeObject(testCompare); + + var result = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + + Assert.NotNull(result); + Assert.AreEqual(jsonTestCompare, result); + } + + [Test] + public void BuildJsonBody_Returns_OneProperty_JJsonWithout_NullFields() + { + var personRequest = new PersonNameRequest() + { + FirstName = "Test", + LastName = "Test Last" + }; + + var testCompare = new Dictionary(); + testCompare.Add("FirstName", "Test"); + testCompare.Add("LastName", "Test Last"); + var jsonTestCompare = JsonConvert.SerializeObject(testCompare); + + var result = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + + Assert.NotNull(result); + Assert.AreEqual(jsonTestCompare, result); + } + + [Test] + public void BuildJsonBody_Returns_EmptyString() + { + var personRequest = new PersonNameRequest(); + + var result = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + + Assert.NotNull(result); + Assert.AreEqual("", result); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/QueryUtilitiesTest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/QueryUtilitiesTest.cs new file mode 100644 index 0000000..0ddffe4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Api.Internal.CoreApiWrapperTest/Utilities/QueryUtilitiesTest.cs @@ -0,0 +1,65 @@ +using NUnit.Framework; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using System.Collections.Generic; + +namespace LCU.Api.Internal.CoreApiWrapperTest.Utilities +{ + public class QueryUtilitiesTest + { + public void GetQuery_Returns_QueryReturned() + { + var testEndpoint = "TEST_Query"; + + var result = QueryUtilities.GetQuery(testEndpoint); + + var testCompare = "select TEST\r\nfrom TEST\r\nwhere TEST like TEST"; + + Assert.NotNull(result); + Assert.AreEqual(testCompare, result); + } + + [Test] + public void GetQuery_Returns_EmptyReturned() + { + var testEndpoint = "TEST_Query_NOPE"; + + var result = QueryUtilities.GetQuery(testEndpoint); + + Assert.IsEmpty(result); + } + + [Test] + public void BuildParameterListString_Returns_StringOfParameterCommaDelimited() + { + var testValues = new List() + { + "Test1", + "Test2", + "Test3" + }; + + var result = QueryUtilities.BuildParameterListString(testValues); + + Assert.IsNotNull(result); + Assert.AreEqual(":param0,:param1,:param2" ,result); + } + + [Test] + public void BuildDictionaryParameter_Returns_DictionaryWithThreeParams() + { + var testValues = new List() + { + "Test1", + "Test2", + "Test3" + }; + + var result = QueryUtilities.BuildDictionaryParameter(testValues); + + Assert.IsNotNull(result); + Assert.IsNotNull(result["param0"]); + Assert.IsNotNull(result["param1"]); + Assert.IsNotNull(result["param2"]); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreApiConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreApiConfiguration.cs new file mode 100644 index 0000000..8103a57 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreApiConfiguration.cs @@ -0,0 +1,40 @@ +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreApiConfiguration + { + public string HostUrl { get; set; } + public string HostPort { get; set; } + public string GrantType { get; set; } + public string Scope { get; set; } + public string SeviceAccountId { get; set; } + public string DeviceName { get; set; } + public string RelyingPassword { get; set; } + public string ServiceApiChannelId { get; set; } + public int ReTryLimit { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string CoreEnvironment { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string UserId { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string Password { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string ApiChannelId { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string BusinessTaskId { get; set; } + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public string ApplId { get; set; } + public CoreEndPointConfiguration CoreEndPointConfiguration { get; set; } + + [NotMapped] + public string HostName + { + get + { + return $"{HostUrl}:{HostPort}"; + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreConfiguration.cs new file mode 100644 index 0000000..11984fc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreConfiguration.cs @@ -0,0 +1,9 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreConfiguration + { + public CoreApiConfiguration CoreApiConfiguration { get; set; } + public CoreSoapApiConfiguration CoreSoapApiConfiguration { get; set; } + public CoreDbConfiguration CoreDbConfiguration { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreDbConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreDbConfiguration.cs new file mode 100644 index 0000000..5cd57d9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreDbConfiguration.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreDbConfiguration + { + public string ConnectionString { get; set; } + + public int CommandTimeout { get; set; } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreEndPointConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreEndPointConfiguration.cs new file mode 100644 index 0000000..d3d969c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreEndPointConfiguration.cs @@ -0,0 +1,55 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreEndPointConfiguration + { + public string ServiceToken { get; set; } + public string StsToken { get; set; } + public string Prelogin { get; set; } + public string DnaToken { get; set; } + + //Persons + public string PersonsQueryName { get; set; } + public string PersonsQuerySearch { get; set; } + public string PersonsQueryMemberAgreementNbr { get; set; } + public string PutPersonUserField { get; set; } + public string PersonUserFields { get; set; } + + //Accounts + public string AccountsQueryMemberAgreement { get; set; } + public string AccountsQueryAccountDetail { get; set; } + public string AccountsTransactionHistoryQueryAccountNumber { get; set; } + public string AccountsCollateral { get; set; } + public string PutAccountUserField { get; set; } + public string AccountUserFields { get; set; } + + //Addresses + public string PersonPostalAddress { get; set; } + public string PersonPostalAddresses { get; set; } + public string PersonAddressLine { get; set; } + + //AccessChannelPersons + public string AccessChannelPersonsByPerson { get; set; } + public string AccessChannelPersonsAccessChannelPersonId { get; set; } + + //AccessType + public string AccessChannelPersonsAccessTypes { get; set; } + + //Branches + public string Branches { get; set; } + + //Properties + public string PropertyById { get; set; } + public string PropertyUserFields { get; set; } + public string PutPropertyUserField { get; set; } + + //Tax + public string GetPersonsDataByTaxId { get; set; } + + public string GetOrganizationsDataByTaxId { get; set; } + + + //Organizations + public string OrganizationsQueryMemberAgreementNbr { get; set; } + public string OrganizationQuerySearch { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapApiConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapApiConfiguration.cs new file mode 100644 index 0000000..3f331e9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapApiConfiguration.cs @@ -0,0 +1,8 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreSoapApiConfiguration + { + public string CoreSoapApiWrapperHost { get; set; } + public CoreSoapEndpointConfiguration CoreSoapEndpointConfiguration { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapEndpointConfiguration.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapEndpointConfiguration.cs new file mode 100644 index 0000000..f363237 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Configuration/CoreSoapEndpointConfiguration.cs @@ -0,0 +1,23 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.Configuration +{ + public class CoreSoapEndpointConfiguration + { + public string GetAccountByAccountNumber { get; set; } + public string PutAccountMaintenanceRequest { get; set; } + public string PutAccountBranchUpdateRequest { get; set; } + public string PutAccountLtvUpdateRequest { get; set; } + public string PutAccountAnalysisGroupMaintenanceRequest { get; set; } + public string PostMonetaryTransactions { get; set; } + public string PutDealerOriginalBalance { get; set; } + public string PutPersonAgreementsDetailTypes { get; set; } + public string PostFundsToAccount { get; set; } + public string PostPersonAccount { get; set; } + public string PostOrganizationAccount { get; set; } + public string PutOrganizationMaintenanceRequest { get; set; } + public string PutAccountNickNameUpdateRequest { get; set; } + public string PutAccountContractDateUpdateRequest { get; set; } + public string PutAccountCreditReportTypeUpdateRequest { get; set; } + public string PutPropertyUserField { get; set; } + public string PostPropertyUserField { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiConnection.cs new file mode 100644 index 0000000..e9777fd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiConnection.cs @@ -0,0 +1,11 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class CoreApiConnection + { + public string EffectiveDate { get; set; } + public string PostingDate { get; set; } + public string CashBoxNumber { get; set; } + public string StsToken { get; set; } + public string DnaToken { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiUserConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiUserConnection.cs new file mode 100644 index 0000000..4df4f2a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/CoreApiUserConnection.cs @@ -0,0 +1,11 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class CoreApiUserConnection + { + public string EffectiveDate { get; set; } + public string PostingDate { get; set; } + public string CashBoxNumber { get; set; } + public string StsToken { get; set; } + public string DnaToken { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/DnaTokenConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/DnaTokenConnection.cs new file mode 100644 index 0000000..44101f8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/DnaTokenConnection.cs @@ -0,0 +1,48 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class DnaTokenConnection + { + private const string DefaultCashBoxNumber = "0"; + + public class DnaTokenRequest + { + public DnaTokenRequest(CoreApiUserConnection coreApiConnection) + { + MessageBody = new MessageBodyRequest(coreApiConnection); + } + + public MessageBodyRequest MessageBody { get; set; } + + public class MessageBodyRequest + { + public MessageBodyRequest(CoreApiUserConnection coreApiConnection) + { + EffectiveDate = coreApiConnection.EffectiveDate; + PostingDate = coreApiConnection.PostingDate; + CashBoxNumber = coreApiConnection.CashBoxNumber; + } + + public string EffectiveDate { get; set; } + public string PostingDate { get; set; } + public string CashBoxNumber { get; set; } + } + } + + public class DnaTokenResponse + { + public MessageHeaderResponse MessageHeader { get; set; } + public MessageBodyResponse MessageBody {get; set;} + + public class MessageHeaderResponse + { + public string UpdateKey { get; set; } + public string MessageId { get; set; } + } + + public class MessageBodyResponse + { + public string Dnatoken { get; set; } + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/PreloginConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/PreloginConnection.cs new file mode 100644 index 0000000..edcebdf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/PreloginConnection.cs @@ -0,0 +1,40 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class PreloginConnection + { + public class PreloginResponse + { + public MessageHeader MessageHeader { get; set; } + public MessageBody MessageBody { get; set; } + } + + public class MessageHeader + { + public string UpdateKey { get; set; } + public string MessageId { get; set; } + } + + public class MessageBody + { + public string PostingDate { get; set; } + public string CarryoverDate { get; set; } + public CashBox[] CashBoxes { get; set; } + } + + public class CashBox + { + public string Id { get; set; } + public int CashboxNumber { get; set; } + public string Description { get; set; } + public LocationOrganization LocationOrganization { get; set; } + public string TypeCode { get; set; } + public string Url { get; set; } + } + + public class LocationOrganization + { + public string BranchNumber { get; set; } + public string BranchName { get; set; } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessRequest.cs new file mode 100644 index 0000000..b3e3f1d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessRequest.cs @@ -0,0 +1,10 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class ServiceAccessRequest + { + public string Grant_Type { get; set; } + public string Scope { get; set; } + public string Service_Account_Id { get; set; } + public string Device_Name { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessResponse.cs new file mode 100644 index 0000000..feec49e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/ServiceAccessResponse.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels +{ + public class ServiceAccessResponse + { + public string Access_Token { get; set; } + public string Token_Type { get; set; } + public string Expires_In { get; set; } + public string Refresh_Token { get; set; } + public string Password_Expiration { get; set; } + public string Roaming_Id { get; set; } + public string ResponseStatus { get; set; } + public string ErrorMessage { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/StsTokenConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/StsTokenConnection.cs new file mode 100644 index 0000000..d5624f0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/ConnectionModels/StsTokenConnection.cs @@ -0,0 +1,20 @@ +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; + +namespace LCU.Library.Internal.CoreApiWrapperModel.ConnectionModels +{ + public class StsTokenConnection + { + public StsTokenConnection(CoreApiConfiguration coreApiConfiguration) + { + device_name = coreApiConfiguration.DeviceName; + environment = coreApiConfiguration.CoreEnvironment; + user_id = coreApiConfiguration.UserId; + password = coreApiConfiguration.Password; + } + + public string device_name { get; set; } + public string environment { get; set; } + public string user_id { get; set; } + public string password { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreRequest.cs new file mode 100644 index 0000000..fb459ef --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreRequest.cs @@ -0,0 +1,141 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Collections.Generic; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public class CoreRequest : ICoreRequest + { + private const int DefaultAttempts = 0; + private readonly IHttpClientFactory _clientFactory; + private readonly ICoreServiceConnection _coreServiceConnection; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public CoreRequest(IHttpClientFactory clientFactory, + ICoreServiceConnection coreServiceConnection, + CoreConfiguration coreConfiguration) + { + _clientFactory = clientFactory; + _coreServiceConnection = coreServiceConnection; + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + public async Task GetRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody = null) + { + return await RequestObject(endpoint, endpointParameters, HttpMethod.Get, jsonBody); + } + + public async Task PostRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody) + { + return await RequestObject(endpoint, endpointParameters, HttpMethod.Post, jsonBody); + } + + public async Task PutRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody) + { + return await RequestObject(endpoint, endpointParameters, HttpMethod.Put, jsonBody); + } + + public async Task DeleteRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody) + { + return await RequestObject(endpoint, endpointParameters, HttpMethod.Delete, jsonBody); + } + + private async Task RequestObject(string endpoint, Dictionary endpointParameters, HttpMethod httpMethod, string jsonBody) + { + var finalEndpoint = HttpUtilities.BuildEndPointWithParams(endpoint, endpointParameters); + var result = await RequestCoreJsonResponse(finalEndpoint, httpMethod, jsonBody); + if (string.IsNullOrEmpty(result)) + { + return default(T); + } + + return JsonConvert.DeserializeObject(result); + } + + public async Task RequestCoreJsonResponse(string endpoint, HttpMethod httpMethod, string body = null) + { + var attempts = DefaultAttempts; + Exception exception = new Exception(); + while (attempts < _coreApiConfiguration.ReTryLimit) + { + try + { + return await SendHttpRequest(endpoint, httpMethod, body); + } + catch (UnauthorizedRequestException uex) + { + await Task.Delay(TimeSpan.FromSeconds(1)); + _coreServiceConnection.RefreshAccessCache(); + attempts++; + exception = uex; + } + catch (Exception ex) + { + attempts = _coreApiConfiguration.ReTryLimit; + exception = ex; + } + } + + throw new Exception($"Failure to perform HTTP request. Exception: {exception.Message}"); + } + + public async Task SendHttpRequest(string endpoint, HttpMethod httpMethod, string body = null) + { + HttpRequestMessage request = CreateHttpRequestMessage(endpoint, httpMethod, body); + var client = HttpUtilities.GetClient(request.RequestUri); + var response = await client.SendAsync(request); + + if (!response.IsSuccessStatusCode) + { + if (response.StatusCode == HttpStatusCode.Unauthorized) + { + throw new UnauthorizedRequestException($"Unauthorized Request."); + } + + throw new Exception($"Unable to successfully send the HTTP request. " + + $"StatusCode:{response.StatusCode}, ReasonPhrase:{response.ReasonPhrase}"); + } + + return await response.Content.ReadAsStringAsync(); + } + + public HttpRequestMessage CreateHttpRequestMessage(string endpoint, HttpMethod httpMethod, string body = null) + { + var accessToken = _coreServiceConnection.GetAccessToken(); + if (string.IsNullOrWhiteSpace(accessToken)) + { + throw new UnauthorizedRequestException($"Unauthorized Request."); + } + + var uri = HttpUtilities.BuildHttpsUri(_coreApiConfiguration.HostName, endpoint); + HttpRequestMessage request = new HttpRequestMessage + { + Method = httpMethod, + RequestUri = uri, + Headers = { + { HttpRequestHeader.Authorization.ToString(), accessToken }, + { "X-ApiChannelId", _coreApiConfiguration.ServiceApiChannelId }, + { "X-MessageId", Guid.NewGuid().ToString() }, + { HttpRequestHeader.ContentType.ToString(), "application/json" } + } + }; + + if (!string.IsNullOrEmpty(body)) + { + var content = new StringContent(body, Encoding.UTF8, "application/json"); + request.Content = content; + } + + return request; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreServiceConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreServiceConnection.cs new file mode 100644 index 0000000..25efe50 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreServiceConnection.cs @@ -0,0 +1,108 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Text; +using Microsoft.Extensions.Caching.Memory; +using Newtonsoft.Json; +using Serilog; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels; +using System.Net.Http.Headers; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public class CoreServiceConnection : ICoreServiceConnection + { + private readonly IHttpClientFactory _clientFactory; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + private IMemoryCache _cache; + private string _accessToken; + + public CoreServiceConnection(IHttpClientFactory clientFactory, + CoreConfiguration coreConfiguration, + IMemoryCache cache) + { + _clientFactory = clientFactory; + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _accessToken = ""; + _cache = cache; + } + + public string GetAccessToken() + { + if (_cache.TryGetValue("accesstoken", out _accessToken)) + { + return _accessToken; + } + + RefreshAccessCache(); + return _accessToken; + } + + public void RefreshAccessCache() + { + if (_cache.TryGetValue("accesstoken", out _accessToken)) + { + _cache.Remove("accesstoken"); + } + + SetAccessToken(); + if (!string.IsNullOrWhiteSpace(_accessToken)) + { + _cache.Set("accesstoken", _accessToken); + } + } + + private void SetAccessToken() + { + try + { + _accessToken = ""; + var body = new ServiceAccessRequest() + { + Grant_Type = _coreApiConfiguration.GrantType, + Scope = _coreApiConfiguration.Scope, + Service_Account_Id = _coreApiConfiguration.SeviceAccountId, + Device_Name = _coreApiConfiguration.DeviceName + }; + var encoded = JsonConvert.SerializeObject(body); + var content = new StringContent(encoded, Encoding.UTF8, "application/json"); + var uri = HttpUtilities.BuildHttpsUri(_coreApiConfiguration.HostName, _coreApiConfiguration.CoreEndPointConfiguration.ServiceToken); + var client = HttpUtilities.GetClient(uri); + var authenticationString = $"{_coreApiConfiguration.SeviceAccountId}:{_coreApiConfiguration.RelyingPassword}"; + var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(authenticationString)); + var basicAthentication = new AuthenticationHeaderValue("Basic", base64EncodedAuthenticationString); + + HttpRequestMessage request = new HttpRequestMessage() + { + Method = HttpMethod.Post, + RequestUri = uri, + Content = content, + Headers = { + { HttpRequestHeader.Authorization.ToString(), basicAthentication.ToString() }, + { HttpRequestHeader.ContentType.ToString(), "application/json" }, + { HttpRequestHeader.Accept.ToString(), "application/json;version=2" } + } + }; + + var response = client.SendAsync(request).Result; + if (!response.IsSuccessStatusCode) + { + Log.Error("Unsuccessful response status code, unable to set the access token."); + return; + } + + var result = response.Content.ReadAsStringAsync().Result; + var accessResponse = JsonConvert.DeserializeObject(result); + _accessToken = $"Bearer {accessResponse.Access_Token}"; + } + catch (Exception ex) + { + Log.Fatal(ex, "Failure to set access token"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreUserConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreUserConnection.cs new file mode 100644 index 0000000..ecfd0af --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/CoreUserConnection.cs @@ -0,0 +1,181 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Text; +using Microsoft.Extensions.Caching.Memory; +using Newtonsoft.Json; +using Serilog; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperModel.ConnectionModels; +using LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + [Obsolete("User connection only, 09/08/2021, will be removed in future release")] + public class CoreUserConnection : ICoreUserConnection + { + private readonly IHttpClientFactory _clientFactory; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + private IMemoryCache _cache; + private CoreApiUserConnection _coreApiUserConnection; + + public CoreUserConnection(IHttpClientFactory clientFactory, + CoreConfiguration coreConfiguration, + IMemoryCache cache) + { + _clientFactory = clientFactory; + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _coreApiUserConnection = new CoreApiUserConnection(); + _cache = cache; + } + + public CoreApiUserConnection GetCoreApiConnection() + { + var coreApiConnection = new CoreApiUserConnection(); + if (_cache.TryGetValue("coreapiuserconnection", out coreApiConnection)) + { + return coreApiConnection; + } + + RefreshConnectionCache(); + return _coreApiUserConnection; + } + + public void RefreshConnectionCache() + { + var coreApiConnection = new CoreApiUserConnection(); + if (_cache.TryGetValue("coreapiuserconnection", out coreApiConnection)) + { + _cache.Remove("coreapiuserconnection"); + } + + SetStsToken(); + SetPreLoginDetails(); + SetDnaToken(); + _cache.Set("coreapiuserconnection", _coreApiUserConnection); + } + + private void SetStsToken() + { + try + { + var body = new StsTokenConnection(_coreApiConfiguration); + var encoded = JsonConvert.SerializeObject(body); + var content = new StringContent(encoded, Encoding.UTF8, "application/json"); + var uri = HttpUtilities.BuildHttpsUri(_coreApiConfiguration.HostName, _coreApiConfiguration.CoreEndPointConfiguration.StsToken); + var client = HttpUtilities.GetClient(uri); + + var response = client.PostAsync(uri, content).Result; + + if (!response.IsSuccessStatusCode) + { + Log.Error("Unable to set the STS Token."); + throw new Exception($"Unable to set the STS Token. StatusCode:{response.StatusCode}, ReasonPhrase:{response.ReasonPhrase}"); + } + + var stsToken = response.Content.ReadAsStringAsync().Result; + _coreApiUserConnection.StsToken = $"Bearer {stsToken.Replace("\"", "")}"; + } + catch (Exception ex) + { + throw new Exception($"Failure to SetStsToken. Exception: {ex.InnerException}"); + } + + } + + private void SetPreLoginDetails() + { + try + { + var uri = HttpUtilities.BuildHttpsUri(_coreApiConfiguration.HostName, _coreApiConfiguration.CoreEndPointConfiguration.Prelogin); + var client = HttpUtilities.GetClient(uri); + HttpRequestMessage request = new HttpRequestMessage() + { + Method = HttpMethod.Post, + RequestUri = uri, + Headers = { + + { HttpRequestHeader.Authorization.ToString(), _coreApiUserConnection.StsToken }, + { HttpRequestHeader.ContentType.ToString(), "application/json" }, + { "X-ApiChannelId", _coreApiConfiguration.ApiChannelId }, + { "X-MessageId", Guid.NewGuid().ToString() } + } + }; + + var response = client.SendAsync(request).Result; + if (!response.IsSuccessStatusCode) + { + Log.Error("Unable to set the Pre Login Details"); + throw new Exception($"Unable to set the Pre Login Details. StatusCode:{response.StatusCode}, ReasonPhrase:{response.ReasonPhrase}"); + } + + var result = response.Content.ReadAsStringAsync().Result; + var preloginConnection = JsonConvert.DeserializeObject(result); + AddPrelogin(preloginConnection); + } + catch (Exception ex) + { + throw new Exception($"Failure to SetPreLoginDetails. Exception: {ex.InnerException}"); + } + + } + + public void AddPrelogin(PreloginConnection.PreloginResponse preloginResponse) + { + _coreApiUserConnection.EffectiveDate = preloginResponse.MessageBody.PostingDate; + _coreApiUserConnection.PostingDate = preloginResponse.MessageBody.PostingDate; + + if (preloginResponse.MessageBody.CashBoxes.Length <= 0 || + preloginResponse.MessageBody.CashBoxes[0] == null) + { + Log.Error("Core API user does not have a cashbox."); + throw new Exception("Core API user does not have a cashbox."); + } + + _coreApiUserConnection.CashBoxNumber = preloginResponse.MessageBody.CashBoxes[0].CashboxNumber.ToString(); + } + + private void SetDnaToken() + { + try + { + var body = new DnaTokenConnection.DnaTokenRequest(_coreApiUserConnection); + var encoded = JsonConvert.SerializeObject(body); + var content = new StringContent(encoded, Encoding.UTF8, "application/json"); + var uri = HttpUtilities.BuildHttpsUri(_coreApiConfiguration.HostName, _coreApiConfiguration.CoreEndPointConfiguration.DnaToken); + var client = HttpUtilities.GetClient(uri); + HttpRequestMessage request = new HttpRequestMessage() + { + Method = HttpMethod.Post, + RequestUri = uri, + Content = content, + Headers = { + { HttpRequestHeader.Authorization.ToString(), _coreApiUserConnection.StsToken }, + { "X-ApiChannelId", _coreApiConfiguration.ApiChannelId }, + { "X-MessageId", Guid.NewGuid().ToString() }, + { HttpRequestHeader.ContentType.ToString(), "application/json" }, + { "X-BusinessTaskId", _coreApiConfiguration.BusinessTaskId } + } + }; + + var response = client.SendAsync(request).Result; + if (!response.IsSuccessStatusCode) + { + Log.Error("Unable to set the DNA Token"); + throw new Exception($"Unable to set the DNA Token. StatusCode:{response.StatusCode}, ReasonPhrase:{response.ReasonPhrase}"); + } + + var result = response.Content.ReadAsStringAsync().Result; + var dnaTokenResponse = JsonConvert.DeserializeObject(result); + _coreApiUserConnection.DnaToken = $"Bearer {dnaTokenResponse.MessageBody.Dnatoken}"; + } + catch (Exception ex) + { + throw new Exception($"Failure to SetDnaToken. Exception: {ex.InnerException}"); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreConnection.cs new file mode 100644 index 0000000..90d90a7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreConnection.cs @@ -0,0 +1,10 @@ +using LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public interface ICoreConnection + { + CoreApiConnection GetCoreApiConnection(); + void RefreshConnectionCache(); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreRequest.cs new file mode 100644 index 0000000..3087863 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreRequest.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using System.Net.Http; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public interface ICoreRequest + { + Task GetRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody = null); + Task PostRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody); + Task PutRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody); + Task DeleteRequestObject(string endpoint, Dictionary endpointParameters, string jsonBody); + Task RequestCoreJsonResponse(string body, HttpMethod httpMethod, string endpoint); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreServiceConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreServiceConnection.cs new file mode 100644 index 0000000..ce71d0f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreServiceConnection.cs @@ -0,0 +1,10 @@ +using LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public interface ICoreServiceConnection + { + string GetAccessToken(); + void RefreshAccessCache(); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreUserConnection.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreUserConnection.cs new file mode 100644 index 0000000..1244d02 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreApiUtilities/ICoreUserConnection.cs @@ -0,0 +1,10 @@ +using LCU.Library.Internal.CoreApiWrapperLib.ConnectionModels; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities +{ + public interface ICoreUserConnection + { + CoreApiUserConnection GetCoreApiConnection(); + void RefreshConnectionCache(); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/CoreDbExecution.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/CoreDbExecution.cs new file mode 100644 index 0000000..d376376 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/CoreDbExecution.cs @@ -0,0 +1,39 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Data; +using Dapper; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities +{ + public class CoreDbExecution : ICoreDbExecution + { + private readonly IDbConnection _dbConnection; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreDbConfiguration _coreDbConfiguration; + + public CoreDbExecution(IDbConnection dbConnection, + CoreConfiguration coreConfiguration) + { + _coreConfiguration = coreConfiguration; + _coreDbConfiguration = _coreConfiguration.CoreDbConfiguration; + _dbConnection = dbConnection; + } + + public async Task> ExecuteQuery(string query) + { + _dbConnection.Open(); + var result = await _dbConnection.QueryAsync(query); + _dbConnection.Close(); + return result; + } + + public async Task> ExecuteQuery(string query, P parameters) + { + _dbConnection.Open(); + var result = await _dbConnection.QueryAsync(query, parameters); + _dbConnection.Close(); + return result; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/ICoreDbExecution.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/ICoreDbExecution.cs new file mode 100644 index 0000000..0c92206 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/CoreDbUtilities/ICoreDbExecution.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities +{ + public interface ICoreDbExecution + { + Task> ExecuteQuery(string query); + Task> ExecuteQuery(string query, P parameters); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessChannelPersonsDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessChannelPersonsDao.cs new file mode 100644 index 0000000..080ce73 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessChannelPersonsDao.cs @@ -0,0 +1,59 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AccessChannelPersonsDao : BaseCoreDao, IAccessChannelPersonsDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public AccessChannelPersonsDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to update Access Channel Person. + /// + /// + /// AccessChannelPerson + public async Task UpdateAccessChannelPerson(CoreApiMessage request) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccessChannelPersonsAccessChannelPersonId, + RequestRootParameters.AccessChannelPersonId, + request.MessageBody.Id); + var jsonBody = JsonConvert.SerializeObject(request); + var result = await _coreRequest.PutRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search for AccessChannelPersons based By Person. + /// Default Included: Graph + /// + /// + /// + /// IEnumerable + public async Task>> FindAccessChannelPersonsByPerson(CoreRequestParameters coreRequestParameters, + AccessChannelPersonsByPersonRequest request) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = JsonConvert.SerializeObject(request); + return await _coreRequest.PostRequestObject>>( + _coreApiConfiguration.CoreEndPointConfiguration.AccessChannelPersonsByPerson, + endpointParameters, + jsonBody); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessTypeDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessTypeDao.cs new file mode 100644 index 0000000..214abac --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccessTypeDao.cs @@ -0,0 +1,42 @@ +using System.Threading.Tasks; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AccessTypeDao : BaseCoreDao, IAccessTypeDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public AccessTypeDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to update Access Type. + /// + /// + /// AccessType + public async Task UpdateAccessType(CoreApiMessage request, string accessChannelPersonId) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccessChannelPersonsAccessTypes, + RequestRootParameters.AccessChannelPersonId, + accessChannelPersonId); + var finalEndpoint = HttpUtilities.ReplaceRootParameter(endpoint, + RequestRootParameters.AccessTypeId, + request.MessageBody.Id); + var jsonBody = JsonConvert.SerializeObject(request); + var result = await _coreRequest.PutRequestObject>(finalEndpoint, null, jsonBody); + return result?.MessageBody; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountDao.cs new file mode 100644 index 0000000..62e442b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountDao.cs @@ -0,0 +1,313 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using LCU.Library.Internal.ApiSecurity.Enums; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Exceptions; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Collaterals; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; +using AccountMaintenanceRequest = LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests.AccountMaintenanceRequest; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AccountDao : BaseCoreDao, IAccountDao + { + private readonly ICoreDbExecution _coreDbExecution; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration; + private readonly ApiSecurityConfiguration _apiSecurityConfiguration; + private readonly IPostRequest _postRequest; + private readonly IPutRequest _putRequest; + + private const string SoapClientKeyValue = "CoreSoapApiWrapper"; + + private const string GetAccountAdminBranchUpdateQuery = "AccountBranch/GetAccountAdminBranchUpdateQuery"; + private const string GetVipSavingsToFundQuery = "Account/GetVipSavingsToFundQuery"; + private const string GetAccountOwnersByAccountNumber = "Account/GetAccountOwnersByAccountNumber"; + private const string GetAccountOwnersByOrganizationName = "Account/GetAccountOwnersByOrganizationName"; + private const string GetAccountOwnersByPersonName = "Account/GetAccountOwnersByPersonName"; + private const string GetAccountsToUpdateGroupAnalysisQuery = "Account/GetAccountsToUpdateGroupAnalysis"; + private const string GetAccountsByMajorMinorBranchAndStatusQuery = "Account/GetAccountsByMajorMinorBranchCodeAndStatus"; + private const string GetAccountsByRecentTransactionsQuery = "Account/GetAccountsByRecentTransactions"; + private const string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + + public AccountDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration, + ApiSecurityConfiguration apiSecurityConfiguration, + ICoreDbExecution coreDbExecution, + IPostRequest postRequest, + IPutRequest putRequest) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _apiSecurityConfiguration = apiSecurityConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _coreSoapApiConfiguration = _coreConfiguration.CoreSoapApiConfiguration; + _coreDbExecution = coreDbExecution; + _postRequest = postRequest; + _putRequest = putRequest; + } + + /// + /// Calls Core API to search based the memberagreenbr in the MemberAgreeNbrRequest model. + /// Default Included: Graph + /// + /// + /// + /// IEnumerable + public async Task> FindByMemberAgreeNbr(CoreRequestParameters coreRequestParameters, MemberAgreeNbrRequest request) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(request); + var result = await _coreRequest.PostRequestObject>>( + _coreApiConfiguration.CoreEndPointConfiguration.AccountsQueryMemberAgreement, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search based the AcctNbr in the AcctNbrRequest model. + /// Default Included: Standard, Graph + /// + /// + /// + /// Account + public async Task FindByAcctNbr(CoreRequestParameters coreRequestParameters, AcctNbrRequest request) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(request); + var result = await _coreRequest.PostRequestObject>( + _coreApiConfiguration.CoreEndPointConfiguration.AccountsQueryAccountDetail, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search based the filled out AccountId. + /// Default Included: Graph + /// + /// + /// + /// IEnumerable + public async Task> FindCollateralById(CoreRequestParameters coreRequestParameters, string accountId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccountsCollateral, + RequestRootParameters.AccountId, + accountId); + var result = await _coreRequest.GetRequestObject>>(endpoint, endpointParameters); + return result?.MessageBody; + } + + /// + /// Calls Core Soap API and provides an AccountMaintenanceRequest to update an account. + /// + /// + public async Task PutAccountMaintenanceRequest(IEnumerable accountMaintenanceRequests) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountMaintenanceRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + var accounts = accountMaintenanceRequests.Select(account => new MaintenanceAccount { AccountNumber = account.AccountNumber, DeliveryMethodCode = account.DeliveryMethod, IsAccountMaintenance = true }).ToArray(); + var accountMaintenanceSoapRequest = new CoreApiWrapperModel.CoreModels.CoreSoapRequests.AccountMaintenanceRequest + { + Accounts = accounts + }; + + var response = await _putRequest.Async (endpoint, accountMaintenanceSoapRequest, headers, 0); + if (!response.IsSuccessStatusCode) + { + throw new AccountMaintenanceRequestException($"Request to update accounts with AccountMaintenanceRequest: {accountMaintenanceSoapRequest} failed with the following bad status code: {response.StatusCode}"); + } + } + + public async Task> FindAdminBranchCodeChangeAccountNumbers() + { + var query = QueryUtilities.GetQuery(GetAccountAdminBranchUpdateQuery); + return await _coreDbExecution.ExecuteQuery(query); + } + + public async Task> FindVipSavingsToFund() + { + var query = QueryUtilities.GetQuery(GetVipSavingsToFundQuery); + return await _coreDbExecution.ExecuteQuery(query); + } + + public async Task> FindAccountsToUpdateAccountAnalysis() + { + var query = QueryUtilities.GetQuery(GetAccountsToUpdateGroupAnalysisQuery); + return await _coreDbExecution.ExecuteQuery(query); + } + + public async Task UpdateAccountAnalysis(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountAnalysisGroupMaintenanceRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountAnalysisGroupMaintenanceRequest, headers, 0); + } + + public async Task UpdateAccountBranch(AccountBranchUpdateRequest accountBranchUpdateRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountBranchUpdateRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountBranchUpdateRequest, headers, 0); + } + + public async Task UpdateAccountLoanToValue(AccountLtvUpdateRequest accountLtvUpdateRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountLtvUpdateRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountLtvUpdateRequest, headers, 0); + } + + public async Task UpdateAccountNickName(AccountNickNameUpdateRequest accountNickNameUpdateRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountNickNameUpdateRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountNickNameUpdateRequest, headers, 0); + } + + public async Task UpdateAccountContractDate(AccountContractDateUpdateRequest accountContractDateUpdateRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountContractDateUpdateRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountContractDateUpdateRequest, headers, 0); + } + + public async Task> GetActivityAccountDetailsByAccountNumbers(List accountNumbers) + { + var query = QueryUtilities.GetQuery("ActivityAccountDetailsByAccountNbr"); + var accountActivityParams = new + { + accountNumbers = accountNumbers.ToArray() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> FindOwnersByAccountNumber(long accountNumber, DateTime creationDate) + { + var query = QueryUtilities.GetQuery(GetAccountOwnersByAccountNumber); + var accountNumberParams = new + { + accountNumber = accountNumber.ToString(), + createdDate = creationDate.Date.ToString(DnaTimeFormat) + }; + return await _coreDbExecution.ExecuteQuery(query, accountNumberParams); + } + + public async Task> FindPrimaryOwnersByOrganizationName(string organizationName) + { + var query = QueryUtilities.GetQuery(GetAccountOwnersByOrganizationName); + var organizationNameParams = new + { + organizationName = organizationName + }; + return await _coreDbExecution.ExecuteQuery(query, organizationNameParams); + } + + public async Task> FindPrimaryOwnersByPersonName(string personName) + { + var query = QueryUtilities.GetQuery(GetAccountOwnersByPersonName); + var personNameParams = new + { + personName = personName + }; + return await _coreDbExecution.ExecuteQuery(query, personNameParams); + } + + /// + /// Calls Core Soap API post to create a new person account. + /// + /// + public async Task AddPersonAccount(CreatePersonAccountRequest createPersonAccountRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostPersonAccount); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _postRequest.Async(endpoint, createPersonAccountRequest, headers, 0); + } + + /// + /// Calls Core Soap API post to create a new organization account. + /// + /// + public async Task AddOrganizationAccount(CreateOrganizationAccountRequest createOrganizationAccountRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostOrganizationAccount); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _postRequest.Async(endpoint, createOrganizationAccountRequest, headers, 0); + } + + /// + /// Calls Core Soap API and provides an OrganizationMaintenanceRequest to update an account. + /// + /// + public async Task PutOrganizationMaintenanceRequest(OrganizationMaintenanceRequest organizationMaintenanceRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutOrganizationMaintenanceRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, organizationMaintenanceRequest, headers, 0); + } + + /// + /// Calls Core Soap API and provides an AccountCreditReportTypeUpdateRequest to update an account. + /// + /// + public async Task UpdateAccountCreditReportType(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutAccountCreditReportTypeUpdateRequest); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, accountCreditReportTypeUpdateRequest, headers, 0); + } + + public async Task> GetAccountsByMajorMinorBranchAndStatus(AccountsByMajorMinorBranchAndStatusRequest request) + { + var query = QueryUtilities.GetQuery(GetAccountsByMajorMinorBranchAndStatusQuery); + var queryParams = new + { + majorAccountTypes = request.MajorTypes.ToArray(), + minorAccountTypes = request.MinorTypes.ToArray(), + accountStatusCodes = request.AccountStatuses.ToArray(), + branchOrgCodes = request.BranchCodes.ToArray() + }; + return await _coreDbExecution.ExecuteQuery(query, queryParams); + } + + public async Task> GetAccountsByRecentTransactions(AccountsByRecentTransactionsRequest request) + { + var query = QueryUtilities.GetQuery(GetAccountsByRecentTransactionsQuery); + var queryParams = new + { + startDate = request.StartDate, + endDate = request.EndDate + }; + return await _coreDbExecution.ExecuteQuery(query, queryParams); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountHistoryDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountHistoryDao.cs new file mode 100644 index 0000000..fb931c4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountHistoryDao.cs @@ -0,0 +1,32 @@ +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AccountHistoryDao : IAccountHistoryDao + { + private readonly ICoreDbExecution _coreDbExecution; + private const string GetChargeOffDateTimes = "AccountHistory/GetChargeOffDateTimes"; + + public AccountHistoryDao(ICoreDbExecution coreDbExecution) + { + _coreDbExecution = coreDbExecution; + } + + public async Task> GetChargeoffDateTimesByAccountNumber(string accountNumber) + { + var query = QueryUtilities.GetQuery(GetChargeOffDateTimes); + var queryParams = new + { + accountNumber + }; + return await _coreDbExecution.ExecuteQuery(query, queryParams); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountUserFieldDao.cs new file mode 100644 index 0000000..bf4ff52 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AccountUserFieldDao.cs @@ -0,0 +1,81 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AccountUserFieldDao : BaseCoreDao, IAccountUserFieldDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public AccountUserFieldDao(ICoreRequest coreRequest, CoreConfiguration coreConfiguration) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to update Accounts UserField. + /// Default Included: Graph + /// + /// + /// + /// + /// AccountUserField + public async Task UpdateAccountUserField(CoreApiMessage accountUserFieldUpdateRequest, + string accountId, + string userFieldId) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PutAccountUserField, + RequestRootParameters.AccountId, + accountId); + endpoint = HttpUtilities.ReplaceRootParameter(endpoint, RequestRootParameters.UserFieldId, userFieldId); + var jsonBody = JsonConvert.SerializeObject(accountUserFieldUpdateRequest); + var result = await _coreRequest.PutRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to insert Accounts UserField. + /// Default Included: Graph + /// + /// + /// + /// + /// AccountUserField + public async Task InsertAccountUserField(CoreApiMessage accountUserFieldRequest, + string accountId) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccountUserFields, + RequestRootParameters.AccountId, + accountId); + var jsonBody = JsonConvert.SerializeObject(accountUserFieldRequest); + var result = await _coreRequest.PostRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search for UserFields based AccountId. + /// Default Included: Graph + /// + /// + /// + /// IEnumerable + public async Task>> FindAccountUserFieldCoreApiResponseByAccountId(CoreRequestParameters coreRequestParameters, string accountId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccountUserFields, + RequestRootParameters.AccountId, + accountId); + return await _coreRequest.GetRequestObject>>(endpoint, endpointParameters); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ActivityDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ActivityDao.cs new file mode 100644 index 0000000..a9d2d71 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ActivityDao.cs @@ -0,0 +1,318 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class ActivityDao : IActivityDao + { + private readonly ICoreDbExecution _coreDbExecution; + private const string NewCheckingAccountSalesDigitalBanking = "Activity/NewCheckingAccountSalesDigitalBanking"; + private const string NewCheckingAccountSalesQuery = "Activity/NewCheckingAccountSales"; + private const string NewAtmCheckCardQuery = "Activity/NewAtmCheckCardSales"; + private const string NewMortgageSalesQuery = "Activity/NewMortgageAccountSales"; + private const string NewVehicleSalesQuery = "Activity/NewVehicleAccountSales"; + private const string NewDebtProtectedLoanQuery = "Activity/NewDebtProtectedLoanSales"; + private const string EStatementDeliveryQuery = "Activity/QueryEStatementDeliveryMethod"; + private const string NewActivityManagerIncentiveReferralQuery = "Activity/NewActivityManagerIncentiveReferralQuery"; + private const string ActivityManagerReferralById = "Activity/QueryActivityManagerActivityDetail"; + private const string GetPersonActivityByPhoneNumberQuery = "Activity/GetPersonActivityByPhoneNumberQuery"; + private const string GetPersonActivityByPersonNumberQuery = "Activity/GetPersonActivityByPersonNumberQuery"; + private const string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + public ActivityDao(ICoreDbExecution coreDbExecution) + { + _coreDbExecution = coreDbExecution; + } + + //Some of this could be DRYer, opting for this for better Type Safety and Messaging in Services. + public async Task> GetNewCheckingActivitiesNewerThanDate( + DateTime newerThanDateTime, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesQuery); + //Define Anonymous Object to Pass in Parameter "newerThanDateTime: "datetimestring" to query + //See: https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/types/anonymous-types + var accountActivityParams = new + { + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + afterActivityNbr = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewCheckingActivitiesAfterActivityNbr( + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewCheckingActivities( + DateTime newerThanDateTime, + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewDigitalBankingCheckingActivitiesNewerThanDate( + DateTime newerThanDateTime, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesDigitalBanking); + var accountActivityParams = new + { + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + afterActivityNbr = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewDigitalBankingCheckingActivitiesAfterActivityNbr( + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesDigitalBanking); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewDigitalBankingCheckingActivities( + DateTime newerThanDateTime, + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewCheckingAccountSalesDigitalBanking); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewAtmCheckCardActivitiesNewerThanDate( + DateTime newerThanDateTime, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewAtmCheckCardQuery); + var accountActivityParams = new + { + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + afterActivityNbr = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewAtmCheckCardActivitiesAfterActivityNbr( + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewAtmCheckCardQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = (string)null, + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewAtmCheckCardActivities( + DateTime newerThanDateTime, + long afterActivityNumber, + int limitAmount + ) + { + var query = QueryUtilities.GetQuery(NewAtmCheckCardQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber.ToString(), + newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat), + limitAmount = limitAmount.ToString() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewActivityManagerReferralsNewerThan( + DateTime newerThanOriginationDateTime) + { + var query = QueryUtilities.GetQuery(NewActivityManagerIncentiveReferralQuery); + var accountActivityParams = new + { + newerThanOriginationDate = newerThanOriginationDateTime.ToString(DnaTimeFormat), + afterActivityId = (string)null + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewActivityManagerReferralsAfterActivityId(long afterActivityId) + { + var query = QueryUtilities.GetQuery(NewActivityManagerIncentiveReferralQuery); + var accountActivityParams = new + { + afterActivityId = afterActivityId.ToString(), + newerThanOriginationDate = (string)null + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewActivityManagerReferrals(DateTime newerThanOriginationDateTime, + long afterActivityId) + { + var query = QueryUtilities.GetQuery(NewActivityManagerIncentiveReferralQuery); + var accountActivityParams = new + { + afterActivityId = afterActivityId.ToString(), + newerThanOriginationDate = newerThanOriginationDateTime.ToString(DnaTimeFormat), + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewMortgageSaleActivities( + DateTime? newerThanDateTime, long? afterActivityNumber) + { + var query = QueryUtilities.GetQuery(NewMortgageSalesQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber?.ToString(), + newerThanDateTime = newerThanDateTime?.ToString(DnaTimeFormat) + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewVehicleSaleActivities( + DateTime? newerThanDateTime, long? afterActivityNumber) + { + var query = QueryUtilities.GetQuery(NewVehicleSalesQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber?.ToString(), + newerThanDateTime = newerThanDateTime?.ToString(DnaTimeFormat) + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetNewDebtProtectedLoanSaleActivities( + DateTime? newerThanDateTime, long? afterActivityNumber) + { + var query = QueryUtilities.GetQuery(NewDebtProtectedLoanQuery); + var accountActivityParams = new + { + afterActivityNbr = afterActivityNumber?.ToString(), + newerThanDateTime = newerThanDateTime?.ToString(DnaTimeFormat) + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> QueryActivityManagerActivity(ActivityQueryRequest request) + { + var query = QueryUtilities.GetQuery(ActivityManagerReferralById); + var accountActivityParams = new + { + activityIds = request.ActivityIds.Select(x => x.ToString()).ToArray() + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetEStatementDeliveryActivity(DateTime? newerThanDateTime) + { + var query = QueryUtilities.GetQuery(EStatementDeliveryQuery); + var accountActivityParams = new + { + newerThanDateTime = newerThanDateTime?.ToString(DnaTimeFormat) + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetPersonActivityByPhoneNumber(string phoneNumber) + { + var query = QueryUtilities.GetQuery(GetPersonActivityByPhoneNumberQuery); + var personRecentActivityParams = new + { + phoneNumber = phoneNumber + }; + return (await _coreDbExecution.ExecuteQuery(query, personRecentActivityParams)).ToList(); + } + + public async Task GetPersonActivityByPersonNumber(string personNumber) + { + var query = QueryUtilities.GetQuery(GetPersonActivityByPersonNumberQuery); + var personRecentActivityParams = new { + personNumber = personNumber + }; + return (await _coreDbExecution.ExecuteQuery(query, personRecentActivityParams)).FirstOrDefault(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AddressDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AddressDao.cs new file mode 100644 index 0000000..752e06a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AddressDao.cs @@ -0,0 +1,132 @@ +using System.Threading.Tasks; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AddressDao : BaseCoreDao, IAddressDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public AddressDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration) + : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to search based on personNumber and postalAddressNumber. + /// Default Included: Standard + /// + /// + /// + /// + /// CoreApiMessage + public async Task> FindByPersonNumberAddressNumber(CoreRequestParameters coreRequestParameters, + string personNumber, + string postalAddressId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = ReplaceEndpointsPersonIdAndPostalAddressId(personNumber, postalAddressId); + return await _coreRequest.GetRequestObject>(endpoint, endpointParameters, null); + } + + /// + /// Calls Core API to search based on personNumber. + /// Default Included: Standard + /// + /// + /// + /// + /// CoreApiMessage + public async Task>> FindByPersonNumber(CoreRequestParameters coreRequestParameters, + string personNumber) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PersonPostalAddresses, + RequestRootParameters.PersonId, + personNumber); + var result = await _coreRequest.GetRequestObject>>(endpoint, endpointParameters, null); + return result; + } + + // + /// Calls Core API to Post Address. + /// Default Included: Standard + /// + /// + /// boole + public async Task InsertPersonPostalAddress(PersonPostalAddress request) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PersonPostalAddresses, + RequestRootParameters.PersonId, + request.PersonNumber.ToString()); + var message = new + { + messageBody = request + }; + var jsonBody = JsonConvert.SerializeObject(message); + var result = await _coreRequest.PostRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to Delete Address. + /// Default Included: Standard + /// + /// + /// boole + public async Task RemovePersonPostalAddress(CoreApiMessage request) + { + var endpoint = ReplaceEndpointsPersonIdAndPostalAddressId(request.MessageBody.PersonNumber.ToString(), + request.MessageBody.Id.ToString()); + var jsonBody = JsonConvert.SerializeObject(request); + var result = await _coreRequest.DeleteRequestObject(endpoint, null, jsonBody); + var stringResult = ""; + + //If not null DNA sent back a error object back. We want to serialize and use in error log message. + if (result != null) + { + stringResult = JsonConvert.SerializeObject(result); + } + + return stringResult; + } + + public async Task UpdatePersonAddrLine(CoreApiMessage request) + { + var endpoint = ReplaceEndpointsPersonIdAndAdressUseCode(request.MessageBody.PersonNumber.ToString(), request.MessageBody.AddressUseCode); + + var jsonBody = JsonConvert.SerializeObject(request); + var result = await _coreRequest.PutRequestObject>(endpoint, null, jsonBody); + + return result?.MessageBody; + } + + private string ReplaceEndpointsPersonIdAndPostalAddressId(string personId, string postalAddressId) + { + var endpoint = ReplaceEndpointsPersonId(_coreApiConfiguration.CoreEndPointConfiguration.PersonPostalAddress, personId); + return HttpUtilities.ReplaceRootParameter(endpoint, RequestRootParameters.PostalAddressId, postalAddressId); + } + + private string ReplaceEndpointsPersonIdAndAdressUseCode(string personId, string addressUseCode) + { + var endpoint = ReplaceEndpointsPersonId(_coreApiConfiguration.CoreEndPointConfiguration.PersonAddressLine, personId); + return HttpUtilities.ReplaceRootParameter(endpoint, RequestRootParameters.AddressUseCode, addressUseCode); + } + + private string ReplaceEndpointsPersonId(string endpoint, string personId) + { + return HttpUtilities.ReplaceRootParameter(endpoint, RequestRootParameters.PersonId, personId); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreeDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreeDao.cs new file mode 100644 index 0000000..a195995 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreeDao.cs @@ -0,0 +1,153 @@ +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AgreeDao: IAgreeDao + { + private readonly ICoreDbExecution _coreDbExecution; + private const string AgreeUserByAccountsQuery = "AgreeUserByAccountsQuery"; + private const string AgreeUserByPersonNumberQuery = "AgreeUserByPersonNumberQuery"; + private const string AgreeUserByOrganizationNumberQuery = "AgreeUserByOrganizationNumberQuery"; + + private const string AgreementByUserIdQuery = "Agreement/AgreementByUserIdQuery"; + private const string AgreementByAgreementIdQuery = "Agreement/AgreementByAgreementIdQuery"; + private const string AgreementsByAccountIdQuery = "Agreement/AgreementsByAccountIdQuery"; + + private const string AccountByAccountIdQuery = "Agreement/AccountByAccountIdQuery"; + private const string AccountsByAgreementUserIdQuery = "Agreement/AccountsByAgreementUserIdQuery"; + private const string AccountsByOrganizationIdQuery = "Agreement/AccountsByOrganizationIdQuery"; + private const string AgreementOwnerByAccountsQuery = "Agreement/AgreementOwnerByAccountsQuery"; + + private const string AuditActiveSubActiveForAccountChangesQuery = "Agreement/Audit/AuditActiveSubActiveForAccountChangesQuery"; + private const string AuditActiveSubActiveForAgreementChangesQuery = "Agreement/Audit/AuditActiveSubActiveForAgreementChangesQuery"; + private const string AuditActiveSubActiveForOrganizationChangesQuery = "Agreement/Audit/AuditActiveSubActiveForOrganizationChangesQuery"; + + private const string AccountNumbersHolder = "{AccountNumbersHolder}"; + private const string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + public AgreeDao(ICoreDbExecution coreDbExecution) + { + _coreDbExecution = coreDbExecution; + } + + public async Task> FindAgreeUsersByAccountNumbers(List accountNumbers) + { + var query = QueryUtilities.GetQuery(AgreeUserByAccountsQuery); + var accountNumbersStringList = QueryUtilities.BuildParameterListString(accountNumbers); + var alteredQuery = query.Replace(AccountNumbersHolder, accountNumbersStringList); + + var parameterDictionary = QueryUtilities.BuildDictionaryParameter(accountNumbers); + var result = await _coreDbExecution.ExecuteQuery>(alteredQuery, parameterDictionary); + return result; + } + + public async Task> FindAgreeUserByPersonNumber(long personNumber) + { + var query = QueryUtilities.GetQuery(AgreeUserByPersonNumberQuery); + var personNumberParam = new { personNumber }; + var agreementUser = await _coreDbExecution.ExecuteQuery(query, personNumberParam); + return agreementUser; + } + + public async Task FindAgreeUserByOrganizationNumber(long organizationNumber) + { + var query = QueryUtilities.GetQuery(AgreeUserByOrganizationNumberQuery); + var organizationNumberParam = new { organizationNumber }; + var agreementUser = await _coreDbExecution.ExecuteQuery(query, organizationNumberParam); + return agreementUser.FirstOrDefault(); + } + + public async Task FindAgreementByUserId(string userId) + { + var query = QueryUtilities.GetQuery(AgreementByUserIdQuery); + var userIdParam = new { userId }; + var agreement = await _coreDbExecution.ExecuteQuery(query, userIdParam); + return agreement.FirstOrDefault(); + } + + public async Task FindAgreementByAgreementId(long agreementId) + { + var query = QueryUtilities.GetQuery(AgreementByAgreementIdQuery); + var agreementIdParam = new { agreementId }; + var agreement = await _coreDbExecution.ExecuteQuery(query, agreementIdParam); + return agreement.FirstOrDefault(); + } + + public async Task> FindAgreementsByAccountId(long accountNumber) + { + var query = QueryUtilities.GetQuery(AgreementsByAccountIdQuery); + var accountNumberParams = new { accountNumber }; + return await _coreDbExecution.ExecuteQuery(query, accountNumberParams); + } + + public async Task> FindAgreementAccountsByUserId(string userId) + { + var query = QueryUtilities.GetQuery(AccountsByAgreementUserIdQuery); + var userIdParams = new { userId }; + return await _coreDbExecution.ExecuteQuery(query, userIdParams); + } + + public async Task> FindAgreementAccountsByOrganizationId(long organizationId) + { + var query = QueryUtilities.GetQuery(AccountsByOrganizationIdQuery); + var organizationIdParams = new { organizationId }; + return await _coreDbExecution.ExecuteQuery(query, organizationIdParams); + } + + public async Task FindAgreementAccountByAccountId(long accountNumber) + { + var query = QueryUtilities.GetQuery(AccountByAccountIdQuery); + var accountNumberParams = new { accountNumber }; + var account = await _coreDbExecution.ExecuteQuery(query, accountNumberParams); + return account.FirstOrDefault(); + } + + public async Task> FindAgreementOwnerByAccountNumbers(IEnumerable accountNumbers) + { + var query = QueryUtilities.GetQuery(AgreementOwnerByAccountsQuery); + var accountNumbersStringList = string.Join(",", accountNumbers); + var alteredQuery = query.Replace(AccountNumbersHolder, accountNumbersStringList); + return await _coreDbExecution.ExecuteQuery(alteredQuery, null); + } + + public async Task FindAgreementOwnerByAccountNumber(long accountNumber) + { + var query = QueryUtilities.GetQuery(AgreementOwnerByAccountsQuery); + var alteredQuery = query.Replace(AccountNumbersHolder, accountNumber.ToString()); + var accountOwner = await _coreDbExecution.ExecuteQuery(alteredQuery, null); + return accountOwner.FirstOrDefault(); + } + + public async Task> AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime maintenanceDate) + { + var query = QueryUtilities.GetQuery(AuditActiveSubActiveForAccountChangesQuery); + var dateLastMaintained = maintenanceDate.ToString(DnaTimeFormat); + var maintenanceDateParam = new { dateLastMaintained }; + return await _coreDbExecution.ExecuteQuery(query, maintenanceDateParam); + } + + public async Task> AuditAccountAgreementChangesByDateLastMaintained(DateTime maintenanceDate) + { + var query = QueryUtilities.GetQuery(AuditActiveSubActiveForAgreementChangesQuery); + var dateLastMaintained = maintenanceDate.ToString(DnaTimeFormat); + var maintenanceDateParam = new { dateLastMaintained }; + return await _coreDbExecution.ExecuteQuery(query, maintenanceDateParam); + } + + public async Task> AuditAccountOrganizationChangesByDateLastMaintained(DateTime maintenanceDate) + { + var query = QueryUtilities.GetQuery(AuditActiveSubActiveForOrganizationChangesQuery); + var dateLastMaintained = maintenanceDate.ToString(DnaTimeFormat); + var maintenanceDateParam = new { dateLastMaintained }; + return await _coreDbExecution.ExecuteQuery(query, maintenanceDateParam); + } + + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreePersonDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreePersonDao.cs new file mode 100644 index 0000000..5d1ab26 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AgreePersonDao.cs @@ -0,0 +1,88 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LCU.Library.Internal.ApiSecurity.Enums; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AgreePersonDao : IAgreePersonDao + { + private readonly ICoreDbExecution _coreDbExecution; + private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration; + private readonly ApiSecurityConfiguration _apiSecurityConfiguration; + private readonly IPutRequest _putRequest; + + private const string SoapClientKeyValue = "CoreSoapApiWrapper"; + + private const string AgreePersonByUserIdQuery = "AgreePerson/AgreePersonByUserIdQuery"; + private const string GetAgreePersonsQuery = "AgreePerson/GetAgreePersonsQuery"; + private const string AgreePersonsWithHyphenatedUserIdQuery = "AgreePerson/AgreePersonsWithHyphenatedUserIdQuery"; + private const string GetActiveCustodialAgreePersonNumbers = "AgreePerson/GetActiveCustodialAgreePersonNumbers"; + private const string GetActiveCustodialVruCardAgreementAgreePersons = "AgreePerson/GetActiveCustodialVruCardAgreementAgreePersons"; + + + public AgreePersonDao(ICoreDbExecution coreDbExecution, + CoreConfiguration coreConfiguration, + ApiSecurityConfiguration apiSecurityConfiguration, + IPutRequest putRequest) + { + _coreDbExecution = coreDbExecution; + _coreSoapApiConfiguration = coreConfiguration.CoreSoapApiConfiguration; + _apiSecurityConfiguration = apiSecurityConfiguration; + _putRequest = putRequest; + } + + public async Task FindByUserId(string userId) + { + var query = QueryUtilities.GetQuery(AgreePersonByUserIdQuery); + var userIdParams = new { userId = userId }; + var result = await _coreDbExecution.ExecuteQuery(query, userIdParams); + return result.FirstOrDefault(); + } + + public async Task> FindAgreePersons(int fetchAmount) + { + var query = QueryUtilities.GetQuery(GetAgreePersonsQuery); + var fectAmountParam = new { fetchAmount = fetchAmount }; + var result = await _coreDbExecution.ExecuteQuery(query, fectAmountParam); + return result; + } + + public async Task> FindAgreePersonsWithHyphenatedUserId() + { + var query = QueryUtilities.GetQuery(AgreePersonsWithHyphenatedUserIdQuery); + var result = await _coreDbExecution.ExecuteQuery(query); + return result; + } + + public async Task> FindActiveCustodialAgreePersonNumbers() + { + var query = QueryUtilities.GetQuery(GetActiveCustodialAgreePersonNumbers); + var result = await _coreDbExecution.ExecuteQuery(query); + return result; + } + + public async Task> FindActiveCustodialVruCardAgreementAgreePersons() + { + var query = QueryUtilities.GetQuery(GetActiveCustodialVruCardAgreementAgreePersons); + var result = await _coreDbExecution.ExecuteQuery(query); + return result; + } + + public async Task UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreementDetailTypeRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutPersonAgreementsDetailTypes); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, personAgreementDetailTypeRequest, headers, 0); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ApplicationHistoryDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ApplicationHistoryDao.cs new file mode 100644 index 0000000..5923a22 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ApplicationHistoryDao.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class ApplicationHistoryDao : IApplicationHistoryDao + { + private readonly ICoreDbExecution _coreDbExecution; + private const string ApplHistoryQuery = "ApplHistoryQuery"; + private const string QueApplParamQuery = "QueApplParamQuery"; + private const string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss"; + private const string ApplicationNumbersHolder = "{ApplicationNumbersHolder}"; + + public ApplicationHistoryDao(ICoreDbExecution coreDbExecution) + { + _coreDbExecution = coreDbExecution; + } + + public async Task> FindApplicationHistory(List applicationNumbers, + DateTime effectiveDate) + { + var query = QueryUtilities.GetQuery(ApplHistoryQuery); + var applicationNumberStringList = QueryUtilities.BuildParameterListString(applicationNumbers); + var alteredQuery = query.Replace(ApplicationNumbersHolder, applicationNumberStringList); + + var parameterDictionary = QueryUtilities.BuildDictionaryParameter(applicationNumbers); + parameterDictionary.Add(nameof(effectiveDate), effectiveDate.ToString(DnaTimeFormat)); + + var results = await _coreDbExecution.ExecuteQuery>(alteredQuery, parameterDictionary); + return results; + } + + public async Task> FindApplicationHistoryParameters(List applicationNumbers, + DateTime effectiveDate) + { + var query = QueryUtilities.GetQuery(QueApplParamQuery); + var applicationNumberStringList = QueryUtilities.BuildParameterListString(applicationNumbers); + var alteredQuery = query.Replace(ApplicationNumbersHolder, applicationNumberStringList); + + var parameterDictionary = QueryUtilities.BuildDictionaryParameter(applicationNumbers); + parameterDictionary.Add(nameof(effectiveDate), effectiveDate.ToString(DnaTimeFormat)); + + var results = await _coreDbExecution.ExecuteQuery>(alteredQuery, parameterDictionary); + return results; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AssociateDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AssociateDao.cs new file mode 100644 index 0000000..5538c21 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/AssociateDao.cs @@ -0,0 +1,35 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class AssociateDao : BaseCoreDao, IAssociateDao + { + private const string GetAssociateDetailsBySsnQuery = "Associate/GetAssociateDetailsBySsnQuery"; + + private readonly ICoreDbExecution _coreDbExecution; + + public AssociateDao(ICoreRequest coreRequest, + ICoreDbExecution coreDbExecution) + : base(coreRequest) + { + _coreDbExecution = coreDbExecution; + } + + public async Task GetAssociateDetailsBySsn(string taxId) + { + var query = QueryUtilities.GetQuery(GetAssociateDetailsBySsnQuery); + var queryParameters = new + { + taxId = taxId + }; + + return (await _coreDbExecution.ExecuteQuery(query, queryParameters)).FirstOrDefault(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BaseCoreDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BaseCoreDao.cs new file mode 100644 index 0000000..37eb868 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BaseCoreDao.cs @@ -0,0 +1,14 @@ +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public abstract class BaseCoreDao + { + protected readonly ICoreRequest _coreRequest; + + public BaseCoreDao(ICoreRequest coreRequest) + { + _coreRequest = coreRequest; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BranchDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BranchDao.cs new file mode 100644 index 0000000..8fb7552 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/BranchDao.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class BranchDao : BaseCoreDao, IBranchDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public BranchDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration) + : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to get all branches. + /// Default Included: Graph + /// + /// IEnumerable + public async Task> FindBranches(CoreRequestParameters coreRequestParameters) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var result = await _coreRequest.GetRequestObject>>( + _coreApiConfiguration.CoreEndPointConfiguration.Branches, + endpointParameters); + return result?.MessageBody; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessChannelPersonsDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessChannelPersonsDao.cs new file mode 100644 index 0000000..9db6cd2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessChannelPersonsDao.cs @@ -0,0 +1,15 @@ +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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAccessChannelPersonsDao + { + Task UpdateAccessChannelPerson(CoreApiMessage request); + Task>> FindAccessChannelPersonsByPerson(CoreRequestParameters coreRequestParameters, + AccessChannelPersonsByPersonRequest request); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessTypeDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessTypeDao.cs new file mode 100644 index 0000000..cb412ff --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccessTypeDao.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAccessTypeDao + { + Task UpdateAccessType(CoreApiMessage request, string accessChannelPersonId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountDao.cs new file mode 100644 index 0000000..90474e6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountDao.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using CoreRequest = LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Collaterals; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAccountDao + { + Task> FindByMemberAgreeNbr(CoreRequestParameters coreRequestParameters, MemberAgreeNbrRequest request); + Task FindByAcctNbr(CoreRequestParameters coreRequestParameters, AcctNbrRequest request); + Task> FindCollateralById(CoreRequestParameters coreRequestParameters, string accountId); + Task PutAccountMaintenanceRequest(IEnumerable accountMaintenanceRequests); + Task> GetActivityAccountDetailsByAccountNumbers(List accountNumbers); + Task> FindAdminBranchCodeChangeAccountNumbers(); + Task> FindVipSavingsToFund(); + Task> FindAccountsToUpdateAccountAnalysis(); + Task UpdateAccountAnalysis(AccountAnalysisGroupMaintenanceRequest accountAnalysisGroupMaintenanceRequest); + Task UpdateAccountBranch(AccountBranchUpdateRequest accountBranchUpdateRequest); + Task UpdateAccountLoanToValue(AccountLtvUpdateRequest accountLtvUpdateRequest); + Task UpdateAccountNickName(AccountNickNameUpdateRequest accountNickNameUpdateRequest); + Task UpdateAccountContractDate(AccountContractDateUpdateRequest accountContractDateUpdateRequest); + Task> FindOwnersByAccountNumber(long accountNumber, DateTime createdDate); + Task> FindPrimaryOwnersByOrganizationName(string organizationName); + Task> FindPrimaryOwnersByPersonName(string personName); + Task AddPersonAccount(CreatePersonAccountRequest createPersonAccountRequest); + Task AddOrganizationAccount(CreateOrganizationAccountRequest createOrganizationAccountRequest); + Task PutOrganizationMaintenanceRequest(OrganizationMaintenanceRequest organziationMaintenanceRequest); + Task UpdateAccountCreditReportType(AccountCreditReportTypeUpdateRequest accountCreditReportTypeUpdateRequest); + Task> GetAccountsByMajorMinorBranchAndStatus(AccountsByMajorMinorBranchAndStatusRequest request); + Task> GetAccountsByRecentTransactions(AccountsByRecentTransactionsRequest request); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountHistoryDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountHistoryDao.cs new file mode 100644 index 0000000..74fdb6e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountHistoryDao.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAccountHistoryDao + { + Task> GetChargeoffDateTimesByAccountNumber(string accountNumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountUserFieldDao.cs new file mode 100644 index 0000000..fba7a28 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAccountUserFieldDao.cs @@ -0,0 +1,18 @@ +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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAccountUserFieldDao + { + Task UpdateAccountUserField(CoreApiMessage accountUserFieldUpdateRequest, + string accountId, + string userFieldId); + Task InsertAccountUserField(CoreApiMessage accountUserFieldUpdateRequest, + string accountId); + Task>> FindAccountUserFieldCoreApiResponseByAccountId(CoreRequestParameters coreRequestParameters, string accountId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IActivityDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IActivityDao.cs new file mode 100644 index 0000000..1bce9ea --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IActivityDao.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IActivityDao + { + Task> GetNewCheckingActivitiesNewerThanDate(DateTime newerThanDateTime, int limitAmount); + Task> GetNewCheckingActivitiesAfterActivityNbr(long afterActivityNumber, int limitAmount); + Task> GetNewCheckingActivities(DateTime newerThanDateTime, long afterActivityNumber, int limitAmount); + Task> GetNewDigitalBankingCheckingActivitiesNewerThanDate(DateTime newerThanDateTime, int limitAmount); + Task> GetNewDigitalBankingCheckingActivitiesAfterActivityNbr(long afterActivityNumber, int limitAmount); + Task> GetNewDigitalBankingCheckingActivities(DateTime newerThanDateTime, long afterActivityNumber, int limitAmount); + Task> GetNewAtmCheckCardActivitiesNewerThanDate(DateTime newerThanDateTime, int limitAmount); + Task> GetNewAtmCheckCardActivitiesAfterActivityNbr(long afterActivityNumber, int limitAmount); + Task> GetNewAtmCheckCardActivities(DateTime newerThanDateTime, long afterActivityNumber, int limitAmount); + Task> GetNewActivityManagerReferralsNewerThan(DateTime newerThanOriginationDateTime); + Task> GetNewActivityManagerReferralsAfterActivityId(long afterActivityId); + Task> GetNewActivityManagerReferrals(DateTime newerThanOriginationDateTime, long afterActivityId); + Task> GetNewMortgageSaleActivities(DateTime? newerThanDateTime, long? afterActivityNumber); + Task> GetNewVehicleSaleActivities(DateTime? newerThanDateTime, long? afterActivityNumber); + Task> GetNewDebtProtectedLoanSaleActivities(DateTime? newerThanDateTime, long? afterActivityNumber); + Task> QueryActivityManagerActivity(ActivityQueryRequest request); + Task> GetEStatementDeliveryActivity(DateTime? newerThanDateTime); + Task> GetPersonActivityByPhoneNumber(string phoneNumber); + Task GetPersonActivityByPersonNumber(string personNumber); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAddressDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAddressDao.cs new file mode 100644 index 0000000..0df784f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAddressDao.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAddressDao + { + Task> FindByPersonNumberAddressNumber(CoreRequestParameters coreRequestParameters, + string personId, + string postalAddressId); + Task>> FindByPersonNumber(CoreRequestParameters coreRequestParameters, + string personNumber); + Task InsertPersonPostalAddress(PersonPostalAddress request); + Task RemovePersonPostalAddress(CoreApiMessage request); + Task UpdatePersonAddrLine(CoreApiMessage request); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreeDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreeDao.cs new file mode 100644 index 0000000..cd9827e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreeDao.cs @@ -0,0 +1,39 @@ +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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAgreeDao + { + Task> FindAgreeUsersByAccountNumbers(List accountNumbers); + + Task> FindAgreeUserByPersonNumber(long personNumber); + + Task FindAgreeUserByOrganizationNumber(long organizationNumber); + + Task FindAgreementByUserId(string userId); + + Task FindAgreementByAgreementId(long agreementId); + + Task> FindAgreementsByAccountId(long accountNumber); + + Task> FindAgreementAccountsByUserId(string userId); + + Task> FindAgreementAccountsByOrganizationId(long organizationId); + + Task FindAgreementAccountByAccountId(long accountId); + + Task> FindAgreementOwnerByAccountNumbers(IEnumerable accountNumber); + + Task FindAgreementOwnerByAccountNumber(long accountNumber); + + Task> AuditAccountDeliveryMethodAndOwnerChangesByDateLastMaintained(DateTime maintenanceDate); + + Task> AuditAccountAgreementChangesByDateLastMaintained(DateTime maintenanceDate); + + Task> AuditAccountOrganizationChangesByDateLastMaintained(DateTime maintenanceDate); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreePersonDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreePersonDao.cs new file mode 100644 index 0000000..366e7f6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAgreePersonDao.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAgreePersonDao + { + Task FindByUserId(string userId); + Task> FindAgreePersons(int fetchAmount); + Task> FindAgreePersonsWithHyphenatedUserId(); + Task> FindActiveCustodialAgreePersonNumbers(); + Task> FindActiveCustodialVruCardAgreementAgreePersons(); + Task UpdatePersonAgreementDetailTypes(PersonAgreementDetailTypeRequest personAgreeementDetailTypeRequest); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IApplicationHistoryDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IApplicationHistoryDao.cs new file mode 100644 index 0000000..5178ec7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IApplicationHistoryDao.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IApplicationHistoryDao + { + Task> FindApplicationHistory(List applicationNumbers, + DateTime effectiveDate); + Task> FindApplicationHistoryParameters(List applicationNumbers, + DateTime effectiveDate); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAssociateDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAssociateDao.cs new file mode 100644 index 0000000..475106f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IAssociateDao.cs @@ -0,0 +1,11 @@ +using System; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IAssociateDao + { + Task GetAssociateDetailsBySsn(string taxId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IBranchDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IBranchDao.cs new file mode 100644 index 0000000..9193aa2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IBranchDao.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IBranchDao + { + Task> FindBranches(CoreRequestParameters coreRequestParameters); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IIndirectLoanDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IIndirectLoanDao.cs new file mode 100644 index 0000000..960ab61 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IIndirectLoanDao.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IIndirectLoanDao + { + Task> FindByAccountNumber(long accountNumber); + + Task> FindByPostedDate(DateTime newerThanDateTime); + + Task> FindClosedByPostedDate(DateTime newerThanDateTime); + + Task> FindClosedWithDetailByPostedDate(DateTime newerThanDateTime); + + Task> UpdateDealerOriginalBalance(string accountNumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IOrganizationDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IOrganizationDao.cs new file mode 100644 index 0000000..e1ed95f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IOrganizationDao.cs @@ -0,0 +1,17 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IOrganizationDao + { + Task FindOrganizationByMemberAgreeNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest organizationRequest); + + Task> FindByOrganizationsSearch(CoreRequestParameters coreRequestParameters, OrganizationSearchRequest searchRequest); + Task CountOrganizationNumbersByName(string name); + Task> FindOrganizationNumbersByNameSearch(string name, int limit); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonDao.cs new file mode 100644 index 0000000..0d455ac --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonDao.cs @@ -0,0 +1,17 @@ +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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IPersonDao + { + Task> FindByPersonsName(CoreRequestParameters coreRequestParameters, PersonNameRequest personRequest); + Task> FindByPersonsSearch(CoreRequestParameters coreRequestParameters, PersonSearchRequest personRequest); + Task FindByPersonMemberAgreementNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest personRequest); + Task> GetPersonNumbersByNameLike(string firstName, string middleName, string lastName, int limit); + Task CountPersonsByNameLike(string firstName, string middleName, string lastName); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonUserFieldDao.cs new file mode 100644 index 0000000..b34ecef --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPersonUserFieldDao.cs @@ -0,0 +1,23 @@ +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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IPersonUserFieldDao + { + Task InsertPersonUserField(CoreApiMessage personUserFieldRequest, + int personId); + + Task UpdatePersonUserField(CoreApiMessage personUserFieldUpdateRequest, + int personId, + string userFieldId); + + Task>> FindPersonUserFieldCoreApiResponseByPersonId(CoreRequestParameters coreRequestParameters, int personId); + + Task> FindPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyDao.cs new file mode 100644 index 0000000..fb3ae65 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyDao.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IPropertyDao + { + Task FindProperty(long propertynumber); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyUserFieldDao.cs new file mode 100644 index 0000000..838cfeb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IPropertyUserFieldDao.cs @@ -0,0 +1,16 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface IPropertyUserFieldDao + { + Task InsertPropertyUserField(UserFieldRequest request); + Task UpdatePropertyUserField(UserFieldRequest request); + Task>> FindPropertyUserFieldCoreApiResponseByPersonId(CoreRequestParameters coreRequestParameters, int propertyId); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ISafDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ISafDao.cs new file mode 100644 index 0000000..1ff6492 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ISafDao.cs @@ -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.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface ISafDao + { + public Task> GetAllSafUsersCoreInfo(); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITaxDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITaxDao.cs new file mode 100644 index 0000000..4ec1ddf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITaxDao.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface ITaxDao + { + /// + /// Calls Core API and provides a peron's taxId to get taxIdData against. + /// + /// + /// + Task> GetPersonTaxIdData(CoreRequestParameters coreRequestParameters, string taxId); + + /// + /// Calls Core API and provides an organization's taxId to get taxIdData against. + /// + /// + /// + Task> GetOrganizationTaxIdData(CoreRequestParameters coreRequestParameters, string taxId); + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITransactionDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITransactionDao.cs new file mode 100644 index 0000000..9dad715 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/ITransactionDao.cs @@ -0,0 +1,22 @@ +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.CoreResponses; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface ITransactionDao + { + Task> FindTransactionHistoryById(CoreRequestParameters coreRequestParameters, + TransactionHistoryRequest request, + string accountId); + Task> AddMonetaryTransactions(List requests); + Task> FindExternalDescriptionsWithSsn(); + void UpdateExternalDescription(ExternalDescription externalTransactionDescription); + Task> PostFundsToAccount(List requests); + Task> GetTransactionsByDateSpan(DateTime startDateRange, DateTime endDateRange, string rtxnTypCdToExcludeParams, string rtxnTypCdToExcludeVerify); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IndirectLoanDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IndirectLoanDao.cs new file mode 100644 index 0000000..6183564 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/IndirectLoanDao.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.ApiSecurity.Enums; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class IndirectLoanDao : IIndirectLoanDao + { + private readonly ICoreDbExecution _coreDbExecution; + private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration; + private readonly ApiSecurityConfiguration _apiSecurityConfiguration; + private readonly IPutRequest _putRequest; + + private const string SoapClientKeyValue = "CoreSoapApiWrapper"; + + private const string indirectLoanByAcctNbrQuery = "IndirectLoan/IndirectLoan_ByAcctNbr_Query"; + private const string indirectLoanByPostedDateQuery = "IndirectLoan/IndirectLoan_ByPostedDate_Query"; + private const string closedIndirectLoanByPostedDateQuery = "IndirectLoan/ClosedIndirectLoan_ByPostedDate_Query"; + private const string closedIndirectLoanWithDetailByPostedDateQuery = "IndirectLoan/ClosedIndirectLoanWithDetail_ByPostedDate_Query"; + private const string DnaTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + public IndirectLoanDao(ICoreDbExecution coreDbExecution, + CoreConfiguration coreConfiguration, + ApiSecurityConfiguration apiSecurityConfiguration, + IPutRequest putRequest) + { + _coreSoapApiConfiguration = coreConfiguration.CoreSoapApiConfiguration; + _coreDbExecution = coreDbExecution; + _apiSecurityConfiguration = apiSecurityConfiguration; + _putRequest = putRequest; + } + + /// + /// Searches for indirect loans based on account number using SQL query. + /// Default Included: Graph + /// + /// + /// IEnumerable + public async Task> FindByAccountNumber(long accountNumber) + { + var query = QueryUtilities.GetQuery(indirectLoanByAcctNbrQuery); + var accountNumberParam = new { AcctNbr = accountNumber }; + var results = await _coreDbExecution.ExecuteQuery(query, accountNumberParam); + return results; + } + + /// + /// Searches for indirect loans with posted date greater than the parameter using SQL query. + /// Default Included: Graph + /// + /// + /// IEnumerable + public async Task> FindByPostedDate(DateTime newerThanDateTime) + { + var query = QueryUtilities.GetQuery(indirectLoanByPostedDateQuery); + var newerThanDateTimeParam = new { newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat) }; + var results = await _coreDbExecution.ExecuteQuery(query, newerThanDateTimeParam); + return results; + } + + /// + /// Searches for closed indirect loans with closed date greater than the parameter using SQL query. + /// Default Included: Graph + /// + /// + /// IEnumerable + public async Task> FindClosedByPostedDate(DateTime newerThanDateTime) + { + var query = QueryUtilities.GetQuery(closedIndirectLoanByPostedDateQuery); + var newerThanDateTimeParam = new { newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat) }; + var results = await _coreDbExecution.ExecuteQuery(query, newerThanDateTimeParam); + return results; + } + + /// + /// Searches for closed indirect loans with detail with closed date greater than the parameter using SQL query. + /// Default Included: Graph + /// + /// + /// IEnumerable + public async Task> FindClosedWithDetailByPostedDate(DateTime newerThanDateTime) + { + var query = QueryUtilities.GetQuery(closedIndirectLoanWithDetailByPostedDateQuery); + var newerThanDateTimeParam = new { newerThanDateTime = newerThanDateTime.ToString(DnaTimeFormat) }; + var results = await _coreDbExecution.ExecuteQuery(query, newerThanDateTimeParam); + return results; + } + + public async Task> UpdateDealerOriginalBalance(string accountNumber) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutDealerOriginalBalance + $"?accountNumber={accountNumber}"); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async>(endpoint, null, headers, 0); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/ILoanPayoffDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/ILoanPayoffDao.cs new file mode 100644 index 0000000..06f1559 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/ILoanPayoffDao.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.LoanPayoff; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public interface ILoanPayoffDao + { + Task> GetLoanPayoffByAccountNumber(long accountNumber, string dateRange); + Task> GetLoanPayoffByVIN(string VIN, string dateRange); + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/LoanPayoffDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/LoanPayoffDao.cs new file mode 100644 index 0000000..45ac6da --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/LoanPayoff/LoanPayoffDao.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.LoanPayoff; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class LoanPayoffDao : BaseCoreDao, ILoanPayoffDao + { + private readonly ICoreDbExecution _coreDbExecution; + + public LoanPayoffDao(ICoreRequest coreRequest, CoreConfiguration coreConfiguration, ICoreDbExecution coreDbExecution) : base(coreRequest) + { + _coreDbExecution = coreDbExecution; + } + + public async Task> GetLoanPayoffByAccountNumber(long accountNumber, string dateRange) + { + var query = QueryUtilities.GetQuery("LoanPayoff/LoanPayoffByAccountNumberQuery"); + var accountActivityParams = new + { + dateRange = dateRange, + accountNumber = accountNumber + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + + public async Task> GetLoanPayoffByVIN(string VIN, string dateRange) + { + var query = QueryUtilities.GetQuery("LoanPayoff/LoanPayoffByVINQuery"); + var accountActivityParams = new + { + dateRange = dateRange, + VIN = VIN + + }; + var results = + await _coreDbExecution.ExecuteQuery(query, accountActivityParams); + return results.ToList(); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/OrganizationDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/OrganizationDao.cs new file mode 100644 index 0000000..8f68490 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/OrganizationDao.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; +using System.Linq; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class OrganizationDao : BaseCoreDao, IOrganizationDao + { + private const string OrganizationByNameLikeCount = "Organization/OrganizationByNameLikeCount"; + private const string OrganizationNumberByNameLikeQuery = "Organization/OrganizationNumberByNameLikeQuery"; + + private readonly CoreApiConfiguration _coreApiConfiguration; + private readonly ICoreDbExecution _coreDb; + + public OrganizationDao + ( + ICoreRequest coreRequest, + CoreConfiguration coreConfiguration, + ICoreDbExecution coreDbExecution + ) + : base(coreRequest) + { + _coreApiConfiguration = coreConfiguration.CoreApiConfiguration; + _coreDb = coreDbExecution; + } + + /// + /// Calls Core API to search based on any field in the OrganizationSearchRequest properties. + /// + /// + /// + /// IEnumerable + public async Task> FindByOrganizationsSearch(CoreRequestParameters coreRequestParameters, OrganizationSearchRequest searchRequest) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(searchRequest); + var result = await _coreRequest.PostRequestObject>>(_coreApiConfiguration.CoreEndPointConfiguration.OrganizationQuerySearch, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search based on MemberAgreementNbrRequest property. + /// Default Included: Graph + /// + /// + /// + /// Organization + public async Task FindOrganizationByMemberAgreeNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest organizationRequest) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(organizationRequest); + var result = await _coreRequest.PostRequestObject>( + _coreApiConfiguration.CoreEndPointConfiguration.OrganizationsQueryMemberAgreementNbr, + endpointParameters, + jsonBody); + + return result?.MessageBody; + } + + public async Task CountOrganizationNumbersByName(string name) + { + var query = QueryUtilities.GetQuery(OrganizationByNameLikeCount); + var queryParameters = new { + organizationName = name.ToLowerInvariant() + }; + + return (await _coreDb.ExecuteQuery(query, queryParameters)).Single(); + } + + public async Task> FindOrganizationNumbersByNameSearch(string name, int limit) + { + var query = QueryUtilities.GetQuery(OrganizationNumberByNameLikeQuery); + var queryParameters = new { + organizationName = name.ToLowerInvariant(), + limit + }; + + return await _coreDb.ExecuteQuery(query, queryParameters); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonDao.cs new file mode 100644 index 0000000..6eea04a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonDao.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class PersonDao : BaseCoreDao, IPersonDao + { + private const string PersonByNameLikeCount = "Person/PersonByNameLikeCount"; + private const string PersonNumberByNameLikeQuery = "Person/PersonNumberByNameLikeQuery"; + + private readonly ICoreDbExecution _coreDbExecution; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public PersonDao(ICoreRequest coreRequest, + ICoreDbExecution coreDbExecution, + CoreConfiguration coreConfiguration) + : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _coreDbExecution = coreDbExecution; + } + + /// + /// Calls Core API to search based on any or any number of the PersonNameRequest properties. + /// Default Included: Graph + /// + /// + /// + /// IEnumerable + public async Task> FindByPersonsName(CoreRequestParameters coreRequestParameters, PersonNameRequest personRequest) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + var result = await _coreRequest.PostRequestObject>>( + _coreApiConfiguration.CoreEndPointConfiguration.PersonsQueryName, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search based on any or any number of the PersonSearchRequest properties. + /// Default Included: EmailAddresses, OrgRelationships, PersonInfo, PersonPhonesCard, PostalAddresses + /// + /// + /// + /// IEnumerable + public async Task> FindByPersonsSearch(CoreRequestParameters coreRequestParameters, PersonSearchRequest personRequest) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + var result = await _coreRequest.PostRequestObject>>(_coreApiConfiguration.CoreEndPointConfiguration.PersonsQuerySearch, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + /// + /// Calls Core API to search based on MemberAgreementNbrRequest property. + /// Default Included: Graph + /// + /// + /// + /// Person + public async Task FindByPersonMemberAgreementNbr(CoreRequestParameters coreRequestParameters, MemberNbrRequest personRequest) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(personRequest); + var result = await _coreRequest.PostRequestObject>( + _coreApiConfiguration.CoreEndPointConfiguration.PersonsQueryMemberAgreementNbr, + endpointParameters, + jsonBody); + return result?.MessageBody; + } + + public async Task> GetPersonNumbersByNameLike(string firstName, string middleName, string lastName, int limit) + { + var query = QueryUtilities.GetQuery(PersonNumberByNameLikeQuery); + var queryParameters = new { + firstName = firstName?.ToLowerInvariant(), + middleName = middleName?.ToLowerInvariant(), + lastName = lastName?.ToLowerInvariant(), + limit + }; + + return await _coreDbExecution.ExecuteQuery(query, queryParameters); + } + + public async Task CountPersonsByNameLike(string firstName, string middleName, string lastName) + { + var query = QueryUtilities.GetQuery(PersonByNameLikeCount); + var queryParameters = new { + firstName = firstName?.ToLowerInvariant(), + middleName = middleName?.ToLowerInvariant(), + lastName = lastName?.ToLowerInvariant() + }; + + return (await _coreDbExecution.ExecuteQuery(query, queryParameters)).Single(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonUserFieldDao.cs new file mode 100644 index 0000000..ffc04d3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PersonUserFieldDao.cs @@ -0,0 +1,78 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using System; +using Newtonsoft.Json; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class PersonUserFieldDao : BaseCoreDao, IPersonUserFieldDao + { + private readonly ICoreDbExecution _coreDbExecution; + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + private const string GetPersonsForCheckHoldsUpdate = "Person/GetPersonsForCheckHoldsUpdate"; + private const string DnaTimeFormat = "MM-dd-yyyy HH:mm:ss"; + + public PersonUserFieldDao(ICoreRequest coreRequest, CoreConfiguration coreConfiguration, ICoreDbExecution coreDbExecution) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _coreDbExecution = coreDbExecution; + } + + public async Task UpdatePersonUserField(CoreApiMessage personUserFieldUpdateRequest, + int personId, + string userFieldId) + { + var strPersonId = JsonConvert.ToString(personId); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PutPersonUserField, + RequestRootParameters.PersonId, + strPersonId); + endpoint = HttpUtilities.ReplaceRootParameter(endpoint, RequestRootParameters.UserFieldId, userFieldId); + var jsonBody = JsonConvert.SerializeObject(personUserFieldUpdateRequest); + var result = await _coreRequest.PutRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + public async Task InsertPersonUserField(CoreApiMessage personUserFieldRequest, + int personId) + { + var strPersonId = JsonConvert.ToString(personId); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PersonUserFields, + RequestRootParameters.PersonId, + strPersonId); + var jsonBody = JsonConvert.SerializeObject(personUserFieldRequest); + var result = await _coreRequest.PostRequestObject>(endpoint, null, jsonBody); + return result?.MessageBody; + } + + public async Task>> FindPersonUserFieldCoreApiResponseByPersonId(CoreRequestParameters coreRequestParameters, int personId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PersonUserFields, + RequestRootParameters.PersonId, + JsonConvert.ToString(personId)); + return await _coreRequest.GetRequestObject>>(endpoint, endpointParameters); + } + + public async Task> FindPersonsForAtmCheckHolds(DateTime? resetStartDate, DateTime? resetEndDate) + { + var query = QueryUtilities.GetQuery(GetPersonsForCheckHoldsUpdate); + var personUserFieldDateParams = new + { + ResetStartDate = resetStartDate?.ToString(DnaTimeFormat), //to indicate the start and end date to reset user field values + ResetEndDate = resetEndDate?.ToString(DnaTimeFormat) + }; + + return await _coreDbExecution.ExecuteQuery(query, personUserFieldDateParams); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyDao.cs new file mode 100644 index 0000000..303df9f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyDao.cs @@ -0,0 +1,38 @@ +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperModel.Constants; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class PropertyDao : BaseCoreDao, IPropertyDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + + public PropertyDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration) + : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + } + + /// + /// Calls Core API to get all property by propertynumber. + /// Default Included: Graph, Standard + /// + /// Property + public async Task FindProperty(long propertynumber) + { + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PropertyById, + RequestRootParameters.PropertyNumber, + propertynumber.ToString()); + var result = await _coreRequest.GetRequestObject>(endpoint, null); + return result?.MessageBody; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyUserFieldDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyUserFieldDao.cs new file mode 100644 index 0000000..4a1a1ff --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/PropertyUserFieldDao.cs @@ -0,0 +1,72 @@ +using Newtonsoft.Json; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.ApiSecurity.Enums; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +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.LcuHttpClient.HttpRequest; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class PropertyUserFieldDao : BaseCoreDao, IPropertyUserFieldDao + { + private readonly CoreConfiguration _coreConfiguration; + private readonly CoreApiConfiguration _coreApiConfiguration; + private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration; + private readonly ApiSecurityConfiguration _apiSecurityConfiguration; + private readonly IPostRequest _postRequest; + private readonly IPutRequest _putRequest; + + private const string SoapClientKeyValue = "CoreSoapApiWrapper"; + + public PropertyUserFieldDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration, + ApiSecurityConfiguration apiSecurityConfiguration, + IPostRequest postRequest, + IPutRequest putRequest) : base(coreRequest) + { + _coreConfiguration = coreConfiguration; + _apiSecurityConfiguration = apiSecurityConfiguration; + _coreApiConfiguration = _coreConfiguration.CoreApiConfiguration; + _coreSoapApiConfiguration = _coreConfiguration.CoreSoapApiConfiguration; + _postRequest = postRequest; + _putRequest = putRequest; + } + + public async Task>> FindPropertyUserFieldCoreApiResponseByPersonId(CoreRequestParameters coreRequestParameters, int propertyId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.PropertyUserFields, + RequestRootParameters.PropertyNumber, + JsonConvert.ToString(propertyId)); + return await _coreRequest.GetRequestObject>>(endpoint, endpointParameters); + } + + /// + /// Calls Core Soap API post to create a new user field. + /// + /// + public async Task InsertPropertyUserField(UserFieldRequest userFieldRequest) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostPropertyUserField); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _postRequest.Async(endpoint, userFieldRequest, headers, 0); + } + + public async Task UpdatePropertyUserField(UserFieldRequest request) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PutPropertyUserField); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _putRequest.Async(endpoint, request, headers, 0); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/SafDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/SafDao.cs new file mode 100644 index 0000000..ef4767e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/SafDao.cs @@ -0,0 +1,25 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Saf; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class SafDao : ISafDao + { + private readonly ICoreDbExecution _coreDbExecution; + private const string GetAllSafUserInfoQuery = "Saf/GetAllSafUserInfo"; + + public SafDao(ICoreDbExecution coreDbExecution) + { + _coreDbExecution = coreDbExecution; + } + public async Task> GetAllSafUsersCoreInfo() + { + var query = QueryUtilities.GetQuery(GetAllSafUserInfoQuery); + return await _coreDbExecution.ExecuteQuery(query); + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TaxDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TaxDao.cs new file mode 100644 index 0000000..01aea2d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TaxDao.cs @@ -0,0 +1,42 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + + public class TaxDao : BaseCoreDao, ITaxDao + { + private readonly CoreApiConfiguration _coreApiConfiguration; + + public TaxDao(ICoreRequest coreRequest, CoreConfiguration coreConfiguration) : base(coreRequest) + { + _coreApiConfiguration = coreConfiguration.CoreApiConfiguration; + } + + public async Task> GetPersonTaxIdData(CoreRequestParameters coreRequestParameters, string taxId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + + var endpoint = _coreApiConfiguration.CoreEndPointConfiguration.GetPersonsDataByTaxId; + var request = HttpUtilities.BuildJsonOfNonNullProperties(new TaxIdRequest { TaxId = taxId }); + var response = await _coreRequest.PostRequestObject>>(endpoint, endpointParameters, request); + return response?.MessageBody; + } + + public async Task> GetOrganizationTaxIdData(CoreRequestParameters coreRequestParameters, string taxId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + + var endpoint = _coreApiConfiguration.CoreEndPointConfiguration.GetOrganizationsDataByTaxId; + var request = HttpUtilities.BuildJsonOfNonNullProperties(new TaxIdRequest { TaxId = taxId }); + var response = await _coreRequest.PostRequestObject>>(endpoint, endpointParameters, request); + return response?.MessageBody; + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TransactionDao.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TransactionDao.cs new file mode 100644 index 0000000..2faec1f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/DataAccess/TransactionDao.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using LCU.Library.Internal.ApiSecurity.Enums; +using LCU.Library.Internal.ApiSecurity.Models; +using LCU.Library.Internal.CoreApiWrapperLib.Configuration; +using LCU.Library.Internal.CoreApiWrapperLib.CoreApiUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.CoreDbUtilities; +using LCU.Library.Internal.CoreApiWrapperLib.Utilities; +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.Transaction; +using LCU.Library.Internal.LcuHttpClient.HttpRequest; + +namespace LCU.Library.Internal.CoreApiWrapperLib.DataAccess +{ + public class TransactionDao : BaseCoreDao, ITransactionDao + { + private readonly CoreApiConfiguration _coreApiConfiguration; + private readonly CoreSoapApiConfiguration _coreSoapApiConfiguration; + private readonly ApiSecurityConfiguration _apiSecurityConfiguration; + private readonly ICoreDbExecution _coreDbExecution; + private readonly IPostRequest _postRequest; + + private const string SoapClientKeyValue = "CoreSoapApiWrapper"; + + private const string GetExternalDescriptionsWithSSNQuery = "Transaction/GetExternalDescriptionsWithSSNQuery"; + private const string UpdateExternalDescriptionQuery = "Transaction/UpdateExternalDescriptionQuery"; + private const string GetTransactionsByDateSpanQuery = "Transaction/GetTransactionsByDateSpanQuery"; + + private const string RtxnTypCdQueryVerifyHolder = "{RtxnTypCdQueryVerifyHolder}"; + private const string RtxnTypCdQueryParamHolder = "{RtxnTypCdQueryParamHolder}"; + + public TransactionDao(ICoreRequest coreRequest, + CoreConfiguration coreConfiguration, + ApiSecurityConfiguration apiSecurityConfiguration, + ICoreDbExecution coreDbExecution, + IPostRequest postRequest) : base(coreRequest) + { + _coreApiConfiguration = coreConfiguration.CoreApiConfiguration; + _coreSoapApiConfiguration = coreConfiguration.CoreSoapApiConfiguration; + _apiSecurityConfiguration = apiSecurityConfiguration; + _coreDbExecution = coreDbExecution; + _postRequest = postRequest; + } + + /// + /// Calls Core API to search based the AccountId and filled out TransactionHistoryRequest model. + /// Default Included: Standard, Graph + /// + /// + /// + /// + /// IEnumerable + public async Task> FindTransactionHistoryById(CoreRequestParameters coreRequestParameters, + TransactionHistoryRequest request, + string accountId) + { + var endpointParameters = HttpUtilities.BuildDictionaryOfNonNullValues(coreRequestParameters); + var endpoint = HttpUtilities.ReplaceRootParameter(_coreApiConfiguration.CoreEndPointConfiguration.AccountsTransactionHistoryQueryAccountNumber, + RequestRootParameters.AccountId, + accountId); + var jsonBody = HttpUtilities.BuildJsonOfNonNullProperties(request); + var result = await _coreRequest.PostRequestObject>>( + endpoint, endpointParameters, jsonBody); + return result?.MessageBody; + } + + public async Task> AddMonetaryTransactions(List monetaryTransactionRequests) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostMonetaryTransactions); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _postRequest.Async, List>(endpoint, monetaryTransactionRequests, headers, 0); + } + + public async Task> FindExternalDescriptionsWithSsn() + { + var query = QueryUtilities.GetQuery(GetExternalDescriptionsWithSSNQuery); + return await _coreDbExecution.ExecuteQuery(query); + } + + public async Task> PostFundsToAccount(List fundsToAccount) + { + var endpoint = HttpUtilities.BuildHttpsUri(_coreSoapApiConfiguration.CoreSoapApiWrapperHost, _coreSoapApiConfiguration.CoreSoapEndpointConfiguration.PostFundsToAccount); + var headers = LcuHttpClient.Utilities.HttpUtilities.GetApiKeyHeaders(SoapClientKeyValue, _apiSecurityConfiguration.ExtractApiKey(SoapClientKeyValue, ApiKeySetName.InternalKeySet)); + + return await _postRequest.Async, List>(endpoint, fundsToAccount, headers, 0); + } + + /// + /// Note: ExecuteQuery does not return anything when running an Update statement. + /// + /// + public void UpdateExternalDescription(ExternalDescription externalTransactionDescription) + { + var query = QueryUtilities.GetQuery(UpdateExternalDescriptionQuery); + var param = new + { + externaldescriptionnumber = externalTransactionDescription.ExternalDescriptionNumber, + externaldescriptiontext = externalTransactionDescription.ExternalDescriptionText + }; + var result = _coreDbExecution.ExecuteQuery(query, param).Result; + } + + public async Task> GetTransactionsByDateSpan(DateTime startDateRange, + DateTime endDateRange, + string rtxnTypCdToExcludeParams, + string rtxnTypCdToExcludeVerify) + { + var query = QueryUtilities.GetQuery(GetTransactionsByDateSpanQuery); + var alteredQuery = query.Replace(RtxnTypCdQueryVerifyHolder, rtxnTypCdToExcludeVerify)//; + .Replace(RtxnTypCdQueryParamHolder, rtxnTypCdToExcludeParams); + var param = new + { + startDateTime = startDateRange.ToString("yyyy-MM-dd HH:mm:ss"), + endDateTime = endDateRange.ToString("yyyy-MM-dd HH:mm:ss") + }; + + return await _coreDbExecution.ExecuteQuery(alteredQuery, param); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/AccountMaintenanceRequestException.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/AccountMaintenanceRequestException.cs new file mode 100644 index 0000000..6c747ea --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/AccountMaintenanceRequestException.cs @@ -0,0 +1,11 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Exceptions +{ + public class AccountMaintenanceRequestException : Exception + { + public AccountMaintenanceRequestException(string message) : base(message) + { + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/FailedToParseException.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/FailedToParseException.cs new file mode 100644 index 0000000..1616651 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/FailedToParseException.cs @@ -0,0 +1,11 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Exceptions +{ + public class FailedToParseException : Exception + { + public FailedToParseException(string message) : base(message) + { + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/UnauthorizedRequestException.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/UnauthorizedRequestException.cs new file mode 100644 index 0000000..626361c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Exceptions/UnauthorizedRequestException.cs @@ -0,0 +1,11 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Exceptions +{ + public class UnauthorizedRequestException : Exception + { + public UnauthorizedRequestException(string message) : base(message) + { + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/LCU.Library.Internal.CoreApiWrapperLib.csproj b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/LCU.Library.Internal.CoreApiWrapperLib.csproj new file mode 100644 index 0000000..23ceea5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/LCU.Library.Internal.CoreApiWrapperLib.csproj @@ -0,0 +1,359 @@ + + + net8.0 + false + 4.1.9 + + 1.0.0 - Initial Setup + 1.1.0 - Added Configurations models and ConnectionModels related to core rather than being pulled from CoreApiWrapperModels prj. + 1.1.1 - Added Indirect loan controller methods for exporting information + 1.1.2 - Added IndirectLoanController method for getting closed loans + 1.1.3 - Creation of the ApplicationHistoryDao, ApplHhistoryQuery, and addition of QueryUtitilies to help add generic list of params to query. + 1.1.4 - Update to IndirectLoanDetail model + 1.1.5 - Update to InidrectLoanDetail model + 1.1.6 - Add SafUser Model + 1.1.7 - Added method to FindApplicationHistoryParameters by application numbers and date range. + 1.1.8 - Added AgreeDao and AgreeuserByAccountsQuery + 1.1.9 - Update Activity Queries, Add Activity Manager Query + 1.1.10 - Update Checking Activity Query + 1.2.0 - Added AccountUserField get and update methods + 1.2.1 - Added AgreementByUserId to controller and subsequent service,dao, and query + 1.3.0 - Add New Mortgage Actvity query + 1.4.0 - Creation of CoreSoapConfiguration models and CoreSoapApiRequest class. + 1.5.0 - Add New Vehicle Activity Query, Update Mortgage Query + 2.0.0 - Refactor model namespaces + 2.0.1 - Moved transaction dao methods from AccountDao to TransactionDao class. + 2.0.2 - Update Referral Activity Query and Model. Add Account Info, fix PersNbr parsing. + 2.1.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate. + 2.1.1 - Update Checking Query. Filter on Minor Account Type, Rely on Sub Activity Data Less. + 2.1.2 - Add Minor Account Type to results + 2.1.3 - Update Mortgage Referral Types for Activity Manager Query + 2.1.4 - Update Loan Queries to Contain Debt Protection Information + 2.1.5 - Add new Endpoint for DP Elligible loans. Update Loan Queries to Contain DP Eligibility Information. + 2.1.6 - Update Loan Originating Person Field Name + 2.1.7 - Adding query to search accounts by orgNbr, audit activity for agreement and organization changes, and determine agreements by agreementId + 2.1.8 - Update AgreeuserByAccountsQuery to fix how to get UserIds by account. + 2.1.9 - Updating query to search accounts by orgNbr and removing types that don't have delivery method codes + 2.2.0 - Add new Endpoint to get Updated Activity Account Details + 2.2.1 - Update Activity Query include Org Role Requirements and Add Basic LIC Referral + 2.2.2 - Updating account and agree audit endpoints to get account fields when removed from agreement. Adding additional active='y' check to owner query + 2.3.0 - Add OrgNbr to Card Activity Query, Make persnbr and orgnbr strings + 2.3.1 - Update DPELoan Activity Query Minor Account Types + 2.4.0 - Update Email Type for Activities + 2.5.0 - Add Member Name and Balance to Activity Query and Models + 2.6.0 - Removal of AccountUserFields in Account methods and Added AccountUserField classes + 2.7.0 - Update Agreement Queries and Endpoints - breaking change (not backwards compatible) + 3.0.0 - Allow Null/Unkown Originators in Loan Activity Queries + 3.1.0 - Changes to Address methods to handle per person. + 3.1.1 - Update Activity Manager Query to Return Email Correctly + 3.2.0 - New AccessChannel classes, added AgreePerson folder and query, and New AgreePersonDao method + 3.3.0 - New AgreePerson query and new Dao for AccessType + 3.4.0 - New AgreePerson query, FindActiveCustodialVruCardAgreementAgreePersons, and UpdatePersonAgreementDetailTypes + 3.4.1 - Update Activity queries/models to include contact info metadata + 3.5.0 - Add OrganizationByMemberAgreeNbr endpoint and OrganizationDao + 3.5.1 - Creating AgreeUserByOrganizationNumberQuery and AgreeUserByPersonNumberQuery + 3.6.0 - Update ActivityAccountDetail query to include Debt Protection info + 3.7.0 - Add new Transaction methods/queries to get Transaction's Exterenal Descriptions with SSN and to update Transaction's External Descriptions + 3.8.0 - Return card activities in batches with default of 100 + 3.9.0 - Add new Account Branch queries to get Admin/MembSvc branch accounts, update to Digital Banking branch code + 3.9.1 - Add new Vip Savings query to get approved new accounts, add Funds to Account + 3.9.2 - Add query to grab all owners by accountNumber + 3.9.3 - Add queries to grab all owners by organizationName or personName + 3.9.4 - Add endpoint to soap configuration for AccountLtvUpdateRequest + 3.9.5 - Update queries for grabbing accounts by account number, person name, or organization name + 3.9.6 - Update query for grabbing accounts by account number to include role (this creates multiple records per person/organization) + 3.9.7 - Update Org and Pers name queries to handle '/', as well as change endpoint names to reflect grabbing only primary owners + 3.9.8 - Update Org and Pers name queries regex_replace to better handle diacritics + 3.9.9 - Update Org and Pers name queries collation for ligatures + 4.0.0 - Add new Account Analysis Group query to get accounts without a group, update account with Analysis Group + 4.0.1 - Update AgreeUserByOrganizationNumberQuery to use FetchLimit 1 instead of RowNum + 4.0.2 - Add Person User Field queries for data cleanup + 4.0.3 - Update AgreeUserByPersonNumberQuery to not use RowNum + 4.0.4 - Update AgreeUserByPersonNumberQuery to return list of UserIDs + 4.0.5 - Add Person/Org accounts and OrgMaintenance + 4.0.6 - Add endpoint to soap configuration for AccountNickNameUpdate request + 4.1.0 - Add Update AddressLine logic + 4.1.1 - Add query for New Checking Activities for Digital Banking + 4.1.2 - Add endpoint to soap configuration for AccountCreditReportTypeUpdateRequest + 4.1.3 - Add query to get AssociateDetails by TaxId + 4.1.4 - Add queries for LoanPayoff + 4.1.5 - Add queries for PersonRecentActivity by PhoneNumber or TaxId + 4.1.6 - Add queries and Dao for GetAccountsByRecentTransactions + 4.1.7 - Add queries and Dao for GetTransactionsByDateSpan + 4.1.8 - Add query and Dao for GetChargeoffDateTimes + 4.1.9 - Update GetTransactionsByDateSpan query to all for exclusion of RtxnTypCd + 4.2.0 - Updating target framework to net8.0 + + + 1.0.0 - Initial Setup + 1.1.0 Added Configurations models and ConnectionModels related to core rather than being pulled from CoreApiWrapperModels prj. + 1.1.1 Added Indirect loan controller methods for exporting information + 1.1.2 Added IndirectLoanController method for getting closed loans + 1.1.3 - Creation of the ApplicationHistoryDao, ApplHhistoryQuery, and addition of QueryUtitilies to help add generic list of params to query. + 1.1.4 - Update to InidrectLoanDetail model + 1.1.5 - Update to InidrectLoanDetail model + 1.1.6 - Add SafUser Model + 1.1.7 - Added method to FindApplicationHistoryParameters by application numbers and date range. + 1.1.8 - Added AgreeDao and AgreeuserByAccountsQuery + 1.1.9 - Update Activity Queries, Add Activity Manager Query + 1.1.10 - Update Checking Activity Query + 1.2.0 - Added AccountUserField get and update methods + 1.2.1 - Added AgreementByUserId to controller and subsequent service,dao, and query + 1.3.0 - Add New Mortgage Actvity query + 1.4.0 - Creation of CoreSoapConfiguration models and CoreSoapApiRequest class. + 1.5.0 - Add New Vehicle Activity Query, Update Mortgage Query + 2.0.0 - Refactor model namespaces + 2.0.1 - Moved transaction dao methods from AccountDao to TransactionDao class. + 2.0.2 - Update Referral Activity Query and Model. Add Account Info, fix PersNbr parsing. + 2.1.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate. + 2.1.1 - Update Checking Query. Filter on Minor Account Type, Rely on Sub Activity Data Less. + 2.1.2 - Add Minor Account Type to results + 2.1.3 - Update Mortgage Referral Types for Activity Manager Query + 2.1.4 - Update Loan Queries to Contain Debt Protection Information + 2.1.5 - Add new Endpoint for DP Elligible loans. Update Loan Queries to Contain DP Eligibility Information. + 2.1.6 - Update Loan Originating Person Field Name + 2.1.7 - Adding query to search accounts by orgNbr, audit activity for agreement and organization changes, and determine agreements by agreementId + 2.1.8 - Update AgreeuserByAccountsQuery to fix how to get UserIds by account. + 2.1.9 - Updating query to search accounts by orgNbr and removing types that don't have delivery method codes + 2.2.0 - Add new Endpoint to get Updated Activity Account Details + 2.2.1 - Update Activity Query include Org Role Requirements and Add Basic LIC Referral + 2.2.2 - Updating account and agree audit endpoints to get account fields when removed from agreement. Adding additional active='y' check to owner query + 2.3.0 - Add OrgNbr to Card Activity Query, Make persnbr and orgnbr strings + 2.3.1 - Update DPELoanActivity Query Minor Account Types + 2.3.2 - Update Email Type for Activities + 2.4.0 - Add Acitivty Manager Incentive Activity Query and Endpoint + 2.5.0 - Add Member Name and Balance to Activity Query and Models + 2.6.0 - Removal of AccountUserFields methods in Account classes and Added AccountUserField classes + 2.7.0 - Update Agreement Queries and Endpoints - breaking change (not backwards compatible) + 3.0.0 - Allow Null/Unkown Originators in Loan Activity Queries + 3.1.0 - Changes to Address methods to handle per person. + 3.1.1 - Update Activity Manager Query to Return Email Correctly + 3.2.0 - New AccessChannel classes, added AgreePerson folder and query, and New AgreePersonDao method + 3.3.0 - New AgreePerson query and new Dao for AccessType + 3.4.0 - New AgreePerson query, FindActiveCustodialVruCardAgreementAgreePersons, and UpdatePersonAgreementDetailTypes + 3.4.1 - Update Activity queries/models to include contact info metadata + 3.5.0 - Add OrganizationByMemberAgreeNbr endpoint and OrganizationDao + 3.5.1 - Creating AgreeUserByOrganizationNumberQuery and AgreeUserByPersonNumberQuery + 3.6.0 - Update ActivityAccountDetail query to include Debt Protection info + 3.7.0 - Add new Transaction methods/queries to get Transaction's Exterenal Descriptions with SSN and to update Transaction's External Descriptions + 3.8.0 - Return card activities in batches with default of 100 + 3.9.1 - Add new Vip Savings query to get approved new accounts, add Funds to Account + 3.9.2 - Add query to grab all owners by accountNumber + 3.9.3 - Add queries to grab all owners by organizationName or personName + 3.9.4 - Add endpoint to soap configuration for AccountLtvUpdateRequest + 3.9.5 - Update queries for grabbing accounts by account number, person name, or organization name + 3.9.6 - Update query for grabbing accounts by account number to include role (this creates multiple records per person/organization) + 3.9.7 - Update Org and Pers name queries to handle '/', as well as change endpoint names to reflect grabbing only primary owners + 3.9.8 - Update Org and Pers name queries regex_replace to better handle diacritics + 3.9.9 - Update Org and Pers name queries collation for ligatures + 4.0.0 - Add new Account Analysis Group query to get accounts without a group, update account with Analysis Group + 4.0.1 - Update AgreeUserByOrganizationNumberQuery to use FetchLimit 1 instead of RowNum + 4.0.2 - Add Person User Field queries for data cleanup + 4.0.3 - Update AgreeUserByPersonNumberQuery to not use RowNum + 4.0.4 - Update AgreeUserByPersonNumberQuery to return list of UserIDs + 4.0.5 - Add Person/Org accounts and OrgMaintenance + 4.0.6 - Add endpoint to soap configuration for AccountNickNameUpdate request + 4.1.0 - Add Update AddressLine logic + 4.1.1 - Add query for New Checking Activities for Digital Banking + 4.1.2 - Add endpoint to soap configuration for AccountCreditReportTypeUpdateRequest + 4.1.3 - Add query to get AssociateDetails by TaxId + 4.1.4 - Add queries for LoanPayoff + 4.1.5 - Add queries for PersonRecentActivity by PhoneNumber or TaxId + 4.1.6 - Add queries and Dao for GetAccountsByRecentTransactions + 4.1.7 - Add queries and Dao for GetTransactionsByDateSpan + 4.1.8 - Add query and Dao for GetChargeoffDateTimes + 4.1.9 - Update GetTransactionsByDateSpan query to all for exclusion of RtxnTypCd + 4.2.0 - Updating target framework to net8.0 + + 4.1.6 + + + + + + + + + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + + + + \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByAccountNumber.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByAccountNumber.sql new file mode 100644 index 0000000..901a0a5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByAccountNumber.sql @@ -0,0 +1,31 @@ +SELECT DISTINCT + a.TAXRPTFORPERSNBR AS PersonNumber, + a.TAXRPTFORORGNBR AS ByOrgNbr, + a.TAXRPTFORPERSNBR AS TaxReportForPersonNumber, + a.TAXRPTFORORGNBR AS TaxReportForOrgNumber, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, + p.MDLINIT AS MiddleInitial, + p.MDLNAME AS MiddleName, + p.LASTNAME, + p.SUFFIX, + '' AS Role, + CASE WHEN (p.PERSNBR = a.TAXRPTFORPERSNBR OR o.ORGNBR = a.TAXRPTFORORGNBR) THEN (1) ELSE (0) END AS IsPrimaryOwner +FROM osibank.ACCT a +LEFT OUTER JOIN OSIBANK.PERS p ON a.TAXRPTFORPERSNBR = p.PERSNBR +LEFT OUTER JOIN OSIBANK.ORG o ON a.TAXRPTFORORGNBR = o.ORGNBR +WHERE a.ACCTNBR = :accountNumber +UNION +(SELECT DISTINCT a2.PERSNBR, NULL, NULL, NULL, NULL, p.FIRSTNAME, p.MDLINIT, p.MDLNAME, p.LASTNAME, p.SUFFIX, a2.ACCTROLECD, 0 +FROM OSIBANK.ACCTACCTROLEPERS a2 +LEFT OUTER JOIN OSIBANK.PERS p ON a2.PERSNBR = p.PERSNBR +WHERE a2.ACCTROLECD IN ( 'SIGN', 'OWN', 'CUST', 'GUAD', 'PREP', 'REPP', 'VAFI', 'TRUT', 'TRUS') +AND a2.ACCTNBR = :accountNumber +AND a2.EFFDATE <= TO_DATE(:createdDate, 'YYYY-MM-DD HH24:MI:SS') AND a2.EFFDATE IS NOT NULL) +UNION +(SELECT DISTINCT NULL, a3.ORGNBR, NULL, NULL, o.ORGNAME, NULL, NULL, NULL, NULL, NULL, a3.ACCTROLECD, 0 +FROM OSIBANK.ACCTACCTROLEORG a3 +LEFT OUTER JOIN OSIBANK.ORG o ON a3.ORGNBR = o.ORGNBR +WHERE a3.ACCTROLECD IN ( 'SIGN', 'OWN', 'CUST', 'GUAD', 'PREP', 'REPP', 'VAFI', 'TRUT', 'TRUS') +AND a3.ACCTNBR = :accountNumber +AND a3.EFFDATE <= TO_DATE(:createdDate, 'YYYY-MM-DD HH24:MI:SS') AND a3.EFFDATE IS NOT NULL) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByOrganizationName.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByOrganizationName.sql new file mode 100644 index 0000000..92a799a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByOrganizationName.sql @@ -0,0 +1,19 @@ +SELECT DISTINCT + a.TAXRPTFORPERSNBR AS PersonNumber, + a.TAXRPTFORORGNBR AS ByOrgNbr, + a.TAXRPTFORPERSNBR AS TaxReportForPersonNumber, + a.TAXRPTFORORGNBR AS TaxReportForOrgNumber, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, + p.MDLINIT AS MiddleInitial, + p.MDLNAME AS MiddleName, + p.LASTNAME, + p.SUFFIX, + CASE WHEN (p.PERSNBR = a.TAXRPTFORPERSNBR OR o.ORGNBR = a.TAXRPTFORORGNBR) THEN (1) ELSE (0) END AS IsPrimaryOwner +FROM osibank.ACCT a +LEFT OUTER JOIN OSIBANK.PERS p ON a.TAXRPTFORPERSNBR = p.PERSNBR +LEFT OUTER JOIN OSIBANK.ORG o ON a.TAXRPTFORORGNBR = o.ORGNBR +WHERE NLSSORT(TRIM(REPLACE(REPLACE(REPLACE(REGEXP_REPLACE(REPLACE(o.ORGNAME, '%2F', '/'), '[^[:alnum:] ]', ''), ' ', '<>'), '><', ''), '<>', ' ')), 'NLS_SORT = UCA0700_DUCET_AI') + LIKE NLSSORT(TRIM(REPLACE(REPLACE(REPLACE(REGEXP_REPLACE(REPLACE(:organizationName, '%2F', '/'), '[^[:alnum:] ]', ''), ' ', '<>'), '><', ''), '<>', ' ')), 'NLS_SORT = UCA0700_DUCET_AI') +OFFSET 0 ROWS +FETCH FIRST 5 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByPersonName.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByPersonName.sql new file mode 100644 index 0000000..3b4fa05 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountOwnersByPersonName.sql @@ -0,0 +1,19 @@ +SELECT DISTINCT + a.TAXRPTFORPERSNBR AS PersonNumber, + a.TAXRPTFORORGNBR AS ByOrgNbr, + a.TAXRPTFORPERSNBR AS TaxReportForPersonNumber, + a.TAXRPTFORORGNBR AS TaxReportForOrgNumber, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, + p.MDLINIT AS MiddleInitial, + p.MDLNAME AS MiddleName, + p.LASTNAME, + p.SUFFIX, + CASE WHEN (p.PERSNBR = a.TAXRPTFORPERSNBR OR o.ORGNBR = a.TAXRPTFORORGNBR) THEN (1) ELSE (0) END AS IsPrimaryOwner +FROM osibank.ACCT a +LEFT OUTER JOIN OSIBANK.PERS p ON a.TAXRPTFORPERSNBR = p.PERSNBR +LEFT OUTER JOIN OSIBANK.ORG o ON a.TAXRPTFORORGNBR = o.ORGNBR +WHERE NLSSORT(TRIM(REPLACE(REPLACE(REPLACE(REGEXP_REPLACE(REPLACE(NVL(p.FIRSTNAME,'') || NVL(' ' || p.MDLINIT,'') || NVL(' ' || p.LASTNAME,'') || NVL(' ' || p.SUFFIX,''), '%2F', '/'), '[^[:alnum:] ]', ''), ' ', '<>'), '><', ''), '<>', ' ')), 'NLS_SORT = UCA0700_DUCET_AI') + LIKE NLSSORT(TRIM(REPLACE(REPLACE(REPLACE(REGEXP_REPLACE(REPLACE(:personName, '%2F', '/'), '[^[:alnum:] ]', ''), ' ', '<>'), '><', ''), '<>', ' ')), 'NLS_SORT = UCA0700_DUCET_AI') +OFFSET 0 ROWS +FETCH FIRST 5 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByMajorMinorBranchCodeAndStatus.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByMajorMinorBranchCodeAndStatus.sql new file mode 100644 index 0000000..6ba4c09 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByMajorMinorBranchCodeAndStatus.sql @@ -0,0 +1,14 @@ +select + ac.branchorgnbr as branchcode, + ac.acctnbr as accountnumber, + CASE + when (ac.taxrptforpersnbr is not null) then (concat(concat(pe.FirstNameUpper, ' '), pe.LastNameUpper)) + else (og.orgname) + end as Name +from acct ac +left join pers pe on ac.taxrptforpersnbr = pe.persnbr +left join org og on og.orgnbr = ac.taxrptfororgnbr +Where AC.MJACCTTYPCD IN :majorAccountTypes +and AC.CURRMIACCTTYPCD IN :minorAccountTypes +and AC.CURRACCTSTATCD IN :accountStatusCodes +and AC.Branchorgnbr IN :branchOrgCodes \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByRecentTransactions.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByRecentTransactions.sql new file mode 100644 index 0000000..cca9018 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsByRecentTransactions.sql @@ -0,0 +1,5 @@ +SELECT +ACCTNBR, DATELASTMAINT +FROM Acct +WHERE DATELASTMAINT >= TO_TIMESTAMP(:startDate, 'yyyy-mm-dd HH24:mi:ss') +AND DATELASTMAINT < TO_TIMESTAMP(:endDate, 'yyyy-mm-dd HH24:mi:ss') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsToUpdateGroupAnalysis.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsToUpdateGroupAnalysis.sql new file mode 100644 index 0000000..fa13734 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetAccountsToUpdateGroupAnalysis.sql @@ -0,0 +1,9 @@ +Select AC.ACCTNBR as AccountNumber + FROM ACCT AC + LEFT JOIN ACCTGRPACCT AGA ON AGA.ACCTNBR= AC.ACCTNBR + LEFT JOIN ACCTGRP AG ON AG.ACCTGRPNBR = AGA.ACCTGRPNBR + Where + AC.MJACCTTYPCD = 'CK' + And AC.CURRMIACCTTYPCD IN ('BC01','BC10','BC11','BC20','MMC1','MMC5','MMC9','BMM1','MMM1') + And AC.CURRACCTSTATCD = 'ACT' + And AG.ACCTGRPNBR is null \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetVipSavingsToFundQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetVipSavingsToFundQuery.sql new file mode 100644 index 0000000..2c58b27 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Account/GetVipSavingsToFundQuery.sql @@ -0,0 +1,9 @@ +Select AC.ACCTNBR as AccountNumber from OSIBANK.ACCT AC + INNER JOIN PERS PE ON PE.PersNbr = AC.TAXRPTFORPERSNBR + INNER JOIN MEMBERAGREEMENT MA ON MA.PRIMARYPERSNBR = PE.PERSNBR +Where AC.MJACCTTYPCD = 'SAV' +and AC.CURRMIACCTTYPCD = 'SV01' +and AC.CURRACCTSTATCD = 'APPR' +and AC.Branchorgnbr = 1210 +and MA.SHAREACCTNBR = AC.ACCTNBR +and NOT EXISTS (select null FROM ACCTACCTROLEPERS AR WHERE AR.ACCTNBR = AC.ACCTNBR And AR.ACCTROLECD = 'OEMP') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountBranch/GetAccountAdminBranchUpdateQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountBranch/GetAccountAdminBranchUpdateQuery.sql new file mode 100644 index 0000000..317d25e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountBranch/GetAccountAdminBranchUpdateQuery.sql @@ -0,0 +1,17 @@ +SELECT + AC.ACCTNBR +FROM + OSIBANK.ACCT AC + INNER JOIN OSIBANK.MJMIACCTTYP MI ON MI.MIACCTTYPCD = AC.CURRMIACCTTYPCD + INNER JOIN OSIBANK.PERS PE ON PE.PERSNBR = AC.TAXRPTFORPERSNBR + INNER JOIN OSIBANK.MEMBERAGREEMENT MA ON MA.PRIMARYPERSNBR = PE.PERSNBR +WHERE + (AC.BRANCHORGNBR = 1500 OR AC.BRANCHORGNBR = 1200) + AND AC.CURRACCTSTATCD IN ('ACT', 'DORM', 'IACT', 'NPFM') + AND AC.MJACCTTYPCD IN ('CK','SAV','TD','CML','CNS','MTG') + AND AC.ACCTNBR NOT IN('99993001','99994001','99997001','27507971401','99998001') + AND AC.CURRMIACCTTYPCD NOT IN ('GL','CK20','APCK','BAT','CASH','FLML','HSA','IRA', + 'IRTH','ITRD','MO','PREC','CDFN','CDFC','CDFI','INVR','DLR','CHSA','CITA','CRTA', + 'CLRA','CANZ','DEF1','LETR','DEF2','DEF3','SDFP','SDFS','SDFI','SVWV','PASS', + 'SVRT','TDFR','TDFN','CDNR') + \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountHistory/GetChargeOffDateTimes.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountHistory/GetChargeOffDateTimes.sql new file mode 100644 index 0000000..b7fbbd4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AccountHistory/GetChargeOffDateTimes.sql @@ -0,0 +1 @@ +SELECT EFFDATETIME FROM OSIBANK.ACCTACCTSTATHIST WHERE ACCTNBR = :accountNumber and ACCTSTATCD = 'CO' ORDER BY EFFDATETIME desc \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPersonNumberQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPersonNumberQuery.sql new file mode 100644 index 0000000..c055375 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPersonNumberQuery.sql @@ -0,0 +1,110 @@ +WITH PersonLookup AS + ( + SELECT DISTINCT + MAX(n.PERSNBR) AS PERSNBR, + MAX(n.SHAREACCTNBR) AS SHAREACCTNBR, + MAX(n.MEMBERAGREENBR) AS MEMBERAGREENBR, + MAX(n.PRIORITY) AS PRIORITY + FROM ( + SELECT a.TAXRPTFORPERSNBR AS PERSNBR, a.ACCTNBR AS SHAREACCTNBR, m.MEMBERAGREENBR, 0 AS PRIORITY + FROM ACCT a + LEFT OUTER JOIN MEMBERAGREEMENT m ON m.PRIMARYPERSNBR = a.TAXRPTFORPERSNBR + LEFT OUTER JOIN OSIBANK.ACCTACCTROLEPERS a1 ON a1.ACCTNBR = a.ACCTNBR AND a.TAXRPTFORPERSNBR <> a1.PERSNBR AND a1.ACCTROLECD = 'CUST' + WHERE a1.ACCTROLECD IS NULL + UNION + SELECT DISTINCT a.PERSNBR, a3.ACCTNBR AS SHAREACCTNBR, NULL AS MEMBERAGREENBR, 1 AS PRIORITY + FROM OSIBANK.ACCTACCTROLEPERS a + INNER JOIN OSIBANK.ACCTROLE a2 ON a.ACCTROLECD = a2.ACCTROLECD AND a2.TRANSACTYN = 'Y' + INNER JOIN ACCT a3 ON a.ACCTNBR IN (a3.ACCTNBR, a3.STMTACCTNBR) + LEFT OUTER JOIN MEMBERAGREEMENT e ON e.SHAREACCTNBR = a3.STMTACCTNBR + WHERE a.EFFDATE <= CURRENT_DATE + AND a.EFFDATE IS NOT NULL + ) n + WHERE n.PERSNBR = :personNumber + GROUP BY (n.PERSNBR, n.SHAREACCTNBR, n.MEMBERAGREENBR) + ORDER BY (MAX(n.PRIORITY)) + ) + ,Person AS + ( + SELECT DISTINCT e.FIRSTNAME||COALESCE(nullif(' '||e.MDLINIT,' '), '')||' '||e.LASTNAME AS PERSONNAME, l.PERSNBR, l.MEMBERAGREENBR, l.SHAREACCTNBR + FROM OSIBANK.PERS e + INNER JOIN PersonLookup l ON l.PERSNBR=e.PERSNBR + ) + ,Phone_list AS + ( + SELECT DISTINCT p.PERSNBR, p.AREACD||p.EXCHANGE||p.PHONENBR AS phone_number, p.PHONEUSECD AS phone_type, p.PHONESEQ, + ROW_NUMBER () OVER(PARTITION BY p.PERSNBR, p.PHONEUSECD ORDER BY PREFERREDYN DESC, p.PHONESEQ DESC) AS rn + FROM OSIBANK.PERSPHONE p + INNER JOIN PersonLookup l ON l.PERSNBR=p.PERSNBR + WHERE p.PHONEUSECD IN ('PER', 'CELL', 'BUS') + ) + ,phone_part AS + ( + SELECT * FROM + ( + SELECT PERSNBR, phone_type, phone_number + FROM Phone_list + WHERE rn=1 + ) + PIVOT + ( + MAX(phone_number) FOR phone_type IN ('PER' AS Home_Phone, 'CELL' AS Cell_Phone, 'BUS' AS Business_Phone) + ) + ) + ,SharedAcctTran AS + ( + SELECT t.ACCTNBR, a.PERSNBR, t.RTXNTYPCD, t.ORIGPOSTDATE, t.TRANAMT, a.SHAREACCTNBR, + CASE WHEN t.RTXNTYPCD = 'WTH' THEN 'WTH' + WHEN t.RTXNTYPCD IN ('DEP', 'XDEP') THEN 'DEP' END AS TransType + FROM PersonLookup a + INNER JOIN OSIBANK.RTXN t ON t.ACCTNBR=a.SHAREACCTNBR AND t.RTXNTYPCD IN ('WTH','DEP','XDEP') + ORDER BY t.ORIGPOSTDATE DESC + FETCH FIRST 1000 ROWS ONLY + ) + ,SharedAcctTranOrder AS + ( + SELECT ACCTNBR, PERSNBR, ORIGPOSTDATE, TRANAMT, RTXNTYPCD, TransType, SHAREACCTNBR, + ROW_NUMBER() OVER(PARTITION BY ACCTNBR, TransType ORDER BY ORIGPOSTDATE DESC) AS rn + FROM SharedAcctTran + ) + ,SharedAcctTran_Part AS + ( + SELECT ACCTNBR, PERSNBR, TransType, SHAREACCTNBR, + CASE WHEN TransType='WTH' THEN ORIGPOSTDATE END AS Last_ShareAcct_Withdrawal_DateTime, + CASE WHEN TransType='DEP' THEN ORIGPOSTDATE END AS Last_Share_Deposit_Date, + CASE WHEN TransType='DEP' THEN TRANAMT END AS Last_Share_Deposit_Amount + FROM SharedAcctTranOrder + WHERE rn=1 + ) + ,Autoloan_Part AS + ( + SELECT DISTINCT MAX(l.PERSNBR) AS PERSNBR, MAX(pr.PROPDESC) AS PROPDESC + FROM OSIBANK.ACCT a + INNER JOIN PersonLookup l ON a.ACCTNBR = l.SHAREACCTNBR OR a.TAXRPTFORPERSNBR = l.PERSNBR + INNER JOIN OSIBANK.ACCTPROP AP ON AP.ACCTNBR=a.ACCTNBR + INNER JOIN OSIBANK.prop pr ON pr.propnbr=ap.PROPNBR + WHERE a.MJACCTTYPCD='CNS' + AND a.CURRMIACCTTYPCD IN ('DL01','DL02','DL03','DL04','DV01','DV02','DV03','DV04') + GROUP BY (l.PERSNBR) + ORDER BY a.CONTRACTDATE DESC + ) +SELECT DISTINCT + MAX(p.PERSNBR) AS PersonNumber, + MAX(e.PERSONNAME) AS PERSONNAME, + MAX(e.MEMBERAGREENBR) AS MemberNumber, + MAX(p.Home_Phone) AS HomePhone, + MAX(p.Cell_Phone) AS CellPhone, + MAX(p.Business_Phone) AS BusinessPhone, + MAX(w.Last_ShareAcct_Withdrawal_DateTime) AS LastShareAcctWithdrawalTime, + MAX(d.Last_Share_Deposit_Date) AS LastShareDepositDate, + MAX(d.Last_Share_Deposit_Amount) AS LastShareDepositAmount, + MAX(l.PROPDESC) AS VehicleYearMakeModelVin, + MAX(puf.VALUE) AS PassPhrase +FROM phone_part p + LEFT JOIN Person e ON p.PERSNBR=e.PERSNBR + LEFT JOIN PERSUSERFIELD puf on p.PERSNBR=puf.PERSNBR AND puf.userfieldcd='PASS' + LEFT JOIN SharedAcctTran_Part w ON e.SHAREACCTNBR=w.SHAREACCTNBR AND w.TransType='WTH' + LEFT JOIN SharedAcctTran_Part d ON e.SHAREACCTNBR=d.SHAREACCTNBR AND d.TransType='DEP' + LEFT JOIN Autoloan_Part l ON p.PERSNBR=l.PERSNBR +GROUP BY (p.PERSNBR) + FETCH FIRST 2 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPhoneNumberQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPhoneNumberQuery.sql new file mode 100644 index 0000000..4811140 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/GetPersonActivityByPhoneNumberQuery.sql @@ -0,0 +1,115 @@ +WITH PersonLookup AS + ( + SELECT DISTINCT + MAX(n.PERSNBR) AS PERSNBR, + MAX(n.SHAREACCTNBR) AS SHAREACCTNBR, + MAX(n.MEMBERAGREENBR) AS MEMBERAGREENBR, + MAX(n.PRIORITY) AS PRIORITY + FROM ( + SELECT a.TAXRPTFORPERSNBR AS PERSNBR, a.ACCTNBR AS SHAREACCTNBR, m.MEMBERAGREENBR, 0 AS PRIORITY + FROM ACCT a + LEFT OUTER JOIN MEMBERAGREEMENT m ON m.PRIMARYPERSNBR = a.TAXRPTFORPERSNBR + LEFT OUTER JOIN OSIBANK.ACCTACCTROLEPERS a1 ON a1.ACCTNBR = a.ACCTNBR AND a.TAXRPTFORPERSNBR <> a1.PERSNBR AND a1.ACCTROLECD = 'CUST' + WHERE a1.ACCTROLECD IS NULL + UNION + SELECT DISTINCT a.PERSNBR, a3.ACCTNBR AS SHAREACCTNBR, NULL AS MEMBERAGREENBR, 1 AS PRIORITY + FROM OSIBANK.ACCTACCTROLEPERS a + INNER JOIN OSIBANK.ACCTROLE a2 ON a.ACCTROLECD = a2.ACCTROLECD AND a2.TRANSACTYN = 'Y' + INNER JOIN ACCT a3 ON a.ACCTNBR IN (a3.ACCTNBR, a3.STMTACCTNBR) + LEFT OUTER JOIN MEMBERAGREEMENT e ON e.SHAREACCTNBR = a3.STMTACCTNBR + WHERE a.EFFDATE <= CURRENT_DATE + AND a.EFFDATE IS NOT NULL + ) n + INNER JOIN ( + SELECT DISTINCT p2.PERSNBR + FROM PERSPHONE p2 + WHERE p2.AREACD||p2.EXCHANGE||p2.PHONENBR = :phoneNumber + FETCH FIRST 50 ROWS ONLY + ) l ON l.PERSNBR = n.PERSNBR + GROUP BY (n.PERSNBR, n.SHAREACCTNBR) + ORDER BY (MAX(n.PRIORITY)) + ) + ,Person AS + ( + SELECT DISTINCT e.FIRSTNAME||COALESCE(nullif(' '||e.MDLINIT,' '), '')||' '||e.LASTNAME AS PERSONNAME, l.PERSNBR, l.MEMBERAGREENBR, l.SHAREACCTNBR + FROM OSIBANK.PERS e + INNER JOIN PersonLookup l ON l.PERSNBR=e.PERSNBR + ) + ,Phone_list AS + ( + SELECT DISTINCT p.PERSNBR, p.AREACD||p.EXCHANGE||p.PHONENBR AS phone_number, p.PHONEUSECD AS phone_type, p.PHONESEQ, + ROW_NUMBER () OVER(PARTITION BY p.PERSNBR, p.PHONEUSECD ORDER BY PREFERREDYN DESC, p.PHONESEQ DESC) AS rn + FROM OSIBANK.PERSPHONE p + INNER JOIN PersonLookup l ON l.PERSNBR=p.PERSNBR + WHERE p.PHONEUSECD IN ('PER', 'CELL', 'BUS') + ) + ,phone_part AS + ( + SELECT * FROM + ( + SELECT PERSNBR, phone_type, phone_number + FROM Phone_list + WHERE rn=1 + ) + PIVOT + ( + MAX(phone_number) FOR phone_type IN ('PER' AS Home_Phone, 'CELL' AS Cell_Phone, 'BUS' AS Business_Phone) + ) + ) + ,SharedAcctTran AS + ( + SELECT t.ACCTNBR, a.PERSNBR, t.RTXNTYPCD, t.ORIGPOSTDATE, t.TRANAMT, a.SHAREACCTNBR, + CASE WHEN t.RTXNTYPCD = 'WTH' THEN 'WTH' + WHEN t.RTXNTYPCD IN ('DEP', 'XDEP') THEN 'DEP' END AS TransType + FROM PersonLookup a + INNER JOIN OSIBANK.RTXN t ON t.ACCTNBR=a.SHAREACCTNBR AND t.RTXNTYPCD IN ('WTH','DEP','XDEP') + ORDER BY t.ORIGPOSTDATE DESC + FETCH FIRST 1000 ROWS ONLY + ) + ,SharedAcctTranOrder AS + ( + SELECT ACCTNBR, PERSNBR, ORIGPOSTDATE, TRANAMT, RTXNTYPCD, TransType, SHAREACCTNBR, + ROW_NUMBER() OVER(PARTITION BY ACCTNBR, TransType ORDER BY ORIGPOSTDATE DESC) AS rn + FROM SharedAcctTran + ) + ,SharedAcctTran_Part AS + ( + SELECT ACCTNBR, PERSNBR, TransType, SHAREACCTNBR, + CASE WHEN TransType='WTH' THEN ORIGPOSTDATE END AS Last_ShareAcct_Withdrawal_DateTime, + CASE WHEN TransType='DEP' THEN ORIGPOSTDATE END AS Last_Share_Deposit_Date, + CASE WHEN TransType='DEP' THEN TRANAMT END AS Last_Share_Deposit_Amount + FROM SharedAcctTranOrder + WHERE rn=1 + ) + ,Autoloan_Part AS + ( + SELECT DISTINCT MAX(l.PERSNBR) AS PERSNBR, MAX(pr.PROPDESC) AS PROPDESC + FROM OSIBANK.ACCT a + INNER JOIN PersonLookup l ON a.ACCTNBR = l.SHAREACCTNBR OR a.TAXRPTFORPERSNBR = l.PERSNBR + INNER JOIN OSIBANK.ACCTPROP AP ON AP.ACCTNBR=a.ACCTNBR + INNER JOIN OSIBANK.prop pr ON pr.propnbr=ap.PROPNBR + WHERE a.MJACCTTYPCD='CNS' + AND a.CURRMIACCTTYPCD IN ('DL01','DL02','DL03','DL04','DV01','DV02','DV03','DV04') + GROUP BY (l.PERSNBR) + ORDER BY a.CONTRACTDATE DESC + ) +SELECT DISTINCT + MAX(p.PERSNBR) AS PersonNumber, + MAX(e.PERSONNAME) AS PERSONNAME, + MAX(e.MEMBERAGREENBR) AS MemberNumber, + MAX(p.Home_Phone) AS HomePhone, + MAX(p.Cell_Phone) AS CellPhone, + MAX(p.Business_Phone) AS BusinessPhone, + MAX(w.Last_ShareAcct_Withdrawal_DateTime) AS LastShareAcctWithdrawalTime, + MAX(d.Last_Share_Deposit_Date) AS LastShareDepositDate, + MAX(d.Last_Share_Deposit_Amount) AS LastShareDepositAmount, + MAX(l.PROPDESC) AS VehicleYearMakeModelVin, + MAX(puf.VALUE) AS PassPhrase +FROM phone_part p + LEFT JOIN Person e ON p.PERSNBR=e.PERSNBR + LEFT JOIN PERSUSERFIELD puf on p.PERSNBR=puf.PERSNBR AND puf.userfieldcd='PASS' + LEFT JOIN SharedAcctTran_Part w ON e.SHAREACCTNBR=w.SHAREACCTNBR AND w.TransType='WTH' + LEFT JOIN SharedAcctTran_Part d ON e.SHAREACCTNBR=d.SHAREACCTNBR AND d.TransType='DEP' + LEFT JOIN Autoloan_Part l ON p.PERSNBR=l.PERSNBR +GROUP BY (p.PERSNBR) + FETCH FIRST 2 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewActivityManagerIncentiveReferralQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewActivityManagerIncentiveReferralQuery.sql new file mode 100644 index 0000000..637a6f2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewActivityManagerIncentiveReferralQuery.sql @@ -0,0 +1,143 @@ +/*New Activity Manager Incentive Referral Query +---------------------------------- +DESCRIPTION: + Get all Activity Manager entries associated with incented referrals. + + Supplies Activity Data, Associate Name information, as well as the Agreement Number, Card Status (Should always be ISS (issue)), + CardAgreementTypeCd, AccountNumber for the associated agreement as well as the account status at time the activity was generated. + +RETURNS: Models/Activity/ActivityManagerIncentiveReferral.cs + +PARAMS: + + |afterActivityOd : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Activity Manager entries with a ID after the supplied ID + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanOriginationDate : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Activity Manager entries that were created after specified date time. + |The origination date is always the date that the activity was first entered into the system + |regardless of its initial station or what station it is in now + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + +NOTES: + - When an activity's station is updated, its activity stays the same, but its created date and date last maintained + dates are updated to the StationDate. They are always with respect to the current station. To get the date that + the activity first entered activity manager, use OriginationDate + + - When a referral is for a business the LF_PERS.EXTID3 column has a O in front of the OrgNbr, + When a referral is for a person the LFPERS.EXTID3 coulumn has a P in front of the PersNbr + + - Remember that these fields are all entered manually by an employee. This should not be used as a source of truth for any given activity. + This data is supplied with the intention of matching this referral to a sale. It is the best plan to focus on the referred person, + and manually query for related accounts as opposed to using the 'custom fields'. We include them here for audit purposes. + +CUSTOM FIELD INFO (ActivityManager.LF_LEAD_CUSTOM): +Credit Card Balance Transfer + --LeadCust_39 = External CC Account Number + --LeadCust_31 = Landmark Credit Card Number + --LeadCust_29 = Transfer Ammount + --LeadCust_28 = Payment State + Zip + --LeadCust_27 = Payment City + --LeadCust_26 = Payment Address Line 1 + --LeadCust_24 = Transfer Institution + +Direct Deposit + --LeadCust_38 = Direct Deposit is Qualified Referral + --LeadCust_4 = Direct Deposit Account Number + +LF_PERSON-> +B = PAGER +C = MOBILE +E = BUSINESS EMAIL +F = FAX +H = HOME +J = PERSONAL EMAIL +P = PHONE +*/ + +WITH EmployeeEmail AS ( + SELECT pers.USERID AS SafUserId, + prod.PERSNBR AS SafPersNbr, + prod.PRODPERSID AS CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM SAF.PERSUSER pers + JOIN SAF.PERSPROD prod ON + pers.PERSNBR = PROD.PERSNBR + AND prod.PRODNBR = '3' + JOIN OSIBANK.PERSADDRUSE paddr ON + prod.PRODPERSID = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +) +SELECT ll.ID AS ActivityId, + -- These custom fields can be reused, guarentee their contents by only using them for their respective campaigns + (CASE WHEN ll.CAMPAIGN = 'CC Balance Transfer' THEN llc.LEADCUST_31 ELSE NULL END) AS LandmarkCreditCardNumber, + (CASE WHEN ll.CAMPAIGN = 'Direct Deposit' THEN llc.LEADCUST_4 ELSE NULL END) AS DirectDepositAccountNumber, + ll.ORIGINATOR AS OriginatorUserId, + safprod.PRODPERSID AS OriginatorPersNbr, + p.FIRSTNAME AS OriginatorFirstName, + p.LASTNAME AS OriginatorLastName, + p.MDLINIT AS OriginatorMiddleInitial, + ee.EmployeeEmail AS EmployeeEmail, + ll.CAMPAIGN AS Campaign, + ll.CATEGORY AS Category, + ll.STATION AS ReferralStation, + ll.DATELASTMAINT AS LastUpdatedDateTime, + (CASE WHEN att.INITIAL_STATION = 'Yes' THEN 1 ELSE 0 END) AS IsInitialStation, + (CASE WHEN att.FINAL_STATION = 'Yes' THEN 1 ELSE 0 END) AS IsFinalStation, + att.ACTIVITY_ORIGINATION_DATE AS OriginationDateTime, + att.ENTER_STATION_DATETIME AS StationDateTime, + ll.SOURCE AS OriginatingBranchName, + (CASE WHEN SUBSTR(lp.EXTID3, 1, 1) = 'P' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') ELSE NULL END) AS ReferredPersonNbr, + (CASE WHEN SUBSTR(lp.EXTID3, 1, 1) = 'O' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') ELSE NULL END) AS ReferredOrgNbr, + CASE WHEN REFPERS.LASTNAME IS NOT NULL THEN CONCAT(CONCAT(REFPERS.LASTNAMEUPPER, ','), REFPERS.FIRSTNAMEUPPER) + WHEN lp.LastName IS NOT NULL THEN CONCAT(CONCAT(UPPER(lp.LastName), ','), UPPER(lp.FirstName)) ELSE NULL END AS ReferredPersonName, + REFORG.ORGNAME AS ReferredOrgName, + lp.EXTID3 AS ReferredPersOrgNbr, + lp.PREFERRED_PHONE AS PreferredPhone, + COALESCE(lp.COMM1, '') AS COMM1, + COALESCE(lp.COMM2, '') AS COMM2, + COALESCE(lp.COMM3, '') AS COMM3, + COALESCE(lp.COMM4, '') AS COMM4, + COALESCE(lp.COMM5, '') AS COMM5, + COALESCE(lp.COMM6, '') AS COMM6, + COALESCE(lp.COMM7, '') AS COMM7 +FROM ACTIVITYMANAGER.LF_LEAD ll + JOIN ACTIVITYMANAGER.LF_LEAD_CUSTOM llc ON + ll.ID = llc.ID + JOIN SAF.PERSUSER safp ON + safp.USERID = ll.ORIGINATOR + JOIN SAF.PERSPROD safprod ON + SAFPROD.PERSNBR = safp.PERSNBR AND + SAFPROD.PRODNBR = '3' + JOIN OSIBANK.PERS p ON + p.PERSNBR = SAFPROD.PRODPERSID + LEFT JOIN EmployeeEmail ee ON + ee.SafPersNbr = SAFP.PERSNBR + JOIN ACTIVITYMANAGER.LF_PERSON lp ON + lp.ID = ll.PERSONID + JOIN ACTIVITYMANAGER.ACTIVITY_TIME_TRACKING att + ON att.ACTIVITY_ID = ll.ID AND SEQUENCE_NUMBER = ( + SELECT MAX(SEQUENCE_NUMBER) + FROM ACTIVITYMANAGER.ACTIVITY_TIME_TRACKING att2 + WHERE att2.ACTIVITY_ID = ll.ID + ) + LEFT JOIN OSIBANK.ORG REFORG ON reforg.ORGNBR = (CASE WHEN SUBSTR(lp.EXTID3, 1, 1) = 'O' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') ELSE NULL END) + LEFT JOIN OSIBANK.PERS REFPERS ON refpers.PERSNBR = (CASE WHEN SUBSTR(lp.EXTID3, 1, 1) = 'P' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') ELSE NULL END) +WHERE ll.CAMPAIGN IN ( + 'ATM Card', + 'Check Card Referral', + 'Checking Referral', + 'Direct Deposit', + 'CC Balance Transfer', + 'Mortgage Referral', + 'LIC Referral', + 'First Mortgage Referral', + 'eStatement Referral') + AND ll.ID > TO_NUMBER(COALESCE(:afterActivityId, '-1')) + AND att.ACTIVITY_ORIGINATION_DATE >= TO_TIMESTAMP(COALESCE(:newerThanOriginationDate, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewAtmCheckCardSales.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewAtmCheckCardSales.sql new file mode 100644 index 0000000..af873dd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewAtmCheckCardSales.sql @@ -0,0 +1,136 @@ +/*New ATM/Check Cards Sale Query +---------------------------------- +DESCRIPTION: + Get all Activities related to New Check or ATM Cards (ActvType = AGRE and SubActivity contains a change + to the 'CardAgreement' table where the AgreeTypCd = 'DBT', 'DBT2', 'BDBT', 'ATM') + after a supplied DateTime (inclusive) or after a supplied ActivityNumber (not inclusive) or both. + + Supplies Activity Data, Associate Name information, as well as the Agreement Number, Card Status (Should always be ISS (issue)), + CardAgreementTypeCd, AccountNumber for the associated agreement as well as the account status at time the activity was generated. + +RETURNS: Models/Activity/NewAtmCheckCardActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Checking Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Checking Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + + |limitAmount : Null or Int (as string) + |------------------------------------------------------------------------------ + |Return record count + |If null defaults to '100' + +NOTES: + - 'AGRE' activity is an activity related to a change or update to an agreement + - 'DBT', 'DBT2', 'BDBT' abd 'ATM are the only CardTypes that are incented + + - This will return all new ATM/Check card sales, even those that were created when a new account was created, + Note that these are not incented. Uncommment the line in the where clause to filter out unincented accounts. + + - Though not explicitly filtered these results will only include cards in the 'ISS' issued status. This is because + of the join with CARDMEMBERISSUEHIST + + - The AcctStatDuringActivity column is the last status of the account (from ACCTACCTSTATHIST table) before or when + the activity occured. We do not return the current status at the time of the query. + + - When Card is in APPR state, sometimes personNbr will be missing. When creating this query there were no situations + Where the cards was in ACT state and did not have a person number assigned to them +*/ +WITH EmployeeEmail AS ( + SELECT p.PERSNBR As CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM OSIBANK.PERSEMPL p + JOIN OSIBANK.PERSADDRUSE paddr ON + p.PERSNBR = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +), + ActivitySubActivity AS ( + SELECT * + FROM OSIBANK.ACTVSUBACTV asa + WHERE asa.TABLEID = 'CardAgreement' + ), + AGREEMENTACTIVITYDATA AS ( + SELECT a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.RESPPERSNBR AS ResponsiblePersonNbr, + a.ACTVTYPCD AS ActivityTypeCde, + -- CardAgreement table has only one row in value table. Other rows may have duplicate unmatching data for Non-owner users + max(CASE WHEN asa.COLUMNID = 'AgreeNbr' THEN asa.NEWVALUE END) AS AgreementNbr, + max(CASE WHEN asa.COLUMNID = 'AgreeTypCd' THEN asa.NEWVALUE END) AS CardState, + max(CASE WHEN asa.COLUMNID = 'AgreeTypCd' THEN asa.NEWVALUE END) AS CardType, + max(CASE WHEN asa.COLUMNID = 'ServChgAcctNbr' THEN asa.NEWVALUE END) AS AccountNbr, + max(CASE WHEN asa.COLUMNID = 'OwnerPersNbr' THEN asa.NEWVALUE END) AS OwnerPersonNbr, + max(CASE WHEN asa.COLUMNID = 'OwnerOrgNbr' THEN asa.NEWVALUE END) AS OwnerOrgNbr + FROM OSIBANK.ACTV a + LEFT JOIN ActivitySubActivity asa ON asa.ACTVNBR = a.ACTVNBR + WHERE a.ACTVTYPCD = 'AGRE' + GROUP BY a.ACTVNBR, a.ACTVDATETIME, a.RESPPERSNBR, a.ACTVTYPCD + ), + PHONEMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR), ',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG(al.TEXT, ',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM', 'EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR + ) +SELECT ActvData.*, + acc.CURRACCTSTATCD AS AcctStatAtQueryTime, + hist.ACCTSTATCD AS AcctStateAtActivity, + hist.EFFDATETIME AS AcctStateEffDateTime, + p.FIRSTNAME AS AssociateFirst, + p.LASTNAME AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + CASE + WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','), TAXPERS.FIRSTNAMEUPPER) + ELSE NULL + END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + ee.EmployeeEmail AS EmployeeEmail, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM AGREEMENTACTIVITYDATA ActvData + -- Sometimes a card activity shows up with identical data but a different date time Seconds apart. + -- There seems to always be an entry created in CARDMEMBERISSUEHIST that has one record matching these timestamps + JOIN OSIBANK.CARDMEMBERISSUEHIST c ON + c.AGREENBR = ActvData.AgreementNbr + AND c.EFFDATETIME = ActvData.ActivityDateTime + JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = ActvData.AccountNbr + LEFT JOIN OSIBANK.PERS taxpers ON ActvData.OwnerPersonNbr = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON ActvData.OwnerOrgNbr = TAXORG.ORGNBR + --Check for most recent account status before the Activity was recorded + --This has been verified to not produce duplicate rows and not eliminate rows + JOIN OSIBANK.ACCTACCTSTATHIST hist ON ActvData.AccountNbr = hist.ACCTNBR AND hist.TIMEUNIQUEEXTN = ( + SELECT MAX(TIMEUNIQUEEXTN) + FROM OSIBANK.ACCTACCTSTATHIST histsearch + WHERE histsearch.EFFDATETIME <= ActvData.ActivityDateTime + AND histsearch.ACCTNBR = ActvData.AccountNbr +) + JOIN OSIBANK.PERS p ON ActvData.ResponsiblePersonNbr = p.PERSNBR + JOIN EmployeeEmail ee ON ActvData.ResponsiblePersonNbr = ee.CorePersNbr + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE (ActvData.AgreementNbr IS NOT NULL AND ActvData.CardState IS NOT NULL AND ActvData.CARDTYPE IS NOT NULL) + AND ActvData.CardType IN ('DBT', 'DBT2', 'BDBT', 'ATM') + --AND ACCTSTATCD = 'ACT' (Uncomment to only return cards that we issued to active accounts) + AND ActivityNbr > TO_NUMBER(COALESCE(:afterActivityNbr, '-1')) + AND ActivityDateTime >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') +ORDER BY ActvData.ActivityDateTime ASC + FETCH NEXT TO_NUMBER(COALESCE(:limitAmount, '100')) ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSales.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSales.sql new file mode 100644 index 0000000..abb593e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSales.sql @@ -0,0 +1,126 @@ +/*New Checking Account Sale Query +---------------------------------- +DESCRIPTION: + Get all Activities related to New checking accounts (ActvType = AADD and AccountType = 'Checking') + after a supplied DateTime (inclusive) or after a supplied ActivityNumber (not inclusive) or both. + Supplies Activity Data as well as the Account Number of the new account and the account status at the time of querying + +RETURNS: Models/Activity/NewCheckingAccountActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Checking Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Checking Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + + |limitAmount : Null or Int (as string) + |------------------------------------------------------------------------------ + |Return record count + |If null defaults to '100' + +NOTES: + - Activity Type Code 'AADD' are activities related to 'Adding an account' + - Limitation: You get the status of the account when querying. This could be different immediately after creation + - When Acct is associated with person, the TAXRPTFORPERSNBR will populate, when associated with organizations the + when associated with an organization the TAXRPTFORORGNBR will populate + - Using both the following sub account filters resulted in the same number of activities to be found (638) and removed duplicates. When neither of these are checked for null values, there are 662 (24 duplicates) + 1. max(CASE WHEN a2.OLDVALUE = 'Key=' AND a2.TABLEID = 'Acct' AND a2.COLUMNID = 'AcctNbr' AND a2.DATABASEACTVCD = 'UPD' THEN a2.NEWVALUE END) AS SubActivityAccount (638 results) + 2. max(CASE WHEN a2.COLUMNID = 'ACCTNBR' AND a2.TABLEID = 'ACCT' AND a2.DATABASEACTVCD = 'ADD' THEN a2.NEWVALUE END) AS SubActivityAccount (638 results) + +*/ +WITH EmployeeEmail AS ( + SELECT p.PERSNBR As CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM OSIBANK.PERSEMPL p + JOIN OSIBANK.PERSADDRUSE paddr ON + p.PERSNBR = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +), + OriginalBalance AS ( + --This assumes there is only 1 Note/Bal sub account for every account + --So far that has been true. + SELECT ACCTNBR, ORIGBAL + FROM OSIBANK.ACCTSUBACCT a2 + WHERE a2.BALCATCD = 'NOTE' + AND a2.BALTYPCD = 'BAL' + ), + ActivitySubActivity AS ( + SELECT * + FROM OSIBANK.ACTVSUBACTV asa + WHERE asa.TABLEID = 'Acct' + ), + NEWCHECKINGACTIVITYDATA AS ( + SELECT a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.SUBJACCTNBR AS SubjectAccountNbr, + a.RESPPERSNBR AS ResponsiblePersonNbr, + a.ACTVTYPCD AS ActivityTypeCode, + --2 activities are sometimes created for adding an account, only 1 will update the account from key= to the actual account number value + max(CASE + WHEN asa.OLDVALUE = 'Key=' AND asa.COLUMNID = 'AcctNbr' AND asa.DATABASEACTVCD = 'UPD' THEN asa.NEWVALUE + END) AS SubActivityAccount + FROM OSIBANK.ACTV a + LEFT JOIN ActivitySubActivity asa ON asa.ACTVNBR = a.ACTVNBR + WHERE a.ACTVTYPCD = 'AADD' + GROUP BY a.ACTVNBR, a.ACTVDATETIME, a.SUBJACCTNBR, a.RESPPERSNBR, a.ACTVTYPCD + ), + PHONEMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR), ',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG(al.TEXT, ',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM', 'EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR + ) +SELECT ActvData.*, + p.FIRSTNAME AS AssociateFirst, + p.LASTNAME AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + ee.EmployeeEmail AS EmployeeEmail, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + CASE + WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','), TAXPERS.FIRSTNAMEUPPER) + ELSE NULL + END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + acc.BranchOrgNbr As BranchOrgNbr, + acc.CONTRACTDATE AS AccountContractDate, + acc.CURRMIACCTTYPCD AS MinorAccountType, + org.ORGNAME AS BranchOrgName, + ob.ORIGBAL AS OriginalBalance, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM NEWCHECKINGACTIVITYDATA ActvData + JOIN OSIBANK.PERS p ON p.PERSNBR = ActvData.ResponsiblePersonNbr + LEFT JOIN EmployeeEmail ee ON ee.CorePersNbr = ActvData.ResponsiblePersonNbr + JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = ActvData.SubjectAccountNbr + JOIN OSIBANK.ORG org ON acc.BranchOrgNbr = org.ORGNBR + LEFT JOIN OSIBANK.PERS taxpers ON acc.TAXRPTFORPERSNBR = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON acc.TAXRPTFORORGNBR = TAXORG.ORGNBR + LEFT JOIN OriginalBalance ob ON acc.ACCTNBR = ob.AcctNbr + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE ActvData.SubActivityAccount IS NOT NULL + AND acc.CURRMIACCTTYPCD IN ('CK04', 'CK01', 'CK02', 'CK03', 'BC10', 'BC20', 'MMC5', 'BOC1', 'BOC2', 'BC01', 'MMC1', 'CK05', 'BC11', 'CK06') + AND ActivityNbr > TO_NUMBER(COALESCE(:afterActivityNbr, '-1')) + AND ActivityDateTime >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') +ORDER BY ActvData.ActivityDateTime ASC + FETCH NEXT TO_NUMBER(COALESCE(:limitAmount, '100')) ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSalesDigitalBanking.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSalesDigitalBanking.sql new file mode 100644 index 0000000..ad1b22a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewCheckingAccountSalesDigitalBanking.sql @@ -0,0 +1,103 @@ +/*New Checking Account Sale Query +---------------------------------- +DESCRIPTION: + Get all Activities related to New checking accounts (ActvType = ADAC and AccountType = 'Checking') + after a supplied DateTime (inclusive) or after a supplied ActivityNumber (not inclusive) or both. + Supplies Activity Data as well as the Account Number of the new account and the account status at the time of querying + +RETURNS: Models/Activity/NewCheckingAccountActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Checking Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Checking Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + +NOTES: + - Activity Type Code 'ADAC' are activities related to 'Adding an account' + - Limitation: You get the status of the account when querying. This could be different immediately after creation + - When Acct is associated with person, the TAXRPTFORPERSNBR will populate, when associated with organizations the + when associated with an organization the TAXRPTFORORGNBR will populate + - Using both the following sub account filters resulted in the same number of activities to be found (638) and removed duplicates. When neither of these are checked for null values, there are 662 (24 duplicates) + 1. max(CASE WHEN a2.OLDVALUE = 'Key=' AND a2.TABLEID = 'Acct' AND a2.COLUMNID = 'AcctNbr' AND a2.DATABASEACTVCD = 'ADD' THEN a2.NEWVALUE END) AS SubActivityAccount (638 results) + 2. max(CASE WHEN a2.COLUMNID = 'ACCTNBR' AND a2.TABLEID = 'ACCT' AND a2.DATABASEACTVCD = 'ADD' THEN a2.NEWVALUE END) AS SubActivityAccount (638 results) + +*/ +WITH OriginalBalance AS ( + --This assumes there is only 1 Note/Bal sub account for every account + --So far that has been true. + SELECT ACCTNBR, ORIGBAL + FROM OSIBANK.ACCTSUBACCT a2 + WHERE a2.BALCATCD = 'NOTE' + AND a2.BALTYPCD = 'BAL' + ), + NEWCHECKINGACTIVITYDATA AS ( + SELECT a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.SUBJACCTNBR AS SubjectAccountNbr, + a.RESPPERSNBR AS ResponsiblePersonNbr, + a.ACTVTYPCD AS ActivityTypeCode, + --2 activities are sometimes created for adding an account, only 1 will update the account from key= to the actual account number value + max(CASE + WHEN asa.OLDVALUE = 'Key=' AND asa.COLUMNID = 'AcctNbr' AND asa.DATABASEACTVCD = 'ADD' THEN asa.NEWVALUE + END) AS SubActivityAccount + FROM OSIBANK.ACTV a + LEFT JOIN OSIBANK.ACTVSUBACTV asa ON asa.ACTVNBR = a.ACTVNBR and asa.TABLEID = 'Acct' + WHERE a.ACTVTYPCD = 'ADAC' + GROUP BY a.ACTVNBR, a.ACTVDATETIME, a.SUBJACCTNBR, a.RESPPERSNBR, a.ACTVTYPCD + ), + PHONEMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR), ',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG(al.TEXT, ',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM', 'EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR ) +SELECT ActvData.*, + 'Digital' AS AssociateFirst, + 'Banking' AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + 'DigitalBanking@landmarkcu.com' AS EmployeeEmail, --we will not have employee email for Digital Banking + CASE + WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','), TAXPERS.FIRSTNAMEUPPER) + ELSE NULL + END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + acc.BranchOrgNbr As BranchOrgNbr, + acc.CONTRACTDATE AS AccountContractDate, + acc.CURRMIACCTTYPCD AS MinorAccountType, + org.ORGNAME AS BranchOrgName, + ob.ORIGBAL AS OriginalBalance, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM NEWCHECKINGACTIVITYDATA ActvData + JOIN OSIBANK.PERS p ON p.PERSNBR = ActvData.ResponsiblePersonNbr + JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = ActvData.SubjectAccountNbr + JOIN OSIBANK.ORG org ON acc.BranchOrgNbr = org.ORGNBR + LEFT JOIN OSIBANK.PERS taxpers ON acc.TAXRPTFORPERSNBR = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON acc.TAXRPTFORORGNBR = TAXORG.ORGNBR + LEFT JOIN OriginalBalance ob ON acc.ACCTNBR = ob.AcctNbr + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE acc.CURRMIACCTTYPCD IN ('CK04', 'CK01', 'CK02', 'CK03', 'BC10', 'BC20', 'MMC5', 'BOC1', 'BOC2', 'BC01', 'MMC1', 'CK05', 'BC11', 'CK06') +AND ActivityNbr > TO_NUMBER(COALESCE(:afterActivityNbr, '-1')) +AND ActivityDateTime >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') +ORDER BY ActvData.ActivityDateTime ASC +FETCH NEXT TO_NUMBER(COALESCE(:limitAmount, '200')) ROWS ONLY diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewDebtProtectedLoanSales.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewDebtProtectedLoanSales.sql new file mode 100644 index 0000000..8d0b925 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewDebtProtectedLoanSales.sql @@ -0,0 +1,175 @@ +/*New Debt Protected Loan Sale Query +---------------------------------- +DESCRIPTION: + All activities related to new loans that can have debt protection associated with them, but are not + incentivised like Mortgages and Vehicles. + +RETURNS: Models/Activity/NewCheckingAccountActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + +NOTES: + - Use ContractDate as the date of the sale. This is the day that the customer signs for the loan. There is a legal grace-period between + When a loan is signed and when the loan is booked into the banking system. This is why there is a gap between contract date and activity date. + -Only need to know if an account has debt protection not how many debt protection policies the account has. We select the earliest sold + debt protection and add the date and type to signify that the loan has debt protection + - LADD type activities seem to produce duplicates occasionally, None were found for mortgage type accounts + */ +WITH EmployeeEmail AS ( + SELECT p.PERSNBR As CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM OSIBANK.PERSEMPL p + JOIN OSIBANK.PERSADDRUSE paddr ON + p.PERSNBR = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +), + OriginatorRole AS ( + SELECT ACCTNBR, PERSNBR, ACCTROLECD, DATELASTMAINT, EFFDATE + from OSIBANK.ACCTACCTROLEPERS a + WHERE ACCTROLECD = 'OEMP' + GROUP BY ACCTNBR, ACCTROLECD, DATELASTMAINT, EFFDATE, PERSNBR + HAVING DATELASTMAINT = MAX(DATELASTMAINT) + ), + LoanLimit AS ( + SELECT a2.ACCTNBR, a2.CREDITLIMITAMT, a2.DATELASTMAINT + FROM OSIBANK.ACCTLOANLIMITHIST a2 + WHERE a2.CREDITLIMITAMT > '0' + GROUP BY a2.ACCTNBR, a2.CREDITLIMITAMT, a2.DATELASTMAINT + HAVING MIN(a2.DATELASTMAINT) = a2.DATELASTMAINT + ORDER BY CREDITLIMITAMT + ), + OriginalBalance AS ( + --This assumes there is only 1 Note/Bal sub account for every account + --So far that has been true. + SELECT ACCTNBR, ORIGBAL + FROM OSIBANK.ACCTSUBACCT a2 + WHERE a2.BALCATCD = 'NOTE' + AND a2.BALTYPCD = 'BAL' + ), + DebtProtection AS ( + SELECT a.ACCTNBR, + MIN(var.CALCTYPEFFDATE) AS EffectiveDate, + a.BALCATCD + FROM OSIBANK.ACCTSUBACCT a + INNER JOIN ( + SELECT ACCTNBR, MIN(SUBACCTNBR) AS SUBACCTNBR + FROM OSIBANK.ACCTSUBACCT sa + WHERE sa.BALTYPCD = 'SINS' + GROUP BY ACCTNBR + ) b ON a.ACCTNBR = b.ACCTNBR AND a.SUBACCTNBR = b.SUBACCTNBR + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR var ON var.ACCTNBR = a.ACCTNBR AND a.SUBACCTNBR = var.SUBACCTNBR + GROUP BY a.ACCTNBR, var.CALCTYPEFFDATE, a.BALCATCD + ), + BorrowerAge AS ( + SELECT a.ACCTNBR, MAX(p.DATEBIRTH) AS YoungestBirthdate + FROM OSIBANK.ACCTACCTROLEPERS a + LEFT JOIN OSIBANK.ACCT acc ON a.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACCTROLE r ON r.ACCTROLECD = a.ACCTROLECD + LEFT JOIN OSIBANK.PERS p ON a.PERSNBR = p.PERSNBR + WHERE a.ACCTROLECD IN ('TRO', 'NTO', 'SIGN') + AND (p.DATEDEATH IS NULL OR p.DATEDEATH > acc.CONTRACTDATE) + GROUP BY a.ACCTNBR + ), + PHONEMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR), ',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG(al.TEXT, ',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM', 'EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR + ) +SELECT a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.SUBJACCTNBR AS SubjectAccountNbr, + a.RESPPERSNBR AS ActivityResponsiblePersonNbr, + oe.PERSNBR AS OriginatingPersonNbr, + a.ACTVTYPCD AS ActivityTypeCode, + p.FIRSTNAME AS AssociateFirst, + p.LASTNAME AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + --NEW = "New" | REFI = "Refinance" + ll.CREDITLIMITAMT AS LoanLimit, + ob.OrigBal AS OriginalBalance, + COALESCE(ll.CREDITLIMITAMT, ob.ORIGBAL) AS LoanAmount, + al.LOANSOURCECD AS LoanSourceCode, + --ABS(r.TRANAMT) AS LoanDispersalAmmount, + ee.EmployeeEmail AS EmployeeEmail, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + CASE WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','), TAXPERS.FIRSTNAMEUPPER) ELSE NULL END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + acc.BranchOrgNbr As BranchOrgNbr, + acc.MjAcctTypCd AS MajorAccountType, + acc.CURRMIACCTTYPCD AS MinorAccountType, + acc.CONTRACTDATE AS AccountContractDate, + org.ORGNAME AS BranchOrgName, + dp.EffectiveDate AS DebtProtectionEffectiveDate, + dp.BALCATCD AS DebtProtectionCategory, + CASE + WHEN + ba.YoungestBirthdate IS NOT NULL AND + p2.DATEBIRTH IS NOT NULL + THEN + GREATEST(ba.YOUNGESTBIRTHDATE, p2.DATEBIRTH) + ELSE + COALESCE(ba.YOUNGESTBIRTHDATE, p2.DATEBIRTH) + END AS YoungestBirthdateOnLoan, + CASE + WHEN + acc.ACCTNBR IN ( + SELECT acctnbr + FROM OSIBANK.ACCTACCTROLEORG aro + Where aro.ACCTROLECD IN ('DBA', 'LLC', 'UNAS') + ) OR + acc.TAXRPTFORORGNBR IS NOT NULL + THEN 1 + ELSE 0 + END AS HasOrgRoles, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM OSIBANK.ACTV a + LEFT JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = a.SUBJACCTNBR + LEFT JOIN OriginatorRole oe ON acc.ACCTNBR = oe.AcctNbr + LEFT JOIN OSIBANK.PERS p ON p.PERSNBR = oe.PERSNBR + LEFT JOIN OSIBANK.PERS taxpers ON acc.TAXRPTFORPERSNBR = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON acc.TAXRPTFORORGNBR = TAXORG.ORGNBR + JOIN OSIBANK.ORG org ON org.ORGNBR = acc.BRANCHORGNBR + LEFT JOIN EmployeeEmail ee ON p.PERSNBR = ee.CorePersNbr + --Uncomment to get Loan Dispersal Transaction Information + --LEFT JOIN OSIBANK.RTXN r ON acc.ACCTNBR = r.ACCTNBR AND r.RTXNTYPCD = 'NDSB' + LEFT JOIN OSIBANK.ACCTLOAN al ON acc.ACCTNBR = al.ACCTNBR + LEFT JOIN LoanLimit ll ON ll.AcctNbr = acc.ACCTNBR + LEFT JOIN OriginalBalance ob ON ob.AcctNbr = acc.ACCTNBR + LEFT JOIN DebtProtection dp ON dp.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACTVSUBACTV sa ON sa.ACTVNBR = a.ACTVNBR + LEFT JOIN BorrowerAge ba ON ba.AcctNbr = acc.ACCTNBR + LEFT JOIN OSIBANK.PERS p2 ON acc.TAXRPTFORPERSNBR = p2.PERSNBR + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE acc.CURRMIACCTTYPCD IN ('SC01', 'SC02', 'SG01') + AND (a.ACTVTYPCD = 'ADAC' OR a.ACTVTYPCD = 'LADD') + AND LOWER(sa.TABLEID) = 'acct' + AND LOWER(sa.COLUMNID) = 'acctnbr' + AND a.ACTVNBR > TO_NUMBER(COALESCE(:afterActivityNbr, '-1')) + AND a.ACTVDATETIME >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewMortgageAccountSales.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewMortgageAccountSales.sql new file mode 100644 index 0000000..21cac9d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewMortgageAccountSales.sql @@ -0,0 +1,186 @@ +/*New Mortgagage Account Sale Query +---------------------------------- +DESCRIPTION: + Get all Activities related to New Mortgage Accounts (ActvType = AADD and AccountType = ('FE01', 'MF01', 'FE02', 'FLML') + after a supplied DateTime (inclusive) or after a supplied ActivityNumber (not inclusive) or both. + Supplies Activity Data as well as the Account Number of the new account and the account status at the time of querying + +RETURNS: Models/Activity/NewCheckingAccountActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Checking Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Checking Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + +NOTES: + - ALL HELOC type loans are technically 'children' of a mainline loan. A person may get approved for a 100,000 mainline loan + but take out only 5k at a time via fixed loans. For incentive purposes we do not want to pull in the activity for HELOC's children loans + instead we pull in Flex Mainline (FLML) Loans. + - For mainline loans we use the first credit limit amount that is not 0 as the loan amount (the amount the customer was approved for) + - For loans that do not have a parent mainline we use the original balance amount on the loan (the amount the customer has available after approval) + - Use ContractDate as the date of the sale. This is the day that the customer signs for the loan. There is a legal grace-period between + When a loan is signed and when the loan is booked into the banking system. This is why there is a gap between contract date and activity date. + -Only need to know if an account has debt protection not how many debt protection policies the account has. We select the earliest sold + debt protection and add the date and type to signify that the loan has debt protection + - LADD type activities seem to produce duplicates occasionally, None were found for mortgage type accounts + */ +WITH EmployeeEmail AS ( + SELECT p.PERSNBR As CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM OSIBANK.PERSEMPL p + JOIN OSIBANK.PERSADDRUSE paddr ON + p.PERSNBR = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +), + OriginatorRole AS ( + SELECT ACCTNBR, PERSNBR, ACCTROLECD, DATELASTMAINT, EFFDATE + from OSIBANK.ACCTACCTROLEPERS a + WHERE ACCTROLECD = 'OEMP' + GROUP BY ACCTNBR, ACCTROLECD, DATELASTMAINT, EFFDATE, PERSNBR + HAVING DATELASTMAINT = MAX(DATELASTMAINT) + ), + LoanLimit AS ( + SELECT a2.ACCTNBR, a2.CREDITLIMITAMT, a2.DATELASTMAINT + FROM OSIBANK.ACCTLOANLIMITHIST a2 + WHERE a2.CREDITLIMITAMT > '0' + GROUP BY a2.ACCTNBR, a2.CREDITLIMITAMT, a2.DATELASTMAINT + HAVING MIN(a2.DATELASTMAINT) = a2.DATELASTMAINT + ORDER BY CREDITLIMITAMT + ), + OriginalBalance AS ( + --This assumes there is only 1 Note/Bal sub account for every account + --So far that has been true. + SELECT ACCTNBR, ORIGBAL + FROM OSIBANK.ACCTSUBACCT a2 + WHERE a2.BALCATCD = 'NOTE' + AND a2.BALTYPCD = 'BAL' + ), + DebtProtection AS ( + SELECT a.ACCTNBR, + MIN(var.CALCTYPEFFDATE) AS EffectiveDate, + a.BALCATCD + FROM OSIBANK.ACCTSUBACCT a + INNER JOIN ( + SELECT ACCTNBR, MIN(SUBACCTNBR) AS SUBACCTNBR + FROM OSIBANK.ACCTSUBACCT sa + WHERE sa.BALTYPCD = 'SINS' + GROUP BY ACCTNBR + ) b ON a.ACCTNBR = b.ACCTNBR AND a.SUBACCTNBR = b.SUBACCTNBR + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR var ON var.ACCTNBR = a.ACCTNBR AND a.SUBACCTNBR = var.SUBACCTNBR + GROUP BY a.ACCTNBR, var.CALCTYPEFFDATE, a.BALCATCD + ), + BorrowerAge AS ( + SELECT a.ACCTNBR, MAX(p.DATEBIRTH) AS YoungestBirthdate + FROM OSIBANK.ACCTACCTROLEPERS a + LEFT JOIN OSIBANK.ACCT acc ON a.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACCTROLE r ON r.ACCTROLECD = a.ACCTROLECD + LEFT JOIN OSIBANK.PERS p ON a.PERSNBR = p.PERSNBR + WHERE a.ACCTROLECD IN ('TRO', 'NTO', 'SIGN') + AND (p.DATEDEATH IS NULL OR p.DATEDEATH > acc.CONTRACTDATE) + GROUP BY a.ACCTNBR + ), + PHONEMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR), ',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT p.PERSNBR, + LISTAGG(al.TEXT, ',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM', 'EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR + ) +SELECT a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.SUBJACCTNBR AS SubjectAccountNbr, + a.RESPPERSNBR AS ActivityResponsiblePersonNbr, + oe.PERSNBR AS OriginatingPersonNbr, + a.ACTVTYPCD AS ActivityTypeCode, + p.FIRSTNAME AS AssociateFirst, + p.LASTNAME AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + --NEW = "New" | REFI = "Refinance" + ll.CREDITLIMITAMT AS LoanLimit, + ob.OrigBal AS OriginalBalance, + COALESCE(ll.CREDITLIMITAMT, ob.ORIGBAL) AS LoanAmount, + al.LOANSOURCECD AS LoanSourceCode, + --ABS(r.TRANAMT) AS LoanDispersalAmmount, + ee.EmployeeEmail AS EmployeeEmail, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + CASE WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','), TAXPERS.FIRSTNAMEUPPER) ELSE NULL END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + acc.BranchOrgNbr As BranchOrgNbr, + acc.MjAcctTypCd AS MajorAccountType, + acc.CURRMIACCTTYPCD AS MinorAccountType, + acc.CONTRACTDATE AS AccountContractDate, + org.ORGNAME AS BranchOrgName, + dp.EffectiveDate AS DebtProtectionEffectiveDate, + dp.BALCATCD AS DebtProtectionCategory, + CASE + WHEN + ba.YOUNGESTBIRTHDATE IS NOT NULL AND + p2.DATEBIRTH IS NOT NULL + THEN + GREATEST(ba.YOUNGESTBIRTHDATE, p2.DATEBIRTH) + ELSE + COALESCE(ba.YOUNGESTBIRTHDATE, p2.DATEBIRTH) + END AS YoungestBirthdateOnLoan, + CASE + WHEN + acc.ACCTNBR IN ( + SELECT acctnbr + FROM OSIBANK.ACCTACCTROLEORG aro + Where aro.ACCTROLECD IN ('DBA', 'LLC', 'UNAS') + ) OR + acc.TAXRPTFORORGNBR IS NOT NULL + THEN 1 + ELSE 0 + END AS HasOrgRoles, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM OSIBANK.ACTV a + LEFT JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = a.SUBJACCTNBR + LEFT JOIN OriginatorRole oe ON acc.ACCTNBR = oe.AcctNbr + LEFT JOIN OSIBANK.PERS p ON p.PERSNBR = oe.PERSNBR + LEFT JOIN OSIBANK.PERS taxpers ON acc.TAXRPTFORPERSNBR = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON acc.TAXRPTFORORGNBR = TAXORG.ORGNBR + JOIN OSIBANK.ORG org ON org.ORGNBR = acc.BRANCHORGNBR + LEFT JOIN EmployeeEmail ee ON p.PERSNBR = ee.CorePersNbr + --Uncomment to get Loan Dispersal Transaction Information + --LEFT JOIN OSIBANK.RTXN r ON acc.ACCTNBR = r.ACCTNBR AND r.RTXNTYPCD = 'NDSB' + LEFT JOIN OSIBANK.ACCTLOAN al ON acc.ACCTNBR = al.ACCTNBR + LEFT JOIN LoanLimit ll ON ll.AcctNbr = acc.ACCTNBR + LEFT JOIN OriginalBalance ob ON ob.AcctNbr = acc.ACCTNBR + LEFT JOIN DebtProtection dp ON dp.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACTVSUBACTV sa ON sa.ACTVNBR = a.ACTVNBR + LEFT JOIN BorrowerAge ba ON ba.AcctNbr = acc.ACCTNBR + LEFT JOIN OSIBANK.PERS p2 ON acc.TAXRPTFORPERSNBR = p2.PERSNBR + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE acc.MJACCTTYPCD IN ('CNS', 'MLN', 'MTG') + AND acc.CURRMIACCTTYPCD IN ('HE01', 'FE01', 'MF01', 'FE02', 'FNMA', 'FRML', 'FRMH', 'MPFR', 'MJ30', 'HM01', 'HM02', +'MF10', 'HM03', 'HM04', 'DEF3', 'ML01', 'ML03', 'MJ03', 'MJ05', 'MJ07', 'MF15', 'MF20', 'MF30', 'MC93', 'MA55', 'MS30', +'MS10', 'MS15', 'MS20', 'MS40', 'MC09', 'ML02', 'MA01', 'MP05', 'MA05', 'MC01', 'MI05', 'MC03', 'MJ55', 'MC91', 'MF40', +'MS05', 'MS07', 'MI03', 'MA03', 'MA07', 'MA27', 'ML23', 'ML21', 'MP25', 'MC21', 'MA21', 'MJ27', 'HM05', 'MA23', 'MA25', +'MI25', 'MJ23', 'MJ25') + AND (a.ACTVTYPCD = 'ADAC' OR a.ACTVTYPCD = 'LADD') + AND LOWER(sa.TABLEID) = 'acct' + AND LOWER(sa.COLUMNID) = 'acctnbr' + AND a.ACTVNBR > TO_NUMBER(COALESCE(:afterActivityNbr, '-1')) + AND a.ACTVDATETIME >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewVehicleAccountSales.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewVehicleAccountSales.sql new file mode 100644 index 0000000..83d6361 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/NewVehicleAccountSales.sql @@ -0,0 +1,164 @@ +/*New Vehicle Account Sale Query +---------------------------------- +DESCRIPTION: + Get all Activities related to New Mortgage Accounts (ActvType = AADD and AccountType = ('FE01', 'MF01', 'FE02', 'FLML') + after a supplied DateTime (inclusive) or after a supplied ActivityNumber (not inclusive) or both. + Supplies Activity Data as well as the Account Number of the new account and the account status at the time of querying + +RETURNS: Models/Activity/NewCheckingAccountActivity.cs + +PARAMS: + + |afterActivityNbr : Null or Int (as string) + |------------------------------------------------------------------------------ + |Returns all Checking Sales with ActivityNbrs larger than the supplied number. + |If null defaults to -1 which will return all Checking SalesActivities + + |newerThanDateTime : Null or Datetime in format 'YYYY-MM-DD HH24:MI:SS' (as string) + |----------------------------------------------------------------------------- + |Returns all Checking Sales with ActivityNbrs that occured on or after the supplied date + |If null defaults to '0001-01-01 00:00:00' which is oracles MIN Date time, this effectively + |returns all Checking Sales Activities + Potential Types: DLxx may be added in the future + 'BE21','DL01','DL06','DL07','DL08','DL09','DL10','DL11','DL12','DL13','DL14','DL16','DV01','DV02','DV03','DV04','DV05','DV06','DV07','DV08', +NOTES: + - See Mortgage Loan Notes + -Only need to know if an account has debt protection not how many debt protection policies the account has. We select the earliest sold + debt protection and add the date and type to signify that the loan has debt protection + - LADD type activities seem to produce duplicates occasionally, None were found for vehicle type accounts +*/ +WITH EmployeeEmail AS ( + SELECT + p.PERSNBR As CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM + OSIBANK.PERSEMPL p + JOIN OSIBANK.PERSADDRUSE paddr ON + p.PERSNBR = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +), + OriginatorRole AS ( + SELECT ACCTNBR, PERSNBR, ACCTROLECD, DATELASTMAINT, EFFDATE from OSIBANK.ACCTACCTROLEPERS a + WHERE ACCTROLECD = 'OEMP' + GROUP BY ACCTNBR, ACCTROLECD, DATELASTMAINT, EFFDATE, PERSNBR + HAVING DATELASTMAINT = MAX(DATELASTMAINT) + ), + OriginalBalance AS ( + --This assumes there is only 1 Note/Bal sub account for every account + --So far that has been true. + SELECT ACCTNBR, ORIGBAL FROM OSIBANK.ACCTSUBACCT a2 + WHERE a2.BALCATCD = 'NOTE' AND a2.BALTYPCD = 'BAL' + ), + DebtProtection AS ( + SELECT + a.ACCTNBR, + MIN(var.CALCTYPEFFDATE) AS EffectiveDate, + a.BALCATCD + FROM OSIBANK.ACCTSUBACCT a + INNER JOIN ( + SELECT ACCTNBR, MAX(SUBACCTNBR) AS SUBACCTNBR FROM OSIBANK.ACCTSUBACCT sa + WHERE sa.BALTYPCD = 'SINS' + GROUP BY ACCTNBR + ) b ON a.ACCTNBR = b.ACCTNBR AND a.SUBACCTNBR = b.SUBACCTNBR + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR var ON var.ACCTNBR = a.ACCTNBR AND a.SUBACCTNBR = var.SUBACCTNBR + GROUP BY a.ACCTNBR, var.CALCTYPEFFDATE, a.BALCATCD + ), + BorrowerAge AS ( + SELECT a.ACCTNBR, MAX(p.DATEBIRTH) AS YoungestBirthdate FROM OSIBANK.ACCTACCTROLEPERS a + LEFT JOIN OSIBANK.ACCT acc ON a.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACCTROLE r ON r.ACCTROLECD = a.ACCTROLECD + LEFT JOIN OSIBANK.PERS p ON a.PERSNBR = p.PERSNBR + WHERE a.ACCTROLECD IN ('TRO','NTO','SIGN') AND (p.DATEDEATH IS NULL OR p.DATEDEATH > acc.CONTRACTDATE) + GROUP BY a.ACCTNBR + ), + PHONEMETADATA AS ( + SELECT + p.PERSNBR, + LISTAGG((pp.AREACD || pp.EXCHANGE || pp.PHONENBR),',') AS PhoneNumbers + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSPHONE pp ON p.PERSNBR = pp.PERSNBR AND pp.PHONEUSECD != 'BUS' + GROUP BY p.PERSNBR + ), + EMAILMETADATA AS ( + SELECT + p.PERSNBR, + LISTAGG(al.TEXT,',') AS EmailAddresses + FROM OSIBANK.PERS p + LEFT JOIN OSIBANK.PERSADDRUSE pa ON p.PERSNBR = pa.PERSNBR AND pa.ADDRUSECD IN ('EHOM','EML') + LEFT JOIN OSIBANK.ADDRLINE al ON pa.ADDRNBR = al.ADDRNBR AND al.LINENBR = 1 + GROUP BY p.PERSNBR + ) +SELECT + a.ACTVNBR AS ActivityNbr, + a.ACTVDATETIME AS ActivityDateTime, + a.SUBJACCTNBR AS SubjectAccountNbr, + a.RESPPERSNBR AS ActivityResponsiblePersonNbr, + oe.PERSNBR AS OriginatingPersonNbr, + a.ACTVTYPCD AS ActivityTypeCode, + p.FIRSTNAME AS AssociateFirst, + p.LASTNAME AS AssociateLast, + p.MDLINIT AS AssociateMiddleInit, + --NEW = "New" | REFI = "Refinance" + ob.OrigBal AS LoanAmount, + al.LOANSOURCECD AS LoanSourceCode, + --ABS(r.TRANAMT) AS LoanDispersalAmmount, + ee.EmployeeEmail AS EmployeeEmail, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + CASE WHEN acc.TAXRPTFORPERSNBR IS NOT NULL THEN CONCAT(CONCAT(TAXPERS.LASTNAMEUPPER, ','),TAXPERS.FIRSTNAMEUPPER) ELSE NULL END AS TaxPersonName, + TAXORG.ORGNAME AS TaxOrgName, + acc.BranchOrgNbr As BranchOrgNbr, + acc.MjAcctTypCd AS MajorAccountType, + acc.CURRMIACCTTYPCD AS MinorAccountType, + acc.CONTRACTDATE AS AccountContractDate, + org.ORGNAME AS BranchOrgName, + dp.EffectiveDate AS DebtProtectionEffectiveDate, + dp.BALCATCD AS DebtProtectionCategory, + CASE + WHEN + ba.YOUNGESTBIRTHDATE IS NOT NULL AND + p2.DATEBIRTH IS NOT NULL + THEN + GREATEST(ba.YoungestBirthdate, p2.DATEBIRTH) + ELSE + COALESCE (ba.YoungestBirthdate, p2.DATEBIRTH) + END AS YoungestBirthdateOnLoan, + CASE + WHEN + acc.ACCTNBR IN ( + SELECT acctnbr FROM OSIBANK.ACCTACCTROLEORG aro + Where aro.ACCTROLECD IN ('DBA', 'LLC','UNAS') + ) OR + acc.TAXRPTFORORGNBR IS NOT NULL + THEN 1 + ELSE 0 + END AS HasOrgRoles, + pmd.PhoneNumbers AS TaxPersonPhoneNumbers, + emd.EmailAddresses AS TaxPersonEmailAddresses +FROM OSIBANK.ACTV a + JOIN OSIBANK.ACCT acc ON acc.ACCTNBR = a.SUBJACCTNBR + LEFT JOIN OriginatorRole oe ON acc.ACCTNBR = oe.AcctNbr + LEFT JOIN OSIBANK.PERS p ON p.PERSNBR = oe.PERSNBR + LEFT JOIN OSIBANK.PERS taxpers ON acc.TAXRPTFORPERSNBR = TAXPERS.PERSNBR + LEFT JOIN OSIBANK.ORG taxorg ON acc.TAXRPTFORORGNBR = TAXORG.ORGNBR + JOIN OSIBANK.ORG org ON org.ORGNBR = acc.BRANCHORGNBR + LEFT JOIN EmployeeEmail ee ON p.PERSNBR = ee.CorePersNbr + --Uncomment to get Loan Dispersal Transaction Information + --LEFT JOIN OSIBANK.RTXN r ON acc.ACCTNBR = r.ACCTNBR AND r.RTXNTYPCD = 'NDSB' + LEFT JOIN OSIBANK.ACCTLOAN al ON acc.ACCTNBR = al.ACCTNBR + LEFT JOIN OriginalBalance ob ON ob.AcctNbr = acc.ACCTNBR + LEFT JOIN DebtProtection dp ON dp.ACCTNBR = acc.ACCTNBR + LEFT JOIN OSIBANK.ACTVSUBACTV sa ON sa.ACTVNBR = a.ACTVNBR + LEFT JOIN BorrowerAge ba ON ba.AcctNbr = acc.ACCTNBR + LEFT JOIN OSIBANK.PERS p2 ON acc.TAXRPTFORPERSNBR = p2.PERSNBR + LEFT JOIN PHONEMETADATA pmd ON taxpers.PERSNBR = pmd.PERSNBR + LEFT JOIN EMAILMETADATA emd ON taxpers.PERSNBR = emd.PERSNBR +WHERE + acc.MJACCTTYPCD IN ('CNS','CML') + AND acc.CURRMIACCTTYPCD IN ('BE21','DV01','DV02','DV03','DV04','DV05','DV06','DV07','DV08') + AND (a.ACTVTYPCD = 'ADAC' OR a.ACTVTYPCD = 'LADD') AND LOWER(sa.TABLEID) = 'acct' AND LOWER(sa.COLUMNID) = 'acctnbr' + AND a.ACTVNBR > TO_NUMBER(COALESCE( :afterActivityNbr, '-1')) + AND a.ACTVDATETIME >= TO_TIMESTAMP(COALESCE(:newerThanDateTime, '0001-01-01 00:00:00'), 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryActivityManagerActivityDetail.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryActivityManagerActivityDetail.sql new file mode 100644 index 0000000..3c5752d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryActivityManagerActivityDetail.sql @@ -0,0 +1,80 @@ +/* +CUSTOM FIELD INFO (ActivityManager.LF_LEAD_CUSTOM): +Credit Card Balance Transfer + --LeadCust_39 = External CC Account Number + --LeadCust_31 = Landmark Credit Card Number + --LeadCust_29 = Transfer Ammount + --LeadCust_28 = Payment State + Zip + --LeadCust_27 = Payment City + --LeadCust_26 = Payment Address Line 1 + --LeadCust_24 = Transfer Institution + +Direct Deposit + --LeadCust_38 = Direct Deposit is Qualified Referral + --LeadCust_4 = Direct Deposit Account Number +*/ + +WITH EmployeeEmail AS ( + SELECT pers.USERID AS SafUserId, + prod.PERSNBR AS SafPersNbr, + prod.PRODPERSID AS CorePersNbr, + addr.TEXT AS EmployeeEmail + FROM SAF.PERSUSER pers + JOIN SAF.PERSPROD prod ON + pers.PERSNBR = PROD.PERSNBR + AND prod.PRODNBR = '3' + JOIN OSIBANK.PERSADDRUSE paddr ON + prod.PRODPERSID = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EBUS' +) +SELECT ll.ID AS ActivityId, + -- These custom fields can be reused, guarentee their contents by only using them for their respective campaigns + (CASE WHEN ll.CAMPAIGN = 'CC Balance Transfer' THEN llc.LEADCUST_31 ELSE NULL END) AS LandmarkCreditCardNumber, + (CASE WHEN ll.CAMPAIGN = 'Direct Deposit' THEN llc.LEADCUST_4 ELSE NULL END) AS DirectDepositAccountNumber, + ll.ORIGINATOR AS OriginatorUserId, + safprod.PRODPERSID AS OriginatorPersNbr, + p.FIRSTNAME AS OriginatorFirstName, + p.LASTNAME AS OriginatorLastName, + p.MDLINIT AS OriginatorMiddleInitial, + ee.EmployeeEmail AS EmployeeEmail, + ll.CAMPAIGN AS Campaign, + ll.CATEGORY AS Category, + ll.STATION AS ReferralStation, + ll.DATELASTMAINT AS LastUpdatedDateTime, + (CASE WHEN att.INITIAL_STATION = 'Yes' THEN 1 ELSE 0 END) AS IsInitialStation, + (CASE WHEN att.FINAL_STATION = 'Yes' THEN 1 ELSE 0 END) AS IsFinalStation, + att.ACTIVITY_ORIGINATION_DATE AS OriginationDateTime, + att.ENTER_STATION_DATETIME AS StationDateTime, + ll.SOURCE AS OriginatingBranchName, + (CASE + WHEN SUBSTR(lp.EXTID3, 1, 1) = 'P' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') + ELSE NULL END + ) AS ReferredPersonNbr, + (CASE + WHEN SUBSTR(lp.EXTID3, 1, 1) = 'O' THEN REGEXP_SUBSTR(lp.EXTID3, '\d+') + ELSE NULL END + ) AS ReferredOrgNbr, + lp.EXTID3 AS ReferredPersOrgNbr +FROM ACTIVITYMANAGER.LF_LEAD ll + JOIN ACTIVITYMANAGER.LF_LEAD_CUSTOM llc ON + ll.ID = llc.ID + JOIN SAF.PERSUSER safp ON + safp.USERID = ll.ORIGINATOR + JOIN SAF.PERSPROD safprod ON + SAFPROD.PERSNBR = safp.PERSNBR AND + SAFPROD.PRODNBR = '3' + JOIN OSIBANK.PERS p ON + p.PERSNBR = SAFPROD.PRODPERSID + LEFT JOIN EmployeeEmail ee ON + ee.SafPersNbr = SAFP.PERSNBR + JOIN ACTIVITYMANAGER.LF_PERSON lp ON + lp.ID = ll.PERSONID + JOIN ACTIVITYMANAGER.ACTIVITY_TIME_TRACKING att + ON att.ACTIVITY_ID = ll.ID AND SEQUENCE_NUMBER = ( + SELECT MAX(SEQUENCE_NUMBER) + FROM ACTIVITYMANAGER.ACTIVITY_TIME_TRACKING att2 + WHERE att2.ACTIVITY_ID = ll.ID + ) +WHERE ll.Id IN :activityIds \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryEStatementDeliveryMethod.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryEStatementDeliveryMethod.sql new file mode 100644 index 0000000..7b4efb5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Activity/QueryEStatementDeliveryMethod.sql @@ -0,0 +1,43 @@ +With PhoneMetaData as ( + Select p.persnbr, ListAgg((pp.areacd || pp.exchange || pp.phonenbr), ',') As PhoneNumbers + From Osibank.Pers p + Left Join Osibank.PersPhone pp on p.persnbr = pp.persnbr and pp.phoneusecd != 'BUS' + Group By p.persnbr + ), + + EmailMetaData as ( + Select p.persnbr, ListAgg(al.text, ',') As EmailAddresses + From Osibank.Pers p + Left Join Osibank.PersAddrUse pa on p.persnbr = pa.persnbr and pa.ADDRUSECD IN ('EHOM', 'EML') + Left Join Osibank.AddrLine al on pa.addrnbr = al.addrnbr and al.linenbr = 1 + Group By p.persnbr), + + ActivityData as ( + Select activity.subjacctnbr as AccountNumber, activity.actvnbr as ActivityNumber, activity.datelastmaint as ActivityDateTime + From (Select av.subjacctnbr, asv.actvnbr, asv.datelastmaint, ROW_NUMBER() Over (Partition by av.subjacctnbr Order by asv.datelastmaint asc) deliveryUpdate + From Osibank.ActvSubActv asv + Join Osibank.Actv av on asv.actvnbr = av.actvnbr + where ( + asv.columnID = 'OvrDeliveryMethCd' + and asv.OldValue = 'PRNT' + and asv.databaseactvcd = 'UPD' + and asv.NewValue = 'WWW' + and asv.datelastmaint > TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + ) + ) activity + +Where deliveryUpdate = 1 and activity.datelastmaint > TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS')) + +Select ad.*, ma.shareacctnbr as ShareAccountNumber, +ma.primarypersnbr as PersonNumber, +ac.taxrptfororgnbr as OrganizationNumber, +ac.currmiaccttypcd as MinorAccountType, +pe.firstname as FirstName, pe.lastname as LastName, +pmd.phonenumbers, emd.emailaddresses +From Osibank.Acct ac +Join ActivityData ad on ad.AccountNumber = ac.acctnbr +Join Osibank.MemberAgreement ma on ma.shareacctnbr = ac.acctnbr +Join Osibank.Pers pe on pe.persnbr = ma.primarypersnbr +Left Join PhoneMetaData pmd on pe.persnbr = pmd.persnbr +Left Join EmailMetaData emd on pe.persnbr = emd.persnbr +where ac.OvrDeliveryMethCd = 'WWW' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ActivityAccountDetailsByAccountNbr.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ActivityAccountDetailsByAccountNbr.sql new file mode 100644 index 0000000..2c456b0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ActivityAccountDetailsByAccountNbr.sql @@ -0,0 +1,38 @@ +/*ActivityAccountDetailsByAccountNbr + ----------------------------------- + Get Account Details that are used by Activities. Used to Re-query accounts to check for + relevant account fields changes. + + --Notes + It is expected that this will grow over time and require joining on more fields, it is therefore kept separate from + a more generic account query. +*/ +WITH DebtProtection AS ( + SELECT a.ACCTNBR, + MAX(var.CALCTYPEFFDATE) AS EffectiveDate, + MAX(var.CALCINACTIVEDATE) AS InactiveDate, + a.BALCATCD AS DPCategory + FROM OSIBANK.ACCTSUBACCT a + INNER JOIN ( + SELECT sa.ACCTNBR, sa.SUBACCTNBR AS SUBACCTNBR + FROM OSIBANK.ACCTSUBACCT sa + WHERE sa.BALTYPCD = 'SINS' + GROUP BY ACCTNBR, sa.SUBACCTNBR + ) b ON a.ACCTNBR = b.ACCTNBR AND a.SUBACCTNBR = b.SUBACCTNBR + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR var ON a.ACCTNBR = var.ACCTNBR AND a.SUBACCTNBR = var.SUBACCTNBR + GROUP BY a.ACCTNBR, var.CALCTYPEFFDATE, var.CALCINACTIVEDATE, a.BALCATCD +) +SELECT acc.ACCTNBR AS AccountNumber, + acc.CURRACCTSTATCD AS CurrentAccountStatus, + acc.TAXRPTFORPERSNBR AS TaxPersonNbr, + acc.TAXRPTFORORGNBR AS TaxOrgNbr, + acc.BRANCHORGNBR As BranchOrgNbr, + acc.MJACCTTYPCD AS MajorAccountType, + acc.CURRMIACCTTYPCD AS MinorAccountType, + acc.CONTRACTDATE AS AccountContractDate, + dp.EffectiveDate AS DebtProtectionEffectiveDate, + dp.InactiveDate AS DebtProtectionInactiveDate, + dp.DPCategory AS DebtProtectionCategory +FROM OSIBANK.ACCT acc + LEFT JOIN DebtProtection dp ON dp.ACCTNBR = acc.ACCTNBR +WHERE acc.ACCTNBR IN :accountNumbers \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonByUserIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonByUserIdQuery.sql new file mode 100644 index 0000000..89794ea --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonByUserIdQuery.sql @@ -0,0 +1,5 @@ +SELECT ap.AgreeNbr AS AgreeNumber, + ap.PersNbr AS PersonNumber, + ap.UserId +FROM OSIBANK.agreepers ap +WHERE ap.UserId = :userId \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonsWithHyphenatedUserIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonsWithHyphenatedUserIdQuery.sql new file mode 100644 index 0000000..05b451c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/AgreePersonsWithHyphenatedUserIdQuery.sql @@ -0,0 +1,10 @@ +select AP.USERID As UserId, + AP.PERSNBR As PersonNumber, + AG.AGREENBR As AgreeNumber +FROM OSIBANK.AGREE AG +INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR AND + AP.ACTIVEYN='Y' +INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR AND + APAT.PERSNBR=AP.PERSNBR AND + APAT.ACCESSTYPCD='WWW' +WHERE AP.USERID LIKE '%-%' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialAgreePersonNumbers.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialAgreePersonNumbers.sql new file mode 100644 index 0000000..eefe646 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialAgreePersonNumbers.sql @@ -0,0 +1,12 @@ +select distinct + a.primarypersnbr AS PersonNumber +from memberagreement a +JOIN PERS b ON a.PRIMARYPERSNBR = b.PERSNBR +JOIN ACCT c ON b.PERSNBR = c.TAXRPTFORPERSNBR AND a.MEMBERAGREENBR = c.MEMBERAGREENBR +JOIN acctacctrolepers d ON c.acctnbr = d.ACCTNBR +JOIN PERS g ON d.PERSNBR = g.PERSNBR +JOIN AGREEPERSACCESSTYPACCT e ON e.ACCTNBR = c.acctnbr and e.PERSNBR = c.taxrptforpersnbr +JOIN AGREEPERSACCESSTYP f ON e.AGREENBR = f.AGREENBR +LEFT JOIN osibank.CARDAGREEMENT ca ON b.PERSNBR = ca.OWNERPERSNBR AND ca.AGREETYPCD = 'VRU' +WHERE d.acctrolecd in ('CUST','GUAD','REPP','PREP','VAFI') +AND activeyn = 'Y' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialVruCardAgreementAgreePersons.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialVruCardAgreementAgreePersons.sql new file mode 100644 index 0000000..27bccc8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetActiveCustodialVruCardAgreementAgreePersons.sql @@ -0,0 +1,15 @@ +select distinct + ca.agreenbr AS AgreeNumber, + a.PRIMARYPERSNBR AS PersonNumber, + f.UserId AS UserId +from memberagreement a +JOIN PERS b ON a.PRIMARYPERSNBR = b.PERSNBR +JOIN ACCT c ON b.PERSNBR = c.TAXRPTFORPERSNBR AND a.MEMBERAGREENBR = c.MEMBERAGREENBR +JOIN acctacctrolepers d ON c.acctnbr = d.ACCTNBR +JOIN PERS g ON d.PERSNBR = g.PERSNBR +JOIN AGREEPERSACCESSTYPACCT e ON e.ACCTNBR = c.acctnbr and e.PERSNBR = c.taxrptforpersnbr +JOIN AGREEPERSACCESSTYP f ON e.AGREENBR = f.AGREENBR +INNER JOIN osibank.CARDAGREEMENT ca ON b.PERSNBR = ca.OWNERPERSNBR AND ca.AGREETYPCD = 'VRU' +INNER JOIN osibank.CARDMEMBERISSUE cmi ON cmi.AGREENBR = ca.AGREENBR +WHERE d.acctrolecd in ('CUST','GUAD','REPP','PREP','VAFI') +AND cmi.currstatuscd != 'CLOS' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetAgreePersonsQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetAgreePersonsQuery.sql new file mode 100644 index 0000000..a924746 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreePerson/GetAgreePersonsQuery.sql @@ -0,0 +1,5 @@ +select ap.AgreeNbr, + ap.PersNbr, + ap.UserId +from OSIBANK.agreepers ap +fetch first :fetchAmount rows only \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByAccountsQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByAccountsQuery.sql new file mode 100644 index 0000000..92276aa --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByAccountsQuery.sql @@ -0,0 +1,38 @@ +SELECT A.ACCTNBR AS AccountNumber, + COALESCE(Y.AGREENBR,Z.AGREENBR) AS AgreeNumber, + CAST(TRIM(COALESCE(Y.USERID,Z.USERID,CASE WHEN A.MEMBERAGREENBR IS NULL THEN NULL ELSE 'M'||A.MEMBERAGREENBR END)) AS VARCHAR2(32)) AS UserId +FROM OSIBANK.ACCT A +LEFT JOIN (/*FIND PPL WHO HAVE ACCESS TO ACCT AS WWW AND ARE ACTIVE(IN TWO TABLES), BREAK TIES WITH LOWEST AGREENBR*/ + SELECT ROW_NUMBER() OVER (PARTITION BY APATA.ACCTNBR,APATA.PERSNBR ORDER BY APATA.AGREENBR) AS ID, + APATA.ACCTNBR, + APATA.PERSNBR, + AP.USERID, + AG.AGREENBR + FROM OSIBANK.AGREE AG /*[PK:AGREENBR]*/ + INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR + AND AP.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR] [NEEDS TO BE ACTIVE]*/ + INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR + AND APAT.PERSNBR=AP.PERSNBR + AND APAT.ACCESSTYPCD='WWW' + AND APAT.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR, ACCESSTYPCD('WWW')] [NEEDS TO BE ACTIVE]*/ + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT APATA ON APATA.AGREENBR=AP.AGREENBR + AND APATA.PERSNBR=AP.PERSNBR + AND APATA.ACCESSTYPCD=APAT.ACCESSTYPCD /*[PK:AGREENBR, PERSNBR, ACCESSTYPCD('WWW'), ACCTNBR]*/ + ) Y ON Y.ACCTNBR=A.ACCTNBR AND Y.PERSNBR=A.TAXRPTFORPERSNBR AND Y.ID=1 +LEFT JOIN (/*FIND PPL WHO HAVE ACCESS TO ORG AS WWW AND ARE ACTIVE(IN TWO TABLES), BREAK TIES WITH PERSON WHO IS CURRENTLY ACTIVE, WAS ACTIVE FIRST, LOWEST AGREENBR, LOWEST PERSNBR*/ + SELECT ROW_NUMBER() OVER (PARTITION BY AG.BYORGNBR ORDER BY CASE WHEN RO.EFFDATE<=TRUNC(CURRENT_DATE) AND (RO.INACTIVEDATE IS NULL OR RO.INACTIVEDATE>TRUNC(CURRENT_DATE)) THEN 0 ELSE 1 END,RO.EFFDATE,AG.AGREENBR,AP.PERSNBR) AS ID, + AG.BYORGNBR, + AP.USERID, + AG.AGREENBR + FROM OSIBANK.AGREE AG /*[PK:AGREENBR]*/ + INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR + AND AP.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR] [NEEDS TO BE ACTIVE]*/ + INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR + AND APAT.PERSNBR=AP.PERSNBR + AND APAT.ACCESSTYPCD='WWW' + AND APAT.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR, ACCESSTYPCD('WWW')] [NEEDS TO BE ACTIVE]*/ + LEFT JOIN OSIBANK.ORGPERSROLE RO ON RO.ORGNBR=AG.BYORGNBR + AND RO.PERSNBR=AP.PERSNBR + AND RO.PERSROLECD=APAT.ACCESSTYPCD /*[PK:ORGNBR, PERSROLECD, EFFDATE, PERSNBR]*/ + ) Z ON Z.BYORGNBR=A.TAXRPTFORORGNBR AND Z.ID=1 +WHERE A.ACCTNBR in ({AccountNumbersHolder}) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByOrganizationNumberQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByOrganizationNumberQuery.sql new file mode 100644 index 0000000..5129fac --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByOrganizationNumberQuery.sql @@ -0,0 +1,8 @@ +SELECT AP.USERID +FROM OSIBANK.AGREE AG /*[PK:AGREENBR]*/ +INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR AND AP.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR] [NEEDS TO BE ACTIVE]*/ +INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR AND APAT.PERSNBR=AP.PERSNBR AND APAT.ACCESSTYPCD='WWW' AND APAT.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR, ACCESSTYPCD('WWW')] [NEEDS TO BE ACTIVE]*/ +LEFT JOIN OSIBANK.ORGPERSROLE RO ON RO.ORGNBR=AG.BYORGNBR AND RO.PERSNBR=AP.PERSNBR AND RO.PERSROLECD=APAT.ACCESSTYPCD /*[PK:ORGNBR, PERSROLECD, EFFDATE, PERSNBR]*/ +WHERE AG.BYORGNBR = :organizationNumber +ORDER BY ROW_NUMBER() OVER (PARTITION BY AG.BYORGNBR ORDER BY CASE WHEN RO.EFFDATE<=CURRENT_DATE AND (RO.INACTIVEDATE IS NULL OR RO.INACTIVEDATE>CURRENT_DATE) THEN 0 ELSE 1 END,RO.EFFDATE,AG.AGREENBR,AP.PERSNBR) +FETCH NEXT 1 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByPersonNumberQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByPersonNumberQuery.sql new file mode 100644 index 0000000..d8022c4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/AgreeUserByPersonNumberQuery.sql @@ -0,0 +1,5 @@ +SELECT AP.USERID +FROM OSIBANK.AGREE AG /*[PK:AGREENBR]*/ +INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR AND AP.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR] [NEEDS TO BE ACTIVE]*/ +INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR AND APAT.PERSNBR=AP.PERSNBR AND APAT.ACCESSTYPCD='WWW' AND APAT.ACTIVEYN='Y' /*[PK:AGREENBR, PERSNBR, ACCESSTYPCD('WWW')] [NEEDS TO BE ACTIVE]*/ +WHERE AG.BYORGNBR IS NULL AND AP.PERSNBR = :personNumber \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountByAccountIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountByAccountIdQuery.sql new file mode 100644 index 0000000..e63e372 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountByAccountIdQuery.sql @@ -0,0 +1,3 @@ +SELECT ACCTNBR AS AccountNumber, ACCTDESC AS AccountDescription, MJACCTTYPCD as MajorAccountTypeCode, TAXRPTFORPERSNBR AS TaxReportForPersonNumber, TAXRPTFORORGNBR AS TaxReportForOrgNumber, OVRDELIVERYMETHCD +FROM OSIBANK.ACCT +WHERE ACCTNBR = :accountNumber \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByAgreementUserIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByAgreementUserIdQuery.sql new file mode 100644 index 0000000..68a3197 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByAgreementUserIdQuery.sql @@ -0,0 +1,6 @@ +SELECT a4.ACCTNBR AS AccountNumber, a4.ACCTDESC AS AccountDescription, a4.MJACCTTYPCD as MajorAccountTypeCode, a4.TAXRPTFORPERSNBR AS TaxReportForPersonNumber, a4.TAXRPTFORORGNBR AS TaxReportForOrgNumber, a4.OVRDELIVERYMETHCD +FROM osibank.AGREEPERS a + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT a2 ON a.PERSNBR = a2.PERSNBR AND a.AGREENBR = a2.AGREENBR AND a2.ACCESSTYPCD = 'WWW' + INNER JOIN OSIBANK.AGREE a3 ON a.AGREENBR = a3.AGREENBR AND a3.ACTIVEDATETIME <= CURRENT_DATE AND (a3.TERMINATEDATETIME IS NULL OR a3.TERMINATEDATETIME > CURRENT_DATE) + INNER JOIN OSIBANK.ACCT a4 ON a2.ACCTNBR = a4.ACCTNBR +WHERE a.USERID = :userId \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByOrganizationIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByOrganizationIdQuery.sql new file mode 100644 index 0000000..e44825f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AccountsByOrganizationIdQuery.sql @@ -0,0 +1,3 @@ +SELECT ACCTNBR AS AccountNumber, ACCTDESC AS AccountDescription, MJACCTTYPCD as MajorAccountTypeCode, TAXRPTFORPERSNBR AS TaxReportForPersonNumber, TAXRPTFORORGNBR AS TaxReportForOrgNumber, OVRDELIVERYMETHCD +FROM OSIBANK.ACCT +WHERE TAXRPTFORORGNBR = :organizationId \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByAgreementIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByAgreementIdQuery.sql new file mode 100644 index 0000000..2e2e0d5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByAgreementIdQuery.sql @@ -0,0 +1,11 @@ +SELECT a.AGREENBR AS AgreementNumber, a.USERID, a.PERSNBR AS PersonNumber, + a3.BYORGNBR, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, p.MDLINIT AS MiddleInitial, p.MDLNAME AS MiddleName, p.LASTNAME, p.SUFFIX +FROM OSIBANK.AGREEPERS a + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT a2 ON a.AGREENBR = a2.AGREENBR AND a.PERSNBR = a2.PERSNBR AND a2.ACCESSTYPCD = 'WWW' + INNER JOIN OSIBANK.PERS p ON a2.PERSNBR = p.PERSNBR + INNER JOIN OSIBANK.AGREE a3 ON a2.AGREENBR = a3.AGREENBR AND a3.ACTIVEDATETIME <= CURRENT_DATE AND (a3.TERMINATEDATETIME IS NULL OR a3.TERMINATEDATETIME > CURRENT_DATE) + LEFT OUTER JOIN OSIBANK.ORG o ON a3.BYORGNBR = o.ORGNBR +WHERE a.AGREENBR = :agreementId +FETCH FIRST 1 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByUserIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByUserIdQuery.sql new file mode 100644 index 0000000..f7abd1e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementByUserIdQuery.sql @@ -0,0 +1,11 @@ +SELECT a.AGREENBR AS AgreementNumber, a.USERID, a.PERSNBR AS PersonNumber, + a3.BYORGNBR, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, p.MDLINIT AS MiddleInitial, p.MDLNAME AS MiddleName, p.LASTNAME, p.SUFFIX +FROM OSIBANK.AGREEPERS a + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT a2 ON a.AGREENBR = a2.AGREENBR AND a.PERSNBR = a2.PERSNBR AND a2.ACCESSTYPCD = 'WWW' + INNER JOIN OSIBANK.PERS p ON a2.PERSNBR = p.PERSNBR + INNER JOIN OSIBANK.AGREE a3 ON a2.AGREENBR = a3.AGREENBR AND a3.ACTIVEDATETIME <= CURRENT_DATE AND (a3.TERMINATEDATETIME IS NULL OR a3.TERMINATEDATETIME > CURRENT_DATE) + LEFT OUTER JOIN OSIBANK.ORG o ON a3.BYORGNBR = o.ORGNBR +WHERE a.UserId = :userId + FETCH FIRST 1 ROWS ONLY \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementOwnerByAccountsQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementOwnerByAccountsQuery.sql new file mode 100644 index 0000000..97e5e4b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementOwnerByAccountsQuery.sql @@ -0,0 +1,28 @@ +SELECT A.ACCTNBR AS AccountNumber, + COALESCE(Y.AGREENBR,Z.AGREENBR) AS AgreementNumber, + COALESCE(Y.USERID,Z.USERID) AS UserId, + COALESCE(Y.PERSNBR, Z.PERSNBR) AS PersonNumber +FROM OSIBANK.ACCT A + LEFT JOIN ( + SELECT ROW_NUMBER() OVER (PARTITION BY APATA.ACCTNBR,APATA.PERSNBR ORDER BY APATA.AGREENBR) AS ID, + APATA.ACCTNBR, + APATA.PERSNBR, + APATA.AGREENBR, + AP.USERID + FROM OSIBANK.AGREE AG + INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR AND AP.ACTIVEYN='Y' + INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR=AP.AGREENBR AND APAT.PERSNBR=AP.PERSNBR AND APAT.ACCESSTYPCD='WWW' AND APAT.ACTIVEYN='Y' + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT APATA ON APATA.AGREENBR=AP.AGREENBR AND APATA.PERSNBR=AP.PERSNBR AND APATA.ACCESSTYPCD=APAT.ACCESSTYPCD +) Y ON Y.ACCTNBR=A.ACCTNBR AND Y.PERSNBR=A.TAXRPTFORPERSNBR AND Y.ID=1 + LEFT JOIN ( + SELECT ROW_NUMBER() OVER (PARTITION BY AG.BYORGNBR ORDER BY CASE WHEN RO.EFFDATE<=TRUNC(CURRENT_DATE) AND (RO.INACTIVEDATE IS NULL OR RO.INACTIVEDATE>TRUNC(CURRENT_DATE)) THEN 0 ELSE 1 END,RO.EFFDATE,AP.AGREENBR,AP.PERSNBR) AS ID, + AG.BYORGNBR, + AG.AGREENBR, + AP.USERID, + AP.PERSNBR + FROM OSIBANK.AGREE AG + INNER JOIN OSIBANK.AGREEPERS AP ON AP.AGREENBR=AG.AGREENBR AND AP.ACTIVEYN='Y' + INNER JOIN OSIBANK.AGREEPERSACCESSTYP APAT ON APAT.AGREENBR = AP.AGREENBR AND APAT.PERSNBR = AP.PERSNBR AND APAT.ACCESSTYPCD = 'WWW' AND APAT.ACTIVEYN = 'Y' + LEFT JOIN OSIBANK.ORGPERSROLE RO ON RO.ORGNBR=AG.BYORGNBR AND RO.PERSNBR = AP.PERSNBR AND RO.PERSROLECD=APAT.ACCESSTYPCD +) Z ON Z.BYORGNBR=A.TAXRPTFORORGNBR AND Z.ID=1 +WHERE A.ACCTNBR in ({AccountNumbersHolder}) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementsByAccountIdQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementsByAccountIdQuery.sql new file mode 100644 index 0000000..41c9d16 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/AgreementsByAccountIdQuery.sql @@ -0,0 +1,11 @@ +SELECT a.AGREENBR AS AgreementNumber, a.USERID, a.PERSNBR AS PersonNumber, + a3.BYORGNBR, + o.ORGNAME AS OrganizationName, + p.FIRSTNAME, p.MDLINIT AS MiddleInitial, p.MDLNAME AS MiddleName, p.LASTNAME, p.SUFFIX +FROM OSIBANK.Acct a4 + INNER JOIN OSIBANK.AGREEPERSACCESSTYPACCT a2 ON a4.ACCTNBR = a2.ACCTNBR AND a2.ACCESSTYPCD = 'WWW' + INNER JOIN OSIBANK.AGREEPERS a ON a2.AGREENBR = a.AGREENBR AND a2.PERSNBR = a.PERSNBR + INNER JOIN OSIBANK.PERS p ON a2.PERSNBR = p.PERSNBR + INNER JOIN OSIBANK.AGREE a3 ON a2.AGREENBR = a3.AGREENBR AND a3.ACTIVEDATETIME <= CURRENT_DATE AND (a3.TERMINATEDATETIME IS NULL OR a3.TERMINATEDATETIME > CURRENT_DATE) + LEFT OUTER JOIN OSIBANK.ORG o ON a3.BYORGNBR = o.ORGNBR +WHERE a4.ACCTNBR = :accountNumber \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAccountChangesQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAccountChangesQuery.sql new file mode 100644 index 0000000..bef0f1c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAccountChangesQuery.sql @@ -0,0 +1,9 @@ +SELECT DISTINCT CASE WHEN UPPER(a.TABLEID) = 'AGREEPERSACCESSTYPACCT' AND UPPER(a.DATABASEACTVCD) = 'DEL' AND UPPER(a.COLUMNID) = 'ACCTNBR' AND a2.SUBJACCTNBR IS NULL THEN TO_NUMBER(a.OLDVALUE) + WHEN UPPER(a.TABLEID) = 'AGREEPERSACCESSTYPACCT' AND UPPER(a.DATABASEACTVCD) = 'ADD' AND UPPER(a.COLUMNID) = 'ACCTNBR' AND a2.SUBJACCTNBR IS NULL THEN TO_NUMBER(a.NEWVALUE) + ELSE a2.SUBJACCTNBR END AS AccountNumber +FROM osibank.ACTVSUBACTV a +LEFT OUTER JOIN OSIBANK.ACTV a2 ON a.ACTVNBR = a2.ACTVNBR AND a2.ACTVDATETIME > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS') +WHERE a2.SUBJACCTNBR IS NOT NULL +AND ((UPPER(a.TABLEID) = 'ACCT' AND (UPPER(COLUMNID) = 'TAXRPTFORPERSNBR' OR UPPER(COLUMNID) = 'TAXRPTFORORGNBR' OR UPPER(COLUMNID) = 'OVRDELIVERYMETHCD')) + OR ((UPPER(a.TABLEID) = 'AGREEPERSACCESSTYPACCT' AND UPPER(DATABASEACTVCD) = 'DEL') AND UPPER(COLUMNID) = 'ACCTNBR' AND a2.ACTVDATETIME > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS')) + OR ((UPPER(a.TABLEID) = 'AGREEPERSACCESSTYPACCT' AND UPPER(DATABASEACTVCD) = 'ADD') AND UPPER(COLUMNID) = 'ACCTNBR' AND a2.ACTVDATETIME > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS'))) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAgreementChangesQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAgreementChangesQuery.sql new file mode 100644 index 0000000..8af1e11 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForAgreementChangesQuery.sql @@ -0,0 +1,7 @@ +SELECT DISTINCT a2.SUBJAGREENBR +FROM OSIBANK.LCU_MVIEW_ACTVSUBACTV a +LEFT OUTER JOIN OSIBANK.LCU_MVIEW_ACTV a2 ON a.ACTVNBR = a2.ACTVNBR +WHERE a2.SUBJAGREENBR IS NOT NULL + AND ((UPPER(a.TABLEID) = 'AGREEPERS' AND UPPER(COLUMNID) = 'ACTIVEYN' AND a.DATELASTMAINT > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS')) + OR (UPPER(a.TABLEID) = 'AGREEPERSACCESSTYP' AND UPPER(COLUMNID) = 'ACTIVEYN' AND a.DATELASTMAINT > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS')) + OR (UPPER(a.TABLEID) = 'AGREEPERSACCESSTYPACCT' AND UPPER(COLUMNID) = 'ACCESSTYPCD' AND (UPPER(OLDVALUE) LIKE '%WWW%' OR UPPER(NEWVALUE) LIKE '%WWWW%') AND a.DATELASTMAINT > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS'))) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForOrganizationChangesQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForOrganizationChangesQuery.sql new file mode 100644 index 0000000..77091d5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Agreement/Audit/AuditActiveSubActiveForOrganizationChangesQuery.sql @@ -0,0 +1,8 @@ +SELECT DISTINCT a2.SUBJORGNBR +FROM osibank.LCU_MVIEW_ACTVSUBACTV a +LEFT OUTER JOIN OSIBANK.LCU_MVIEW_ACTV a2 ON a.ACTVNBR = a2.ACTVNBR +WHERE a2.SUBJORGNBR IS NOT NULL +AND ((UPPER(a.TABLEID) = 'ORGPERSROLE' AND UPPER(COLUMNID) = 'INACTIVEDATE' AND OLDVALUE IS NOT NULL +AND NEWVALUE IS NOT NULL AND a.DATELASTMAINT > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS')) +OR (UPPER(a.TABLEID) = 'ORGPERSROLE' AND UPPER(COLUMNID) = 'PERSROLECD' AND (UPPER(OLDVALUE) LIKE '%WWW%' OR UPPER(NEWVALUE) LIKE '%WWW%') +AND a.DATELASTMAINT > TO_DATE(:dateLastMaintained, 'YYYY-MM-DD HH24:MI:SS'))) diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ApplHistoryQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ApplHistoryQuery.sql new file mode 100644 index 0000000..60824cf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/ApplHistoryQuery.sql @@ -0,0 +1,10 @@ +SELECT appl.applname As ApplicationName, + qah.applnbr As ApplicationNumber, + qah.quenbr AS QueueNumber, + qah.stopdatetime As StopDateTime, + que.EffDate AS EffectiveDate +FROM QUEAPPLHIST qah +INNER JOIN appl ON qah.APPLNBR = appl.APPLNBR +INNER JOIN que ON que.quenbr = qah.quenbr +WHERE qah.APPLNBR in ({ApplicationNumbersHolder}) +AND que.EffDate = TO_TIMESTAMP(:EffectiveDate, 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Associate/GetAssociateDetailsBySsnQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Associate/GetAssociateDetailsBySsnQuery.sql new file mode 100644 index 0000000..86ed799 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Associate/GetAssociateDetailsBySsnQuery.sql @@ -0,0 +1,30 @@ +SELECT DISTINCT base.Person as AssociateName, + base.ActiveEmp as ActiveEmployee, + base.PERSTYPDESC as PersonType, + base.PERSNBR as PersonNumber +FROM ( + SELECT + P.PERSNBR, + P.FIRSTNAME || ' ' || P.LASTNAME AS Person, + CASE + WHEN PE.PERSNBR is not null and ((PE.INACTIVEDATE is null) or (PE.INACTIVEDATE is not null and PE.INACTIVEDATE > CURRENT_DATE)) THEN 1 + WHEN PE.PERSNBR is not null and PE.INACTIVEDATE is not null and PE.INACTIVEDATE <= CURRENT_DATE THEN 0 + WHEN PE.PERSNBR is null THEN null + ELSE null + END AS ActiveEmp, + ppt.PERSTYPDESC, + P.TAXID + FROM OSIBANK.PERS P + LEFT JOIN OSIBANK.PERSEMPL PE ON PE.PERSNBR = P.PERSNBR + JOIN ( + SELECT ppt.PERSNBR, LISTAGG(PT.PERSTYPDESC, ',') as PERSTYPDESC + FROM OSIBANK.PERSPERSTYP ppt + JOIN OSIBANK.PERSTYP PT ON ppt.PERSTYPCD = pt.PERSTYPCD + WHERE ppt.PERSTYPCD IN ('AUD','DIR','EMP','EOFF','OFF','REPI') + GROUP BY ppt.PERSNBR + ) ppt ON P.PERSNBR = ppt.PERSNBR + LEFT JOIN OSIBANK.ACCT A ON P.PERSNBR = A.TAXRPTFORPERSNBR + LEFT JOIN OSIBANK.VIEWPERSTAXID V ON P.PERSNBR = V.PERSNBR + WHERE V.TAXID = :taxId +) base +ORDER BY AssociateName \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoanWithDetail_ByPostedDate_Query.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoanWithDetail_ByPostedDate_Query.sql new file mode 100644 index 0000000..2d9d078 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoanWithDetail_ByPostedDate_Query.sql @@ -0,0 +1,120 @@ +SELECT + Coalesce(MA.MemberAgreeNbr, MAOrg.MemberAgreeNbr) AS MemberNumber, + AC.ACCTNBR AS LoanNumber, + AUFAI.Value AS ApplicationId, + RTRIM(PERS.FirstName) AS MemberFirstName, + PERS.mdlinit AS MemberInitial, + COALESCE(RTRIM(PERS.LastName), RTRIM(ORGM.OrgName)) AS MemberLastName, + OUFDC.Value AS DealerCode, + DGA.AcctNbr AS DealerAccountNumber, + DGA.taxrptfororgnbr AS DealerOrganizationNumber, + ORGD.OrgName AS DealerName, + CASE WHEN AUFWA.Value = 'Y' OR ASAW.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS Warranty, + CASE WHEN AUFG.Value = 'Y' OR ASAG.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS GAP, + CASE WHEN ASADL.SubAcctNbr IS NOT NULL OR ASADI.SubAcctNbr IS NOT NULL OR ASADLLD.SubAcctNbr IS NOT NULL OR ASADLLF.SubACctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditLife, + CASE WHEN ASADD.SubAcctNbr IS NOT NULL OR ASADI.SubAcctNbr IS NOT NULL OR ASADLLD.SubAcctNbr IS NOT NULL OR ASADLDS.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditDisability, + CASE WHEN ASAMBP.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS Mbp, + AC.currmiaccttypcd AS AccountType, + MMA.MIACCTTYPDESC AS AccountDescription, + AC.CONTRACTDATE AS LoanDate, + Coalesce(RTXN.OrigPostDate,TO_DATE(AUFAD.Value, 'YYYY-MM-DD' )) AS PostedDate, + AL.date1stpmtdue AS FirstPmtDate, + AC.DATEMAT AS FinalPmtDate, + AC.ORIGTERM AS OriginalTermInDays, + ASA.OrigBal AS LoanAmount, + To_number(AUFBR.Value) AS BuyRate, + AUFLT.Value AS LoanType, + RTC.INTRATE * 100 AS ContractRate, + PT.PMTAMT AS MonthlyPmt, + RTRIM(PR.PROPID) AS Vin, + RTRIM(PR.PropMake) AS Make, + RTRIM(PR.PropModel) AS Model, + PR.propyearnbr AS Year, + RTRIM(PR.PropColor) AS Color, + PR.PropVehicleOdometer AS Mileage, + AAA.PostDate AS PaidLoanDate + FROM ACCT AC + LEFT JOIN PERS + ON PERS.PersNbr = AC.TAXRPTFORPERSNBR + LEFT JOIN ORG ORGM + ON ORGM.OrgNbr = AC.TaxrptForORgNbr + LEFT JOIN MEMBERAGREEMENT MA + ON MA.PrimaryPersNbr = PERS.PersNbr + LEFT JOIN MEMBERAGREEMENT MAOrg + ON MAOrg.PrimaryOrgNbr = ORGM.OrgNbr + LEFT JOIN ACCTGRPACCT AGA + ON AC.AcctNbr = AGA.AcctNbr + LEFT JOIN (select acctgrpnbr, acct.acctnbr, acct.taxrptfororgnbr from acctgrpacct aga + inner join acct + on acct.acctnbr = aga.acctnbr and acct.currmiaccttypcd = 'DLR') DGA + ON DGA.AcctGrpNbr = AGA.AcctGrpNbr + LEFT JOIN ORG ORGD + ON ORGD.ORGNbr = DGA.taxrptfororgnbr + LEFT JOIN ACCTLOAN AL + ON AL.AcctNbr = AC.AcctNbr + LEFT JOIN (SELECT Propnbr, AcctNbr,ROW_NUMBER() OVER(PARTITION BY ACCTNBR ORDER BY PropNbr) PPP_RNK + FROM ACCTPROP) AP ON AP.AcctNbr = AC.AcctNbr AND AP.PPP_RNK = 1 + LEFT JOIN PROP PR + ON PR.Propnbr = AP.Propnbr + LEFT JOIN ACCTSUBACCT ASA + ON ASA.ACCTNBR = AC.ACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL' + LEFT JOIN (SELECT PS.ACCTNBR,PS.SUBACCTNBR,PS.EFFDATE,PS.INACTIVEDATE,PMT.PMTNBR, PMT.PMTTYPCD,T.PMTTYPDESC,PMT.PMTAMT,PMT.PMTPERCENT, + PMT.EFFDATE PMT_EFFDATE,PMT.PMTCALPERIODCD,PMT.INACTIVEDATE PMT_INACTIVEDATE,PMT.DATELASTMAINT, + ROW_NUMBER() OVER(PARTITION BY PS.ACCTNBR,PS.SUBACCTNBR ORDER BY PMT.EFFDATE DESC ) P_RNK + FROM ACCTPMTSUBACCTHIST PS + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = PS.ACCTNBR AND ASA.SUBACCTNBR = PS.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'DUE' + JOIN ACCTPMTHIST PMT ON PMT.ACCTNBR = PS.ACCTNBR AND PMT.PMTNBR = PS.PMTNBR + JOIN PMTTYP T ON T.PMTTYPCD = PMT.PMTTYPCD) PT ON PT.ACCTNBR = AC.ACCTNBR AND P_RNK = 1 + LEFT JOIN (SELECT R.DATELASTMAINT,R.ACCTNBR,R.SUBACCTNBR, R.EFFDATE ,R.INTRATE,R.INACTIVEDATE,R.DELQRATEYN,R.POSTDATE,R.DISCLOSEDINTRATE + ,ROW_NUMBER() OVER(PARTITION BY R.ACCTNBR,R.SUBACCTNBR ORDER BY R.POSTDATE DESC ) RTB_RNK + FROM ACCTRATEHIST R + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = R.ACCTNBR AND ASA.SUBACCTNBR = R.SUBACCTNBR AND ASA.BALCATCD = 'UPFR' AND ASA.BALTYPCD = 'DLR') RTB + ON RTB.ACCTNBR = AC.ACCTNBR AND RTB_RNK = 1 + LEFT JOIN (SELECT R.DATELASTMAINT,R.ACCTNBR,R.SUBACCTNBR, R.EFFDATE,R.INTRATE,R.INACTIVEDATE,R.DELQRATEYN,R.POSTDATE,R.DISCLOSEDINTRATE + ,ROW_NUMBER() OVER(PARTITION BY R.ACCTNBR,R.SUBACCTNBR ORDER BY R.POSTDATE DESC) RTC_RNK + FROM ACCTRATEHIST R + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = R.ACCTNBR AND ASA.SUBACCTNBR = R.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL') RTC + ON RTC.ACCTNBR = AC.ACCTNBR AND RTC_RNK = 1 + LEFT JOIN MJMIACCTTYP MMA + ON MMA.MIACCTTYPCD = AC.CURRMIACCTTYPCD + LEFT JOIN ACCTUSERFIELD AUFLT + ON AUFLT.Acctnbr = AC.Acctnbr AND AUFLT.userfieldCD = 'COMC' + LEFT JOIN ACCTUSERFIELD AUFAI + ON AUFAI.Acctnbr = AC.Acctnbr AND AUFAI.userfieldCD = 'LOSA' + LEFT JOIN ORGUSERFIELD OUFDC + ON OUFDC.OrgNbr = ORGD.OrgNbr AND OUFDC.UserFieldCD = 'DLCD' + LEFT JOIN RTXN + ON RTXN.ACCTNBR = AC.ACCTNBR AND rtxntypcd = 'NDSB' + LEFT JOIN ACCTUSERFIELD AUFAD + ON AUFAD.Acctnbr = AC.Acctnbr AND AUFAD.userfieldCD = 'LOSD' + LEFT JOIN ACCTUSERFIELD AUFBR + ON AUFBR.Acctnbr = AC.Acctnbr AND AUFBR.userfieldCD = 'BUYR' + LEFT JOIN ACCTUSERFIELD AUFWA + ON AUFWA.Acctnbr = AC.Acctnbr AND AUFWA.userfieldCD = 'WRYN' + LEFT JOIN ACCTUSERFIELD AUFG + ON AUFG.Acctnbr = AC.Acctnbr AND AUFG.userfieldCD = 'GPYN' + LEFT JOIN ACCTSUBACCT ASADL + ON ASADL.AcctNbr = AC.AcctNbr AND ASADL.BALTYPCD = 'SINS' AND ASADL.BALCATCD = 'DL' + LEFT JOIN ACCTSUBACCT ASADD + ON ASADD.AcctNbr = AC.AcctNbr AND ASADD.BALTYPCD = 'SINS' AND ASADD.BALCATCD = 'DD' + LEFT JOIN ACCTSUBACCT ASADI + ON ASADI.AcctNbr = AC.AcctNbr AND ASADI.BALTYPCD = 'SINS' AND ASADI.BALCATCD = 'DI' + LEFT JOIN ACCTSUBACCT ASADLLD + ON ASADLLD.AcctNbr = AC.AcctNbr AND ASADLLD.BALTYPCD = 'COST' AND ASADLLD.BALCATCD = 'DLLD' + LEFT JOIN ACCTSUBACCT ASADLDS + ON ASADLDS.AcctNbr = AC.AcctNbr AND ASADLDS.BALTYPCD = 'COST' AND ASADLDS.BALCATCD = 'DLDS' + LEFT JOIN ACCTSUBACCT ASADLLF + ON ASADLLF.AcctNbr = AC.AcctNbr AND ASADLLF.BALTYPCD = 'COST' AND ASADLLF.BALCATCD = 'DLLF' + LEFT JOIN ACCTSUBACCT ASAG + ON ASAG.AcctNbr = AC.AcctNbr AND ASAG.BALTYPCD = 'COST' AND ASAG.BALCATCD = 'GAP' + LEFT JOIN ACCTSUBACCT ASAW + ON ASAW.AcctNbr = AC.AcctNbr AND ASAW.BALTYPCD = 'COST' AND ASAW.BALCATCD = 'WARA' + LEFT JOIN ACCTSUBACCT ASAMBP + ON ASAMBP.AcctNbr = AC.AcctNbr AND ASAMBP.BALTYPCD = 'COST' AND ASAMBP.BALCATCD = 'ODLR' + LEFT JOIN (SELECT aas.ACCTNBR,aas.EFFDATETIME ,aas.acctstatcd,aas.POSTDATE + ,ROW_NUMBER() OVER(PARTITION BY aas.ACCTNBR ORDER BY aas.EFFDATETIME DESC ) AAS_RNK + FROM acctacctstathist aas ) aaa + ON aaa.ACCTNBR = ac.ACCTNBR AND AAS_RNK = 1 +WHERE AC.currmiaccttypcd IN ('DL01','DL02','DL03','DL04','DL05','DL06','DL07','DL08','DL09','DL10','DL11','DL12','DL13','DL14','DL15','DL16') + AND AC.CURRACCTSTATCD = 'CLS' + AND AAA.EffDateTime >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoan_ByPostedDate_Query.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoan_ByPostedDate_Query.sql new file mode 100644 index 0000000..0cb5934 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/ClosedIndirectLoan_ByPostedDate_Query.sql @@ -0,0 +1,10 @@ +SELECT + AC.ACCTNBR AS LoanNumber, + AAA.PostDate AS PaidLoanDate + FROM ACCT AC + LEFT JOIN (SELECT aas.ACCTNBR,aas.EFFDATETIME, aas.POSTDATE + ,ROW_NUMBER() OVER(PARTITION BY aas.ACCTNBR ORDER BY aas.EFFDATETIME DESC ) AAS_RNK + FROM acctacctstathist aas ) aaa + ON aaa.ACCTNBR = ac.ACCTNBR AND AAS_RNK = 1 + WHERE AC.curracctstatcd = 'CLS' AND AAA.EFFDATETIME >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + AND AC.currmiaccttypcd IN ('DL01','DL02','DL03','DL04','DL05','DL06','DL07','DL08','DL09','DL10','DL11','DL12','DL13','DL14','DL15','DL16') diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByAcctNbr_Query.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByAcctNbr_Query.sql new file mode 100644 index 0000000..9723744 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByAcctNbr_Query.sql @@ -0,0 +1,118 @@ +SELECT + Coalesce(MA.MemberAgreeNbr, MAOrg.MemberAgreeNbr) AS MemberNumber, + AC.ACCTNBR AS LoanNumber, + AUFAI.Value AS ApplicationId, + RTRIM(PERS.FirstName) AS MemberFirstName, + PERS.mdlinit AS MemberInitial, + COALESCE(RTRIM(PERS.LastName), RTRIM(ORGM.OrgName)) AS MemberLastName, + OUFDC.Value AS DealerCode, + DGA.AcctNbr AS DealerAccountNumber, + DGA.taxrptfororgnbr AS DealerOrganizationNumber, + ORGD.OrgName AS DealerName, + CASE WHEN AUFWA.Value = 'Y' OR ASAW.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS Warranty, + CASE WHEN AUFG.Value = 'Y' OR ASAG.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS GAP, + CASE WHEN ASADL.SubAcctNbr IS NOT NULL OR ASADI.SubAcctNbr IS NOT NULL OR ASADLLD.SubAcctNbr IS NOT NULL OR ASADLLF.SubACctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditLife, + CASE WHEN ASADD.SubAcctNbr IS NOT NULL OR ASADI.SubAcctNbr IS NOT NULL OR ASADLLD.SubAcctNbr IS NOT NULL OR ASADLDS.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditDisability, + CASE WHEN ASAM.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END As Mbp, + AC.currmiaccttypcd AS AccountType, + MMA.MIACCTTYPDESC AS AccountDescription, + AC.CONTRACTDATE AS LoanDate, + Coalesce(RTXN.OrigPostDate,TO_DATE(AUFAD.Value, 'YYYY-MM-DD' )) AS PostedDate, + AL.date1stpmtdue AS FirstPmtDate, + AC.DATEMAT AS FinalPmtDate, + AC.ORIGTERM AS OriginalTermInDays, + ASA.OrigBal AS LoanAmount, + COALESCE(RTB.INTRATE * 100, To_number(AUFBR.Value)) AS BuyRate, + AUFLT.Value AS LoanType, + RTC.INTRATE * 100 AS ContractRate, + PT.PMTAMT AS MonthlyPmt, + RTRIM(PR.PROPID) AS Vin, + RTRIM(PR.PropMake) AS Make, + RTRIM(PR.PropModel) AS Model, + PR.propyearnbr AS Year, + RTRIM(PR.PropColor) AS Color, + PR.PropVehicleOdometer AS Mileage, + AAA.PostDate AS PaidLoanDate + FROM ACCT AC + LEFT JOIN PERS + ON PERS.PersNbr = AC.TAXRPTFORPERSNBR + LEFT JOIN ORG ORGM + ON ORGM.OrgNbr = AC.TaxrptForORgNbr + LEFT JOIN MEMBERAGREEMENT MA + ON MA.PrimaryPersNbr = PERS.PersNbr + LEFT JOIN MEMBERAGREEMENT MAOrg + ON MAOrg.PrimaryOrgNbr = ORGM.OrgNbr + LEFT JOIN ACCTGRPACCT AGA + ON AC.AcctNbr = AGA.AcctNbr + LEFT JOIN (select acctgrpnbr, acct.acctnbr, acct.taxrptfororgnbr from acctgrpacct aga + inner join acct + on acct.acctnbr = aga.acctnbr and acct.currmiaccttypcd = 'DLR') DGA + ON DGA.AcctGrpNbr = AGA.AcctGrpNbr + LEFT JOIN ORG ORGD + ON ORGD.ORGNbr = DGA.taxrptfororgnbr + LEFT JOIN ACCTLOAN AL + ON AL.AcctNbr = AC.AcctNbr + LEFT JOIN (SELECT Propnbr, AcctNbr,ROW_NUMBER() OVER(PARTITION BY ACCTNBR ORDER BY PropNbr) PPP_RNK + FROM ACCTPROP) AP ON AP.AcctNbr = AC.AcctNbr AND AP.PPP_RNK = 1 + LEFT JOIN PROP PR + ON PR.Propnbr = AP.Propnbr + LEFT JOIN ACCTSUBACCT ASA + ON ASA.ACCTNBR = AC.ACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL' + LEFT JOIN (SELECT PS.ACCTNBR,PS.SUBACCTNBR,PS.EFFDATE,PS.INACTIVEDATE,PMT.PMTNBR, PMT.PMTTYPCD,T.PMTTYPDESC,PMT.PMTAMT,PMT.PMTPERCENT, + PMT.EFFDATE PMT_EFFDATE,PMT.PMTCALPERIODCD,PMT.INACTIVEDATE PMT_INACTIVEDATE,PMT.DATELASTMAINT, + ROW_NUMBER() OVER(PARTITION BY PS.ACCTNBR,PS.SUBACCTNBR ORDER BY PMT.EFFDATE DESC ) P_RNK + FROM ACCTPMTSUBACCTHIST PS + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = PS.ACCTNBR AND ASA.SUBACCTNBR = PS.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'DUE' + JOIN ACCTPMTHIST PMT ON PMT.ACCTNBR = PS.ACCTNBR AND PMT.PMTNBR = PS.PMTNBR + JOIN PMTTYP T ON T.PMTTYPCD = PMT.PMTTYPCD) PT ON PT.ACCTNBR = AC.ACCTNBR AND P_RNK = 1 + LEFT JOIN (SELECT R.DATELASTMAINT,R.ACCTNBR,R.SUBACCTNBR, R.EFFDATE ,R.INTRATE,R.INACTIVEDATE,R.DELQRATEYN,R.POSTDATE,R.DISCLOSEDINTRATE + ,ROW_NUMBER() OVER(PARTITION BY R.ACCTNBR,R.SUBACCTNBR ORDER BY R.POSTDATE DESC ) RTB_RNK + FROM ACCTRATEHIST R + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = R.ACCTNBR AND ASA.SUBACCTNBR = R.SUBACCTNBR AND ASA.BALCATCD = 'UPFR' AND ASA.BALTYPCD = 'DLR') RTB + ON RTB.ACCTNBR = AC.ACCTNBR AND RTB_RNK = 1 + LEFT JOIN (SELECT R.DATELASTMAINT,R.ACCTNBR,R.SUBACCTNBR, R.EFFDATE,R.INTRATE,R.INACTIVEDATE,R.DELQRATEYN,R.POSTDATE,R.DISCLOSEDINTRATE + ,ROW_NUMBER() OVER(PARTITION BY R.ACCTNBR,R.SUBACCTNBR ORDER BY R.POSTDATE DESC) RTC_RNK + FROM ACCTRATEHIST R + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = R.ACCTNBR AND ASA.SUBACCTNBR = R.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL') RTC + ON RTC.ACCTNBR = AC.ACCTNBR AND RTC_RNK = 1 + LEFT JOIN MJMIACCTTYP MMA + ON MMA.MIACCTTYPCD = AC.CURRMIACCTTYPCD + LEFT JOIN ACCTUSERFIELD AUFLT + ON AUFLT.Acctnbr = AC.Acctnbr AND AUFLT.userfieldCD = 'COMC' + LEFT JOIN ACCTUSERFIELD AUFAI + ON AUFAI.Acctnbr = AC.Acctnbr AND AUFAI.userfieldCD = 'LOSA' + LEFT JOIN ORGUSERFIELD OUFDC + ON OUFDC.OrgNbr = ORGD.OrgNbr AND OUFDC.UserFieldCD = 'DLCD' + LEFT JOIN RTXN + ON RTXN.ACCTNBR = AC.ACCTNBR AND rtxntypcd = 'NDSB' + LEFT JOIN ACCTUSERFIELD AUFAD + ON AUFAD.Acctnbr = AC.Acctnbr AND AUFAD.userfieldCD = 'LOSD' + LEFT JOIN ACCTUSERFIELD AUFBR + ON AUFBR.Acctnbr = AC.Acctnbr AND AUFBR.userfieldCD = 'BUYR' + LEFT JOIN ACCTUSERFIELD AUFWA + ON AUFWA.Acctnbr = AC.Acctnbr AND AUFWA.userfieldCD = 'WRYN' + LEFT JOIN ACCTUSERFIELD AUFG + ON AUFG.Acctnbr = AC.Acctnbr AND AUFG.userfieldCD = 'GPYN' + LEFT JOIN ACCTSUBACCT ASADL + ON ASADL.AcctNbr = AC.AcctNbr AND ASADL.BALTYPCD = 'SINS' AND ASADL.BALCATCD = 'DL' + LEFT JOIN ACCTSUBACCT ASADI + ON ASADI.AcctNbr = AC.AcctNbr AND ASADI.BALTYPCD = 'SINS' AND ASADI.BALCATCD = 'DI' + LEFT JOIN ACCTSUBACCT ASADD + ON ASADD.AcctNbr = AC.AcctNbr AND ASADD.BALTYPCD = 'SINS' AND ASADD.BALCATCD = 'DD' + LEFT JOIN ACCTSUBACCT ASADLLD + ON ASADLLD.AcctNbr = AC.AcctNbr AND ASADLLD.BALTYPCD = 'FIN' AND ASADLLD.BALCATCD = 'DLLD' + LEFT JOIN ACCTSUBACCT ASADLDS + ON ASADLDS.AcctNbr = AC.AcctNbr AND ASADLDS.BALTYPCD = 'FIN' AND ASADLDS.BALCATCD = 'DLDS' + LEFT JOIN ACCTSUBACCT ASADLLF + ON ASADLLF.AcctNbr = AC.AcctNbr AND ASADLLF.BALTYPCD = 'FIN' AND ASADLLF.BALCATCD = 'DLLF' + LEFT JOIN ACCTSUBACCT ASAG + ON ASAG.AcctNbr = AC.AcctNbr AND ASAG.BALTYPCD = 'FIN' AND ASAG.BALCATCD = 'GAP' + LEFT JOIN ACCTSUBACCT ASAW + ON ASAW.AcctNbr = AC.AcctNbr AND ASAW.BALTYPCD = 'FIN' AND ASAW.BALCATCD = 'WARA' + LEFT JOIN ACCTSUBACCT ASAM + ON ASAW.AcctNbr = AC.AcctNbr AND ASAW.BALTYPCD = 'FIN' AND ASAW.BALCATCD = 'ODLR' + LEFT JOIN (SELECT aas.ACCTNBR,aas.EFFDATETIME ,aas.acctstatcd,aas.POSTDATE + ,ROW_NUMBER() OVER(PARTITION BY aas.ACCTNBR ORDER BY aas.EFFDATETIME DESC ) AAS_RNK + FROM acctacctstathist aas ) aaa + ON aaa.ACCTNBR = ac.ACCTNBR AND AAS_RNK = 1 +WHERE AC.AcctNbr = :AcctNbr \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByPostedDate_Query.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByPostedDate_Query.sql new file mode 100644 index 0000000..ce6eff4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/IndirectLoan/IndirectLoan_ByPostedDate_Query.sql @@ -0,0 +1,129 @@ +With Cte_IndirectActiveLoans as ( +SELECT + Coalesce(MA.MemberAgreeNbr, MAOrg.MemberAgreeNbr) AS MemberNumber, + AC.ACCTNBR AS LoanNumber, + AUFAI.Value AS ApplicationId, + RTRIM(PERS.FirstName) AS MemberFirstName, + PERS.mdlinit AS MemberInitial, + COALESCE(RTRIM(PERS.LastName), RTRIM(ORGM.OrgName)) AS MemberLastName, + OUFDC.Value AS DealerCode, + DGA.AcctNbr AS DealerAccountNumber, + DGA.taxrptfororgnbr AS DealerOrganizationNumber, + ORGD.OrgName AS DealerName, + CASE WHEN AUFWA.Value = 'Y' OR ASAW.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS Warranty, + CASE WHEN AUFG.Value = 'Y' OR ASAG.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS GAP, + CASE WHEN ASADLLD.SubAcctNbr IS NOT NULL OR ASADLLF.SubACctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditLife, + CASE WHEN ASADLLD.SubAcctNbr IS NOT NULL OR ASADLDS.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS CreditDisability, + CASE WHEN ASAMBP.SubAcctNbr IS NOT NULL THEN 1 ELSE 0 END AS Mbp, + AC.currmiaccttypcd AS AccountType, + MMA.MIACCTTYPDESC AS AccountDescription, + AC.CONTRACTDATE AS LoanDate, + Coalesce(RTXN.OrigPostDate,TO_DATE(AUFAD.Value, 'YYYY-MM-DD' )) AS PostedDate, + AL.date1stpmtdue AS FirstPmtDate, + AC.DATEMAT AS FinalPmtDate, + AC.ORIGTERM AS OriginalTermInDays, + ASA.OrigBal AS LoanAmount, + To_number(AUFBR.Value) AS BuyRate, + AUFLT.Value AS LoanType, + RTC.INTRATE * 100 AS ContractRate, + PT.PMTAMT AS MonthlyPmt, + RTRIM(PR.PROPID) AS Vin, + RTRIM(PR.PropMake) AS Make, + RTRIM(PR.PropModel) AS Model, + PR.propyearnbr AS Year, + RTRIM(PR.PropColor) AS Color, + PR.PropVehicleOdometer AS Mileage + FROM ACCT AC + LEFT JOIN PERS + ON PERS.PersNbr = AC.TAXRPTFORPERSNBR + LEFT JOIN ORG ORGM + ON ORGM.OrgNbr = AC.TaxrptForORgNbr + LEFT JOIN MEMBERAGREEMENT MA + ON MA.PrimaryPersNbr = PERS.PersNbr + LEFT JOIN MEMBERAGREEMENT MAOrg + ON MAOrg.PrimaryOrgNbr = ORGM.OrgNbr + LEFT JOIN ACCTGRPACCT AGA + ON AC.AcctNbr = AGA.AcctNbr + LEFT JOIN (select acctgrpnbr, acct.acctnbr, acct.taxrptfororgnbr from acctgrpacct aga + inner join acct + on acct.acctnbr = aga.acctnbr and acct.currmiaccttypcd = 'DLR') DGA + ON DGA.AcctGrpNbr = AGA.AcctGrpNbr + LEFT JOIN ORG ORGD + ON ORGD.ORGNbr = DGA.taxrptfororgnbr + LEFT JOIN ACCTLOAN AL + ON AL.AcctNbr = AC.AcctNbr + LEFT JOIN (SELECT Propnbr, AcctNbr,ROW_NUMBER() OVER(PARTITION BY ACCTNBR ORDER BY PropNbr) PPP_RNK + FROM ACCTPROP) AP ON AP.AcctNbr = AC.AcctNbr AND AP.PPP_RNK = 1 + LEFT JOIN PROP PR + ON PR.Propnbr = AP.Propnbr + LEFT JOIN ACCTSUBACCT ASA + ON ASA.ACCTNBR = AC.ACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL' + LEFT JOIN (SELECT PS.ACCTNBR,PS.SUBACCTNBR,PS.EFFDATE,PS.INACTIVEDATE,PMT.PMTNBR, PMT.PMTTYPCD,T.PMTTYPDESC,PMT.PMTAMT,PMT.PMTPERCENT, + PMT.EFFDATE PMT_EFFDATE,PMT.PMTCALPERIODCD,PMT.INACTIVEDATE PMT_INACTIVEDATE,PMT.DATELASTMAINT, + ROW_NUMBER() OVER(PARTITION BY PS.ACCTNBR,PS.SUBACCTNBR ORDER BY PMT.EFFDATE DESC ) P_RNK + FROM ACCTPMTSUBACCTHIST PS + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = PS.ACCTNBR AND ASA.SUBACCTNBR = PS.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'DUE' + JOIN ACCTPMTHIST PMT ON PMT.ACCTNBR = PS.ACCTNBR AND PMT.PMTNBR = PS.PMTNBR + JOIN PMTTYP T ON T.PMTTYPCD = PMT.PMTTYPCD) PT ON PT.ACCTNBR = AC.ACCTNBR AND P_RNK = 1 + LEFT JOIN (SELECT R.DATELASTMAINT,R.ACCTNBR,R.SUBACCTNBR, R.EFFDATE,R.INTRATE,R.INACTIVEDATE,R.DELQRATEYN,R.POSTDATE,R.DISCLOSEDINTRATE + ,ROW_NUMBER() OVER(PARTITION BY R.ACCTNBR,R.SUBACCTNBR ORDER BY R.POSTDATE DESC) RTC_RNK + FROM ACCTRATEHIST R + JOIN ACCTSUBACCT ASA ON ASA.ACCTNBR = R.ACCTNBR AND ASA.SUBACCTNBR = R.SUBACCTNBR AND ASA.BALCATCD = 'NOTE' AND ASA.BALTYPCD = 'BAL') RTC + ON RTC.ACCTNBR = AC.ACCTNBR AND RTC_RNK = 1 + LEFT JOIN MJMIACCTTYP MMA + ON MMA.MIACCTTYPCD = AC.CURRMIACCTTYPCD + LEFT JOIN ACCTUSERFIELD AUFLT + ON AUFLT.Acctnbr = AC.Acctnbr AND AUFLT.userfieldCD = 'COMC' + LEFT JOIN ACCTUSERFIELD AUFAI + ON AUFAI.Acctnbr = AC.Acctnbr AND AUFAI.userfieldCD = 'LOSA' + LEFT JOIN ORGUSERFIELD OUFDC + ON OUFDC.OrgNbr = ORGD.OrgNbr AND OUFDC.UserFieldCD = 'DLCD' + LEFT JOIN RTXN + ON RTXN.ACCTNBR = AC.ACCTNBR AND rtxntypcd = 'NDSB' + LEFT JOIN ACCTUSERFIELD AUFAD + ON AUFAD.Acctnbr = AC.Acctnbr AND AUFAD.userfieldCD = 'LOSD' + LEFT JOIN ACCTUSERFIELD AUFBR + ON AUFBR.Acctnbr = AC.Acctnbr AND AUFBR.userfieldCD = 'BUYR' + LEFT JOIN ACCTUSERFIELD AUFWA + ON AUFWA.Acctnbr = AC.Acctnbr AND AUFWA.userfieldCD = 'WRYN' + LEFT JOIN ACCTUSERFIELD AUFG + ON AUFG.Acctnbr = AC.Acctnbr AND AUFG.userfieldCD = 'GPYN' + LEFT JOIN ACCTSUBACCT ASADLLD + ON ASADLLD.AcctNbr = AC.AcctNbr AND ASADLLD.BALTYPCD = 'COST' AND ASADLLD.BALCATCD = 'DLLD' + LEFT JOIN ACCTSUBACCT ASADLDS + ON ASADLDS.AcctNbr = AC.AcctNbr AND ASADLDS.BALTYPCD = 'COST' AND ASADLDS.BALCATCD = 'DLDS' + LEFT JOIN ACCTSUBACCT ASADLLF + ON ASADLLF.AcctNbr = AC.AcctNbr AND ASADLLF.BALTYPCD = 'COST' AND ASADLLF.BALCATCD = 'DLLF' + LEFT JOIN ACCTSUBACCT ASAG + ON ASAG.AcctNbr = AC.AcctNbr AND ASAG.BALTYPCD = 'COST' AND ASAG.BALCATCD = 'GAP' + LEFT JOIN ACCTSUBACCT ASAW + ON ASAW.AcctNbr = AC.AcctNbr AND ASAW.BALTYPCD = 'COST' AND ASAW.BALCATCD = 'WARA' + LEFT JOIN ACCTSUBACCT ASAMBP + ON ASAMBP.AcctNbr = AC.AcctNbr AND ASAMBP.BALTYPCD = 'COST' AND ASAMBP.BALCATCD = 'ODLR' +WHERE AC.currmiaccttypcd IN ('DL01','DL02','DL03','DL04','DL05','DL06','DL07','DL08','DL09','DL10','DL11','DL12','DL13','DL14','DL15','DL16') + AND AC.CURRACCTSTATCD = 'ACT' + AND (Coalesce(RTXN.OrigPostDate,TO_DATE(AUFAD.Value, 'YYYY-MM-DD' )) >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AC.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AL.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR PERS.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR MA.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFAI.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR PR.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ORGD.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR PT.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFLT.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR OUFDC.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR RTC.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFAD.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFBR.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFWA.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR AUFG.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASADLLD.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASADLDS.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASADLLF.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASAW.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASAMBP.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + OR ASAG.DATELASTMAINT >= TO_TIMESTAMP(:newerThanDateTime, 'YYYY-MM-DD HH24:MI:SS') + )) + Select * from Cte_IndirectActiveLoans + Where NOT EXISTS (select null from ACTV AV Where AV.ACTVTYPCD = 'MDFY' and av.subjacctnbr = Cte_IndirectActiveLoans.LoanNumber) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByAccountNumberQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByAccountNumberQuery.sql new file mode 100644 index 0000000..eaa6276 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByAccountNumberQuery.sql @@ -0,0 +1,231 @@ +--BASED ON SPEC 1.6 BATCH PAYOFF QUOTES +WITH CTE_DATES AS ( + SELECT Y.*, + Y.DATE_RUN+Y.PAYOFF_DAYS AS EXPIRATION_DATE, + CASE + WHEN Y.DAYS_LEFT_IN_MONTH<=11 OR Y.DAY_OF_MONTH<=2 THEN 1 + ELSE 0 + END AS PAYOFF_INDICATOR + FROM (/*DO IN TWO STEPS TO TROUBLESHOOT*/ + SELECT X.DATE_RUN, + 11 AS PAYOFF_DAYS, + ADD_MONTHS(TRUNC(X.DATE_RUN,'YEAR'),12)-TRUNC(X.DATE_RUN,'YEAR') AS DAYS_IN_YEAR, + (ADD_MONTHS(TRUNC(X.DATE_RUN,'MONTH'),1)-1)-X.DATE_RUN AS DAYS_LEFT_IN_MONTH, + CAST(TO_CHAR(X.DATE_RUN,'DD') AS INT) AS DAY_OF_MONTH + FROM ( + SELECT TO_DATE(:dateRange,'YYYY-MM-DD') AS DATE_RUN + FROM DUAL + ) X + ) Y +), CTE_LOANS_IN_SCOPE AS (/*PAYOFF CALCULATIONS ARE REALLY IMPORTANT, IF FAILS NEED TO FILL IN DAYS*/ + SELECT A.ACCTNBR, + A.TAXRPTFORORGNBR, + A.TAXRPTFORPERSNBR, + COALESCE(CAST(AMT.VALUE AS NUMERIC(12,2)),0) AS PAYOFF_VALUE, + DR.PAYOFF_DAYS+(DR.DATE_RUN-TO_DATE(DT.VALUE,'YYYY-MM-DD')) AS PAYOFF_DAYS, + DR.EXPIRATION_DATE, + DR.PAYOFF_INDICATOR, + DR.DAYS_IN_YEAR, + DR.DATE_RUN, + A.DATEMAT + FROM OSIBANK.ACCT A + INNER JOIN CTE_DATES DR ON 1=1 + INNER JOIN OSIBANK.ACCTUSERFIELD AMT ON AMT.ACCTNBR=A.ACCTNBR AND AMT.USERFIELDCD='8AUF' + INNER JOIN OSIBANK.ACCTUSERFIELD DT ON DT.ACCTNBR=AMT.ACCTNBR AND DT.USERFIELDCD='8DUF' AND DT.VALUE IS NOT NULL + WHERE A.CURRACCTSTATCD IN ('ACT','NPFM') + AND ( + (A.MJACCTTYPCD='CNS' AND A.CURRMIACCTTYPCD LIKE 'DL%') + OR + (A.MJACCTTYPCD='CNS' AND A.CURRMIACCTTYPCD LIKE 'DV%') + OR + (A.MJACCTTYPCD='CML' AND A.CURRMIACCTTYPCD='BE21') + ) + AND A.ACCTNBR = :accountNumber +), CTE_PRIMARY AS ( + SELECT X.ACCTNBR, + UPPER(X.LASTNAME) AS LASTNAME, + UPPER(X.FIRSTNAME) AS FIRSTNAME, + UPPER(X.MDLINIT) AS MDLINIT, + X.ORGNAME, + X.PRIVACYYN AS OPTOUTCODE, + TRIM(REGEXP_REPLACE(AD.CITYNAME,'( ){2,}',' ')) AS CITY, + TRIM(AD.STATECD) AS STATE, + TRIM(REGEXP_REPLACE(AL.LINE1,'( ){2,}',' ')) AS ADDRESS_1, + TRIM(REGEXP_REPLACE(AL.LINE2||' '||AL.LINE3,'( ){2,}',' ')) AS ADDRESS_2, + TRIM(REGEXP_REPLACE(AD.ZIPCD||CASE WHEN LPAD(AD.ZIPSUF,4,'0')='0000' THEN NULL ELSE LPAD(AD.ZIPSUF,4,'0') END,'( ){2,}',' ')) AS ZIP + FROM + ( + SELECT A.ACCTNBR, + PAU.ADDRNBR, + P1.PRIVACYYN, + P1.LASTNAME, + P1.FIRSTNAME, + P1.MDLINIT, + NULL AS ORGNAME + FROM CTE_LOANS_IN_SCOPE A + INNER JOIN OSIBANK.PERS P1 ON P1.PERSNBR=A.TAXRPTFORPERSNBR + LEFT JOIN OSIBANK.PERSADDRUSE PAU ON PAU.PERSNBR=P1.PERSNBR AND PAU.ADDRUSECD='PRI' + UNION ALL + SELECT A.ACCTNBR, + OAU.ADDRNBR, + O1.PRIVACYYN, + NULL AS LASTNAME, + NULL AS FIRSTNAME, + NULL AS MDLINIT, + O1.ORGNAME + FROM CTE_LOANS_IN_SCOPE A + INNER JOIN OSIBANK.ORG O1 ON O1.ORGNBR=A.TAXRPTFORORGNBR + LEFT JOIN OSIBANK.ORGADDRUSE OAU ON OAU.ORGNBR=O1.ORGNBR AND OAU.ADDRUSECD='PRI' + ) X + LEFT JOIN OSIBANK.ADDR AD ON AD.ADDRNBR=X.ADDRNBR + LEFT JOIN ( + SELECT X.ADDRNBR, + MAX(DECODE(X.LINENUM,1,X.TEXT,NULL)) AS LINE1, + MAX(DECODE(X.LINENUM,2,X.TEXT,NULL)) AS LINE2, + MAX(DECODE(X.LINENUM,3,X.TEXT,NULL)) AS LINE3 + FROM ( + SELECT ROW_NUMBER() OVER (PARTITION BY AL.ADDRNBR ORDER BY AL.LINENBR) AS LINENUM, + AL.ADDRNBR, + AL.TEXT + FROM OSIBANK.ADDRLINE AL + INNER JOIN OSIBANK.ADDRLINETYP ALT ON AL.ADDRLINETYPCD=ALT.ADDRLINETYPCD + WHERE ALT.MAILADDRYN='Y' + ) X + GROUP BY X.ADDRNBR + ) AL ON AL.ADDRNBR=AD.ADDRNBR +), CTE_EXCLUSIONS AS ( + SELECT LIS.ACCTNBR + FROM CTE_LOANS_IN_SCOPE LIS + WHERE LIS.PAYOFF_INDICATOR=1 /*END/START OF MONTH*/ + AND EXISTS ( + SELECT 1 + FROM OSIBANK.ACCTSUBACCT ASA + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR ASACV ON ASACV.ACCTNBR=ASA.ACCTNBR AND ASACV.SUBACCTNBR=ASA.SUBACCTNBR AND ASACV.CALCTYPCD=ASA.BALTYPCD + WHERE LIS.ACCTNBR=ASA.ACCTNBR + AND UPPER(ASA.BALTYPCD)='SINS'/*SIMPLE*/ + AND UPPER(ASACV.CALCVARCD)='SCHD'/*SCHEDULE NUMBER*/ + AND ASACV.CALCVALUEEFFDATE<=LIS.DATE_RUN + AND (ASACV.CALCINACTIVEDATE IS NULL OR ASACV.CALCINACTIVEDATE>=LIS.DATE_RUN) + AND ( + /*MOB INSURANCE*/ + UPPER(ASA.BALCATCD) IN ('JDIS'/*JOINT-DISAB*/,'JLIF'/*JOINT-LIFE*/,'SDIS'/*SINGLE-DISAB*/,'SING'/*SINGLE-LIFE*/) + OR + /*DEBT PROTECTION*/ + UPPER(ASA.BALCATCD) IN ('DJD'/*DEBT-PRO-JOINT-DISAB*/,'DJL'/*DEBT-PRO-JOINT-LIFE*/,'DJLD'/*DEBT-PRO-JOINT-LIFE-DISAB*/,'DSD'/*DEBT-PRO-SINGLE-DISAB*/,'DSL'/*DEBT-PRO-SINGLE-LIFE*/,'DSLD'/*DEBT-PRO-SINGLE-LIFE-DISAB*/) + ) + ) +), CTE_STAGE AS ( +SELECT LIS.ACCTNBR as ACCOUNTNUMBER,/*FOR TROUBLESHOOTING*/ + CE.ACCTNBR AS EXCLUSIONS,/*FOR TROUBLESHOOTING*/ + CAST(SUBSTR(CP.ACCTNBR,-4,4) AS VARCHAR2(4)) AS ACCOUNT,/*RIGHTMOST 4 DIGITS, MAXLENGTH 4*/ + CAST( + CASE + WHEN LENGTH(AU.VALUE) IS NULL OR LENGTH(AU.VALUE)>3 THEN '1234' + ELSE AU.VALUE + END AS VARCHAR2(20)) AS LENDERID,/*LOOK IN USERFIELD MAXLENGTH 20*/ + CP.OPTOUTCODE,/*MAIL MARKETING, MAXLENGTH 1*/ + CAST(SUBSTR(COALESCE(CP.FIRSTNAME,CP.ORGNAME),0,20) AS VARCHAR2(20)) AS FIRSTNAME,/*MAXLENGTH 20*/ + CAST(SUBSTR(CP.MDLINIT,0,1) AS VARCHAR2(1)) AS MIDDLENAME,/*MAXLENGTH 1*/ + CAST(SUBSTR(COALESCE(CP.LASTNAME,CP.ORGNAME),0,20) AS VARCHAR2(20)) AS LASTNAME,/*MAXLENGTH 20*/ + CAST(SUBSTR(CP.ADDRESS_1,0,20) AS VARCHAR2(20)) AS ADDRESS1,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.ADDRESS_2,0,20) AS VARCHAR2(20)) AS ADDRESS2,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.CITY,0,20) AS VARCHAR2(20)) AS CITY,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.STATE,0,2) AS VARCHAR2(2)) AS STATE,/*DNA ALLOWS LONGER, MAXLENGTH 2*/ + CAST(SUBSTR(CP.ZIP,0,9) AS VARCHAR2(9)) AS ZIPCODE, /*MAXLENGTH 9*/ + CAST(NULL AS VARCHAR2(10)) AS HOMEPHONE, /*NULL IN PREVIOUS VERSION MAXLENGTH 10*/ + CAST(NULL AS VARCHAR2(10)) AS BUSINESSPHONE, /*NULL IN PREVIOUS VERSION MAXLENGTH 10*/ + CAST(SUBSTR(PR.PROPID,0,17) AS VARCHAR2(17)) AS VEHICLEVIN, /*DNA ALLOWS LONGER, MAXLENGTH 17*/ + CAST( + CASE + WHEN LENGTH(PR.PROPYEARNBR)> 4 THEN NULL + ELSE PR.PROPYEARNBR + END + AS VARCHAR2(4)) AS VEHICLEYEAR, /*DNA ALLOWS LONGER, MAXLENGTH 4, NEEDS TO BE NUMERIC, WHICH DNA IS*/ + CAST(SUBSTR(PR.PROPMAKE,0,20) AS VARCHAR2(20)) AS VEHICLEMAKE, /*DNA IS SHORTER, MAXLENGTH 20*/ + CAST(SUBSTR(PR.PROPMODEL,0,20) AS VARCHAR2(20)) AS VEHICLEMODEL, /*DNA IS SHORTER, MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(20)) AS VEHICLETRIM,/*NULL IN PREVIOUS VERSION MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(40)) AS VEHICLEDESCRIPTION,/*NULL IN PREVIOUS VERSION MAXLENGTH 40*/ + CAST('R' AS VARCHAR2(1)) AS PRODUCT,/*HARD-CODED IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 1*/ + CAST(NULL AS VARCHAR2(20)) AS SUBPRODUCT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 20*/ + TO_CHAR( + CASE WHEN CE.ACCTNBR IS NOT NULL THEN 0 + ELSE ROUND(LIS.PAYOFF_VALUE+(LIS.PAYOFF_DAYS*RATE.INTRATE/LIS.DAYS_IN_YEAR*CNB.BALAMT),2) + END + ,'FM999990.00') AS NETPAYOFFAMOUNT,/*PER: KYLE MATHER-IF MOB OR DEBT PROTECTION THEN ZERO. MAXLENGTH 6.2*/ + TO_CHAR(LIS.EXPIRATION_DATE,'YYYYMMDD') AS GOODUNTILDATE, /*CALCULATED, MAXLENGTH 8*/ + TO_CHAR(LIS.DATEMAT,'YYYYMMDD') AS MATURITYDATE, + CASE + WHEN AC.ORIGTERM IS NULL OR AC.CONTRACTDATE IS NULL THEN 0--NO EXAMPLE OF NULL CONTRACT DATE BUT SYSTEM DOES NOT PREVENT IT + ELSE ROUND(MONTHS_BETWEEN(AC.CONTRACTDATE+AC.ORIGTERM, AC.CONTRACTDATE)) + END AS TERMINMONTHS,/*MAXLENGTH2, PER KYLE MATHER SHOULD NOT BE LIMITED TO THIS*/ + CASE + WHEN MONTHS_BETWEEN(LIS.DATEMAT,CDD.DUEDATE)<=0 THEN 0 + ELSE MONTHS_BETWEEN(LIS.DATEMAT,CDD.DUEDATE)+1 + END AS MONTHS_LEFT, /*MAXLENGTH 2, PER KYLE MATHER SHOULD NOT BE LIMITED TO THIS*/ + CAST(NULL AS VARCHAR2(8)) AS NEXTPAYMENTDATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 8*/ + TO_CHAR(ROUND(NVL(PMT.PMTAMT,0),2),'FM99990.00') AS MONTHLYPAYMENT, /*MAXLENGTH 5.2*/ + CAST(NULL AS VARCHAR2(9)) AS GROSSPAYOFF,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS SECURITYDEPOSIT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS RESIDUALVALUE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + TO_CHAR(ROUND((RATE.INTRATE/LIS.DAYS_IN_YEAR*CNB.BALAMT),2),'FM999990.00') AS DOLLARDAYRATE,/*MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS BALLOONAMOUNT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST( + CASE + WHEN CE.ACCTNBR IS NOT NULL THEN 'Contact lender for payoff' + ELSE NULL + END + AS VARCHAR2(80)) AS PAYOFFMESSAGE,/*MAXLENGTH 80*/ + CAST(NULL AS VARCHAR2(1)) AS PREAPPROVEDCODE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 1*/ + CAST(NULL AS VARCHAR2(20)) AS REFERENCENUMBER,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(8)) AS EXPIRATIONDATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 8*/ + CAST(NULL AS VARCHAR2(9)) AS BUYRATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 2.6*/ + CAST(NULL AS VARCHAR2(8)) AS ACQUISITIONFEE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 5.2*/ + CAST(NULL AS VARCHAR2(8)) AS PARTICIPATIONPERCENT/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 3.2*/ +FROM CTE_LOANS_IN_SCOPE LIS +INNER JOIN OSIBANK.ACCT AC ON AC.ACCTNBR=LIS.ACCTNBR +INNER JOIN CTE_PRIMARY CP ON CP.ACCTNBR=LIS.ACCTNBR +LEFT JOIN ( + SELECT PMT.ACCTNBR, + SUM(PMT.PMTAMT) AS PMTAMT + FROM OSIBANK.ACCTPMTHIST PMT + INNER JOIN CTE_DATES CD ON 1=1 + INNER JOIN OSIBANK.ACCTPMTSUBACCTHIST APSH ON APSH.ACCTNBR=PMT.ACCTNBR AND APSH.PMTNBR=PMT.PMTNBR AND APSH.EFFDATE=PMT.EFFDATE + INNER JOIN OSIBANK.ACCTSUBACCT ASA ON ASA.ACCTNBR=APSH.ACCTNBR AND ASA.SUBACCTNBR=APSH.SUBACCTNBR AND ASA.BALCATCD='NOTE' AND ASA.BALTYPCD IN ('OINT','BAL','DUE') + WHERE PMT.PMTTYPCD IN ('FB','FBI','FDUE') + AND PMT.EFFDATE<=CD.DATE_RUN + AND (PMT.INACTIVEDATE>CD.DATE_RUN OR PMT.INACTIVEDATE IS NULL) + AND (APSH.INACTIVEDATE>CD.DATE_RUN OR APSH.INACTIVEDATE IS NULL) + GROUP BY PMT.ACCTNBR + ) PMT ON PMT.ACCTNBR=LIS.ACCTNBR +LEFT JOIN ( + SELECT ARH.ACCTNBR, + ARH.INTRATE, + ROW_NUMBER() OVER (PARTITION BY ARH.ACCTNBR, ARH.SUBACCTNBR ORDER BY ARH.EFFDATE DESC) AS RWN + FROM OSIBANK.ACCTRATEHIST ARH + INNER JOIN OSIBANK.ACCTSUBACCT ASA ON ASA.ACCTNBR=ARH.ACCTNBR AND ASA.SUBACCTNBR=ARH.SUBACCTNBR AND ASA.BALCATCD='NOTE' AND ASA.BALTYPCD='BAL' + INNER JOIN CTE_DATES CD ON 1=1 + WHERE ARH.EFFDATE<=CD.DATE_RUN AND (ARH.INACTIVEDATE>CD.DATE_RUN OR ARH.INACTIVEDATE IS NULL) + ) RATE ON RATE.ACCTNBR=LIS.ACCTNBR AND RATE.RWN=1 +LEFT JOIN OSIBANK.VIEW_LN_CURR_NOTEBAL CNB ON CNB.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.ACCTPROP AP ON AP.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.PROP PR ON PR.PROPNBR=AP.PROPNBR +LEFT JOIN OSIBANK.VIEW_LN_CURR_DUEDATE CDD ON CDD.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.ACCTUSERFIELD AU ON AU.ACCTNBR=LIS.ACCTNBR AND AU.USERFIELDCD='DECD' +LEFT JOIN CTE_EXCLUSIONS CE ON CE.ACCTNBR=LIS.ACCTNBR +) /*MATCH REQUIREMENTS ON SPEC DOCUMENT*/ +SELECT DISTINCT * +FROM CTE_STAGE S +WHERE S.ACCOUNT IS NOT NULL + AND S.LENDERID IS NOT NULL + AND S.FIRSTNAME IS NOT NULL + AND S.LASTNAME IS NOT NULL + AND S.ADDRESS1 IS NOT NULL + AND S.CITY IS NOT NULL +/*PER KYLE MATHER INCLUDE RECORDS WITHOUT STATE, REJECT ON DEALERTRACK INGEST SIDE*/ + AND S.ZIPCODE IS NOT NULL + AND S.VEHICLEVIN IS NOT NULL + AND S.PRODUCT IS NOT NULL + AND S.NETPAYOFFAMOUNT IS NOT NULL + AND S.GOODUNTILDATE IS NOT NULL + AND S.MATURITYDATE IS NOT NULL +/*PER KYLE MATHER INCLUDE LOANS WITH MOB INSURANCE AND/OR DEBT PROTECTION*/ \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByVINQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByVINQuery.sql new file mode 100644 index 0000000..f85e540 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/LoanPayoff/LoanPayoffByVINQuery.sql @@ -0,0 +1,233 @@ +--BASED ON SPEC 1.6 BATCH PAYOFF QUOTES +WITH CTE_DATES AS ( + SELECT Y.*, + Y.DATE_RUN+Y.PAYOFF_DAYS AS EXPIRATION_DATE, + CASE + WHEN Y.DAYS_LEFT_IN_MONTH<=11 OR Y.DAY_OF_MONTH<=2 THEN 1 + ELSE 0 + END AS PAYOFF_INDICATOR + FROM (/*DO IN TWO STEPS TO TROUBLESHOOT*/ + SELECT X.DATE_RUN, + 11 AS PAYOFF_DAYS, + ADD_MONTHS(TRUNC(X.DATE_RUN,'YEAR'),12)-TRUNC(X.DATE_RUN,'YEAR') AS DAYS_IN_YEAR, + (ADD_MONTHS(TRUNC(X.DATE_RUN,'MONTH'),1)-1)-X.DATE_RUN AS DAYS_LEFT_IN_MONTH, + CAST(TO_CHAR(X.DATE_RUN,'DD') AS INT) AS DAY_OF_MONTH + FROM ( + SELECT TO_DATE(:dateRange,'YYYY-MM-DD') AS DATE_RUN + FROM DUAL + ) X + ) Y +), CTE_LOANS_IN_SCOPE AS (/*PAYOFF CALCULATIONS ARE REALLY IMPORTANT, IF FAILS NEED TO FILL IN DAYS*/ + SELECT A.ACCTNBR, + A.TAXRPTFORORGNBR, + A.TAXRPTFORPERSNBR, + COALESCE(CAST(AMT.VALUE AS NUMERIC(12,2)),0) AS PAYOFF_VALUE, + DR.PAYOFF_DAYS+(DR.DATE_RUN-TO_DATE(DT.VALUE,'YYYY-MM-DD')) AS PAYOFF_DAYS, + DR.EXPIRATION_DATE, + DR.PAYOFF_INDICATOR, + DR.DAYS_IN_YEAR, + DR.DATE_RUN, + A.DATEMAT + FROM OSIBANK.ACCT A + INNER JOIN CTE_DATES DR ON 1=1 + INNER JOIN OSIBANK.ACCTUSERFIELD AMT ON AMT.ACCTNBR=A.ACCTNBR AND AMT.USERFIELDCD='8AUF' + INNER JOIN OSIBANK.ACCTUSERFIELD DT ON DT.ACCTNBR=AMT.ACCTNBR AND DT.USERFIELDCD='8DUF' AND DT.VALUE IS NOT NULL + INNER JOIN OSIBANK.ACCTPROP AP ON AP.ACCTNBR=A.ACCTNBR + INNER JOIN OSIBANK.PROP PR ON PR.PROPNBR=AP.PROPNBR + WHERE A.CURRACCTSTATCD IN ('ACT','NPFM') + AND ( + (A.MJACCTTYPCD='CNS' AND A.CURRMIACCTTYPCD LIKE 'DL%') + OR + (A.MJACCTTYPCD='CNS' AND A.CURRMIACCTTYPCD LIKE 'DV%') + OR + (A.MJACCTTYPCD='CML' AND A.CURRMIACCTTYPCD='BE21') + ) + AND PR.PROPID = :VIN +), CTE_PRIMARY AS ( + SELECT X.ACCTNBR, + UPPER(X.LASTNAME) AS LASTNAME, + UPPER(X.FIRSTNAME) AS FIRSTNAME, + UPPER(X.MDLINIT) AS MDLINIT, + X.ORGNAME, + X.PRIVACYYN AS OPTOUTCODE, + TRIM(REGEXP_REPLACE(AD.CITYNAME,'( ){2,}',' ')) AS CITY, + TRIM(AD.STATECD) AS STATE, + TRIM(REGEXP_REPLACE(AL.LINE1,'( ){2,}',' ')) AS ADDRESS_1, + TRIM(REGEXP_REPLACE(AL.LINE2||' '||AL.LINE3,'( ){2,}',' ')) AS ADDRESS_2, + TRIM(REGEXP_REPLACE(AD.ZIPCD||CASE WHEN LPAD(AD.ZIPSUF,4,'0')='0000' THEN NULL ELSE LPAD(AD.ZIPSUF,4,'0') END,'( ){2,}',' ')) AS ZIP + FROM + ( + SELECT A.ACCTNBR, + PAU.ADDRNBR, + P1.PRIVACYYN, + P1.LASTNAME, + P1.FIRSTNAME, + P1.MDLINIT, + NULL AS ORGNAME + FROM CTE_LOANS_IN_SCOPE A + INNER JOIN OSIBANK.PERS P1 ON P1.PERSNBR=A.TAXRPTFORPERSNBR + LEFT JOIN OSIBANK.PERSADDRUSE PAU ON PAU.PERSNBR=P1.PERSNBR AND PAU.ADDRUSECD='PRI' + UNION ALL + SELECT A.ACCTNBR, + OAU.ADDRNBR, + O1.PRIVACYYN, + NULL AS LASTNAME, + NULL AS FIRSTNAME, + NULL AS MDLINIT, + O1.ORGNAME + FROM CTE_LOANS_IN_SCOPE A + INNER JOIN OSIBANK.ORG O1 ON O1.ORGNBR=A.TAXRPTFORORGNBR + LEFT JOIN OSIBANK.ORGADDRUSE OAU ON OAU.ORGNBR=O1.ORGNBR AND OAU.ADDRUSECD='PRI' + ) X + LEFT JOIN OSIBANK.ADDR AD ON AD.ADDRNBR=X.ADDRNBR + LEFT JOIN ( + SELECT X.ADDRNBR, + MAX(DECODE(X.LINENUM,1,X.TEXT,NULL)) AS LINE1, + MAX(DECODE(X.LINENUM,2,X.TEXT,NULL)) AS LINE2, + MAX(DECODE(X.LINENUM,3,X.TEXT,NULL)) AS LINE3 + FROM ( + SELECT ROW_NUMBER() OVER (PARTITION BY AL.ADDRNBR ORDER BY AL.LINENBR) AS LINENUM, + AL.ADDRNBR, + AL.TEXT + FROM OSIBANK.ADDRLINE AL + INNER JOIN OSIBANK.ADDRLINETYP ALT ON AL.ADDRLINETYPCD=ALT.ADDRLINETYPCD + WHERE ALT.MAILADDRYN='Y' + ) X + GROUP BY X.ADDRNBR + ) AL ON AL.ADDRNBR=AD.ADDRNBR +), CTE_EXCLUSIONS AS ( + SELECT LIS.ACCTNBR + FROM CTE_LOANS_IN_SCOPE LIS + WHERE LIS.PAYOFF_INDICATOR=1 /*END/START OF MONTH*/ + AND EXISTS ( + SELECT 1 + FROM OSIBANK.ACCTSUBACCT ASA + INNER JOIN OSIBANK.ACCTSUBACCTCALCVAR ASACV ON ASACV.ACCTNBR=ASA.ACCTNBR AND ASACV.SUBACCTNBR=ASA.SUBACCTNBR AND ASACV.CALCTYPCD=ASA.BALTYPCD + WHERE LIS.ACCTNBR=ASA.ACCTNBR + AND UPPER(ASA.BALTYPCD)='SINS'/*SIMPLE*/ + AND UPPER(ASACV.CALCVARCD)='SCHD'/*SCHEDULE NUMBER*/ + AND ASACV.CALCVALUEEFFDATE<=LIS.DATE_RUN + AND (ASACV.CALCINACTIVEDATE IS NULL OR ASACV.CALCINACTIVEDATE>=LIS.DATE_RUN) + AND ( + /*MOB INSURANCE*/ + UPPER(ASA.BALCATCD) IN ('JDIS'/*JOINT-DISAB*/,'JLIF'/*JOINT-LIFE*/,'SDIS'/*SINGLE-DISAB*/,'SING'/*SINGLE-LIFE*/) + OR + /*DEBT PROTECTION*/ + UPPER(ASA.BALCATCD) IN ('DJD'/*DEBT-PRO-JOINT-DISAB*/,'DJL'/*DEBT-PRO-JOINT-LIFE*/,'DJLD'/*DEBT-PRO-JOINT-LIFE-DISAB*/,'DSD'/*DEBT-PRO-SINGLE-DISAB*/,'DSL'/*DEBT-PRO-SINGLE-LIFE*/,'DSLD'/*DEBT-PRO-SINGLE-LIFE-DISAB*/) + ) + ) +), CTE_STAGE AS ( +SELECT LIS.ACCTNBR as ACCOUNTNUMBER,/*FOR TROUBLESHOOTING*/ + CE.ACCTNBR AS EXCLUSIONS,/*FOR TROUBLESHOOTING*/ + CAST(SUBSTR(CP.ACCTNBR,-4,4) AS VARCHAR2(4)) AS ACCOUNT,/*RIGHTMOST 4 DIGITS, MAXLENGTH 4*/ + CAST( + CASE + WHEN LENGTH(AU.VALUE) IS NULL OR LENGTH(AU.VALUE)>3 THEN '1234' + ELSE AU.VALUE + END AS VARCHAR2(20)) AS LENDERID,/*LOOK IN USERFIELD MAXLENGTH 20*/ + CP.OPTOUTCODE,/*MAIL MARKETING, MAXLENGTH 1*/ + CAST(SUBSTR(COALESCE(CP.FIRSTNAME,CP.ORGNAME),0,20) AS VARCHAR2(20)) AS FIRSTNAME,/*MAXLENGTH 20*/ + CAST(SUBSTR(CP.MDLINIT,0,1) AS VARCHAR2(1)) AS MIDDLENAME,/*MAXLENGTH 1*/ + CAST(SUBSTR(COALESCE(CP.LASTNAME,CP.ORGNAME),0,20) AS VARCHAR2(20)) AS LASTNAME,/*MAXLENGTH 20*/ + CAST(SUBSTR(CP.ADDRESS_1,0,20) AS VARCHAR2(20)) AS ADDRESS1,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.ADDRESS_2,0,20) AS VARCHAR2(20)) AS ADDRESS2,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.CITY,0,20) AS VARCHAR2(20)) AS CITY,/*CLEAN UP IN ABOVE CTE, MAXLENGTH 20*/ + CAST(SUBSTR(CP.STATE,0,2) AS VARCHAR2(2)) AS STATE,/*DNA ALLOWS LONGER, MAXLENGTH 2*/ + CAST(SUBSTR(CP.ZIP,0,9) AS VARCHAR2(9)) AS ZIPCODE, /*MAXLENGTH 9*/ + CAST(NULL AS VARCHAR2(10)) AS HOMEPHONE, /*NULL IN PREVIOUS VERSION MAXLENGTH 10*/ + CAST(NULL AS VARCHAR2(10)) AS BUSINESSPHONE, /*NULL IN PREVIOUS VERSION MAXLENGTH 10*/ + CAST(SUBSTR(PR.PROPID,0,17) AS VARCHAR2(17)) AS VEHICLEVIN, /*DNA ALLOWS LONGER, MAXLENGTH 17*/ + CAST( + CASE + WHEN LENGTH(PR.PROPYEARNBR)> 4 THEN NULL + ELSE PR.PROPYEARNBR + END + AS VARCHAR2(4)) AS VEHICLEYEAR, /*DNA ALLOWS LONGER, MAXLENGTH 4, NEEDS TO BE NUMERIC, WHICH DNA IS*/ + CAST(SUBSTR(PR.PROPMAKE,0,20) AS VARCHAR2(20)) AS VEHICLEMAKE, /*DNA IS SHORTER, MAXLENGTH 20*/ + CAST(SUBSTR(PR.PROPMODEL,0,20) AS VARCHAR2(20)) AS VEHICLEMODEL, /*DNA IS SHORTER, MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(20)) AS VEHICLETRIM,/*NULL IN PREVIOUS VERSION MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(40)) AS VEHICLEDESCRIPTION,/*NULL IN PREVIOUS VERSION MAXLENGTH 40*/ + CAST('R' AS VARCHAR2(1)) AS PRODUCT,/*HARD-CODED IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 1*/ + CAST(NULL AS VARCHAR2(20)) AS SUBPRODUCT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 20*/ + TO_CHAR( + CASE WHEN CE.ACCTNBR IS NOT NULL THEN 0 + ELSE ROUND(LIS.PAYOFF_VALUE+(LIS.PAYOFF_DAYS*RATE.INTRATE/LIS.DAYS_IN_YEAR*CNB.BALAMT),2) + END + ,'FM999990.00') AS NETPAYOFFAMOUNT,/*PER: KYLE MATHER-IF MOB OR DEBT PROTECTION THEN ZERO. MAXLENGTH 6.2*/ + TO_CHAR(LIS.EXPIRATION_DATE,'YYYYMMDD') AS GOODUNTILDATE, /*CALCULATED, MAXLENGTH 8*/ + TO_CHAR(LIS.DATEMAT,'YYYYMMDD') AS MATURITYDATE, + CASE + WHEN AC.ORIGTERM IS NULL OR AC.CONTRACTDATE IS NULL THEN 0--NO EXAMPLE OF NULL CONTRACT DATE BUT SYSTEM DOES NOT PREVENT IT + ELSE ROUND(MONTHS_BETWEEN(AC.CONTRACTDATE+AC.ORIGTERM, AC.CONTRACTDATE)) + END AS TERMINMONTHS,/*MAXLENGTH2, PER KYLE MATHER SHOULD NOT BE LIMITED TO THIS*/ + CASE + WHEN MONTHS_BETWEEN(LIS.DATEMAT,CDD.DUEDATE)<=0 THEN 0 + ELSE MONTHS_BETWEEN(LIS.DATEMAT,CDD.DUEDATE)+1 + END AS MONTHS_LEFT, /*MAXLENGTH 2, PER KYLE MATHER SHOULD NOT BE LIMITED TO THIS*/ + CAST(NULL AS VARCHAR2(8)) AS NEXTPAYMENTDATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 8*/ + TO_CHAR(ROUND(NVL(PMT.PMTAMT,0),2),'FM99990.00') AS MONTHLYPAYMENT, /*MAXLENGTH 5.2*/ + CAST(NULL AS VARCHAR2(9)) AS GROSSPAYOFF,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS SECURITYDEPOSIT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS RESIDUALVALUE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + TO_CHAR(ROUND((RATE.INTRATE/LIS.DAYS_IN_YEAR*CNB.BALAMT),2),'FM999990.00') AS DOLLARDAYRATE,/*MAXLENGTH 6.2*/ + CAST(NULL AS VARCHAR2(9)) AS BALLOONAMOUNT,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 6.2*/ + CAST( + CASE + WHEN CE.ACCTNBR IS NOT NULL THEN 'Contact lender for payoff' + ELSE NULL + END + AS VARCHAR2(80)) AS PAYOFFMESSAGE,/*MAXLENGTH 80*/ + CAST(NULL AS VARCHAR2(1)) AS PREAPPROVEDCODE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 1*/ + CAST(NULL AS VARCHAR2(20)) AS REFERENCENUMBER,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 20*/ + CAST(NULL AS VARCHAR2(8)) AS EXPIRATIONDATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 8*/ + CAST(NULL AS VARCHAR2(9)) AS BUYRATE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 2.6*/ + CAST(NULL AS VARCHAR2(8)) AS ACQUISITIONFEE,/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 5.2*/ + CAST(NULL AS VARCHAR2(8)) AS PARTICIPATIONPERCENT/*NULL IN PREVIOUS VERSION IN PREVIOUS VERSION MAXLENGTH 3.2*/ +FROM CTE_LOANS_IN_SCOPE LIS +INNER JOIN OSIBANK.ACCT AC ON AC.ACCTNBR=LIS.ACCTNBR +INNER JOIN CTE_PRIMARY CP ON CP.ACCTNBR=LIS.ACCTNBR +LEFT JOIN ( + SELECT PMT.ACCTNBR, + SUM(PMT.PMTAMT) AS PMTAMT + FROM OSIBANK.ACCTPMTHIST PMT + INNER JOIN CTE_DATES CD ON 1=1 + INNER JOIN OSIBANK.ACCTPMTSUBACCTHIST APSH ON APSH.ACCTNBR=PMT.ACCTNBR AND APSH.PMTNBR=PMT.PMTNBR AND APSH.EFFDATE=PMT.EFFDATE + INNER JOIN OSIBANK.ACCTSUBACCT ASA ON ASA.ACCTNBR=APSH.ACCTNBR AND ASA.SUBACCTNBR=APSH.SUBACCTNBR AND ASA.BALCATCD='NOTE' AND ASA.BALTYPCD IN ('OINT','BAL','DUE') + WHERE PMT.PMTTYPCD IN ('FB','FBI','FDUE') + AND PMT.EFFDATE<=CD.DATE_RUN + AND (PMT.INACTIVEDATE>CD.DATE_RUN OR PMT.INACTIVEDATE IS NULL) + AND (APSH.INACTIVEDATE>CD.DATE_RUN OR APSH.INACTIVEDATE IS NULL) + GROUP BY PMT.ACCTNBR + ) PMT ON PMT.ACCTNBR=LIS.ACCTNBR +LEFT JOIN ( + SELECT ARH.ACCTNBR, + ARH.INTRATE, + ROW_NUMBER() OVER (PARTITION BY ARH.ACCTNBR, ARH.SUBACCTNBR ORDER BY ARH.EFFDATE DESC) AS RWN + FROM OSIBANK.ACCTRATEHIST ARH + INNER JOIN OSIBANK.ACCTSUBACCT ASA ON ASA.ACCTNBR=ARH.ACCTNBR AND ASA.SUBACCTNBR=ARH.SUBACCTNBR AND ASA.BALCATCD='NOTE' AND ASA.BALTYPCD='BAL' + INNER JOIN CTE_DATES CD ON 1=1 + WHERE ARH.EFFDATE<=CD.DATE_RUN AND (ARH.INACTIVEDATE>CD.DATE_RUN OR ARH.INACTIVEDATE IS NULL) + ) RATE ON RATE.ACCTNBR=LIS.ACCTNBR AND RATE.RWN=1 +LEFT JOIN OSIBANK.VIEW_LN_CURR_NOTEBAL CNB ON CNB.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.ACCTPROP AP ON AP.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.PROP PR ON PR.PROPNBR=AP.PROPNBR +LEFT JOIN OSIBANK.VIEW_LN_CURR_DUEDATE CDD ON CDD.ACCTNBR=LIS.ACCTNBR +LEFT JOIN OSIBANK.ACCTUSERFIELD AU ON AU.ACCTNBR=LIS.ACCTNBR AND AU.USERFIELDCD='DECD' +LEFT JOIN CTE_EXCLUSIONS CE ON CE.ACCTNBR=LIS.ACCTNBR +) /*MATCH REQUIREMENTS ON SPEC DOCUMENT*/ +SELECT DISTINCT * +FROM CTE_STAGE S +WHERE S.ACCOUNT IS NOT NULL + AND S.LENDERID IS NOT NULL + AND S.FIRSTNAME IS NOT NULL + AND S.LASTNAME IS NOT NULL + AND S.ADDRESS1 IS NOT NULL + AND S.CITY IS NOT NULL +/*PER KYLE MATHER INCLUDE RECORDS WITHOUT STATE, REJECT ON DEALERTRACK INGEST SIDE*/ + AND S.ZIPCODE IS NOT NULL + AND S.VEHICLEVIN IS NOT NULL + AND S.PRODUCT IS NOT NULL + AND S.NETPAYOFFAMOUNT IS NOT NULL + AND S.GOODUNTILDATE IS NOT NULL + AND S.MATURITYDATE IS NOT NULL +/*PER KYLE MATHER INCLUDE LOANS WITH MOB INSURANCE AND/OR DEBT PROTECTION*/ \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationByNameLikeCount.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationByNameLikeCount.sql new file mode 100644 index 0000000..fcaec42 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationByNameLikeCount.sql @@ -0,0 +1,3 @@ +SELECT COUNT(1) +FROM OSIBANK.ORG +WHERE LOWER(ORGNAME) LIKE '%' || :organizationName || '%' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationNumberByNameLikeQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationNumberByNameLikeQuery.sql new file mode 100644 index 0000000..00c97b1 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Organization/OrganizationNumberByNameLikeQuery.sql @@ -0,0 +1,4 @@ +SELECT ORGNBR +FROM OSIBANK.ORG +WHERE LOWER(ORGNAME) LIKE '%' || :organizationName || '%' + AND ROWNUM <= :limit \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/GetPersonsForCheckHoldsUpdate.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/GetPersonsForCheckHoldsUpdate.sql new file mode 100644 index 0000000..f8f47f4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/GetPersonsForCheckHoldsUpdate.sql @@ -0,0 +1,184 @@ +With CTE_ActiveAccounts As + ( + Select PE.persnbr + ,ar.AcctNbr As "OldestRoleActiveAccount" + ,ar.EFFDATETIME As "OldestRoleActiveDate" + ,at.ACCTNBR As "OldestTaxActiveAccount" + ,at.EFFDATETIME As "OldestTaxAccountDate" + from pers PE + left join + ( + Select A.AcctNbr, ASH.EffDateTime, A.taxrptforpersnbr, row_number() over (partition by A.taxrptforpersnbr order by ASH.EffDateTime asc) rowTaxActive + from ACCT A Inner Join ACCTACCTSTATHIST ASH ON A.ACCTNBR = ASH.ACCTNBR + Where A.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And A.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND NOT EXISTS (select null from ACCTACCTSTATHIST OTA Where OTA.Acctstatcd IN ('CLS', 'CO') and OTA.ACCTNBR = A.Acctnbr) + And A.CURRACCTSTATCD NOT IN ('CLS', 'CWB', 'CO') + And ASH.ACCTSTATCD IN ('ACT','DORM','IACT') + ) at on at.taxrptforpersnbr = PE.persnbr And rowTaxActive = 1 + + left join + ( + Select AC.AcctNbr, ASH.EffDateTime, ARP.persnbr, row_number() over (partition by ARP.persnbr order by ASH.EffDateTime asc) rowRoleActive + from ACCTACCTROLEPERS ARP Join ACCT AC on AC.acctnbr = ARP.acctnbr + Join ACCTACCTSTATHIST ASH ON ASH.ACCTNBR = ARP.ACCTNBR + Where AC.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And AC.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND NOT EXISTS (select null from ACCTACCTSTATHIST ORA Where ORA.Acctstatcd IN ('CLS', 'CO') and ORA.ACCTNBR = AC.Acctnbr) + And AC.CURRACCTSTATCD NOT IN ('CLS', 'CWB', 'CO') + And ASH.ACCTSTATCD IN ('ACT','DORM','IACT') + And ARP.ACCTROLECD IN ('OWN','SIGN','POA') + ) ar on PE.persnbr = ar.persnbr And rowRoleActive = 1 + ), + +CTE_ActiveClosedAccounts As +( + +Select PE.persnbr as "PersonNumber", +PUF.Value as "ValueSet", +PUF.DateLastMaint, +PUF.valueLastUpdatedDate + ,Case + When PUF.valueLastUpdatedDate IS NOT NULL Then 1 Else 0 End As "UserFieldExists" + ,Case + When (ract.AcctNbr IS NOT NULL and aac."OldestTaxActiveAccount" IS NULL) Then ract.EffDateTime + When (racr.AcctNbr IS NOT NULL and aac."OldestRoleActiveAccount" IS NULL) Then racr.EffDateTime + When (cto.AcctNbr IS NOT NULL and aac."OldestTaxActiveAccount" IS NULL) Then cto.EffDateTime + When (cro.AcctNbr IS NOT NULL and aac."OldestRoleActiveAccount" IS NULL) Then cro.EffDateTime + When (aac."OldestRoleActiveDate" IS NULL or aac."OldestTaxAccountDate" IS NULL) Then + COALESCE(aac."OldestRoleActiveDate", aac."OldestTaxAccountDate") Else + LEAST(aac."OldestRoleActiveDate", aac."OldestTaxAccountDate") + End As "OldestActiveEffectiveDate" + + ,Case + When (ct.AcctNbr = ctad.AcctNbr or cr.AcctNbr = crad.AcctNbr) Then Null + When (ct.EffDateTime IS NULL or cr.EffDateTime IS NULL) Then + COALESCE(ct.EffDateTime, cr.EffDateTime) Else + GREATEST(ct.EffDateTime, cr.EffDateTime) + End As "RecentClosedEffectiveDate" + from pers PE + left join CTE_ActiveAccounts aac on aac.PersNbr = PE.persnbr + left join + ( + Select A.AcctNbr, ASH.EffDateTime, A.taxrptforpersnbr, row_number() over (partition by A.taxrptforpersnbr order by ASH.EffDateTime desc) rowTaxClosed + from ACCT A Inner Join ACCTACCTSTATHIST ASH ON A.ACCTNBR = ASH.ACCTNBR + Where A.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And A.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST OTA Where OTA.Acctstatcd IN ('ACT', 'IACT', 'DORM') and OTA.ACCTNBR = A.Acctnbr) + And A.CURRACCTSTATCD IN ('CLS', 'CWB') + ) ct on ct.taxrptforpersnbr = PE.persnbr and rowTaxClosed = 1 and ct.EffDateTime > sysdate - 30 --check if the mostrecentcloseddate account number is less than 30 days old + + left join + ( + Select AC.AcctNbr, ASH.EffDateTime, arp.persnbr, row_number() over (partition by ARP.persnbr order by ASH.EffDateTime desc) rowRoleClosed + from ACCTACCTROLEPERS ARP Join ACCT AC on AC.acctnbr = ARP.acctnbr + Join ACCTACCTSTATHIST ASH ON ASH.ACCTNBR = ARP.ACCTNBR + Where AC.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And AC.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST ORA Where ORA.Acctstatcd IN ('ACT', 'IACT', 'DORM') and ORA.ACCTNBR = AC.Acctnbr ) + And AC.CURRACCTSTATCD IN ('CLS', 'CWB') and ARP.ACCTROLECD IN ('OWN','SIGN','POA') + ) cr on PE.persnbr = cr.persnbr and rowRoleClosed = 1 and cr.EffDateTime > sysdate - 30 --check if the mostrecentcloseddate account number is less than 30 days old + + left join + ( + Select A.AcctNbr, ASH.EffDateTime, A.taxrptforpersnbr, row_number() over (partition by A.taxrptforpersnbr order by ASH.EffDateTime desc) rowTaxClosedOldReactivated + from ACCT A Inner Join ACCTACCTSTATHIST ASH ON A.ACCTNBR = ASH.ACCTNBR + Where A.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And A.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST CRA Where CRA.Acctstatcd IN ('CLS', 'CWB') and CRA.ACCTNBR = A.Acctnbr and CRA.EffDateTime < sysdate - 30) + And A.CURRACCTSTATCD IN ('ACT', 'IACT', 'DORM') + ) cto on cto.taxrptforpersnbr = PE.persnbr and rowTaxClosedOldReactivated = 1 and cto.EffDateTime > sysdate - 30 --check to see if account was reopened after being closed more than 30 days + + left join + ( + Select AC.AcctNbr, ASH.EffDateTime, arp.persnbr, row_number() over (partition by ARP.persnbr order by ASH.EffDateTime desc) rowRoleClosedOldReactivated + from ACCTACCTROLEPERS ARP Join ACCT AC on AC.acctnbr = ARP.acctnbr + Join ACCTACCTSTATHIST ASH ON ASH.ACCTNBR = ARP.ACCTNBR + Where AC.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And AC.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST CRRA Where CRRA.Acctstatcd IN ('CLS', 'CWB') and CRRA.ACCTNBR = AC.Acctnbr and CRRA.EffDateTime < sysdate - 30) + And AC.CURRACCTSTATCD IN ('ACT', 'DORM', 'IACT') + And ARP.ACCTROLECD IN ('OWN','SIGN','POA') + ) cro on PE.persnbr = cro.persnbr and rowRoleClosedOldReactivated = 1 and cro.EffDateTime > sysdate - 30 --check to see if account was reopened after being closed more than 30 days + + left join + ( + Select A.AcctNbr, ASH.EffDateTime, A.taxrptforpersnbr, A.CURRACCTSTATCD from ACCT A Inner Join ACCTACCTSTATHIST ASH ON A.ACCTNBR = ASH.ACCTNBR + Where A.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And A.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + And (ASH.ACCTSTATCD = 'ACT' Or ASH.ACCTSTATCD = 'DORM' Or ASH.ACCTSTATCD = 'IACT')) ctad on Pe.Persnbr = ctad.taxrptforpersnbr + And ct.AcctNbr = ctad.AcctNbr + And ctad.EffDateTime > sysdate - 30 --check if mostrecentclosed date has opened in last 30 days + + left join + ( + Select A.AcctNbr, ASH.EffDateTime, A.taxrptforpersnbr, row_number() over (partition by A.taxrptforpersnbr order by ASH.EffDateTime asc) rowTaxClosedNewReactivated + from ACCT A Inner Join ACCTACCTSTATHIST ASH ON A.ACCTNBR = ASH.ACCTNBR + Where A.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And A.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST CRA Where CRA.Acctstatcd IN ('CLS', 'CWB') and CRA.ACCTNBR = A.Acctnbr and CRA.EffDateTime > sysdate - 30) + AND EXISTS (select null from ACCTACCTSTATHIST CRA Where CRA.Acctstatcd IN ('ACT', 'IACT', 'DORM') and CRA.ACCTNBR = A.Acctnbr and CRA.EffDateTime > sysdate - 30) + And A.CURRACCTSTATCD IN ('ACT', 'IACT', 'DORM') + ) ract on ract.taxrptforpersnbr = PE.persnbr and rowTaxClosedNewReactivated = 1 and ract.EffDateTime < sysdate - 30 + --check if most recent reactivated tax account has closed and reopened in last 30 days take the oldest active date before that + + left join + ( + Select AC.AcctNbr, ASH.EffDateTime, ARP.persnbr from ACCTACCTROLEPERS ARP Inner Join ACCT AC on AC.acctnbr = ARP.acctnbr + Inner Join ACCTACCTSTATHIST ASH ON ASH.ACCTNBR = ARP.ACCTNBR + Where AC.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And AC.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + And ASH.ACCTSTATCD IN ('ACT','DORM','IACT') + And ARP.ACCTROLECD IN ('OWN','SIGN','POA')) crad on Pe.Persnbr = crad.persnbr + And cr.AcctNbr = crad.AcctNbr + And crad.EffDateTime > sysdate - 30 --check if mostrecentclosed date has opened in last 30 days + + left join + ( + Select AC.AcctNbr, ASH.EffDateTime, arp.persnbr, row_number() over (partition by ARP.persnbr order by ASH.EffDateTime asc) rowRoleClosedNewReactivated + from ACCTACCTROLEPERS ARP Join ACCT AC on AC.acctnbr = ARP.acctnbr + Join ACCTACCTSTATHIST ASH ON ASH.ACCTNBR = ARP.ACCTNBR + Where AC.MJACCTTYPCD NOT IN ('EXT', 'RR', 'GL', 'RTMT') + And AC.CURRMIACCTTYPCD NOT IN ('BAT', 'CASH', 'CLRA', 'DLR', 'GL','SDB') + AND EXISTS (select null from ACCTACCTSTATHIST CRRA Where CRRA.Acctstatcd IN ('CLS', 'CWB') and CRRA.ACCTNBR = AC.Acctnbr and CRRA.EffDateTime > sysdate - 30) + AND EXISTS (select null from ACCTACCTSTATHIST CRRA Where CRRA.Acctstatcd IN ('ACT', 'IACT', 'DORM') and CRRA.ACCTNBR = AC.Acctnbr and CRRA.EffDateTime > sysdate - 30) + And AC.CURRACCTSTATCD IN ('ACT', 'DORM', 'IACT') + And ARP.ACCTROLECD IN ('OWN','SIGN','POA') + ) racr on PE.persnbr = racr.persnbr and rowRoleClosedNewReactivated = 1 and racr.EffDateTime < sysdate - 30 + --check if most recent reactivated role account has closed and reopened in last 30 days take the oldest active date before that + +left join (Select value, valueLastUpdatedDate, persnbr, DateLastMaint from PERSUSERFIELD Where userfieldCD = 'MBRH') PUF on PUF.persnbr = ct.taxrptforpersnbr or PUF.persnbr = cr.persnbr or PUF.persnbr = aac.PersNbr +inner join (Select persnbr, purgeyn from pers where purgeyn = 'N') PUR on PUR.persnbr = PE.persnbr + + --option to reset all of them if so don't run this or pass in a date +Where PUR.purgeyn = 'N' +and (PUF.DateLastMaint > TO_TIMESTAMP(:ResetStartDate, 'MM-DD-YY HH24:MI:SS') and PUF.DateLastMaint < TO_TIMESTAMP(:ResetEndDate, 'MM-DD-YY HH24:MI:SS')) + or PUF.valueLastUpdatedDate Is Null + or PUF.DateLastMaint < cr.EffDateTime + or PUF.DateLastMaint < aac."OldestTaxAccountDate" + or PUF.DateLastMaint < aac."OldestRoleActiveDate" + or PUF.DateLastMaint < ct.EffDateTime + +--The oldest active or most recent closed is greater than valuelastupdatedate indicating a recent change in account status OR +--ValuelastUpdatedate is less than or equal to passed in as current date. This should ensure if a cleanup fails we are not just relying on the value last update date one day prior to today. +--A non existant ValuelastUpdatedate is considered to be selected and added as a user value. +) +Select * from CTE_ActiveClosedAccounts where "PersonNumber" != 5775 + and "UserFieldExists" = 0 +Union +Select * from CTE_ActiveClosedAccounts where "PersonNumber" != 5775 + and "UserFieldExists" = 1 + and "OldestActiveEffectiveDate" < sysdate - 30 + and "ValueSet" = 'Y' +Union +Select * from CTE_ActiveClosedAccounts where "PersonNumber" != 5775 + and "UserFieldExists" = 1 + and "RecentClosedEffectiveDate" is null + and "OldestActiveEffectiveDate" > sysdate - 30 + and "ValueSet" = 'N' +Union +Select * from CTE_ActiveClosedAccounts where "PersonNumber" != 5775 + and "UserFieldExists" = 1 + and "RecentClosedEffectiveDate" < sysdate - 30 + and "OldestActiveEffectiveDate" is null + and "ValueSet" = 'N' diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonByNameLikeCount.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonByNameLikeCount.sql new file mode 100644 index 0000000..a862201 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonByNameLikeCount.sql @@ -0,0 +1,5 @@ +SELECT COUNT(1) +FROM OSIBANK.PERS +WHERE (LOWER(FIRSTNAME) LIKE '%' || :firstName || '%' OR :firstName IS NULL) + AND (LOWER(MDLNAME) LIKE '%' || :middleName || '%' OR :middleName IS NULL) + AND (LOWER(LASTNAME) LIKE '%' || :lastName || '%' OR :lastName IS NULL) \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonNumberByNameLikeQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonNumberByNameLikeQuery.sql new file mode 100644 index 0000000..c49dc90 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Person/PersonNumberByNameLikeQuery.sql @@ -0,0 +1,6 @@ +SELECT PERSNBR +FROM OSIBANK.PERS +WHERE (LOWER(FIRSTNAME) LIKE '%' || :firstName || '%' OR :firstName IS NULL) + AND (LOWER(MDLNAME) LIKE '%' || :middleName || '%' OR :middleName IS NULL) + AND (LOWER(LASTNAME) LIKE '%' || :lastName || '%' OR :lastName IS NULL) + AND ROWNUM <= :limit \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/QueApplParamQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/QueApplParamQuery.sql new file mode 100644 index 0000000..27198c5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/QueApplParamQuery.sql @@ -0,0 +1,10 @@ +SELECT q.QUENBR AS QueueNumber, + q.ApplNbr AS ApplicationNumber, + q.ParameterCd AS ParameterCode, + q.ParameterValue AS ParameterValue, + q.DateLastMaint AS DateLastMaint +FROM QUEAPPLPARAM q +INNER JOIN que ON que.quenbr = q.quenbr +WHERE q.APPLNBR in ({ApplicationNumbersHolder}) +AND que.EffDate = TO_TIMESTAMP(:EffectiveDate, 'YYYY-MM-DD HH24:MI:SS') +ORDER BY q.QUENBR DESC \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Saf/GetAllSafUserInfo.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Saf/GetAllSafUserInfo.sql new file mode 100644 index 0000000..1019fd6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Saf/GetAllSafUserInfo.sql @@ -0,0 +1,18 @@ +/* + Query to map SAF UserIDs to a known Core Person and Employee + */ +SELECT + pers.USERID AS SafUserId, + prod.PERSNBR AS SafPersNbr, + prod.PRODPERSID AS CorePersNbr, + addr.TEXT AS EmployeeEmail +FROM + SAF.PERSUSER pers + JOIN SAF.PERSPROD prod ON + pers.PERSNBR = PROD.PERSNBR + AND prod.PRODNBR = '3' + JOIN OSIBANK.PERSADDRUSE paddr ON + prod.PRODPERSID = PADDR.PERSNBR + JOIN OSIBANK.ADDRLINE addr ON + paddr.ADDRNBR = addr.ADDRNBR + AND paddr.ADDRUSECD = 'EMPE' \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetExternalDescriptionsWithSSNQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetExternalDescriptionsWithSSNQuery.sql new file mode 100644 index 0000000..1de3ee8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetExternalDescriptionsWithSSNQuery.sql @@ -0,0 +1,8 @@ +select * +from (SELECT EXTRTXNDESCNBR AS ExternalDescriptionNumber, + EXTRTXNDESCTEXT AS ExternalDescriptionText, +DATELASTMAINT AS DateLastMaintained +FROM osibank.EXTRTXNDESC +WHERE EXTRTXNDESCTEXT LIKE '%State of Wisc - SSI%' +AND EXTRTXNDESCTEXT NOT LIKE '%*XXXXX%') t +where length(regexp_substr(t.externaldescriptiontext, '\*[0-9]{9}\*')) > 0 \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetTransactionsByDateSpanQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetTransactionsByDateSpanQuery.sql new file mode 100644 index 0000000..e05ac56 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/GetTransactionsByDateSpanQuery.sql @@ -0,0 +1,48 @@ +WITH ABC AS ( +SELECT +to_date(:startDateTime, 'YYYY-MM-DD HH24:MI:SS') AS start_date, +to_date(:endDateTime, 'YYYY-MM-DD HH24:MI:SS') AS end_date +FROM DUAL +), Transactions AS ( +SELECT r2.ACCTNBR, r2.RTXNNBR, r2.POSTDATE, r.TRANAMT, r.CHECKNBR, r.EXTRTXNDESCNBR, r.INTRRTXNDESCNBR, r.CURRRTXNSTATCD, r.RTXNTYPCD +FROM osibank.RTXNSTATHIST r2 +INNER JOIN osibank.rtxn r ON R.ACCTNBR = R2.ACCTNBR AND R.RTXNNBR = R2.RTXNNBR +INNER JOIN ABC D ON r2.ACTDATETIME > D.start_date and r2.ACTDATETIME <= D.end_date +WHERE r.TRANAMT != 0 AND ({RtxnTypCdQueryVerifyHolder} IS NULL OR {RtxnTypCdQueryVerifyHolder} = '' OR r.RTXNTYPCD NOT IN ({RtxnTypCdQueryParamHolder})) +), AccountSubAccounts AS ( +SELECT ASA.ACCTNBR, ASA.SUBACCTNBR +FROM OSIBANK.AcctSubAcct ASA +WHERE ASA.BalCatCd = 'NOTE' AND ASA.BalTypCd = 'BAL' +AND EXISTS (SELECT 1 FROM Transactions T WHERE T.ACCTNBR = ASA.ACCTNBR) +), MostRecentAccountBalanceHistory AS ( +SELECT ABH.ACCTNBR, + ABH.BALAMT +FROM AccountSubAccounts ASA +INNER JOIN OSIBANK.ACCTBALHIST ABH ON ASA.ACCTNBR=ABH.ACCTNBR AND ASA.SubAcctNbr = ABH.SubAcctNbr AND ABH.EFFDATE = + (SELECT MAX(D.EffDate) AS MA + FROM OSIBANK.AcctBalHist D + INNER JOIN AccountSubAccounts ASA ON ASA.ACCTNBR=D.ACCTNBR AND ASA.SUBACCTNBR = D.SUBACCTNBR + INNER JOIN ABC A ON D.EFFDATE <= A.end_date + WHERE D.AcctNbr = abh.AcctNbr + AND D.SubAcctNbr = abh.SubAcctNbr + ) +) +SELECT T.ACCTNBR as AccountNumber, + T.RTXNNBR as TransactionNumber, + e.EXTRTXNDESCTEXT as ExternalTransactionDescription, + i.INTRTXNDESCTEXT as InternalTransactionDescription, + T.TRANAMT as Amount, + T.POSTDATE as PostingDate, + T.RTXNTYPCD as TransactionCode, + abh.BALAMT as CurrentBalance, + T.CHECKNBR as CheckNumber, + rs.RTXNSTATDESC as CurrRtxnStatCd, + r3.RTXNTYPDESC AS TransactionTypeDescription, + CASE WHEN T.TRANAMT > 0 THEN 'C' ELSE 'D' END as DebitCredit +-- SELECT COUNT(1) +FROM Transactions T +INNER JOIN osibank.RTXNSTAT rs ON rs.RTXNSTATCD = T.CURRRTXNSTATCD +INNER JOIN osibank.RTXNTYP r3 ON r3.RTXNTYPCD = T.RTXNTYPCD +INNER JOIN MostRecentAccountBalanceHistory ABH ON ABH.ACCTNBR = T.ACCTNBR +LEFT JOIN osibank.EXTRTXNDESC e ON T.EXTRTXNDESCNBR = e.EXTRTXNDESCNBR +LEFT JOIN osibank.INTRTXNDESC i ON T.INTRRTXNDESCNBR = i.INTRTXNDESCNBR \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/UpdateExternalDescriptionQuery.sql b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/UpdateExternalDescriptionQuery.sql new file mode 100644 index 0000000..1577a26 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Queries/Transaction/UpdateExternalDescriptionQuery.sql @@ -0,0 +1,4 @@ +UPDATE osibank.EXTRTXNDESC +SET Extrtxndesctext = :externaldescriptiontext, + DATELASTMAINT = SYSDATE +WHERE Extrtxndescnbr = :externaldescriptionnumber \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/HttpUtilities.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/HttpUtilities.cs new file mode 100644 index 0000000..1d73a2b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/HttpUtilities.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using Newtonsoft.Json; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Utilities +{ + public static class HttpUtilities + { + private const int ParamCounterDefault = 1; + + public static HttpClient GetClient(Uri uri) + { + var handler = new HttpClientHandler + { + SslProtocols = System.Security.Authentication.SslProtocols.Tls12 | + System.Security.Authentication.SslProtocols.Tls11 | + System.Security.Authentication.SslProtocols.Tls, + ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => true + }; + + var httpClient = new HttpClient(handler) + { + Timeout = TimeSpan.FromSeconds(60), + BaseAddress = uri + }; + return httpClient; + } + + public static Uri BuildHttpsUri(string hostName, string endpoint) + { + return new Uri($"https://{hostName}{endpoint}"); + } + + public static string BuildEndPointWithParams(string endpoint, Dictionary parameters) + { + if(parameters == null || parameters.Count < 0) + { + return endpoint; + } + + var counter = ParamCounterDefault; + foreach (var key in parameters.Keys) + { + var splitter = counter == ParamCounterDefault ? "?" : "&"; + endpoint = $"{endpoint}{splitter}{key}={parameters[key]}"; + counter++; + } + + return endpoint; + } + + public static string ReplaceRootParameter(string endpoint, string placeholder, string value) + { + return endpoint.Replace(placeholder, value); + } + + public static Dictionary BuildDictionaryOfNonNullValues(T model) + { + var bodyParams = new Dictionary(); + var modelType = typeof(T); + var properties = modelType.GetProperties(); + + foreach (var property in properties) + { + var fieldValue = model.GetType().GetProperty(property.Name).GetValue(model, null); + if (fieldValue != null) + { + bodyParams.Add(property.Name, fieldValue.ToString()); + } + } + + return bodyParams; + } + + public static string BuildJsonOfNonNullProperties(T model) + { + var bodyParams = BuildDictionaryOfNonNullValues(model); + + if (bodyParams.Count <= 0) + { + return ""; + } + + return JsonConvert.SerializeObject(bodyParams); + } + + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/QueryUtilities.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/QueryUtilities.cs new file mode 100644 index 0000000..0b86b91 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperLib/Utilities/QueryUtilities.cs @@ -0,0 +1,57 @@ +using Serilog; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Dynamic; + +namespace LCU.Library.Internal.CoreApiWrapperLib.Utilities +{ + public static class QueryUtilities + { + private const string QueryFolder = "Queries"; + private const string DynamicParamater = "param"; + + public static string GetQuery(string queryFileName) + { + var basePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory); + var path = $"{basePath}//{QueryFolder}//{queryFileName}.sql"; + + if (!File.Exists(path)) + { + Log.Error($"Query was not found at location {path}"); + return ""; + } + + var query = File.ReadAllText(path); + return query; + } + + public static string BuildParameterListString(List values) + { + var bindListBuilder = new StringBuilder(); + for (int currentCount = 0; currentCount < values.Count; ++currentCount) + { + var comma = ""; + if (currentCount != 0) + { + comma = ","; + } + + bindListBuilder.Append($"{comma}:{DynamicParamater}{currentCount}"); + } + + return bindListBuilder.ToString(); + } + + public static Dictionary BuildDictionaryParameter(List values) + { + var parameterDictionary = new Dictionary(); + for (int currentCount = 0; currentCount < values.Count; ++currentCount) + { + parameterDictionary.Add($"{DynamicParamater}{currentCount}", values[currentCount]); + } + return parameterDictionary; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountRoleConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountRoleConstants.cs new file mode 100644 index 0000000..b197bfd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountRoleConstants.cs @@ -0,0 +1,12 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + public static class AccountRoleConstants + { + //Core Account Roles + public const string LoanOfficer = "Loan Officer"; + + //Account Roles + public const string Borrower = "Borrower"; + public const string CoBorrower = "Co-Borrower"; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountStatusConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountStatusConstants.cs new file mode 100644 index 0000000..58fbb1a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AccountStatusConstants.cs @@ -0,0 +1,16 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + public static class AccountStatusConstants + { + //Core Account Status + public const string CoreClosedAccount = "Closed"; + public const string CoreActiveAccount = "Active"; + public const string CoreChargeOffAccount = "Chargeoff"; + + //Business Statuses + public const string ClosedStatus = "Closed"; + public const string OpenStatus = "Open"; + public const string WrittenOffStatus = "Written Off"; + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AddressConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AddressConstants.cs new file mode 100644 index 0000000..36de41e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/AddressConstants.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + public static class AddressConstants + { + //Country constants + public const string CountryUSA = "USA"; + public const string CountryUS = "US"; + + //Descriptions, Types, and Codes + public const string AddressUseDescriptionPrimary = "Primary"; + public const string HomeType = "Home"; + public const string PrimaryUseCode = "PRI"; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestIncludeConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestIncludeConstants.cs new file mode 100644 index 0000000..5c4aae4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestIncludeConstants.cs @@ -0,0 +1,46 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + // Pulled from the DNA swagger page. + public class RequestIncludeConstants + { + public const string AccountAgreements = "AccountAgreements"; + public const string AccountAndUserFieldInfo = "AccountAndUserFieldInfo"; + public const string AccountRolesInformation = "AccountRolesInformation"; + public const string AccountsByAgreement = "AccountsByAgreement"; + public const string AccessTypes = "AccessTypes"; + public const string AllAddresses = "AllAddresses"; + public const string Balances = "Balances"; + public const string Collateral = "Collateral"; + public const string Create = "Create"; + public const string CtrInformation = "CtrInformation"; + public const string EmailAddresses = "EmailAddresses"; + public const string EntityAttributes = "EntityAttributes"; + public const string EntityDocument = "EntityDocument"; + public const string ExternalOrganizationInformation = "ExternalOrganizationInformation"; + public const string Graph = "Graph"; + public const string Minimum = "Minimum"; + public const string OrgRelationships = "OrgRelationships"; + public const string PersonAddresses = "PersonAddresses"; + public const string PersonAndUserFieldInfo = "PersonAndUserFieldInfo"; + public const string PersonIds = "PersonIds"; + public const string PersonInfo = "PersonInfo"; + public const string PersonPhonesCard = "PersonPhonesCard"; + public const string PersonProfileCard = "PersonProfileCard"; + public const string PersonTypes = "PersonTypes"; + public const string PostalAddresses = "PostalAddresses"; + public const string Search = "Search"; + public const string Standard = "Standard"; + public const string TheLoanAccount = "TheLoanAccount"; + public const string Update = "Update"; + public const string ValRule = "ValRule"; + public const string PersonAddressInformation = "PersonAddressInformation"; + public const string AccountBalanceInformation = "AccountBalanceInformation"; + public const string Basic = "Basic"; + public const string SpecialIncludesCharacter = "^"; + + public static string AddSpecialIncludesCharacter(string input) + { + return SpecialIncludesCharacter + input; + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestRootParameters.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestRootParameters.cs new file mode 100644 index 0000000..5109db0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/RequestRootParameters.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + public class RequestRootParameters + { + public const string AccountId = "{AccountId}"; + public const string AccessChannelPersonId = "{AccessChannelPersonId}"; + public const string AccessTypeId = "{AccessTypeId}"; + public const string PostalAddressId = "{PostalAddressId}"; + public const string PersonId = "{PersonId}"; + public const string PropertyNumber = "{PropertyId}"; + public const string UserFieldId = "{UserFieldId}"; + public const string AddressUseCode = "{AddressUseCode}"; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/TransactionConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/TransactionConstants.cs new file mode 100644 index 0000000..9edd7d7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/TransactionConstants.cs @@ -0,0 +1,18 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + public class TransactionConstants + { + public const string RegularPaymentDescription = "Regular Payment"; + public const string TotalDescription = "Total"; + public const string LoanAdvanceType = "LOAN ADVANCE"; + public const string LoanPaymentTransferType = "LOAN PAYMENT-TRANSFER"; + + //Transaction Request Parameters + public const string OnlyCompletedYN = "Y"; + public const int SearchDateOption = 1; + + public const string RtxnTypeCodeString = "'{param}'"; + public const string RtxnTypCdReplaceConstant = "{param}"; + public const string RtxnTypCdEmptyValue = "''"; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/VehicleCodeConstants.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/VehicleCodeConstants.cs new file mode 100644 index 0000000..8d40951 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Constants/VehicleCodeConstants.cs @@ -0,0 +1,25 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Constants +{ + // These are pulled from The DNA database "select * from proptyp". + // There is no type of vehicle so judgement had to be done to determin that property is a vehicle. + public class VehicleCodeConstants + { + public static readonly string[] VehicleCodes = { AutomobileNew, AutomobileUsed, XBoat, MobileHome, + RecreationalVehicle, XPowersports, XMotorcycle, MotorcycleUsed, + PowersportsNew, BoatNew, PowersportsUsed, MotorcycleNew, BoatUsed}; + + public const string AutomobileNew = "AUTN"; + public const string AutomobileUsed = "AUTU"; + public const string XBoat = "BOAT"; + public const string MobileHome = "MOBL"; + public const string RecreationalVehicle = "RV"; + public const string XPowersports = "POWE"; + public const string XMotorcycle = "MOTO"; + public const string MotorcycleUsed = "MTRU"; + public const string PowersportsNew = "PWRN"; + public const string BoatNew = "BOTN"; + public const string PowersportsUsed = "PWRU"; + public const string MotorcycleNew = "MTRN"; + public const string BoatUsed = "BOTU"; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessChannelPersons/AccessChannelPerson.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessChannelPersons/AccessChannelPerson.cs new file mode 100644 index 0000000..44b7715 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessChannelPersons/AccessChannelPerson.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessChannelPersons +{ + public class AccessChannelPerson + { + private string _id; + + public string Id + { + get + { + return _id ?? $"{ChannelNumber}_{PersonNumber}"; + } + set + { + _id = value ?? $"{ChannelNumber}_{PersonNumber}"; + } + } + public int ChannelNumber { get; set; } + public int PersonNumber { get; set; } + public bool IsActive { get; set; } + public string NameFML { get; set; } + public string NameLFM { get; set; } + public DateTime LastMaintained { get; set; } + public string UserId { get; set; } + public bool IsPasswordChangeRequiredOnNextLogin { get; set; } + public bool IsPinChangeRequiredOnNextLogin { get; set; } + public List AccessTypes { get; set; } + public string Uid { get; set; } + public string Origin { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessTypes/AccessType.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessTypes/AccessType.cs new file mode 100644 index 0000000..184909a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/AccessTypes/AccessType.cs @@ -0,0 +1,18 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes +{ + public class AccessType + { + public string Id { get; set; } + public int ChannelNumber { get; set; } + public int PersonNumber { get; set; } + public string AccessTypeCode { get; set; } + public string AccessTypeDescription { get; set; } + public bool IsEnrolled { get; set; } + public string UserId { get; set; } + public bool IsPasswordChangeRequiredOnNextLogin { get; set; } + public bool IsDisclaimer { get; set; } + public bool IsActive { get; set; } + public string Uid { get; set; } + public string Origin { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/Account.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/Account.cs new file mode 100644 index 0000000..e4e8b6d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/Account.cs @@ -0,0 +1,134 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Collaterals; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Loans; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties; +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class Account + { + public string AbbreviatedAccountNumber { get; set; } + public long AccountNumber { get; set; } + public List AccountRolesInfo { get; set; } + public int ActiveClassNumber { get; set; } + public string AddressFormatCode { get; set; } + public string AddressUseDescription { get; set; } + //public List AgreementPersons { get; set; } + //public List AllowedTransactions { get; set; } + public string AlternateDisplayName { get; set; } + public int AssignedNumber { get; set; } + public decimal AvailableBalance { get; set; } + public decimal Balance { get; set; } + //public List BalanceDefinitions { get; set; } + public string BranchName { get; set; } + public int BranchNumber { get; set; } + //public CheckingSummaryInfo CheckingSummaryInfo { get; set; } + public string CloseReasonCode { get; set; } + public List Collaterals { get; set; } + //public CommercialLoanSummaryInfo CommercialLoanSummaryInfo { get; set; } + //public ConsumerLoanSummaryInfo ConsumerLoanSummaryInfo { get; set; } + public string ContractDate { get; set; } + public string CurrencyCode { get; set; } + public string CurrencyDescription { get; set; } + public string CurrentAccountStatusCode { get; set; } + public DateTime CurrentAccountStatusDateTime { get; set; } + public string CurrentAccountStatusDescription { get; set; } + public string CurrentProductCode { get; set; } + public int CurrentTerm { get; set; } + public string DateConverted { get; set; } + public DateTime DateLastContact { get; set; } + public string DateMaturity { get; set; } + //public List Dates { get; set; } + public string Description { get; set; } + public string DisplayName { get; set; } + //public List EntityAttributeHistory { get; set; } + public string EscheatDate { get; set; } + //public ExternalAccountSummaryInfo ExternalAccountSummaryInfo { get; set; } + //public ExternalEntity ExternalEntity { get; set; } + public int HoldAccountBalanceNumber { get; set; } + public long HoldAccountNumber { get; set; } + //public List HsaEvents { get; set; } + public string HsaSource { get; set; } + public string Id { get; set; } + public int InstitutionNumber { get; set; } + public bool IsAnalysis { get; set; } + public bool IsChecks { get; set; } + public bool IsCreditCardAccount { get; set; } + public bool IsDraw { get; set; } + public bool IsEmployeeAccount { get; set; } + public bool IsEscheat { get; set; } + public bool IsLeaseSecurity { get; set; } + public bool IsPassbook { get; set; } + public bool IsPositivePayment { get; set; } + public bool IsReport1098 { get; set; } + public bool IsReportingForOwner { get; set; } + public bool IsReportingForSigner { get; set; } + public bool IsReportPoints { get; set; } + public bool IsRetirement { get; set; } + public bool IsShare { get; set; } + public bool IsStatement { get; set; } + public bool IsTransaction { get; set; } + public bool IsUsersAccount { get; set; } + public bool IsValid { get; set; } + public DateTime LastMaintained { get; set; } + public string LastTransactionPurgeToDate { get; set; } + public LoanInfo LoanInfo { get; set; } + //public List LoanLimitHistory { get; set; } + public string MailAddressUseCode { get; set; } + public string MailTypeCode { get; set; } + public string MaskedExternalAccountNumber { get; set; } + //public MasterlineAccountSummaryInfo MasterlineAccountSummaryInfo { get; set; } + //public List MasterProperties { get; set; } + //public int MaximumOverdraftLimit { get; set; } + public long MemberAgreementNumber { get; set; } + //public List MemoBalanceTypes { get; set; } + //public MortgageLoanSummaryInfo MortgageLoanSummaryInfo { get; set; } + public string NcuaCategoryCode { get; set; } + public int NextStopPaymentRequestNumber { get; set; } + public string OpenFundSourceCode { get; set; } + public int OriginalTerm { get; set; } + public string OverrideDeliveryMethodCode { get; set; } + public string OverrideDeliveryMethodDescription { get; set; } + public string OwnerCode { get; set; } + public string OwnerDescription { get; set; } + public string OwnerName { get; set; } + public string PaymentFrequency { get; set; } + public string PaymentFrequencyCode { get; set; } + //public List PaymentHistory { get; set; } + public string ProductCategoryCode { get; set; } + public string ProductCategoryDescription { get; set; } + public string ProductCurrencyCd { get; set; } + public string ProductName { get; set; } + //public ProductType ProductType { get; set; } + public string ProductTypeCode { get; set; } + public string ProductTypeDescription { get; set; } + public List Properties { get; set; } + //public List RelatedOrganizations { get; set; } + //public List RelatedPersons { get; set; } + public int ReportingForOrganizationNumber { get; set; } + public int ReportingForPersonNumber { get; set; } + //public List RestrictionAccounts { get; set; } + //public List RestrictionOrganizations { get; set; } + //public List RestrictionPersons { get; set; } + //public List RestrictionsInfo { get; set; } + //public RetirementPlanSummaryInfo RetirementPlanSummaryInfo { get; set; } + //public List RoleOrganizations { get; set; } + //public List RolePersons { get; set; } + //public SavingsSummaryInfo SavingsSummaryInfo { get; set; } + //public SingleAccountODSummaryInfo SingleAccountODSummaryInfo { get; set; } + //public StandardClass StandardClass { get; set; } + public int StandardClassNumber { get; set; } + public long StatementAccountNumber { get; set; } + public int SuffixNumber { get; set; } + public string SuffixNumberProductGroupCode { get; set; } + public string TaxOwnerOrganizationName { get; set; } + public string TaxOwnerPersonName { get; set; } + //public List TaxReportingOverrides { get; set; } + //public TimeDepositSummaryInfo TimeDepositSummaryInfo { get; set; } + public string Uid { get; set; } + public string Url { get; set; } + //public List UserFields { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountOwnership.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountOwnership.cs new file mode 100644 index 0000000..5ff28b8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountOwnership.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class AccountOwnership + { + public long PersonNumber { get; set; } + + public long ByOrgNbr { get; set; } + + public string OrganizationName { get; set; } + + public string FirstName { get; set; } + + public string MiddleInitial { get; set; } + + public string MiddleName { get; set; } + + public string LastName { get; set; } + + public string Suffix { get; set; } + + public string Role { get; set; } + + public bool IsPrimaryOwner { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountRoleInfo.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountRoleInfo.cs new file mode 100644 index 0000000..9005f56 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountRoleInfo.cs @@ -0,0 +1,18 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class AccountRolesInfo + { + public long AccountNumber { get; set; } + public string AccountRoleCode { get; set; } + public string AccountRoleDescription { get; set; } + public bool IsEmployeeRole { get; set; } + public bool IsReportingFor { get; set; } + public bool IsReportingForOwner { get; set; } + public bool IsReportingForSigner { get; set; } + public bool IsTransacting { get; set; } + public int OrganizationNumber { get; set; } + public int PersonNumber { get; set; } + public string RoleName { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountUserField.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountUserField.cs new file mode 100644 index 0000000..11c36bf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountUserField.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class AccountUserField + { + public string Id { get; set; } + public long AccountNumber { get; set; } + public string UserFieldCode { get; set; } + public string Value { get; set; } + public DateTime LastMaintained { get; set; } + public string UserFieldDescription { get; set; } + public string DataTypeCode { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByMajorMinorBranchAndStatusResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByMajorMinorBranchAndStatusResponse.cs new file mode 100644 index 0000000..e39772c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByMajorMinorBranchAndStatusResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class AccountsByMajorMinorBranchAndStatusResponse + { + public long AccountNumber { get; set; } + public long BranchCode { get; set; } + public string Name { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByRecentTransactionsResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByRecentTransactionsResponse.cs new file mode 100644 index 0000000..396b15d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/AccountsByRecentTransactionsResponse.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class AccountsByRecentTransactionsResponse + { + public string AcctNbr { get; set; } + + public DateTime DateLastMaint { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/ActivityAccountDetails.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/ActivityAccountDetails.cs new file mode 100644 index 0000000..f802d74 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/ActivityAccountDetails.cs @@ -0,0 +1,19 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class ActivityAccountDetails + { + public long AccountNumber { get; set; } + public string CurrentAccountStatus { get; set; } + public string TaxPersonNbr { get; set; } + public string TaxOrgNbr { get; set; } + public long BranchOrgNbr { get; set; } + public string MajorAccountType { get; set; } + public string MinorAccountType { get; set; } + public DateTime AccountContractDate { get; set; } + public DateTime? DebtProtectionEffectiveDate { get; set; } + public DateTime? DebtProtectionInactiveDate { get; set; } + public string DebtProtectionCategory { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/MissingSavingsRequirement.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/MissingSavingsRequirement.cs new file mode 100644 index 0000000..ed500a0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Accounts/MissingSavingsRequirement.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations.Schema; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Accounts +{ + public class MissingSavingsRequirement + { + public string? FirstName { get; set; } + public string? LastName { get; set; } + public long? PersonNumber { get; set; } + public long? OrganizationNumber { get; set; } + public string? OrganizationName { get; set; } + public int BranchNumber { get; set; } + public long? AccountNumberMissingFunds { get; set; } + public double? Balance { get; set; } + public long? ControllingPersonNumber { get; set; } + public bool IsControllingPersonAssigned { get; set; } + + [NotMapped] + public bool IsPerson + { + get + { + return PersonNumber != null && + PersonNumber > 0 && + !string.IsNullOrWhiteSpace(FirstName) && + !string.IsNullOrWhiteSpace(LastName); + } + } + + [NotMapped] + public bool IsOrganization + { + get + { + return OrganizationNumber != null && + OrganizationNumber > 0 && + !string.IsNullOrWhiteSpace(OrganizationName); + } + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/ActivityQueryRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/ActivityQueryRequest.cs new file mode 100644 index 0000000..f24f3c7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/ActivityQueryRequest.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class ActivityQueryRequest + { + public List ActivityIds { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/EStatementDeliveryMethod.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/EStatementDeliveryMethod.cs new file mode 100644 index 0000000..6a05a48 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/EStatementDeliveryMethod.cs @@ -0,0 +1,18 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class EStatementDeliveryMethod + { + public long AccountNumber { get; set; } + public long ActivityNumber { get; set; } + public DateTime ActivityDateTime { get; set; } + public string MinorAccountType { get; set; } + public long PersonNumber { get; set; } + public long OrganizationNumber { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string PhoneNumbers { get; set; } + public string EmailAddresses { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewActivityManagerIncentiveReferral.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewActivityManagerIncentiveReferral.cs new file mode 100644 index 0000000..0077cb5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewActivityManagerIncentiveReferral.cs @@ -0,0 +1,41 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class NewActivityManagerIncentiveReferral + { + public long ActivityId {get; set;} + public string OriginatorUserId {get; set;} + public long OriginatorPersNbr {get; set;} + public string OriginatorFirstName {get; set;} + public string OriginatorLastName {get; set;} + public string OriginatorMiddleInitial {get; set;} + //Only populated for CC Balance Transfer Referrals + public long? LandmarkCreditCardNumber { get; set; } + //Only Populated for Direct Deposit Referrals + public long? DirectDepositAccountNumber { get; set; } + public string EmployeeEmail {get; set;} + public DateTime LastUpdatedDateTime {get; set;} + public string Campaign {get; set;} + public string Category {get; set;} + public string ReferralStation {get; set;} + public int IsInitialStation {get; set;} + public int IsFinalStation {get; set;} + public DateTime OriginationDateTime {get; set;} + public DateTime StationDateTime {get; set;} + public string OriginatingBranchName {get; set;} + public string ReferredPersonNbr {get; set;} + public string ReferredOrgNbr {get; set;} + public string ReferredPersonName {get; set;} + public string ReferredOrgName {get; set;} + public string ReferredPersOrgNbr { get; set; } + public string PreferredPhone { get; set; } + public string Comm1 { get; set; } + public string Comm2 { get; set; } + public string Comm3 { get; set; } + public string Comm4 { get; set; } + public string Comm5 { get; set; } + public string Comm6 { get; set; } + public string Comm7 { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewAtmCheckCardActivity.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewAtmCheckCardActivity.cs new file mode 100644 index 0000000..fdc51a8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewAtmCheckCardActivity.cs @@ -0,0 +1,29 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class NewAtmCheckCardActivity + { + public long ActivityNbr { get; set; } + public DateTime ActivityDateTime { get; set; } + public long ResponsiblePersonNbr { get; set; } + public string ActivityTypeCde { get; set; } + public long AgreementNbr { get; set; } + public string CardState { get; set; } + public string CardType { get; set; } + public long AccountNbr { get; set; } + public string OwnerPersonNbr { get; set; } + public string OwnerOrgNbr { get; set; } + public string TaxPersonName { get; set; } + public string TaxOrgName { get; set; } + public string AcctStateAtActivity { get; set; } + public string AcctStatAtQueryTime { get; set; } + public DateTime AcctStateEffDateTime { get; set; } + public string AssociateFirst { get; set; } + public string AssociateMiddleInit { get; set; } + public string AssociateLast { get; set; } + public string EmployeeEmail { get; set; } + public string TaxPersonPhoneNumbers { get; set; } + public string TaxPersonEmailAddresses { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewCheckingAccountActivity.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewCheckingAccountActivity.cs new file mode 100644 index 0000000..f73993d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewCheckingAccountActivity.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class NewCheckingAccountActivity + { + public long ActivityNbr { get; set; } + public DateTime ActivityDateTime { get; set; } + public long ResponsiblePersonNbr { get; set; } + public string ActivityTypeCode { get; set; } + public long SubjectAccountNbr { get; set; } + public string MinorAccountType { get; set; } + public string AssociateFirst { get; set; } + public string AssociateMiddleInit { get; set; } + public string AssociateLast { get; set; } + public string TaxPersonNbr { get; set; } + public string TaxOrgNbr { get; set; } + public string TaxPersonName { get; set; } + public string TaxOrgName { get; set; } + //ACT = active, which is what we want + public string CurrentAccountStatus { get; set; } + public long BranchOrgNbr { get; set; } + public string BranchOrgName { get; set; } + public string EmployeeEmail { get; set; } + public DateTime AccountContractDate { get; set; } + public decimal? OriginalBalance { get; set; } + public string TaxPersonPhoneNumbers { get; set; } + public string TaxPersonEmailAddresses { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewLoanSaleActivity.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewLoanSaleActivity.cs new file mode 100644 index 0000000..4e70954 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Activity/NewLoanSaleActivity.cs @@ -0,0 +1,38 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Activity +{ + public class NewLoanSaleActivity + { + public long ActivityNbr { get; set; } + public DateTime ActivityDateTime { get; set; } + public long SubjectAccountNbr { get; set; } + public long OriginatingPersonNbr { get; set; } + public string ActivityTypeCode { get; set; } + public string MajorAccountType { get; set; } + public string MinorAccountType { get; set; } + public string AssociateFirst { get; set; } + public string AssociateMiddleInit { get; set; } + public string AssociateLast { get; set; } + public string TaxPersonNbr { get; set; } + public string TaxOrgNbr { get; set; } + public string TaxPersonName { get; set; } + public string TaxOrgName { get; set; } + public DateTime AccountContractDate { get; set; } + //ACT = active, Appr = Approve + public string CurrentAccountStatus { get; set; } + public long BranchOrgNbr { get; set; } + public string BranchOrgName { get; set; } + public string EmployeeEmail { get; set; } + //New Or Refi (Refinance) + public string LoanSourceCode { get; set; } + public decimal? LoanAmount { get; set; } + public DateTime? DebtProtectionEffectiveDate { get; set; } + public string DebtProtectionCategory { get; set; } + public DateTime? YoungestBirthdateOnLoan { get; set; } + public int HasOrgRoles { get; set; } + public string TaxPersonPhoneNumbers { get; set; } + public string TaxPersonEmailAddresses { get; set; } + //TODO: Refinance Amount + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/Agreement.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/Agreement.cs new file mode 100644 index 0000000..d5df6ab --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/Agreement.cs @@ -0,0 +1,27 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements +{ + public class Agreement + { + public long AgreementNumber { get; set; } + + public string UserId { get; set; } + + public long PersonNumber { get; set; } + + public long ByOrgNbr { get; set; } + + public string OrganizationName { get; set; } + + public string FirstName { get; set; } + + public string MiddleInitial { get; set; } + + public string MiddleName { get; set; } + + public string LastName { get; set; } + + public string Suffix { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccount.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccount.cs new file mode 100644 index 0000000..4947387 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccount.cs @@ -0,0 +1,22 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements +{ + public class AgreementAccount + { + public long AccountNumber { get; set; } + + public string AccountDescription { get; set; } + + public string MajorAccountTypeCode { get; set; } + + /// Tax report for person number. This value will be used for determining Consumer Account "Ownership" + public long? TaxReportForPersonNumber { get; set; } + + /// Tax report for organization number. This value will be used for determining Organization Account "Ownership" + public long? TaxReportForOrgNumber { get; set; } + + /// Delivery method code for Agreement "WWW" (Electronic) or "PRNT" (Paper). + public string OvrDeliveryMethCD { get; set; } + + public AgreementAccountOwner AccountOwner { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccountOwner.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccountOwner.cs new file mode 100644 index 0000000..fcc36da --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Agreements/AgreementAccountOwner.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Agreements +{ + public class AgreementAccountOwner + { + + public long AccountNumber { get; set; } + + public long AgreementNumber { get; set; } + + public string UserId { get; set; } + + public long PersonNumber { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/ApplicationHistory.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/ApplicationHistory.cs new file mode 100644 index 0000000..5c5d36a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/ApplicationHistory.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories +{ + public class ApplicationHistory + { + public string ApplicationName { get; set; } + public long ApplicationNumber { get; set; } + public long QueueNumber { get; set; } + public DateTime StopDateTime { get; set; } + public DateTime EffectiveDate { get; set; } + public List QueueApplicationParameters { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/QueueApplicationParameter.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/QueueApplicationParameter.cs new file mode 100644 index 0000000..bfde17d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/ApplicationHistories/QueueApplicationParameter.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.ApplicationHistories +{ + public class QueueApplicationParameter + { + public long QueueNumber { get; set; } + public long ApplicationNumber { get; set; } + public string ParameterCode { get; set; } + public string ParameterValue { get; set; } + public DateTime DateLastMaint { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Associate/AssociateDetails.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Associate/AssociateDetails.cs new file mode 100644 index 0000000..5fe8144 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Associate/AssociateDetails.cs @@ -0,0 +1,10 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Associate +{ + public class AssociateDetails + { + public string AssociateName { get; set; } + public bool? ActiveEmployee { get; set; } + public string PersonType { get; set; } + public long PersonNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Branches/Branch.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Branches/Branch.cs new file mode 100644 index 0000000..89d7a9d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Branches/Branch.cs @@ -0,0 +1,20 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Branches +{ + public class Branch + { + public string BranchName { get; set; } + public int BranchNumber { get; set; } + public int CurrentRouteNumber { get; set; } + public string DefaultClearingCategoryCode { get; set; } + public string DefaultFundTypeCode { get; set; } + public string DefaultFundTypeDetailCode { get; set; } + public string Id { get; set; } + public bool IsFinalProofRequired { get; set; } + public bool IsMultipleFinalProof { get; set; } + public bool IsT5sBypass { get; set; } + public int TransitCheckCashFlatFee { get; set; } + public int TransitCheckCashPercentFee { get; set; } + public string Uid { get; set; } + public string Url { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Collaterals/Collateral.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Collaterals/Collateral.cs new file mode 100644 index 0000000..9b59560 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Collaterals/Collateral.cs @@ -0,0 +1,19 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Collaterals +{ + public class Collateral + { + public long AccountNumber { get; set; } + public string EffectiveDate { get; set; } + public decimal HoldAmount { get; set; } + public decimal HoldPercent { get; set; } + public string Id { get; set; } + public string InactiveDate { get; set; } + public DateTime LastMaintained { get; set; } + public long LoanAccountNumber { get; set; } + public int SequenceNumber { get; set; } + public string Uid { get; set; } + public string Url { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreApiMessage.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreApiMessage.cs new file mode 100644 index 0000000..b4eebee --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreApiMessage.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels +{ + public class CoreApiMessage + { + public CoreApiMessage(CoreMessageHeader coreMessageHeader, T messageBody) + { + MessageHeader = coreMessageHeader; + MessageBody = messageBody; + } + + public CoreMessageHeader MessageHeader { get; set; } + public T MessageBody { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreMessageHeader.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreMessageHeader.cs new file mode 100644 index 0000000..f5423db --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreMessageHeader.cs @@ -0,0 +1,17 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels +{ + public class CoreMessageHeader + { + public CoreMessageHeader() + { + } + + public CoreMessageHeader(long? updateKey) + { + UpdateKey = updateKey; + } + + public long? UpdateKey { get; set; } + public string MessageId { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequestParameters.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequestParameters.cs new file mode 100644 index 0000000..aff0c40 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequestParameters.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels +{ + public class CoreRequestParameters + { + public const int PageSizeDefault = 100000; + + public CoreRequestParameters() + { + } + + public CoreRequestParameters(List includes, int? pageSize = null) + { + Include = BuildCommaDelimitedString(includes); + PageSize = pageSize; + } + + [Display(Description = "Comma delimited string values of what to include with in model.")] + public string Include { get; set; } + + public int? PageSize { get; set; } + + + public string BuildCommaDelimitedString(List listOfString) + { + if (listOfString == null || listOfString.Count < 0) + { + return null; + } + + StringBuilder stringBuild = new StringBuilder(); + var count = listOfString.Count; + foreach (var include in listOfString) + { + stringBuild.Append(include); + count--; + if (count > 0) + { + stringBuild.Append(","); + } + } + + return stringBuild.ToString(); + } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessChannelPersonsByPersonRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessChannelPersonsByPersonRequest.cs new file mode 100644 index 0000000..e90561d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessChannelPersonsByPersonRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccessChannelPersonsByPersonRequest + { + [Required] + public long PersonNumber { get; set; } + public bool ActiveOnly { get; set; } = false; + public bool IncludeCards { get; set; } = true; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessTypeUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessTypeUpdateRequest.cs new file mode 100644 index 0000000..11e12c3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccessTypeUpdateRequest.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.AccessTypes; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccessTypeUpdateRequest + { + [Required] + public AccessType AccessType { get; set; } + [Required] + public string AccessChannelPersonId { get; set; } + [Required] + public long UpdateKey { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountAnalysisGroupMaintenanceRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountAnalysisGroupMaintenanceRequest.cs new file mode 100644 index 0000000..831c629 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountAnalysisGroupMaintenanceRequest.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountAnalysisGroupMaintenanceRequest + { + [Required] + public long AccountNumber { get; set; } + public bool IsGenerateAnalysisStatement { get; set; } + public bool IsPrintAnalysisStatement { get; set; } + public bool IsUseForServiceCharge { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountBranchUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountBranchUpdateRequest.cs new file mode 100644 index 0000000..e4a8ab3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountBranchUpdateRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountBranchUpdateRequest + { + [Required] + public long AccountNumber { get; set; } + [Required] + public string BranchOrganizationNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountContractDateUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountContractDateUpdateRequest.cs new file mode 100644 index 0000000..8690a42 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountContractDateUpdateRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountContractDateUpdateRequest + { + [Required] + public long AccountNumber { get; set; } + [Required] + public DateTime ContractDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountCreditReportTypeUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountCreditReportTypeUpdateRequest.cs new file mode 100644 index 0000000..d5e9da9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountCreditReportTypeUpdateRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountCreditReportTypeUpdateRequest + { + [Required] + public long AccountNumber { get; set; } + [Required] + public string CreditReportType { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountLtvUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountLtvUpdateRequest.cs new file mode 100644 index 0000000..23d46e0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountLtvUpdateRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountLtvUpdateRequest + { + [Required] + public long AccountNumber { get; set; } + [Required] + public double LoanToValue { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountMaintenanceRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountMaintenanceRequest.cs new file mode 100644 index 0000000..c568782 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountMaintenanceRequest.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountMaintenanceRequest + { + [Required] + public long AccountNumber { get; set; } + + ///Delivery Method to be set for Agreement Accounts. Valid values are 'PRNT' for Paper or 'WWW' for Electronic delivery. + [Required] + [RegularExpression(@"\b(PRNT|WWW)\b")] + public string DeliveryMethod { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountNickNameUpdateRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountNickNameUpdateRequest.cs new file mode 100644 index 0000000..cfa6224 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountNickNameUpdateRequest.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountNickNameUpdateRequest + { + [Required] + public long AccountNumber { get; set; } + public string AccountDescription { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountUserFieldRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountUserFieldRequest.cs new file mode 100644 index 0000000..2e79ae6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountUserFieldRequest.cs @@ -0,0 +1,9 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountUserFieldRequest + { + public long AccountNumber { get; set; } + public string UserFieldCode { get; set; } + public string Value { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByMajorMinorBranchAndStatusRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByMajorMinorBranchAndStatusRequest.cs new file mode 100644 index 0000000..71dce27 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByMajorMinorBranchAndStatusRequest.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountsByMajorMinorBranchAndStatusRequest + { + [Required] + public List MajorTypes { get; set; } + [Required] + public List MinorTypes { get; set; } + [Required] + public List AccountStatuses { get; set; } + [Required] + public List BranchCodes { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByRecentTransactionsRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByRecentTransactionsRequest.cs new file mode 100644 index 0000000..146c555 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AccountsByRecentTransactionsRequest.cs @@ -0,0 +1,14 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AccountsByRecentTransactionsRequest + { + [Required] + public String StartDate { get; set; } + + [Required] + public String EndDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AcctNbrRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AcctNbrRequest.cs new file mode 100644 index 0000000..5b028c0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/AcctNbrRequest.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class AcctNbrRequest + { + public long AcctNbr { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/ApplicationHistoryRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/ApplicationHistoryRequest.cs new file mode 100644 index 0000000..392f4b2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/ApplicationHistoryRequest.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class ApplicationHistoryRequest + { + public List ApplicationNumbers { get; set; } + public string EffectiveDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateAccountRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateAccountRequest.cs new file mode 100644 index 0000000..f92f2ef --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateAccountRequest.cs @@ -0,0 +1,41 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class CreateAccountRequest + { + + [Required, Display(Description = "ACCTDESC - The Account Description column is a textual description of the account.")] + public string AccountDescription { get; set; } + + [Required] + public int BankOrganizationNumber { get; set; } + + [Required] + public int BranchOrganizationNumber { get; set; } + + [Required, Display(Description = "CURRMIACCTTYPCD -The Current Minor Account Type Code identifies the secondary product grouping for the account.")] + public string CurrentMinorAccountTypeCode { get; set; } + + [Required] + public string DeliveryMethodCode { get; set; } + + [Required, Display(Description = "MJACCTTYPCD - The Major Account Type Code identifies the highest product grouping for the account.")] + public string MajorAccountTypeCode { get; set; } + + [Required, Display(Description = "OWNCD - The Ownership Code identifies the kind of ownership that pertains to the account.")] + public string OwnershipCode { get; set; } + + [Required, Display(Description = "TAXRPTFOROWNYN - The Tax Reported For Owner indicates if the account has a tax reported for owner. Y = Yes N = No")] + public bool IsTaxReportedForOwner { get; set; } + + [Required, Display(Description = "TAXRPTFORSIGYN - The Tax Reported For Signatory indicates if the account has a tax reported for signator. Y = Yes N = NO")] + public bool IsTaxReportedForSigner { get; set; } + + [Required, Display(Description = "VALIDYN - The Valid indicator indicates if the account has been validated for transaction processing. Validation does NOT necessarily mean approval. Y = Yes N = No")] + public bool IsValid { get; set; } + + [Required] + public string CurrentAccountStatusCode { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateOrganizationAccountRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateOrganizationAccountRequest.cs new file mode 100644 index 0000000..9216fd2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreateOrganizationAccountRequest.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class CreateOrganizationAccountRequest : CreateAccountRequest + { + [Required] + public long OrganizationNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreatePersonAccountRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreatePersonAccountRequest.cs new file mode 100644 index 0000000..85e4aac --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/CreatePersonAccountRequest.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class CreatePersonAccountRequest : CreateAccountRequest + { + [Required] + public long? PersonNumber { get; set; } + [Required] + public string FirstName { get; set; } + [Required] + public string LastName { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/GroupedMonetaryTransactionRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/GroupedMonetaryTransactionRequest.cs new file mode 100644 index 0000000..2bab112 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/GroupedMonetaryTransactionRequest.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class GroupedMonetaryTransactionRequest + { + public string ParentRequestNumber { get; set; } + + public List MonetaryTransactionRequests { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberAgreeNbrRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberAgreeNbrRequest.cs new file mode 100644 index 0000000..9a9f4a5 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberAgreeNbrRequest.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class MemberAgreeNbrRequest + { + public long MemberAgreeNbr { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberNbrRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberNbrRequest.cs new file mode 100644 index 0000000..2db8f86 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MemberNbrRequest.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class MemberNbrRequest + { + public long MemberNbr { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MonetaryTransactionRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MonetaryTransactionRequest.cs new file mode 100644 index 0000000..b71e970 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/MonetaryTransactionRequest.cs @@ -0,0 +1,39 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class MonetaryTransactionRequest + { + [Required] + public long AccountNumber { get; set; } + + public double? TransactionAmount { get; set; } + + [Required] + public string RequestNumber { get; set; } + + public long? OverrideCashBoxNumber { get; set; } + + public long? ApprovalPersonNumber { get; set; } + + [Required] + public string TransactionTypeCode { get; set; } + + public string ParentRequestNumber { get; set; } + + public string Description { get; set; } + + public string EffectiveDate { get; set; } + + public List FundBalanceTypes { get; set; } + + [Required] + public List BalanceTypes { get; set; } + + [Required] + public List Funds { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationMaintenanceRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationMaintenanceRequest.cs new file mode 100644 index 0000000..7c1e9a9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationMaintenanceRequest.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class OrganizationMaintenanceRequest + { + [Required] + public long OrganizationNumber { get; set; } + [Required] + public long? ControllingPersonNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationSearchRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationSearchRequest.cs new file mode 100644 index 0000000..30d787b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/OrganizationSearchRequest.cs @@ -0,0 +1,15 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class OrganizationSearchRequest + { + public long OrgNbr { get; set; } + public string OrgTypCd { get; set; } + public string OrgName { get; set; } + public long MemberNbr { get; set; } + public string TaxId { get; set; } + public string AreaCode { get; set; } + public string Exchange { get; set; } + public string PhoneNbr { get; set; } + public string SoundexYN { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonNameRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonNameRequest.cs new file mode 100644 index 0000000..e3851dc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonNameRequest.cs @@ -0,0 +1,9 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class PersonNameRequest + { + public string FirstName { get; set; } + public string LastName { get; set; } + public string MdlName { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonSearchRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonSearchRequest.cs new file mode 100644 index 0000000..10b83fd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonSearchRequest.cs @@ -0,0 +1,15 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class PersonSearchRequest + { + public long PersNbr { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public long MemberNbr { get; set; } + public string Taxid { get; set; } + public string AreaCode { get; set; } + public string Exchange { get; set; } + public string PhoneNbr { get; set; } + public string SoundexYN { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonUserFieldRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonUserFieldRequest.cs new file mode 100644 index 0000000..f0e1493 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/PersonUserFieldRequest.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class PersonUserFieldRequest + { + [Required] + public int PersonNumber { get; set; } + [Required] + public string UserFieldCode { get; set; } + public string Value { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TaxIdRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TaxIdRequest.cs new file mode 100644 index 0000000..496a79e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TaxIdRequest.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class TaxIdRequest + { + public string TaxId { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TransactionHistoryRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TransactionHistoryRequest.cs new file mode 100644 index 0000000..0d66a8f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/TransactionHistoryRequest.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class TransactionHistoryRequest + { + public long? AccountNumber { get; set; } + [Required] + public string FromDate { get; set; } + [Required] + public string ThruDate { get; set; } + [Required] + public string OnlyCompletedYN { get; set; } + [Required] + [MaxLength(1)] + public decimal SearchDateOption { get; set; } + public string RtxnSourceCds { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/UserFieldRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/UserFieldRequest.cs new file mode 100644 index 0000000..79a963f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreRequests/UserFieldRequest.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class UserFieldRequest + { + public long PropertyNumber { get; set; } + public string UserFieldCode { get; set; } + public string Value { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreResponses/BasicResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreResponses/BasicResponse.cs new file mode 100644 index 0000000..adef8c7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreResponses/BasicResponse.cs @@ -0,0 +1,10 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses +{ + public class BasicResponse + { + public bool Success { get; set; } + public List Errors { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/AccountMaintenanceRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/AccountMaintenanceRequest.cs new file mode 100644 index 0000000..0c8fcd4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/AccountMaintenanceRequest.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests +{ + public class AccountMaintenanceRequest + { + public MaintenanceAccount[] Accounts { get; set; } + } + + public class MaintenanceAccount + { + public long AccountNumber { get; set; } + public bool IsAccountMaintenance { get; set; } + public string DeliveryMethodCode { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/DetailType.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/DetailType.cs new file mode 100644 index 0000000..91b7f13 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/DetailType.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests +{ + public class DetailType + { + [Required] + public string DetailTypeCode { get; set; } + [Required] + public string DetailValue { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/PersonAgreementDetailTypeRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/PersonAgreementDetailTypeRequest.cs new file mode 100644 index 0000000..fc4337b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapRequests/PersonAgreementDetailTypeRequest.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapRequests +{ + public class PersonAgreementDetailTypeRequest + { + [Required] + public long PersonNumber { get; set; } + [Required] + public decimal AgreeNumber { get; set; } + [Required] + public string AgreeTypeCode { get; set; } + [Required] + public List DetailTypes { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapResponses/CreatedAccountResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapResponses/CreatedAccountResponse.cs new file mode 100644 index 0000000..f430036 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/CoreSoapResponses/CreatedAccountResponse.cs @@ -0,0 +1,13 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreResponses; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreSoapResponses +{ + public class CreatedAccountResponse + { + public long? AccountNumber { get; set; } + public string MajorTypeCode { get; set; } + public string MinorTypeCode { get; set; } + public BasicResponse BasicResponse { get; set; } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/EmailAddress/Email.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/EmailAddress/Email.cs new file mode 100644 index 0000000..415a979 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/EmailAddress/Email.cs @@ -0,0 +1,15 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.EmailAddress +{ + public class Email + { + public int AddressNumber { get; set; } + public string AddressUseCode { get; set; } + public string AddressUseDescription { get; set; } + public string EffectiveDate { get; set; } + public string EmailAddress { get; set; } + public string InactiveDate { get; set; } + public int PersonNumber { get; set; } + public string StartDate { get; set; } + public string StopDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Identifications/Identification.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Identifications/Identification.cs new file mode 100644 index 0000000..a906810 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Identifications/Identification.cs @@ -0,0 +1,14 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Identifications +{ + public class Identification + { + public string CountryCode { get; set; } + public string CountrySubdivisionCode { get; set; } + public string ExpireDate { get; set; } + public string IdNumber { get; set; } + public string IssueDate { get; set; } + public string StateCode { get; set; } + public string TypeCode { get; set; } + public string TypeDescription { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/ClosedIndirectLoan.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/ClosedIndirectLoan.cs new file mode 100644 index 0000000..f17e588 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/ClosedIndirectLoan.cs @@ -0,0 +1,11 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan +{ + public class ClosedIndirectLoan + { + public string LoanNumber { get; set; } + + public DateTime PaidLoanDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/IndirectLoanDetail.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/IndirectLoanDetail.cs new file mode 100644 index 0000000..e6786ce --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/IndirectLoanDetail.cs @@ -0,0 +1,75 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan +{ + public class IndirectLoanDetail + { + public string MemberNumber { get; set; } + + public string LoanNumber { get; set; } + + public string ApplicationId { get; set; } + + public string MemberFirstName { get; set; } + + public string MemberInitial { get; set; } + + public string MemberLastName { get; set; } + + public string DealerCode { get; set; } + + public string DealerAccountNumber { get; set; } + + public string DealerOrganizationNumber { get; set; } + + public string DealerName { get; set; } + + public bool Warranty { get; set; } + + public bool GAP { get; set; } + + public bool CreditLife { get; set; } + + public bool CreditDisability { get; set; } + + public bool Mbp { get; set; } + + public string AccountType { get; set; } + + public string AccountDescription { get; set; } + + public string LoanType { get; set; } + + public DateTime LoanDate { get; set; } + + public DateTime PostedDate { get; set; } + + public DateTime FirstPmtDate { get; set; } + + public DateTime FinalPmtDate { get; set; } + + public int OriginalTermInDays { get; set; } + + public DateTime? PaidLoanDate { get; set; } + + public decimal LoanAmount { get; set; } + + public decimal BuyRate { get; set; } + + public decimal ContractRate { get; set; } + + public decimal MonthlyPmt { get; set; } + + public string Vin { get; set; } + + public string Make { get; set; } + + public string Model { get; set; } + + public int Year { get; set; } + + public string Color { get; set; } + + public int Mileage { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/UpdateDealerOriginalBalanceResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/UpdateDealerOriginalBalanceResponse.cs new file mode 100644 index 0000000..b689ba4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/IndirectLoan/UpdateDealerOriginalBalanceResponse.cs @@ -0,0 +1,10 @@ + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.IndirectLoan +{ + public class UpdateDealerOriginalBalanceResponse + { + public string AccountNumber { get; set; } + + public string ErrorMessage { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Loans/LoanInfo.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Loans/LoanInfo.cs new file mode 100644 index 0000000..24e0595 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Loans/LoanInfo.cs @@ -0,0 +1,77 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Loans +{ + public class LoanInfo + { + public string AnticipatedDateMaturity { get; set; } + public string BilledThruDate { get; set; } + public int BillingLeadDaysOvr { get; set; } + public string CallDate { get; set; } + public string CraCategoryCode { get; set; } + public DateTime CreditOvrdClatReacquiredDate { get; set; } + public string CreditReportCommentCode { get; set; } + public string CreditReportComplianceConditionCode { get; set; } + public string CreditReportConsumerInfoCode { get; set; } + public string CreditReportStatusCode { get; set; } + public string CreditReportTypeCode { get; set; } + public int CreditScore { get; set; } + public DateTime CurrentDueDate { get; set; } + public int CushionMonths { get; set; } + public string DateFirstPaymentDue { get; set; } + public string DefaultReasonCode { get; set; } + public string EscrowComponentMonthCode { get; set; } + public string EscrowPaymentRoundingMethodCode { get; set; } + public string FdicCategoryCode { get; set; } + public string FhlbCategoryCode { get; set; } + public int GraceDays { get; set; } + public string InterestFirstConvertDate { get; set; } + public string InterestFirstFutureProductCode { get; set; } + public string InterestFirstFutureProductTypeCode { get; set; } + public bool IsAutoParticipationAdvance { get; set; } + public bool IsAutoParticipationPayment { get; set; } + public bool IsBalloon { get; set; } + public bool IsBillAdvance { get; set; } + public bool IsBorrInDfltRespForRemainBal { get; set; } + public bool IsChargeOff { get; set; } + public bool IsDemand { get; set; } + public bool IsImminentDefault { get; set; } + public bool IsInvestorConform { get; set; } + public bool IsLoanLimit { get; set; } + public bool IsMultipleDueDates { get; set; } + public bool IsNonRESPA { get; set; } + public bool IsNotRE { get; set; } + public bool IsPartialPaymentAllowed { get; set; } + public bool IsPrinSurplusProc { get; set; } + public bool IsRateChangeRecalculationPayment { get; set; } + public bool IsRestructured { get; set; } + public bool IsRevolveLoan { get; set; } + public bool IsShadowAccounting { get; set; } + public bool IsUnSchedulePrincipalPaymentsAllowed { get; set; } + public bool IsUseScheduleGeneratedDate { get; set; } + public string LastReviewDate { get; set; } + public string LoanAgencyCode { get; set; } + public string LoanLossCategoryCode { get; set; } + public string LoanQualityCode { get; set; } + public string LoanSourceCode { get; set; } + public DateTime NextDueDate { get; set; } + public int NextLoanModificationNumber { get; set; } + public string NextPaymentChangeDate { get; set; } + public string OccupationLoanCategoryCode { get; set; } + public decimal OriginationLtvRatio { get; set; } + public string OtsLoanCategoryCode { get; set; } + public decimal ParticipationThresholdBalance { get; set; } + public int PaymentChangeLeadDays { get; set; } + public string PaymentMethodCode { get; set; } + public string PurposeCode { get; set; } + public int RateChangeLeadDays { get; set; } + public long RefinancePriorAccountNumber { get; set; } + public string RiskRatingCode { get; set; } + public string ScoreDate { get; set; } + public string ShadowAccountingEndDate { get; set; } + public string ShadowAccountingStartDate { get; set; } + public string SlpCode { get; set; } + public string SubClassCode { get; set; } + public int TotalPercentSold { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreePerson.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreePerson.cs new file mode 100644 index 0000000..a2729a1 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreePerson.cs @@ -0,0 +1,9 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements +{ + public class AgreePerson + { + public long AgreeNumber { get; set; } + public long PersonNumber { get; set; } + public string UserId { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreeUserAccount.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreeUserAccount.cs new file mode 100644 index 0000000..a863731 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/AgreeUserAccount.cs @@ -0,0 +1,9 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements +{ + public class AgreeUserAccount + { + public long AccountNumber { get; set; } + public long AgreeNumber { get; set; } + public string UserId { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/MemberAgreement.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/MemberAgreement.cs new file mode 100644 index 0000000..b9a586c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/MemberAgreements/MemberAgreement.cs @@ -0,0 +1,11 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements +{ + public class MemberAgreement + { + public long MemberAgreementNumber { get; set; } + public string MemberGroupCode { get; set; } + public string MemberGroupDescription { get; set; } + public int PrimaryPersonNumber { get; set; } + public long ShareAccountNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Mixed/PersonOrganization.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Mixed/PersonOrganization.cs new file mode 100644 index 0000000..4f843e1 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Mixed/PersonOrganization.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +#nullable enable +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Mixed +{ + public class PersonOrganization + { + public string? PersonNumber { get; set; } = null; + public string? OrganizationNumber { get; set; } = null; + public string? EntityName { get; set; } = null; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Organizations/Organization.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Organizations/Organization.cs new file mode 100644 index 0000000..7aaee2b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Organizations/Organization.cs @@ -0,0 +1,13 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Organizations +{ + public class Organization + { + public long MemberAgreementNumber { get; set; } + public long OrganizationNumber { get; set; } + public string Name { get; set; } + public List PostalAddressList { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PersonTypes/PersonType.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PersonTypes/PersonType.cs new file mode 100644 index 0000000..4ba8eba --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PersonTypes/PersonType.cs @@ -0,0 +1,12 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PersonTypes +{ + public class PersonType + { + public string EffectiveDate { get; set; } + public string InactiveDate { get; set; } + public string PersonFullName { get; set; } + public int PersonNumber { get; set; } + public string PersonTypeCode { get; set; } + public string PersonTypeDescription { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Pers.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Pers.cs new file mode 100644 index 0000000..ff2520a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Pers.cs @@ -0,0 +1,11 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons +{ + public class Pers + { + public string FirstName { get; set; } + public string LastName { get; set; } + public string MdlName { get; set; } + public string MdlInit { get; set; } + public string Suffix { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersQueryName.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersQueryName.cs new file mode 100644 index 0000000..491c1d7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersQueryName.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons +{ + public class PersQueryName + { + public string FirstName { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Person.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Person.cs new file mode 100644 index 0000000..199f4cd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/Person.cs @@ -0,0 +1,99 @@ +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.EmailAddress; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Identifications; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.MemberAgreements; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PersonTypes; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Phones; +using LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses; +using System; +using System.Collections.Generic; + +//TODO: Clean up commented out unused models if determined not needed. +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons +{ + public class Person + { + //public List Accounts { get; set; } + public string AddDate { get; set; } + public int Age { get; set; } + public bool AllowsPromotionalContact { get; set; } + public string BirthDate { get; set; } + public string CountryName { get; set; } + public string CreditRatingCode { get; set; } + public string CreditReportConsumerInfoCode { get; set; } + public string CustomerKeyWord { get; set; } + public string DateOfDeath { get; set; } + public string DateTaxIdApply { get; set; } + public string EducationLevelCode { get; set; } + public List EmailAddressList { get; set; } + //public List EntityAttributeHistory { get; set; } + //public List ExternalOrganizationIds { get; set; } + public string FirstMiddleInitialLastSuffix { get; set; } + public string FirstName { get; set; } + public string FirstNameSoundex { get; set; } + public string FirstNameUpper { get; set; } + public string ForeignCertificationExpirationDate { get; set; } + public string FullNameWithSecondSurName { get; set; } + public string GraduationDate { get; set; } + public string Id { get; set; } + public List Identifications { get; set; } + public string IncomeLevelCode { get; set; } + public bool IsAtm { get; set; } + public bool IsDirectDeposit { get; set; } + public bool IsEmployee { get; set; } + public bool IsOtherPersonsUpdated { get; set; } + public bool IsPrivacy { get; set; } + public bool IsPurge { get; set; } + public bool IsReport1042s { get; set; } + public bool IsValid { get; set; } + public DateTime LastMaintained { get; set; } + public string LastName { get; set; } + public string LastNameSoundex { get; set; } + public string LastNameUpper { get; set; } + public string MailTypeCode { get; set; } + public MemberAgreement MemberAgreement { get; set; } + //public MemberGroup MemberGroup { get; set; } + public string MemberGroupCode { get; set; } + public long MemberNumber { get; set; } + public string MiddleInitial { get; set; } + public string MiddleName { get; set; } + public string NameFirstLast { get; set; } + public string NameFirstMiddleLast { get; set; } + public string NameFull { get; set; } + public string NameLastFirst { get; set; } + public string NameLastFirstInitial { get; set; } + public string NameLastFirstMiddle { get; set; } + public string NameLastFirstMiddleSuffix { get; set; } + public string NickName { get; set; } + public string NonResidentReportingChapterCode { get; set; } + public string NonResidentStatusCode { get; set; } + public int NumberDependents { get; set; } + public string OccupationCode { get; set; } + //public List OrganizationRelationships { get; set; } + public string OwnOrRent { get; set; } + public int PersonNumber { get; set; } + public List PersonTypes { get; set; } + public List Phones { get; set; } + //public List PostalAddresses { get; set; } + public List PostalAddressList { get; set; } + public string PreferredCultureCode { get; set; } + public string PrimaryIdDocumentNumber { get; set; } + public int PrimaryImageDocumentNumber { get; set; } + //public PrimaryImageDocumentUse PrimaryImageDocumentUse { get; set; } + public string ProfileUserField { get; set; } + //public ResidentTaxCountry ResidentTaxCountry { get; set; } + public string ResidentTaxCountryCode { get; set; } + public string SalutationCode { get; set; } + public string SalutationDescription { get; set; } + public string SecondSurname { get; set; } + public string ShortName { get; set; } + public string SpouseFullName { get; set; } + public int SpouseNumber { get; set; } + public string Suffix { get; set; } + public string TaxCertificationDate { get; set; } + public string TaxId { get; set; } + public string TimeWithInstitution { get; set; } + public string Uid { get; set; } + public string Url { get; set; } + //public List UserFields { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonCheckHoldsUserField.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonCheckHoldsUserField.cs new file mode 100644 index 0000000..6214945 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonCheckHoldsUserField.cs @@ -0,0 +1,12 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons +{ + public class PersonCheckHoldsUserField + { + public long PersonNumber { get; set; } + public DateTime? OldestActiveEffectiveDate { get; set; } + public DateTime? RecentClosedEffectiveDate { get; set; } + public bool UserFieldExists { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonUserField.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonUserField.cs new file mode 100644 index 0000000..a165f7b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Persons/PersonUserField.cs @@ -0,0 +1,16 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Persons +{ + public class PersonUserField + { + public string Id { get; set; } + public long PersonNumber { get; set; } + public string UserFieldCode { get; set; } + public string Value { get; set; } + public DateTime LastMaintained { get; set; } + public string UserFieldDescription { get; set; } + public string DataTypeCode { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Phones/Phone.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Phones/Phone.cs new file mode 100644 index 0000000..e7004f3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Phones/Phone.cs @@ -0,0 +1,19 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Phones +{ + public class Phone + { + public string AreaCode { get; set; } + public string Exchange { get; set; } + public string ForeignPhoneNumber { get; set; } + public string PhoneExtension { get; set; } + public string PhoneNumber { get; set; } + public int PhoneSequence { get; set; } + public string PhoneUseCode { get; set; } + public string PhoneUseDescription { get; set; } + public string CountryCode { get; set; } + public string CountryName { get; set; } + public string FormattedPhoneNumber { get; set; } + public bool IsPreferred { get; set; } + public int PersonNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Address.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Address.cs new file mode 100644 index 0000000..4841042 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Address.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class Address + { + [Required] + public int AddressNumber { get; set; } + public string CensusTrtNumber { get; set; } + [Required] + public string CityName { get; set; } + [Required] + public string CountryCode { get; set; } + public string CountryMailCode { get; set; } + public string CountrySubdivisionCode { get; set; } + public string Id { get; set; } + [Required] + public DateTime LastMaintained { get; set; } + public List Lines { get; set; } + [Required] + public int NextLineNumber { get; set; } + public string PostNetCode { get; set; } + public string SmsaNumber { get; set; } + public string StateCode { get; set; } + public string Uid { get; set; } + public string Url { get; set; } + public string ZipCode { get; set; } + public string ZipPlus { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Line.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Line.cs new file mode 100644 index 0000000..bc4cf43 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/Line.cs @@ -0,0 +1,15 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class Line + { + public int AddressNumber { get; set; } + public string AddressTextSoundex { get; set; } + public DateTime LastMaintained { get; set; } + public int LineNumber { get; set; } + public string Text { get; set; } + public string TypeCode { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddrLine.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddrLine.cs new file mode 100644 index 0000000..02084e3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddrLine.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class PersonAddrLine + { + public string Id { get; set; } + [Required] + public int PersonNumber { get; set; } + public string AddressUseCode { get; set; } + [Required] + public int AddressNumber { get; set; } + public string AddressLine1 { get; set; } + public string AddressLineTypeCode1 { get; set; } + public string AddressLine2 { get; set; } + public string AddressLineTypeCode2 { get; set; } + public string AddressLine3 { get; set; } + public string AddressLineTypeCode3 { get; set; } + public string CityName { get; set; } + [Required] + public string CountrySubdivisionCode { get; set; } + public string PostalCode { get; set; } + public string ZipPlus { get; set; } + public string PostNetCode { get; set; } + public string CountryCode { get; set; } + public string CensusTractNumber { get; set; } + public string SmsaNumber { get; set; } + public string StartDate { get; set; } + public string StopDate { get; set; } + public string InactiveDate { get; set; } + public string EffectiveDate { get; set; } + public string OccupanceDate { get; set; } + public string StartMonthCode { get; set; } + public int? StartDayNumber { get; set; } + public string StopMonthCode { get; set; } + public int? StopDayNumber { get; set; } + public DateTime LastMaintained { get; set; } + public string Url { get; set; } + public bool IsPerformIRSCorrection { get; set; } = false; + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddressInfo.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddressInfo.cs new file mode 100644 index 0000000..964ba40 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonAddressInfo.cs @@ -0,0 +1,11 @@ + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class PersonAddressInfo + { + public int PersonNumber { get; set; } + public string AddressUseCode { get; set; } + public string AddressLine { get; set; } + public int LineNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonPostalAddress.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonPostalAddress.cs new file mode 100644 index 0000000..343dd2a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PersonPostalAddress.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class PersonPostalAddress + { + public string Id { get; set; } + [Required] + public int PersonNumber { get; set; } + public string AddressUseCode { get; set; } + public string AddressUseDescription { get; set; } + [Required] + public int AddressNumber { get; set; } + public string AddressLine1 { get; set; } + public string AddressLineTypeCode1 { get; set; } + public string AddressLine2 { get; set; } + public string AddressLineTypeCode2 { get; set; } + public string AddressLine3 { get; set; } + public string AddressLineTypeCode3 { get; set; } + public string CityName { get; set; } + public string CountrySubdivisionCode { get; set; } + public string CountrySubdivisionName { get; set; } + public string PostalCode { get; set; } + public string ZipPlus { get; set; } + [Required] + public string CountryCode { get; set; } + public string CountryName { get; set; } + public string CensusTractNumber { get; set; } + public string SmsaNumber { get; set; } + public string StartDate { get; set; } + public string StopDate { get; set; } + public string StartMonthCode { get; set; } + public string StartMonthName { get; set; } + public int? StartDayNumber { get; set; } + public string StopMonthCode { get; set; } + public string StopMonthName { get; set; } + public int? StopDayNumber { get; set; } + public DateTime LastMaintained { get; set; } + public List PersonAddressInfo { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PostalAddress.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PostalAddress.cs new file mode 100644 index 0000000..0dcbb38 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/PostalAddresses/PostalAddress.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.PostalAddresses +{ + public class PostalAddress + { + public string AddressLine1 { get; set; } + public string AddressLine2 { get; set; } + public string AddressLine3 { get; set; } + public string AddressLineTypeCode1 { get; set; } + public string AddressLineTypeCode2 { get; set; } + public string AddressLineTypeCode3 { get; set; } + public int AddressNumber { get; set; } + public string AddressUseCode { get; set; } + public string AddressUseDescription { get; set; } + public string CensusTractNumber { get; set; } + public string CityName { get; set; } + public string CountryCode { get; set; } + public string CountryName { get; set; } + public string CountrySubdivisionCode { get; set; } + public string CountrySubdivisionName { get; set; } + public string PostalCode { get; set; } + public string SmsaNumber { get; set; } + public string StartDate { get; set; } + public string StopDate { get; set; } + public string ZipPlus { get; set; } + public Address Address { get; set; } + public string EffectiveDate { get; set; } + public List FormattedAddress { get; set; } + public string InactiveDate { get; set; } + public string OccupancyDate { get; set; } + public int PersonNumber { get; set; } + public string PostNetCode { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/Property.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/Property.cs new file mode 100644 index 0000000..97582b6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/Property.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties +{ + public class Property + { + public int AddressNumber { get; set; } + public string AreaUnitOfMeasurementTypeCode { get; set; } + public string BlockNumber { get; set; } + public string BuildDate { get; set; } + public string CertificationNumber { get; set; } + public string Color { get; set; } + public int CondoMaintenanceFee { get; set; } + public int CondoSquareFeet { get; set; } + public string CurrencyCode { get; set; } + public string CusipNumber { get; set; } + public string CusipSymbol { get; set; } + public int DepreciationMonths { get; set; } + public string Description { get; set; } + public string FleetNumber { get; set; } + public int FloodCommunity { get; set; } + public string FloodPanel { get; set; } + public int FloodVendorOrganizationNumber { get; set; } + public string FloodZone { get; set; } + public string Id { get; set; } + public bool IsFloodZone { get; set; } + public bool IsNew { get; set; } + public string LastAssessmentDate { get; set; } + public string LastAuditDate { get; set; } + public string LastEnvAuditDate { get; set; } + public DateTime LastMaintained { get; set; } + public string LocationDescription { get; set; } + public string LotNumber { get; set; } + public string Make { get; set; } + public string MapNumber { get; set; } + public string MaturityDate { get; set; } + public string Model { get; set; } + public int NumberOfUnits { get; set; } + public string OccupancyEffectiveDate { get; set; } + public string OwnerDate { get; set; } + public string OwnerOccupiedCode { get; set; } + public string ParcelNumber { get; set; } + public string PlatBookNumber { get; set; } + public string PlatBookPage { get; set; } + public string PlateCountryCode { get; set; } + public string PlateNumber { get; set; } + public string PlateStateCode { get; set; } + public string PropertyId { get; set; } + public int PropertyNumber { get; set; } + public string PurchaseDate { get; set; } + public double PurchasePrice { get; set; } + public string RangeNumber { get; set; } + public string RedeterminationDate { get; set; } + public int ResidualValueAmount { get; set; } + public string SectionNumber { get; set; } + public string SettlementDate { get; set; } + public int SettlementPrice { get; set; } + public int SquareFeet { get; set; } + public int TaxValue { get; set; } + public string TownshipNumber { get; set; } + public string TypeCode { get; set; } + public string TypeDetailCode { get; set; } + public string Uid { get; set; } + public int UnitValue { get; set; } + public string UnitValueEffectiveDate { get; set; } + public string Url { get; set; } + public double Value { get; set; } + public string ValueDate { get; set; } + public int VehicleOdometer { get; set; } + public int YearNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyAddressInfo.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyAddressInfo.cs new file mode 100644 index 0000000..809a93f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyAddressInfo.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties +{ + public class PropertyAddressInfo + { + public string AddressLine { get; set; } + public int PropertyNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyShort.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyShort.cs new file mode 100644 index 0000000..e4f938e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyShort.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties +{ + public class PropertyShort + { + public string EffectiveDate { get; set; } + public string InactiveDate { get; set; } + public List PropertyAddressInfo { get; set; } + public string PropertyDescription { get; set; } + public int PropertyNumber { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyUserField.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyUserField.cs new file mode 100644 index 0000000..44af726 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Properties/PropertyUserField.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Properties +{ + public class PropertyUserField + { + public string Id { get; set; } + public long PropertyNumber { get; set; } + public string UserFieldCode { get; set; } + public string Value { get; set; } + public DateTime LastMaintained { get; set; } + public string UserFieldDescription { get; set; } + public string DataTypeCode { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Saf/SafUser.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Saf/SafUser.cs new file mode 100644 index 0000000..16d25c1 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Saf/SafUser.cs @@ -0,0 +1,10 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Saf +{ + public class SafUser + { + public string SafUserId { get; set; } + public long SafPersNbr { get; set; } + public string CorePersNbr { get; set; } + public string EmployeeEmail { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/OrganizationTaxIdDataResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/OrganizationTaxIdDataResponse.cs new file mode 100644 index 0000000..915e4e2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/OrganizationTaxIdDataResponse.cs @@ -0,0 +1,8 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax +{ + public class OrganizationTaxIdDataResponse + { + public string Name { get; set; } + public long OrganizationNumber { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/PersonTaxIdDataResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/PersonTaxIdDataResponse.cs new file mode 100644 index 0000000..c3270e2 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Tax/PersonTaxIdDataResponse.cs @@ -0,0 +1,24 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Tax +{ + public class PersonTaxIdDataResponse + { + public string FirstName { get; set; } + public string MiddleInitial { get; set; } + public string MiddleName { get; set; } + + public string LastName { get; set; } + public string Suffix { get; set; } + public string NameFull { get; set; } + + public string FullNameWithSecondSurName { get; set; } + public string NameFirstMiddleLast { get; set; } + public string NameLastFirst { get; set; } + public string NameFirstLast { get; set; } + public string NameLastFirstInitial { get; set; } + public string NameLastFirstMiddle { get; set; } + public string NameLastFirstMiddleSuffix { get; set; } + public string NickName { get; set; } + + public long PersonNumber { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/BalanceType.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/BalanceType.cs new file mode 100644 index 0000000..0cd96c3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/BalanceType.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class BalanceType1 + { + [Required] + public string BalanceCategoryCode { get; set; } + + [Required] + public string BalanceTypeCode { get; set; } + + [Required] + public double BalanceTypeAmount { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Error.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Error.cs new file mode 100644 index 0000000..b3a83de --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Error.cs @@ -0,0 +1,11 @@ + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class Error + { + public string ErrorMessage { get; set; } + + public int? ErrorNumber { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/ExternalDescription.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/ExternalDescription.cs new file mode 100644 index 0000000..275bb9c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/ExternalDescription.cs @@ -0,0 +1,8 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class ExternalDescription + { + public long ExternalDescriptionNumber { get; set; } + public string ExternalDescriptionText { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Fund.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Fund.cs new file mode 100644 index 0000000..8eb26b8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/Fund.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class Fund + { + [Required] + public string ClearingCategoryCode { get; set; } + + [Required] + public double FundAmount { get; set; } + + [Required] + public string FundTypeCode { get; set; } + + [Required] + public string FundTypeDetailCode { get; set; } + + [Required] + public long NumberOfItems { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundBalanceType.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundBalanceType.cs new file mode 100644 index 0000000..b9a1986 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundBalanceType.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class FundBalanceType + { + [Required] + public double FundBalanceAmount { get; set; } + + [Required] + public string FundTypeCode { get; set; } + + [Required] + public string FundTypeDetailCode { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundRequest.cs new file mode 100644 index 0000000..ec9618a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundRequest.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class FundRequest + { + [Required] + public string ClearingCategoryCode { get; set; } + [Required] + public double FundAmount { get; set; } + [Required] + public string FundTypeCode { get; set; } + [Required] + public string FundTypeDetailCode { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundsToAccountRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundsToAccountRequest.cs new file mode 100644 index 0000000..556a628 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/FundsToAccountRequest.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.CoreRequests +{ + public class FundsToAccountRequest + { + private const string SingleRequestNumber = "1"; + + [Required] + public long AccountNumber { get; set; } + [Required] + public string Description { get; set; } + [Required] + public double? TransactionAmount { get; set; } + [Required] + public string TransactionTypeCode { get; set; } + [Required] + public List FundRequests { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/MonetaryTransactionResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/MonetaryTransactionResponse.cs new file mode 100644 index 0000000..0aa2611 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/MonetaryTransactionResponse.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class MonetaryTransactionResponse + { + + public long? AccountNumber { get; set; } + + public long? CashBoxNumber { get; set; } + + public long? RTxnNumber { get; set; } + + public List Errors { get; set; } + + public bool WasSuccessful { get; set; } + + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionAlertInfo.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionAlertInfo.cs new file mode 100644 index 0000000..b9a9e4c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionAlertInfo.cs @@ -0,0 +1,20 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class TransactionAlertInfo + { + public string AccountNumber { get; set; } + public string TransactionNumber { get; set; } + public string ExternalTransactionDescription { get; set; } + public string InternalTransactionDescription { get; set; } + public decimal Amount { get; set; } + public DateTime PostingDate { get; set; } + public string TransactionCode { get; set; } + public decimal CurrentBalance { get; set; } + public string CheckNumber { get; set; } + public string CurrRtxnStatCd { get; set; } + public string DebitCredit { get; set; } + public string TransactionTypeDescription { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistory.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistory.cs new file mode 100644 index 0000000..86cad4a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistory.cs @@ -0,0 +1,31 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class TransactionHistory + { + public long AccountNumber { get; set; } + public DateTime ActivityDateTime { get; set; } + public bool AllowCustomerView { get; set; } + public decimal? Amount { get; set; } + public decimal BalanceAccountNumber { get; set; } + public string BalanceTypeDescription { get; set; } + public string CurrTransactionStatusCode { get; set; } + public string DueDate { get; set; } + public string EffectiveDate { get; set; } + public string ExternalTransactionDescription { get; set; } + public string Id { get; set; } + public bool IsDisputedTransaction { get; set; } + public int OnlineCheckTraceNumber { get; set; } + public string PostingDate { get; set; } + public decimal? RunningBalance { get; set; } + public int TimeUniqueNumber { get; set; } + public TransactionHistoryDetail TransactionHistoryDetail { get; set; } + public int TransactionNumber { get; set; } + public string TransactionReference { get; set; } + public string TransactionStatusDescription { get; set; } + public string TransactionTypeCode { get; set; } + public string TransactionTypeDescription { get; set; } + public string Uid { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryDetail.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryDetail.cs new file mode 100644 index 0000000..3412701 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryDetail.cs @@ -0,0 +1,26 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + public class TransactionHistoryDetail + { + public int ApprovingPersonNumber { get; set; } + public int CashboxNumber { get; set; } + public int ConfirmationNumber { get; set; } + public List Funds { get; set; } + public long HoldAccountNumber { get; set; } + public bool IsOffline { get; set; } + public bool IsPassbookPosted { get; set; } + public int OriginatingPersonNumber { get; set; } + public long ParentAccountNumber { get; set; } + public int ParentTransactionNumber { get; set; } + public int PreauthorizedTransactionNumber { get; set; } + public string ProcessName { get; set; } + public int QueueProcessNumber { get; set; } + public int ReversedTransactionNumber { get; set; } + public string SourceCategoryCode { get; set; } + public int TransactingPersonNumber { get; set; } + public int TransactionNumber { get; set; } + public string TransactionSourceCode { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryGroup.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryGroup.cs new file mode 100644 index 0000000..dbe64db --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/CoreModels/Transaction/TransactionHistoryGroup.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.CoreModels.Transaction +{ + //Not a DNA generated mode. Is needed to help map to our LoanHistoryDetail model. + public class TransactionHistoryGroup + { + public int TransactionNumber { get; set; } + public List TransactionHistorys { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Enums/IdentificationTypeEnum.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Enums/IdentificationTypeEnum.cs new file mode 100644 index 0000000..f0d9be4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/Enums/IdentificationTypeEnum.cs @@ -0,0 +1,17 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.Enums +{ + //TODO: Pull from database? (select * from persidtyp) + public enum IdentificationTypeEnum + { + Unknown = 0, + UnexpiredDriversLicense = 1, + UnexpiredPhotoNonDrivers = 2, + UnexpiredPassport = 3, + WelfareCard = 4, + SchoolPhotoIDMinorsOnly = 5, + MilitaryID = 6, + Matricula = 7, + PermResidentCard = 8, + MilwaukeeMunicID = 9 + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LCU.Library.Internal.CoreApiWrapperModel.csproj b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LCU.Library.Internal.CoreApiWrapperModel.csproj new file mode 100644 index 0000000..ba48245 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LCU.Library.Internal.CoreApiWrapperModel.csproj @@ -0,0 +1,199 @@ + + + netstandard2.1 + true + 2.27.22 + 2.27.22 + + 1.0.0 - Initial Setup + 1.1.0 - Removal of the Configuration models and ConnectionModels. + 1.1.1 - Adding models for IndirectLoans + 1.1.2 - Added ClosedIndirectLoan model + 1.1.3 - Addition of ApplicationHistoryRequest and ApplicationHistory models + 1.1.4 - Update to IndirectLoanDetail model + 1.1.5 - Update to InidrectLoanDetail model + 1.1.6 - Add SafUser Model + 1.1.7 - Added QueueApplicationParameter Model and List<QueueApplicationParameter> to ApplicationHistory. + 1.1.8 - Fix QueueApplicationParameter ParameterValue to be CamelCase. + 1.1.9 - Added AgreeUserAccount model + 1.2.0 - Added Agreement, AgreementAccount, AgreementAccountOwner, and AgreementDeliveryMethod models + 1.2.1 - Fix Activity Models, Add Activity Manager Model + 1.2.2 - Update to IndirectLoanExport model, Add BalanceType, Fund, MonetaryTransaction + 1.2.3 - Update NewCheckingSaleActivity model to include branch name + 1.2.4 - Added AccountUserField and AccountUserFieldUpdateRequest models + 1.2.5 - Added OriginalTermInDays to IndirectLoanDetail + 1.2.6 - Updating AgreementDeliveryMethodRequest to be AccountMaintenanceRequest + 1.2.7 - added major account type to agreementAccount + 1.3.0 - Add NewLoanSaleActivity For Mortgages + 1.3.1 - Add UserId to AgreementAccount + 1.3.2 - Add new AccountAudit object + 1.3.3 - Add new Transaction objects + 1.4.0 - Add Vehicle Loan Sale Models + 1.4.1 - Update Transaction Indirect Loan objects + 2.0.0 - Refactor model namespaces + 2.1.0 - TransactionHistoryDetail added Funds and deleted unneeded LcuModels Loans models. + 2.1.1 - Update Referral Activity Query and Model. Add Account Info, fix PersNbr parsing. + 2.2.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate. + 2.2.1 - Add Contract Date to NewChceckingActivity Model + 2.2.2 - Remove unused fields from NewCheckingccountActivity Model + 2.2.3 - Add debt protection info to loan model + 2.3.0 - Add DealerUpdateAmount model + 2.3.1 - Add debt protection eligiblity info to loan model + 2.3.2 - Update Loan Originating Person Field Name + 2.3.3 - Removing AccountAudit model, it is no longer used + 2.4.0 - Add ActivityAccountDetail model and request + 2.5.0 - Add OrgNbr to Card Activities and Make Pers and Org Number strings + 2.6.0 - Add New Activity Manager Incentive Activity Query + 2.7.0 - Add Member Name and Balance to Activity Query and Models + 2.8.0 - Change AccountuserFieldRequest name. + 2.9.0 - Updating agreement to remove some fields and include org fields + 2.10.0 - Add of PersonPostalAddress and PersonAddressInfo + 2.11.0 - Add AccessChannelPerson and Update AgreePerson model. + 2.12.0 - Added AccessType model, added list of accesstype to AccessChannelPerson, and added new AccessTypeUpdateRequest + 2.13.0 - Update CoreModels Account model's StatementAccountNumber to be long. + 2.14.0 - Added models BasicResponse, DetailType, and PersonAgreementDetailTypeRequest. + 2.15.0 - AccesschannelPerson Id created if null and add UserId to AccessTypes model. + 2.16.0 - Update Activity queries/models to include contact info metadata + 2.17.0 - Add Oganization model. + 2.18.0 - Add of OrganizationTaxIdDataResponse and PersonTaxIdDataResponse + 2.19.0 - Update PersonTaxIdDataResponse to include additional name fields + 2.20.0 - Add Debt Protection info to ActivityAccountDetail + 2.21.0 - Add External Transaction Description + 2.22.0 - Refactor Property > Value to be double instead of int + 2.23.0 - Add AccountBranchUpdateRequest model + 2.24.0 - Add FundRequest, FundsToAccountRequest models + 2.25.0 - Add AccountOwnership model + 2.26.0 - Add AccountLtvUpdateRequest model + 2.26.1 - Remove UserID from AccountOwnership model + 2.26.2 - Add Role to AccountOwnership model + 2.26.3 - Add AccountAnalysisGroup models + 2.26.4 - Adding OrganizationSearchRequest + 2.26.5 - Add Person User Field models + 2.26.6 - Add Person/Org accounts and OrgMaintenance models + 2.26.7 - Add AccountNickNameUpdateRequest model + 2.26.8 - Add PersonOrganization model + 2.26.9 - Update PersonOrganization model to include entity name + 2.26.10 - Add PersonAddrLine model for AddressLine update logic + 2.27.0 - Add model for AccountCreditReportTypeUpdateRequest + 2.27.1 - Add PropertyUserField Model + 2.27.2 - Updated PropertyUserField Model + 2.27.3 - Added EStatementDelivery Model + 2.27.4 - Updated Property Model + 2.27.5 - Add AssociateDetails model + 2.27.6 - Add LoanPayoff model + 2.27.7 - Update LoanPayoff Model to include VehicleYear + 2.27.8 - Update namespace + 2.27.9 - Add PersonRecentActivity model + 2.27.10 - Update LoanPayoff Model to change lenderid and exclusions to strings + 2.27.11 - Update PersonRecentActivity model + 2.27.12 - Add PersonRecentActivityResponse model + 2.27.13 - Add PersonName to PersonRecentActivity + 2.27.14 - Add AccountsByMajorMinorBranchAndStatus models + 2.27.15 - Add models for AccountsByRecentTransactions + 2.27.16 - Add AccountContractDateUpdateRequest model + 2.27.17 - Add TransactionAlertInfo model + 2.27.18 - Update TransactionAlertInfo model + 2.27.19 - Update TransactionAlertInfo model + 2.27.20 - Add to RequestIncludeConstants + 2.27.21 - Update TransactionConstants + 2.27.22 - Update PersonActivity model + + + 1.0.0 - Initial Setup + 1.1.0 - Removal of the Configuration models and ConnectionModels. + 1.1.1 - Adding models for IndirectLoans + 1.1.2 - Added ClosedIndirectLoan model + 1.1.3 - Addition of ApplicationHistoryRequest and ApplicationHistory models + 1.1.4 - Update to IndirectLoanDetail model + 1.1.5 - Update to InidrectLoanDetail model + 1.1.6 - Add Saf User Model + 1.1.7 - Added QueueApplicationParameter Model and List<QueueApplicationParameter> to ApplicationHistory. + 1.1.8 - Fix QueueApplicationParameter ParameterValue to be CamelCase. + 1.1.9 - Added AgreeUserAccount model + 1.2.1 - Fix Activity Models, Add Activity Manager Model + 1.2.2 - Update to IndirectLoanExport model, Add BalanceType, Fund, MonetaryTransaction + 1.2.3 - Update NewCheckingSaleActivity model to include branch name + 1.2.4 - Added AccountUserField and AccountUserFieldUpdateRequest models + 1.2.5 - Updating AgreementDeliveryMethodRequest to be AccountMaintenanceRequest + 1.2.6 - Added OriginalTermInDays to IndirectLoanDetail + 1.2.7 - added major account type to agreementAccount + 1.3.0 - Add NewLoanSaleActivity For Mortgages + 1.3.1 - Add UserId to AgreementAccount + 1.3.2 - Add new AccountAudit object + 1.3.3 - Add new Transaction objects + 1.4.0 - Add Vehicle Loan Sale Models + 1.4.1 - Update Transaction Indirect Loan objects + 2.0.0 - Refactor model namespaces + 2.1.0 - TransactionHistoryDetail added Funds and deleted unneeded LcuModels Loans models. + 2.1.1 - Update Referral Activity Model. Add Account Info. + 2.2.0 - ApplciationHistory and ApplicationHistoryRequest change to use effectivedate. + 2.2.1 - Add Contract Date to NewChceckingActivity Model + 2.2.2 - Remove unused fields from NewCheckingccountActivity Model + 2.2.3 - Add debt protection info to loan model + 2.3.0 - Add DealerUpdateAmount model + 2.3.1 - Add debt protection eligiblity info to loan model + 2.3.2 - Update Loan Originating Person Field Name + 2.3.3 - Removing AccountAudit model, it is no longer used + 2.4.0 - Add ActivityAccountDetail model and request + 2.5.0 - Add OrgNbr to Card Activities and Make Pers and Org Number strings + 2.6.0 - Add New Activity Manager Incentive Activity Query + 2.7.0 - Add Member Name and Balance to Activity Query and Models + 2.8.0 - Change AccountuserFieldRequest name. + 2.9.0 - Updating agreement to remove some fields and include org fields + 2.10.0 - Add of PersonPostalAddress and PersonAddressInfo + 2.11.0 - Add AccessChannelPerson and Update AgreePerson model. + 2.12.0 - Added AccessType model, added list of accesstype to AccessChannelPerson, and added new AccessTypeUpdateRequest + 2.13.0 - Update CoreModels Account model's StatementAccountNumber to be long. + 2.14.0 - Added models BasicResponse, DetailType, and PersonAgreementDetailTypeRequest. + 2.15.0 - AccesschannelPerson Id created if null and add UserId to AccessTypes model. + 2.16.0 - Update Activity queries/models to include contact info metadata + 2.17.0 - Add Oganization model. + 2.18.0 - Add of OrganizationTaxIdDataResponse and PersonTaxIdDataResponse + 2.19.0 - Update PersonTaxIdDataResponse to include additional name fields + 2.20.0 - Add Debt Protection info to ActivityAccountDetail + 2.21.0 - Add External Transaction Description + 2.22.0 - Refactor Property > Value to be double instead of int + 2.23.0 - Add AccountBranchUpdateRequest model + 2.24.0 - Add FundRequest, FundsToAccountRequest models + 2.25.0 - Add AccountOwnership model + 2.26.0 - Add AccountLtvUpdateRequest model + 2.26.1 - Remove UserID from AccountOwnership model + 2.26.2 - Add Role to AccountOwnership model + 2.26.3 - Add AccountAnalysisGroup models + 2.26.4 - Adding OrganizationSearchRequest + 2.26.5 - Add Person User Field models + 2.26.6 - Add Person/Org accounts and OrgMaintenance models + 2.26.7 - Add AccountNickNameUpdateRequest model + 2.26.8 - Add PersonOrganization model + 2.26.9 - Update PersonOrganization model to include entity name + 2.26.10 - Add PersonAddrLine model for AddressLine update logic + 2.27.0 - Add model for AccountCreditReportTypeUpdateRequest + 2.27.1 - Add PropertyUserField Model + 2.27.2 - Updated PropertyUserField Model + 2.27.3 - Added EStatementDelivery Model + 2.27.4 - Updated Property Model + 2.27.5 - Add AssociateDetails model + 2.27.6 - Add LoanPayoff model + 2.27.7 - Update LoanPayoff Model to include VehicleYear + 2.27.8 - Update namespace + 2.27.9 - Add PersonRecentActivity model + 2.27.10 - Update LoanPayoff Model to change lenderid and exclusions to strings + 2.27.11 - Update PersonRecentActivity model + 2.27.12 - Add PersonRecentActivityResponse model + 2.27.13 - Add PersonName to PersonRecentActivity + 2.27.14 - Add AccountsByMajorMinorBranchAndStatus models + 2.27.15 - Add models for AccountsByRecentTransactions + 2.27.16 - Add AccountContractDateUpdateRequest model + 2.27.17 - Add TransactionAlertInfo model + 2.27.18 - Update TransactionAlertInfo model + 2.27.19 - Update TransactionAlertInfo model + 2.27.20 - Add to RequestIncludeConstants + 2.27.21 - Update TransactionConstants + 2.27.22 - Update PersonActivity model + + + + + + + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Account/ActivityAccountDetailsRequest.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Account/ActivityAccountDetailsRequest.cs new file mode 100644 index 0000000..4bc9a87 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Account/ActivityAccountDetailsRequest.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Account +{ + public class ActivityAccountDetailsRequest + { + public List AccountNumbers { get; set; } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivity.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivity.cs new file mode 100644 index 0000000..9cf3f0a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivity.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity +{ + public class PersonRecentActivity + { + public long PersonNumber { get; set; } + public string PersonName { get; set; } + public long MemberNumber { get; set; } + public string HomePhone { get; set; } + public string CellPhone { get; set; } + public string BusinessPhone { get; set; } + public DateTime? LastShareAcctWithdrawalTime { get; set; } + public DateTime? LastShareDepositDate { get; set; } + public decimal? LastShareDepositAmount { get; set; } + public string VehicleYearMakeModelVin { get; set; } + public string PassPhrase { get; set; } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivityResponse.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivityResponse.cs new file mode 100644 index 0000000..b45afca --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Activity/PersonRecentActivityResponse.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Activity +{ + public class PersonRecentActivityResponse + { + public bool Success { get; set; } + public string Message { get; set; } + public PersonRecentActivity? PersonRecentActivity { get; set; } + } +} + diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Addresses/Address.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Addresses/Address.cs new file mode 100644 index 0000000..1c10cab --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Addresses/Address.cs @@ -0,0 +1,25 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Addresses +{ + public class Address + { + public int AddressId { get; set; } + public string Line1 { get; set; } + public string Line2 { get; set; } + public string Line3 { get; set; } + public string City { get; set; } + public string State { get; set; } + public string ZipCode { get; set; } + public string Country { get; set; } + public string CountyName { get; set; } + public string AddressType { get; set; } + public bool IsPrimary { get; set; } + public bool IsInternational { get; set; } + public int AddressVerification { get; set; } + public string Occupancy { get; set; } + public DateTime StartDate { get; set; } + public DateTime EndDate { get; set; } + public bool UspsVerified { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Branches/Branch.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Branches/Branch.cs new file mode 100644 index 0000000..b8cbb42 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Branches/Branch.cs @@ -0,0 +1,8 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Branches +{ + public class Branch + { + public int BranchId { get; set; } + public string BranchName { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/CollateralDetail.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/CollateralDetail.cs new file mode 100644 index 0000000..1a3cf03 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/CollateralDetail.cs @@ -0,0 +1,26 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals +{ + public class CollateralDetail + { + public int CollateralId { get; set; } + public int OwnerId { get; set; } + public string OwnerName { get; set; } + public string CollateralType { get; set; } + public string NameOnTitle { get; set; } + public string Description { get; set; } + public decimal PurchasePrice { get; set; } + public decimal CurrentValue { get; set; } + public string SourceOfEvaluation { get; set; } + public DateTime EvaluationDate { get; set; } + public int ValueVerifiedByOperatorNumber { get; set; } + public string ValueVerifiedByOperatorName { get; set; } + public string VerificationMethod { get; set; } + public System.DateTime VerificationDate { get; set; } + public int VerifiedBy { get; set; } + public string SerialNumber { get; set; } + public Vehicle Vehicle { get; set; } + public OtherCollateral Other { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/OtherCollateral.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/OtherCollateral.cs new file mode 100644 index 0000000..c729e92 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/OtherCollateral.cs @@ -0,0 +1,7 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals +{ + public class OtherCollateral + { + public string MiscellaneousInformation { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/Vehicle.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/Vehicle.cs new file mode 100644 index 0000000..25b29bb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Collaterals/Vehicle.cs @@ -0,0 +1,20 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Collaterals +{ + public class Vehicle + { + public string VIN { get; set; } + public int Year { get; set; } + public string Make { get; set; } + public string Model { get; set; } + public string LicensePlate { get; set; } + public string LicenseState { get; set; } + public string CountryLicensed { get; set; } + public int Mileage { get; set; } + public string BodyStyle { get; set; } + public string Color { get; set; } + public string KeyCode { get; set; } + public string SellerName { get; set; } + public decimal LowBookValue { get; set; } + public decimal HighBookValue { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Individuals/Individual.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Individuals/Individual.cs new file mode 100644 index 0000000..7a80f2f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Individuals/Individual.cs @@ -0,0 +1,44 @@ +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Addresses; +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Phones; +using System; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Individuals +{ + public class Individual + { + public int IndividualId { get; set; } + public string IndividualType { get; set; } + public string Title { get; set; } + public string FirstName { get; set; } + public string MiddleName { get; set; } + public string LastName { get; set; } + public string NameSuffix { get; set; } + public string TaxId { get; set; } + public string Gender { get; set; } + public DateTime BirthDate { get; set; } + public int Branch { get; set; } + public string DriversLicense { get; set; } + public string DriversLicenseState { get; set; } + public string Ident { get; set; } + public string PreferredContact { get; set; } + public string MaritalStatus { get; set; } + public bool IsUSCitizen { get; set; } + public int PrimaryAddressId { get; set; } + public bool IsEmployee { get; set; } + public int EmployeeNumber { get; set; } + public string CompanyName { get; set; } + public string EmployerName { get; set; } + public int ApplicationCountLast90Days { get; set; } + public int ApplicationsDeclinedLast90Days { get; set; } + public int ApplicationsApprovedLast90Days { get; set; } + public List
Address { get; set; } + public string Email1 { get; set; } + public string Email2 { get; set; } + public List Phone { get; set; } + public string Status { get; set; } + public bool IsHomeOwner { get; set; } + public bool IsHeadOfHouseHold { get; set; } + public string Language { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/LoanPayoff/LoanPayoff.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/LoanPayoff/LoanPayoff.cs new file mode 100644 index 0000000..d4a7daf --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/LoanPayoff/LoanPayoff.cs @@ -0,0 +1,50 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.LoanPayoff +{ + public class LoanPayoff + { + public long AccountNumber { get; set; } + public string Exclusions { get; set; } + public int Account { get; set; } + public string LenderID { get; set; } + public string OptOutCode { get; set; } + public string FirstName { get; set; } + public string MiddleName { get; set; } + public string LastName { get; set; } + public string Address1 { get; set; } + public string Address2 { get; set; } + public string City { get; set; } + public string State { get; set; } + public int ZipCode { get; set; } + public int HomePhone { get; set; } + public int BusinessPhone { get; set; } + public string VehicleVin { get; set; } + public string VehicleYear { get; set; } + public string VehicleMake { get; set; } + public string VehicleModel { get; set; } + public string VehicleTrim { get; set; } + public string VehicleDescription { get; set; } + public string Product { get; set; } + public string SubProduct { get; set; } + public decimal NetPayoffAmount { get; set; } + public string GoodUntilDate { get; set; } + public string MaturityDate { get; set; } + public int TermInMonths { get; set; } + public int MonthsLeft { get; set; } + public string NextPaymentDate { get; set; } + public decimal MonthlyPayment { get; set; } + public decimal GrossPayoff { get; set; } + public decimal SecurityDeposit { get; set; } + public decimal ResidualValue { get; set; } + public decimal DollarDayRate { get; set; } + public decimal BalloonAmount { get; set; } + public string PayoffMessage { get; set; } + public string PreApprovedCode { get; set; } + public string ReferenceNumber { get; set; } + public string ExpirationDate { get; set; } + public decimal BuyRate { get; set; } + public decimal AcquisitionFee { get; set; } + public int ParticipationPercent { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanDetail.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanDetail.cs new file mode 100644 index 0000000..2bc33aa --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanDetail.cs @@ -0,0 +1,256 @@ +using System; +using System.Collections.Generic; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans +{ + public class LoanDetail + { + public long MemberId { get; set; } + public int LoanId { get; set; } + public long ExternalLoanId { get; set; } + public int[] IndividualId { get; set; } + public List Borrowers { get; set; } + public string LoanType { get; set; } + public string Title { get; set; } + public string Alerts { get; set; } + public string Product { get; set; } + public int ProductCode { get; set; } + public string Template { get; set; } + public int ProductId { get; set; } + public string ProductDescription { get; set; } + public string ProductCategory { get; set; } + public string ProductClass { get; set; } + public int AccountType { get; set; } + public string Status { get; set; } + public DateTime ClosedDate { get; set; } + public string Category { get; set; } + public string Classification { get; set; } + public string MetroAcctType { get; set; } + public string SMSA { get; set; } + public string Officer { get; set; } + public string OtherSecurity { get; set; } + public string NoteNumber { get; set; } + public DateTime LastMaintenance { get; set; } + public DateTime WrittenOffDate { get; set; } + public string CreditCardNumber { get; set; } + public DateTime LastCycleDate { get; set; } + public string LegalDescription { get; set; } + public string PropertyType { get; set; } + public string PurposeCode { get; set; } + public string CollateralCode { get; set; } + public string RefinanceCount { get; set; } + public DateTime LastRefinanceDate { get; set; } + public string LdcNumber { get; set; } + public string Messages { get; set; } + public decimal OriginalAmount { get; set; } + public DateTime OriginationDate { get; set; } + public decimal Balance { get; set; } + public decimal AvailableBalance { get; set; } + public decimal Limit { get; set; } + public decimal EscrowBalance { get; set; } + public decimal Payoff { get; set; } + public decimal UnappliedFundsBalance { get; set; } + public decimal CashAdvanceBalance { get; set; } + public decimal PurchaseAdvanceBalance { get; set; } + public decimal ActiveAuthorizationAmount { get; set; } + public decimal EscrowDividends { get; set; } + public string PledgeType { get; set; } + public string MiscCharge1 { get; set; } + public string MiscCharge2 { get; set; } + public string MiscCharge3 { get; set; } + public string MiscChargeCode1 { get; set; } + public string MiscChargeCode2 { get; set; } + public string MiscChargeCode3 { get; set; } + public decimal InterestMemoed { get; set; } + public DateTime InterestAccruedDate { get; set; } + public decimal PaymentInterestDue { get; set; } + public decimal PayoffInterestDue { get; set; } + public string LateChargeMethod { get; set; } + public decimal LateCharge { get; set; } + public DateTime LateChargeDate { get; set; } + public decimal CashAdvance { get; set; } + public string Insurance { get; set; } + public decimal LastStatementLateCharges { get; set; } + public decimal LastStatementMiscFees { get; set; } + public decimal LastStatementPurchaseAdvances { get; set; } + public decimal LastStatementCashAdvances { get; set; } + public decimal LastStatementCashAdvanceFees { get; set; } + public decimal LastStatementMiscDebits { get; set; } + public decimal LastStatementTotalPayments { get; set; } + public decimal LastStatementCreditsPosted { get; set; } + public decimal LastStatementAccruedInterest { get; set; } + public DateTime LastStatementDate { get; set; } + public decimal LastStatementPurchaseAdvanceBalance { get; set; } + public decimal LastStatementEndingBalance { get; set; } + public decimal DelinquentAmount { get; set; } + public decimal LastStatementMonthlyMinimum { get; set; } + public decimal LastStatementRequiredDue { get; set; } + public decimal LastStatementRequiredPayment { get; set; } + public decimal ScheduledPayment { get; set; } + public DateTime NextDueDate { get; set; } + public decimal PartialPaymentAmount { get; set; } + public DateTime PreviousDate { get; set; } + public string PaymentFrequency { get; set; } + public DateTime AlignmentDate { get; set; } + public string PaymentMethod { get; set; } + public string SourceAccount { get; set; } + public string ProcessingGroup { get; set; } + public DateTime LoanCouponDate { get; set; } + public decimal RequiredPaymentDue { get; set; } + public DateTime FirstPaymentDate { get; set; } + public decimal AlternatePaymentAmount { get; set; } + public DateTime AlternateBeginDate { get; set; } + public DateTime AlternateEndDate { get; set; } + public int PaymentSkips { get; set; } + public decimal FinalPaymentAmount { get; set; } + public DateTime FinalPaymentDate { get; set; } + public decimal CycleAmount { get; set; } + public string VariableRatePaymentChange { get; set; } + public string VariableRateCode { get; set; } + public decimal MinimumDue { get; set; } + public decimal FrequencyPayment { get; set; } + public decimal EscrowPayment { get; set; } + public decimal PrincipalAndInterestPayment { get; set; } + public string PaymentLoanDefinitionNumber { get; set; } + public string RateLoanDefinitionNumber { get; set; } + public int VacationWeeks { get; set; } + public int PayrollRepaidWeeklyPaymentCount { get; set; } + public decimal BaseRate { get; set; } + public decimal TieredRateAdj { get; set; } + public decimal ManualRateAdj { get; set; } + public decimal Rate { get; set; } + public decimal ManualRate { get; set; } + public decimal APR { get; set; } + public decimal OriginalInterestRate { get; set; } + public decimal AlternateInterestRate { get; set; } + public DateTime LastRateChange { get; set; } + public decimal RealEstateMargin { get; set; } + public string Amortization { get; set; } + public int AmortizationTerm { get; set; } + public int MonthlyTerm { get; set; } + public int NumberOfPayments { get; set; } + public decimal InterestYTD { get; set; } + public decimal InterestPYTD { get; set; } + public decimal InterestDaily { get; set; } + public decimal PrincipalYTD { get; set; } + public decimal PrincipalPYTD { get; set; } + public decimal LateChargeYTD { get; set; } + public decimal LateChargePYTD { get; set; } + public string PaymentHistory { get; set; } + public DateTime LastPaymentDue { get; set; } + public int PaymentsPastDue { get; set; } + public int DaysPastDue { get; set; } + public int MonthsPastDue { get; set; } + public decimal CurrentStatementLateCharges { get; set; } + public decimal CurrentStatementMiscFees { get; set; } + public decimal CurrentStatementPurchaseAdvances { get; set; } + public decimal CurrentStatementCashAdvances { get; set; } + public decimal CurrentStatementCashAdvanceFees { get; set; } + public decimal CurrentStatementMiscDebits { get; set; } + public decimal CurrentStatementTotalPayments { get; set; } + public decimal CurrentStatementTotalCredits { get; set; } + public DateTime DelinquentPaymentDueDate { get; set; } + public bool IsInactive { get; set; } + public string StatementFrequency { get; set; } + public decimal AppraisedValue { get; set; } + public int LocCycleDay { get; set; } + public bool IgnorePledge { get; set; } + public bool OpenEndPlan { get; set; } + public string OpenEndCategory { get; set; } + public decimal PointsPaid { get; set; } + public decimal CurtailmentAmount { get; set; } + public DateTime CurtailmentDate { get; set; } + public DateTime InsuranceExpirationDate { get; set; } + public string LifeInsuranceMI { get; set; } + public string DisabilityInsuranceMI { get; set; } + public string LifeActivityInsuranceCode { get; set; } + public string DisabilityActivityInsuranceCode { get; set; } + public bool LoanCoupons { get; set; } + public bool PaidbyGrace { get; set; } + public string EscrowAccount { get; set; } + public bool EscrowInterestPaid { get; set; } + public DateTime NextPaymentAdjustmentDate { get; set; } + public decimal EffectivePayment { get; set; } + public decimal InterestRate { get; set; } + public DateTime LastPaymentDate { get; set; } + public DateTime LastPurchaseDate { get; set; } + public DateTime LastCashAdvanceDate { get; set; } + public string BlockCode { get; set; } + public string ReclassCode { get; set; } + public int OutstandingAuthCount { get; set; } + public decimal OutstandingAuthAmount { get; set; } + public string InterestType { get; set; } + public string AlternateLoanNumber { get; set; } + public int ArmIndex { get; set; } + public string DeductionOption { get; set; } + public bool DelinquentPaymentSkips { get; set; } + public bool FirstPayment { get; set; } + public decimal InterestDue { get; set; } + public bool LoanLevelSkips { get; set; } + public bool PaymentReduction { get; set; } + public bool WaiveLateCharge { get; set; } + public int ExcessPaymentTargetAccountId { get; set; } + public long ExcessPaymentMemberId { get; set; } + public bool CustRate { get; set; } + public string IntRateMethod { get; set; } + public decimal Margin { get; set; } + public string Index { get; set; } + public decimal RndFactPct { get; set; } + public string RndFactOpt { get; set; } + public decimal IntRateCeiling { get; set; } + public decimal IntRateFloor { get; set; } + public decimal MaxDnRateChgLife { get; set; } + public decimal MaxUpRateChgLife { get; set; } + public decimal MaxDnRateChgPeriod { get; set; } + public decimal MaxUpRateChgPeriod { get; set; } + public decimal MinDnRateChgPeriod { get; set; } + public decimal MinUpRateChgPeriod { get; set; } + public short PmtAdjPeriod { get; set; } + public short DaysPriorToPeriodicRateAdj { get; set; } + public short DaysPriorToInitialRateAdjustment { get; set; } + public bool FirstAdjustmentIsEstimate { get; set; } + public System.DateTime InitialAnalysisEstimateDate { get; set; } + public string EstimatePerformed { get; set; } + public int BalloonTerm { get; set; } + public string PledgeTypeDescription { get; set; } + public string SystemApproved { get; set; } + public string[] VINList { get; set; } + public long? MortgageLoanOriginator { get; set; } + public decimal? LastPaymentPrincipal { get; set; } + public decimal? LastPaymentInterest { get; set; } + public decimal? LastPaymentFees { get; set; } + public decimal? LastPaymentLateCharges { get; set; } + public decimal? LastPaymentEscrowImpound { get; set; } + public decimal? LastPaymentCurtailment { get; set; } + public decimal? LastPaymentTotal { get; set; } + public short TransferDay { get; set; } + public long SourceMember { get; set; } + public bool AdjustPurchaseAccrual { get; set; } + public bool AnnualFee { get; set; } + public DateTime AnnualFeeDate { get; set; } + public decimal BalaceLimit { get; set; } + public bool CloseOnZero { get; set; } + public DateTime DrawDate { get; set; } + public string Form1098Option { get; set; } + public bool MethodADelinquency { get; set; } + public short? NumberofSkips { get; set; } + public decimal OverlimitAmount { get; set; } + public DateTime OverlimitDate { get; set; } + public decimal PurchaseAdvBalance { get; set; } + public DateTime SkipDate { get; set; } + public bool ToBeDelinquent { get; set; } + public bool WaiveDelinquencyNotice { get; set; } + public bool WaiveBillingNotice { get; set; } + public bool WaiveInterest { get; set; } + public decimal LastStatementMinimumPayment { get; set; } + public decimal LastStatementCycleRequiredPayment { get; set; } + public bool ExemptNonResident { get; set; } + public string YTDNonresidentWithholding { get; set; } + public string PYTDNonresidentWithholding { get; set; } + public string InCollection { get; set; } + public string UniversalLoanId { get; set; } + public DateTime RateLockDate { get; set; } + public string ActiveStopPays { get; set; } + public string[] ErrorMessage { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanOwner.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanOwner.cs new file mode 100644 index 0000000..6266030 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Loans/LoanOwner.cs @@ -0,0 +1,19 @@ +using System; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Loans +{ + public class LoanOwner + { + public int IndividualId { get; set; } + public string Name { get; set; } + public string Type { get; set; } + public string Address { get; set; } + public string TaxId { get; set; } + public string Association { get; set; } + public DateTime LastAssociationCodeChangedDate { get; set; } + public string Metro2ConsumerInformationIndicator { get; set; } + public bool CoborrowerIsSpouse { get; set; } + public decimal OwnershipPercentage { get; set; } + public string PercentageDescription { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/Member.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/Member.cs new file mode 100644 index 0000000..bc3b67c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/Member.cs @@ -0,0 +1,57 @@ +using LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Addresses; + +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members +{ + // Some "Depth" fields commented out as they don't serve a purpose at this time. + public class Member + { + public long MemberId { get; set; } + public string MemberName { get; set; } + public int PrimaryIndividualId { get; set; } + public string MemberType { get; set; } + public string Affiliation { get; set; } + public System.DateTime MemberSince { get; set; } + public string Miscellaneous1 { get; set; } + public string Miscellaneous2 { get; set; } + public string OriginalOpenBranch { get; set; } + public string WithholdingCode { get; set; } + public decimal ExpeditedFunds { get; set; } + public System.DateTime ExpeditedFundsDate { get; set; } + public int AccessLevel { get; set; } + public int StandardStatementCycle { get; set; } + public string StandardStatementCode { get; set; } + public string StandardStatementMethod { get; set; } + public int CATFeeCounter { get; set; } + public System.DateTime CATFeeDate { get; set; } + public int CreditCardStatementCycle { get; set; } + public string CreditCardStatementCode { get; set; } + public string CreditCardStatementMethod { get; set; } + public int AccountCount { get; set; } + public decimal AccountBalance { get; set; } + public int LoanCount { get; set; } + public decimal LoanBalance { get; set; } + public int LoansDelinquentCount { get; set; } + public decimal LoansDelinquent { get; set; } + public int LoansWrittenOffCount { get; set; } + public decimal LoansWrittenOff { get; set; } + public int LoansInCollectionCount { get; set; } + public decimal LoansInCollection { get; set; } + // public AccountSummary[] Account { get; set; } + // public LoanSummary[] Loan { get; set; } + // public CrossMemberDetails[] CrossMember { get; set; } + public string Password { get; set; } + public string PinLock { get; set; } + public int BranchId { get; set; } + public int RelationshipPricingLevel { get; set; } + public string RelationshipPricingLevelPermanent { get; set; } + public string RelationshipPricingDescription { get; set; } + public int PreviousRelationshipPricingLevel { get; set; } + public string LastRelationshipPricingLevelAnalysisDate { get; set; } + public string LastRelationshipPricingLevelChangeDate { get; set; } + public string InhibitActivity { get; set; } + public string WrittenOffLoan { get; set; } + public string LoanInCollection { get; set; } + public string PurgeMembership { get; set; } + public Address Address { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/MemberOwner.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/MemberOwner.cs new file mode 100644 index 0000000..91e36bb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Members/MemberOwner.cs @@ -0,0 +1,13 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Members +{ + public class MemberOwner + { + public int IndividualId { get; set; } + public string Name { get; set; } + public string Type { get; set; } + public string Address { get; set; } + public string TaxId { get; set; } + public string DriverLicense { get; set; } + public string BirthDate { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Phones/Phone.cs b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Phones/Phone.cs new file mode 100644 index 0000000..7988df3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/LCU.Library.Internal.CoreApiWrapperModel/LcuModels/Phones/Phone.cs @@ -0,0 +1,13 @@ +namespace LCU.Library.Internal.CoreApiWrapperModel.LcuModels.Phones +{ + public class Phone + { + public string PhoneKey { get; set; } + public bool IsPrimaryForType { get; set; } + public bool IsInternational { get; set; } + public string CountryCode { get; set; } + public string AreaCode { get; set; } + public string PhoneNumber { get; set; } + public string Extension { get; set; } + } +} diff --git a/LCU.Api.Internal.CoreApiWrapper/README.md b/LCU.Api.Internal.CoreApiWrapper/README.md new file mode 100644 index 0000000..eb2cd30 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/README.md @@ -0,0 +1,60 @@ +# Introduction +Core Api Wrapper was created to give us the ability to call the Core's Api and to query the Core's database. + +# Getting Started +1. Set appsettings to local or lower environment settings(if possible). + +# Core Api Connection +To make a Core Api call it is required that we have a DNA Token. Currently the DNA Token expires every 15 mins but this can be increased by Application Support Team in the DNA config. The following steps are performed in the CoreConnection class to get/refresh a DNA Token. + +1. Check cache if coreapiconnection is set. + a. Return if set. +2. Else Refresh Connection Cache + a. The STS Token is set by using Device Name, environment, user id, and password to call the sts end point. + b. The prelogin data is set by using STS Token and ApiChannelId + i. Note: ApiChannelId is pulled by the Application Support Team from the DNA application. + c. Prelogin returns the EffectiveDate (PostingDate), Posting Date (PostingDate), and the cashbox. + d. The DNA Token is set by using the Sts Token, ApiChannelId, BusinessTaskId, EffectiveDate, Posting Date, and CashboxNumber. + i. Note: BusinessTaskId is a default given to us by DNA. +3. Once a CoreApiConnection is fetched either by cache or refresh, the Core Api call is performed. + a. CoreRequest Class can be used to make a core Api call. + b. A new UnauthorizedRequestException is used to catch if a CoreApiConnection is no longer authorized. + i. The amount of retries is set by ReTryLimit in the AppSettings. + +# Using DNA Api Notes + +### Endpoints +* Occasionally there can be an Id in the endpoint path. This id is most often the primary key or "number" for the data trying to be retrieved. This can be seen in “/DNABusinessServices/Addresses/{AddressId}”. The AddressNumber is the AddressId. +* There is also the possibility that the "id" in the path could be a guid generated by DNA. Example for this is “/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber” +* In the TransactionHistory endpoint there is an AccountId this is a guid generated by DNA. To get this guid you must use the “/DNABusinessServices/Accounts/Query/AccountDetail” endpoint. This endpoint will return an Account model that contains an Id property. This Id property is the Guid required to be put into the “/DNABusinessServices/Accounts/{AccountId}/TransactionHistory/Query/AccountNumber” endpoint. +* Using these parameters in the root of the endpoint path can be done by: + 1. Creating the RequestRootParameters string constant. + 2. Using the HttpUtilities.ReplaceRootParameter() method. + a. HttpUtilities.ReplaceRootParameter uses the endpoint from the appsettings, the RequestRootParameter constant, and the parameter its replacing to help build out the endpoint. + +### General Request +* In most cases when making a DNA request you are required to use a RequestHeader. RequestHeader can be used to add things like Include or PayeSize properties. +* It has been found that when updating, we are required to use a model that has a MessageHeader and MessageBody. This can be done by using the CoreUpdateRequest. +* A DNA response has been found to follow a format of MessageHeader and MessageBody. The model CoreApiResponse can be used to help deserialize. If the MessageHeader is not required then in the DAO class the MessageBody can just be used to return. + +### Updating +* Updating requires using an UpdateKey to be present in the Request Header. +* Steps to make an update. Update Address is our example. + 1. We need to use a get endpoint to get the model we are trying to update. + a. The CoreApiResponse model can be used to help. + b. CoreApiResponse has a MessageHeader and a MessageBody. + a MessageHeader contains the property UpdateKey. + b. MessageBody is a generic type. This would be assigned the Address model for example. + 2. Use the UpdateKey to fill out the CoreUpdateRequest model. + a. CoreUpdateRequest has a MessageHeader and a MessageBody. + a MessageHeader contains the property UpdateKey. + b. MessageBody is a generic type. This would be assigned the Address model for example. + 3. Use DNA’s PUT endpoint with the required parameters and the CoreUpdateRequest. + +# Build and Test +Currently we are using unit tests. + +# Dictionary + +* SAF - Shared Application Framework + * This appears to be a way DNA shares data/users across several of their application offerings. The SAF controller has been added to contain queries that help track users and data across applications. diff --git a/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/install_dependencies.ps1 b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/install_dependencies.ps1 new file mode 100644 index 0000000..8b1994d --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/install_dependencies.ps1 @@ -0,0 +1 @@ +cinst -y kind diff --git a/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/kind.cluster.config b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/kind.cluster.config new file mode 100644 index 0000000..b33f889 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/kind.cluster.config @@ -0,0 +1,7 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +nodes: +- role: control-plane + extraPortMappings: + - containerPort: 30000 + hostPort: 80 diff --git a/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/setup_and_deploy.ps1 b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/setup_and_deploy.ps1 new file mode 100644 index 0000000..f41cd5e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/setup_and_deploy.ps1 @@ -0,0 +1,17 @@ +kind create cluster --config kind.cluster.config --wait 300s + +kubectl create namespace landmarkcu + +helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx +helm repo update + +helm install my-release ingress-nginx/ingress-nginx ` + --set controller.service.type=LoadBalancer ` + --set controller.service.nodePorts.http=30000 ` + --set controller.service.nodePorts.https=30001 + +docker build -t local/core-api-wrapper:1.0 .. + +kind load docker-image local/core-api-wrapper:1.0 + +kubectl apply -k ..\_deploy\overlays\local diff --git a/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/teardown.ps1 b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/teardown.ps1 new file mode 100644 index 0000000..64866e8 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/_kube_local_testing/teardown.ps1 @@ -0,0 +1 @@ +kind delete cluster diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-k8s-pipeline.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-k8s-pipeline.yaml new file mode 100644 index 0000000..671e711 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-k8s-pipeline.yaml @@ -0,0 +1,97 @@ +parameters: +- name: target_environment + displayName: Target Environment + type: string + default: qa + values: + - qa + - uat + - prd + +- name: k8s_namespace + displayName: K8s Namespace to deploy to + type: string + default: landmarkcu + values: + - landmarkcu + +variables: +- template: ./config-files/${{ parameters.target_environment }}-pvars.yaml +- name: source_branch_name + value: $[replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), '/', '-')] +- name: docker_container_repository_name + value: landmarkcu/lcu.api.internal.coreapiwrapper-coreapiwrapper + +resources: + repositories: + - repository: azdo_pipeline_templates + type: git + name: Infrastructure Platform/azdo-pipeline-templates + ref: main + +stages: +# DOTNET BUILD AND NUGET PUSH +- stage: dotnet_nuget + displayName: Restore / Build / Upload Nuget packages + jobs: + - job: build_and_push + displayName: Dotnet Nuget + pool: + name: $(pvar_azdo_agent_pool_nuget) + demands: + - msbuild + steps: + - task: DotNetCoreCLI@2 + displayName: Nuget Restore + inputs: + command: 'restore' + feedsToUse: 'select' + projects: '**/*.csproj' + vstsFeed: 'LCU-Internal' + + - task: DotNetCoreCLI@2 + displayName: Nuget Build + inputs: + command: 'build' + projects: '**/*.csproj' + arguments: '--configuration Release' + + - task: DotNetCoreCLI@2 + displayName: Nuget Test + inputs: + command: test + projects: '**/*Test.csproj' + arguments: '--configuration Release --collect "Code coverage"' + + - ${{ if eq(variables['Build.SourceBranchName'], 'develop') }}: + - task: NuGetCommand@2 + displayName: NuGet Push + inputs: + command: 'push' + packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg' + publishVstsFeed: 'LCU-Internal' + allowPackageConflicts: true + +# DOCKER BUILD AND PUSH +- template: docker-build-push.yaml@azdo_pipeline_templates + parameters: + azdo_agent_pool: $(pvar_azdo_agent_pool) + docker_registry_service_connection: $(pvar_docker_registry_service_connection) + docker_container_repository_name: $(docker_container_repository_name) + dockerfile_path: ./Dockerfile + docker_image_tags: | + build-$(Build.BuildId) + $(source_branch_name) + +# K8S DEPLOY +- template: k8s-deploy.yaml@azdo_pipeline_templates + parameters: + dependsOn: CI + condition: or(eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'main')) + azdo_agent_pool: $(pvar_azdo_agent_pool) + kubectl_version: $(pvar_kubectl_version) + k8s_service_connection: $(pvar_k8s_service_connection) + k8s_namespace: ${{ parameters.k8s_namespace }} + k8s_kustomization_path: ./kustomize/overlays/${{ parameters.target_environment }} + docker_registry_service_connection: $(pvar_docker_registry_service_connection) + docker_image_to_deploy: $(docker_container_repository_name):build-$(Build.BuildId) diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-feature-branches.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-feature-branches.yaml new file mode 100644 index 0000000..6a7b5a9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-feature-branches.yaml @@ -0,0 +1,11 @@ +trigger: + branches: + include: + - '*' + exclude: + - 'main' + - 'develop' + +extends: + template: azure-k8s-pipeline.yaml + \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-prd.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-prd.yaml new file mode 100644 index 0000000..8e66ed4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-prd.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'main' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: prd + k8s_namespace: landmarkcu diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-qa.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-qa.yaml new file mode 100644 index 0000000..30ce939 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-qa.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'develop' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: qa + k8s_namespace: landmarkcu diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-uat.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-uat.yaml new file mode 100644 index 0000000..e33f5d3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/azure-pipelines-uat.yaml @@ -0,0 +1,10 @@ +trigger: + branches: + include: + - 'main' + +extends: + template: azure-k8s-pipeline.yaml + parameters: + target_environment: uat + k8s_namespace: landmarkcu diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/prd-pvars.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/prd-pvars.yaml new file mode 100644 index 0000000..9b650cd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/prd-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-prd-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-prd-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/qa-pvars.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/qa-pvars.yaml new file mode 100644 index 0000000..dfc1bfb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/qa-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-qa-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-qa-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/uat-pvars.yaml b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/uat-pvars.yaml new file mode 100644 index 0000000..10d7ce3 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/azdo_pipelines/config-files/uat-pvars.yaml @@ -0,0 +1,7 @@ +--- +variables: + pvar_azdo_agent_pool: vmss-sub-df-lcu-apps-uat-lz-uscz + pvar_docker_registry_service_connection: Docker Registry LMCU + pvar_k8s_service_connection: svcon-sub-df-lcu-apps-uat-aks-k8s-uscz + pvar_kubectl_version: 1.25.9 + pvar_azdo_agent_pool_nuget: LCUOnPrem diff --git a/LCU.Api.Internal.CoreApiWrapper/cleanbuildrun.sh b/LCU.Api.Internal.CoreApiWrapper/cleanbuildrun.sh new file mode 100644 index 0000000..753f052 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/cleanbuildrun.sh @@ -0,0 +1,16 @@ +#!/bin/bash +echo "Building Core Api Wrapper Docker Image"; +dotnet clean +rm -rf LCU.Api.Internal.CoreApiWrapper/bin +rm -rf LCU.Api.Internal.CoreApiWrapper/obj +rm -rf LCU.Library.Internal.CoreApiWrapperLib/bin +rm -rf LCU.Library.Internal.CoreApiWrapperLib/obj +rm -rf LCU.Library.Internal.CoreApiWrapperModel/bin +rm -rf LCU.Library.Internal.CoreApiWrapperModel/obj +rm -rf LCU.Api.Internal.CoreApiWrapperTest/obj +rm -rf LCU.Api.Internal.CoreApiWrapperTest/bin +docker build -t landmarkcu/core-api-wrapper . +echo "Running Core Api Wrapper Docker Container"; +docker run -p 8080:80 landmarkcu/core-api-wrapper + + diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Deployment.yaml new file mode 100644 index 0000000..da1f81e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Deployment.yaml @@ -0,0 +1,44 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: core-api-wrapper-api +spec: + replicas: 3 + selector: + matchLabels: + app: core-api-wrapper-api + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + labels: + app: core-api-wrapper-api + spec: + volumes: [] + containers: + - name: core-api-wrapper-api + env: [] + volumeMounts: [] + image: core-api-wrapper-api + resources: + limits: + memory: "1536Mi" + cpu: "500m" + ports: + - containerPort: 8080 + livenessProbe: + initialDelaySeconds: 5 + periodSeconds: 5 + httpGet: + path: /api/status + port: 8080 + readinessProbe: + initialDelaySeconds: 5 + periodSeconds: 5 + httpGet: + path: /api/status + port: 8080 \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Service.yaml new file mode 100644 index 0000000..fb98795 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/Service.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: core-api-wrapper-api +spec: + selector: + app: core-api-wrapper-api + ports: + - port: 8080 + targetPort: 8080 \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/base/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..264fae4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/kustomization.yaml @@ -0,0 +1,9 @@ +resources: + - Deployment.yaml + - Service.yaml + - secrets-provider-class.yaml + - virtual-service.yaml + +images: +- name: core-api-wrapper-api + newName: landmarkcu/lcu.api.internal.coreapiwrapper-coreapiwrapper \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/base/secrets-provider-class.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/secrets-provider-class.yaml new file mode 100644 index 0000000..cee2925 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/secrets-provider-class.yaml @@ -0,0 +1,11 @@ +--- +apiVersion: secrets-store.csi.x-k8s.io/v1 +kind: SecretProviderClass +metadata: + name: core-api-wrapper-api-csi-key-vault-secrets-provider +spec: + provider: azure + parameters: + usePodIdentity: "false" + useVMManagedIdentity: "true" + tenantId: 63cd1554-2783-4a86-ae50-b9e6c21c9499 \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/base/virtual-service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/virtual-service.yaml new file mode 100644 index 0000000..b0d7b97 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/base/virtual-service.yaml @@ -0,0 +1,19 @@ +--- +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: core-api-wrapper-api +spec: + hosts: [] + gateways: + - istio-system/ingress-gateway + http: + - name: core-api-wrapper-api + match: + - uri: + prefix: / + route: + - destination: + host: core-api-wrapper-api + port: + number: 8080 diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/kustomization.yaml new file mode 100644 index 0000000..0ae1552 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: Deployment + path: set_secrets_deployment.yaml + - target: + kind: SecretProviderClass + path: set_secrets_provider.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml new file mode 100644 index 0000000..6754b85 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_deployment.yaml @@ -0,0 +1,105 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: core-api-wrapper-api-secrets + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: normal-core-api-wrapper-api-csi-key-vault-secrets-provider + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-api-wrapper-api-key.json + readOnly: true + subPath: core-api-wrapper-core-api-wrapper-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-soap-api-wrapper-api-key.json + readOnly: true + subPath: core-api-wrapper-core-soap-api-wrapper-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-remote-deposit-capture-api-key.json + readOnly: true + subPath: core-api-wrapper-remote-deposit-capture-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-reserve-management-system-api-key.json + readOnly: true + subPath: core-api-wrapper-reserve-management-system-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-member-preferences-api-key.json + readOnly: true + subPath: core-api-wrapper-member-preferences-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-data-cleanup-api-key.json + readOnly: true + subPath: core-api-wrapper-data-cleanup-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-client-secret-id.json + readOnly: true + subPath: core-api-wrapper-client-secret-id + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-environment-from-vault.json + readOnly: true + subPath: core-api-wrapper-environment-from-vault + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-seq-api-key.json + readOnly: true + subPath: core-api-wrapper-seq-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-temenos-action-handler-api-key.json + readOnly: true + subPath: core-api-wrapper-temenos-action-handler-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-relying-password.json + readOnly: true + subPath: core-api-wrapper-core-relying-password + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-database-connection-string.json + readOnly: true + subPath: core-api-wrapper-core-database-connection-string \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_provider.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_provider.yaml new file mode 100644 index 0000000..061c23e --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/normal/set_secrets_provider.yaml @@ -0,0 +1,52 @@ +- op: add + path: /spec/parameters/objects + value: | + array: + - | + objectName: core-api-wrapper-environment-from-vault + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-client-secret-id + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-data-cleanup-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-seq-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-member-preferences-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-reserve-management-system-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-remote-deposit-capture-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-core-api-wrapper-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-core-soap-api-wrapper-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-temenos-action-handler-api-key + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-core-relying-password + objectType: secret + objectVersion: "" + - | + objectName: core-api-wrapper-core-database-connection-string + objectType: secret + objectVersion: "" \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/kustomization.yaml new file mode 100644 index 0000000..0ae1552 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: Deployment + path: set_secrets_deployment.yaml + - target: + kind: SecretProviderClass + path: set_secrets_provider.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_deployment.yaml new file mode 100644 index 0000000..950780a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_deployment.yaml @@ -0,0 +1,105 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: core-api-wrapper-api-secrets + csi: + driver: secrets-store.csi.k8s.io + readOnly: true + volumeAttributes: + secretProviderClass: scanbi-core-api-wrapper-api-csi-key-vault-secrets-provider + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-api-wrapper-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-core-api-wrapper-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-soap-api-wrapper-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-core-soap-api-wrapper-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-remote-deposit-capture-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-remote-deposit-capture-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-reserve-management-system-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-reserve-management-system-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-member-preferences-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-member-preferences-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-data-cleanup-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-data-cleanup-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-client-secret-id.json + readOnly: true + subPath: scanbi-core-api-wrapper-client-secret-id + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-environment-from-vault.json + readOnly: true + subPath: scanbi-core-api-wrapper-environment-from-vault + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-seq-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-seq-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-temenos-action-handler-api-key.json + readOnly: true + subPath: scanbi-core-api-wrapper-temenos-action-handler-api-key + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-relying-password.json + readOnly: true + subPath: scanbi-core-api-wrapper-core-relying-password + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: core-api-wrapper-api-secrets + mountPath: /vault/secrets/core-api-wrapper-core-database-connection-string.json + readOnly: true + subPath: scanbi-core-api-wrapper-core-database-connection-string \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_provider.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_provider.yaml new file mode 100644 index 0000000..e4fdddd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/keyvaults/scanbi/set_secrets_provider.yaml @@ -0,0 +1,52 @@ +- op: add + path: /spec/parameters/objects + value: | + array: + - | + objectName: scanbi-core-api-wrapper-environment-from-vault + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-client-secret-id + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-data-cleanup-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-seq-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-member-preferences-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-reserve-management-system-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-remote-deposit-capture-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-core-api-wrapper-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-core-soap-api-wrapper-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-temenos-action-handler-api-key + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-core-relying-password + objectType: secret + objectVersion: "" + - | + objectName: scanbi-core-api-wrapper-core-database-connection-string + objectType: secret + objectVersion: "" \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/appsettings/appsettings.json new file mode 100644 index 0000000..b59d446 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/appsettings/appsettings.json @@ -0,0 +1,7 @@ +{ + "Primary": { + "FeatureFlags": { + "DisableCoreDBWrite": false + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/kustomization.yaml new file mode 100644 index 0000000..b1b75b0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/kustomization.yaml @@ -0,0 +1,40 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +#Test istio process +namePrefix: normal- + +configMapGenerator: + - name: core-api-wrapper-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + +replacements: + - source: + kind: Deployment + fieldPath: metadata.name + targets: + - select: + kind: Deployment + fieldPaths: + - spec.selector.matchLabels.app + - spec.template.metadata.labels.app + - spec.template.spec.containers.*.name + + - select: + kind: Service + fieldPaths: + - spec.selector.app + + - select: + kind: VirtualService + fieldPaths: + - spec.http.*.route.*.destination.host + - spec.http.*.name diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/set_appsettings_deployment.yaml new file mode 100644 index 0000000..1df4d57 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal-prod/set_appsettings_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-appsettings + configMap: + name: core-api-wrapper-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-appsettings + mountPath: /app/config/workload-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/appsettings/appsettings.json new file mode 100644 index 0000000..b59d446 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/appsettings/appsettings.json @@ -0,0 +1,7 @@ +{ + "Primary": { + "FeatureFlags": { + "DisableCoreDBWrite": false + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/kustomization.yaml new file mode 100644 index 0000000..b1b75b0 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/kustomization.yaml @@ -0,0 +1,40 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +#Test istio process +namePrefix: normal- + +configMapGenerator: + - name: core-api-wrapper-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + +replacements: + - source: + kind: Deployment + fieldPath: metadata.name + targets: + - select: + kind: Deployment + fieldPaths: + - spec.selector.matchLabels.app + - spec.template.metadata.labels.app + - spec.template.spec.containers.*.name + + - select: + kind: Service + fieldPaths: + - spec.selector.app + + - select: + kind: VirtualService + fieldPaths: + - spec.http.*.route.*.destination.host + - spec.http.*.name diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/set_appsettings_deployment.yaml new file mode 100644 index 0000000..1df4d57 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/normal/set_appsettings_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-appsettings + configMap: + name: core-api-wrapper-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-appsettings + mountPath: /app/config/workload-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/appsettings/appsettings.json new file mode 100644 index 0000000..62ae91a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/appsettings/appsettings.json @@ -0,0 +1,7 @@ +{ + "Primary": { + "FeatureFlags": { + "DisableCoreDBWrite": true + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/kustomization.yaml new file mode 100644 index 0000000..3057a4f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/kustomization.yaml @@ -0,0 +1,39 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +namePrefix: scanbi- + +configMapGenerator: + - name: core-api-wrapper-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + +replacements: + - source: + kind: Deployment + fieldPath: metadata.name + targets: + - select: + kind: Deployment + fieldPaths: + - spec.selector.matchLabels.app + - spec.template.metadata.labels.app + - spec.template.spec.containers.*.name + + - select: + kind: Service + fieldPaths: + - spec.selector.app + + - select: + kind: VirtualService + fieldPaths: + - spec.http.*.route.*.destination.host + - spec.http.*.name diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/set_appsettings_deployment.yaml new file mode 100644 index 0000000..1df4d57 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi-prod/set_appsettings_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-appsettings + configMap: + name: core-api-wrapper-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-appsettings + mountPath: /app/config/workload-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/appsettings/appsettings.json new file mode 100644 index 0000000..62ae91a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/appsettings/appsettings.json @@ -0,0 +1,7 @@ +{ + "Primary": { + "FeatureFlags": { + "DisableCoreDBWrite": true + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/kustomization.yaml new file mode 100644 index 0000000..3057a4f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/kustomization.yaml @@ -0,0 +1,39 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +namePrefix: scanbi- + +configMapGenerator: + - name: core-api-wrapper-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + +replacements: + - source: + kind: Deployment + fieldPath: metadata.name + targets: + - select: + kind: Deployment + fieldPaths: + - spec.selector.matchLabels.app + - spec.template.metadata.labels.app + - spec.template.spec.containers.*.name + + - select: + kind: Service + fieldPaths: + - spec.selector.app + + - select: + kind: VirtualService + fieldPaths: + - spec.http.*.route.*.destination.host + - spec.http.*.name diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/set_appsettings_deployment.yaml new file mode 100644 index 0000000..1df4d57 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/components/workloads/scanbi/set_appsettings_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-appsettings + configMap: + name: core-api-wrapper-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-appsettings + mountPath: /app/config/workload-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/kustomization.yaml new file mode 100644 index 0000000..78e465b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/kustomization.yaml @@ -0,0 +1,8 @@ +resources: + - ../../../base +patchesStrategicMerge: + - set_appsettings_deployment.yaml + - set_secrets_provider_class.yaml +images: +- name: core-api-wrapper-api + newName: landmarkcu/lcu.api.internal.coreapiwrapper-coreapiwrapper diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_appsettings_deployment.yaml new file mode 100644 index 0000000..6431825 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_appsettings_deployment.yaml @@ -0,0 +1,12 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: core-api-wrapper-api +spec: + template: + spec: + containers: + - name: core-api-wrapper-api + env: + - name: ASPNETCORE_ENVIRONMENT + value: "Development" diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_secrets_provider_class.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_secrets_provider_class.yaml new file mode 100644 index 0000000..1245547 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/common/set_secrets_provider_class.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: secrets-store.csi.x-k8s.io/v1 +kind: SecretProviderClass +metadata: + name: core-api-wrapper-api-csi-key-vault-secrets-provider +spec: + parameters: + userAssignedIdentityID: 3286ed9a-f85c-4c50-b742-dbd3c1c3fe1f + keyvaultName: kv-lz-apps-qa-uscz diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/kustomization.yaml new file mode 100644 index 0000000..25a65b6 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - normal diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/configmap.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/configmap.yaml new file mode 100644 index 0000000..5c5b7eb --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/configmap.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: coreapiwrapperapi-configmap +data: + primary.json: | + { + "Primary": { + "SeqUrl": "https://qa-seq.lcu-internal.com", + "CorsAllowedOrigins": [ + "http://localhost:3000", + "http://lcu-internal.com", + "https://lcu-internal.com", + "https://qa-api.lcu-internal.com" + ] + } + } \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/kustomization.yaml new file mode 100644 index 0000000..6dd0c3b --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/kustomization.yaml @@ -0,0 +1,5 @@ +resources: + - configmap.yaml + - ../common +patchesStrategicMerge: + - set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/set_virtual_service.yaml new file mode 100644 index 0000000..166ee67 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/local/normal/set_virtual_service.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: core-api-wrapper-api +spec: + hosts: + - qa-core-api-wrapper-api.apps.azure.lcu-internal.com diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/appsettings/appsettings.json new file mode 100644 index 0000000..6007b86 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/appsettings/appsettings.json @@ -0,0 +1,23 @@ +{ + "Primary": { + "SeqUrl": "https://seq.lcu-internal.com" + }, + "ApiHealthCheckConfiguration": { + "VaultStatusConfiguration": { + "RunVaultStatusCheck": true, + "EnvironmentFromConfigmap": "PROD" + } + }, + "CoreConfiguration": { + "CoreApiConfiguration": { + "HostUrl": "Prodapi.dna.lcu-internal.com", + "HostPort": "10002" + }, + "CoreSoapApiConfiguration": { + "CoreSoapApiWrapperHost": "prd-core-soap-api-wrapper-api.apps.azure.lcu-internal.com" + }, + "CoreDbconfiguration":{ + "CommandTimeout": 300 + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/kustomization.yaml new file mode 100644 index 0000000..75fab81 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + - target: + kind: SecretProviderClass + path: set_secrets_provider_class.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_appsettings_deployment.yaml new file mode 100644 index 0000000..335b8be --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_appsettings_deployment.yaml @@ -0,0 +1,5 @@ +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: ASPNETCORE_ENVIRONMENT + value: "Production" \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_secrets_provider_class.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_secrets_provider_class.yaml new file mode 100644 index 0000000..816f14c --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/component/set_secrets_provider_class.yaml @@ -0,0 +1,7 @@ +- op: add + path: /spec/parameters/userAssignedIdentityID + value: 9eaefc49-e5d3-48d4-a2b9-b42cf2d8ca03 + +- op: add + path: /spec/parameters/keyvaultName + value: kv-lz-apps-prod-uscz diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/kustomization.yaml new file mode 100644 index 0000000..6d04cbc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/kustomization.yaml @@ -0,0 +1,15 @@ +resources: + - normal + - scanbi + +configMapGenerator: + - name: core-api-wrapper-environment-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_configmap_deployment.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/kustomization.yaml new file mode 100644 index 0000000..b74d310 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/keyvaults/normal + - ../../../components/workloads/normal-prod + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/set_virtual_service.yaml new file mode 100644 index 0000000..584c7f9 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/normal/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: prd-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/kustomization.yaml new file mode 100644 index 0000000..ccdb53a --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/keyvaults/scanbi + - ../../../components/workloads/scanbi-prod + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/set_virtual_service.yaml new file mode 100644 index 0000000..a30ba36 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/scanbi/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: prd-scanbi-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/set_configmap_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/set_configmap_deployment.yaml new file mode 100644 index 0000000..f018064 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/prd/set_configmap_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-environment-appsettings + configMap: + name: core-api-wrapper-environment-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-environment-appsettings + mountPath: /app/config/environment-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/appsettings/appsettings.json new file mode 100644 index 0000000..66cb543 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/appsettings/appsettings.json @@ -0,0 +1,23 @@ +{ + "Primary": { + "SeqUrl": "https://qa-seq.lcu-internal.com" + }, + "ApiHealthCheckConfiguration": { + "VaultStatusConfiguration": { + "RunVaultStatusCheck": true, + "EnvironmentFromConfigmap": "QA" + } + }, + "CoreConfiguration": { + "CoreApiConfiguration": { + "HostUrl": "UATapi.dna.lcu-internal.com", + "HostPort": "10005" + }, + "CoreSoapApiConfiguration": { + "CoreSoapApiWrapperHost": "qa-core-soap-api-wrapper-api.apps.azure.lcu-internal.com" + }, + "CoreDbconfiguration":{ + "CommandTimeout": 60 + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/kustomization.yaml new file mode 100644 index 0000000..75fab81 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + - target: + kind: SecretProviderClass + path: set_secrets_provider_class.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_appsettings_deployment.yaml new file mode 100644 index 0000000..818dec4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_appsettings_deployment.yaml @@ -0,0 +1,5 @@ +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: ASPNETCORE_ENVIRONMENT + value: Development \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_secrets_provider_class.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_secrets_provider_class.yaml new file mode 100644 index 0000000..8719a77 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/component/set_secrets_provider_class.yaml @@ -0,0 +1,7 @@ +- op: add + path: /spec/parameters/userAssignedIdentityID + value: 3286ed9a-f85c-4c50-b742-dbd3c1c3fe1f + +- op: add + path: /spec/parameters/keyvaultName + value: kv-lz-apps-qa-uscz diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/kustomization.yaml new file mode 100644 index 0000000..6d04cbc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/kustomization.yaml @@ -0,0 +1,15 @@ +resources: + - normal + - scanbi + +configMapGenerator: + - name: core-api-wrapper-environment-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_configmap_deployment.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/kustomization.yaml new file mode 100644 index 0000000..a1e6b06 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/keyvaults/normal + - ../../../components/workloads/normal + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/set_virtual_service.yaml new file mode 100644 index 0000000..b9f2fd4 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/normal/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: qa-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/kustomization.yaml new file mode 100644 index 0000000..adb2d03 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/workloads/scanbi + - ../../../components/keyvaults/scanbi + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/set_virtual_service.yaml new file mode 100644 index 0000000..d121549 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/scanbi/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: qa-scanbi-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/set_configmap_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/set_configmap_deployment.yaml new file mode 100644 index 0000000..f018064 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/qa/set_configmap_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-environment-appsettings + configMap: + name: core-api-wrapper-environment-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-environment-appsettings + mountPath: /app/config/environment-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/appsettings/appsettings.json b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/appsettings/appsettings.json new file mode 100644 index 0000000..dee9256 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/appsettings/appsettings.json @@ -0,0 +1,23 @@ +{ + "Primary": { + "SeqUrl": "https://uat-seq.lcu-internal.com" + }, + "ApiHealthCheckConfiguration": { + "VaultStatusConfiguration": { + "RunVaultStatusCheck": true, + "EnvironmentFromConfigmap": "UAT" + } + }, + "CoreConfiguration": { + "CoreApiConfiguration": { + "HostUrl": "UATapi.dna.lcu-internal.com", + "HostPort": "10005" + }, + "CoreSoapApiConfiguration": { + "CoreSoapApiWrapperHost": "uat-core-soap-api-wrapper-api.apps.azure.lcu-internal.com" + }, + "CoreDbconfiguration":{ + "CommandTimeout": 60 + } + } +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/kustomization.yaml new file mode 100644 index 0000000..75fab81 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1alpha1 +kind: Component + +patches: + - target: + kind: Deployment + path: set_appsettings_deployment.yaml + - target: + kind: SecretProviderClass + path: set_secrets_provider_class.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_appsettings_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_appsettings_deployment.yaml new file mode 100644 index 0000000..4fd0533 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_appsettings_deployment.yaml @@ -0,0 +1,5 @@ +- op: add + path: /spec/template/spec/containers/0/env/- + value: + name: ASPNETCORE_ENVIRONMENT + value: "Staging" \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_secrets_provider_class.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_secrets_provider_class.yaml new file mode 100644 index 0000000..efe4103 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/component/set_secrets_provider_class.yaml @@ -0,0 +1,7 @@ +- op: add + path: /spec/parameters/userAssignedIdentityID + value: 64ba01ed-1ecc-4c9b-b56e-8d618f2b81ce + +- op: add + path: /spec/parameters/keyvaultName + value: kv-lz-apps-uat-uscz diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/kustomization.yaml new file mode 100644 index 0000000..6d04cbc --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/kustomization.yaml @@ -0,0 +1,15 @@ +resources: + - normal + - scanbi + +configMapGenerator: + - name: core-api-wrapper-environment-appsettings + files: + - appsettings/appsettings.json +generatorOptions: + disableNameSuffixHash: true + +patches: + - target: + kind: Deployment + path: set_configmap_deployment.yaml \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/kustomization.yaml new file mode 100644 index 0000000..a1e6b06 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/keyvaults/normal + - ../../../components/workloads/normal + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/set_virtual_service.yaml new file mode 100644 index 0000000..f62f810 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/normal/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: uat-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/kustomization.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/kustomization.yaml new file mode 100644 index 0000000..adb2d03 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/kustomization.yaml @@ -0,0 +1,12 @@ +resources: + - ../../../base + +components: + - ../component + - ../../../components/workloads/scanbi + - ../../../components/keyvaults/scanbi + +patches: + - target: + kind: VirtualService + path: set_virtual_service.yaml diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/set_virtual_service.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/set_virtual_service.yaml new file mode 100644 index 0000000..b8c66c7 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/scanbi/set_virtual_service.yaml @@ -0,0 +1,3 @@ +- op: add + path: /spec/hosts/- + value: uat-scanbi-core-api-wrapper-api.apps.azure.lcu-internal.com \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/set_configmap_deployment.yaml b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/set_configmap_deployment.yaml new file mode 100644 index 0000000..f018064 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/kustomize/overlays/uat/set_configmap_deployment.yaml @@ -0,0 +1,12 @@ +- op: add + path: /spec/template/spec/volumes/- + value: + name: volume-environment-appsettings + configMap: + name: core-api-wrapper-environment-appsettings + +- op: add + path: /spec/template/spec/containers/0/volumeMounts/- + value: + name: volume-environment-appsettings + mountPath: /app/config/environment-appsettings diff --git a/LCU.Api.Internal.CoreApiWrapper/postman/Core Api Environment.postman_environment.json b/LCU.Api.Internal.CoreApiWrapper/postman/Core Api Environment.postman_environment.json new file mode 100644 index 0000000..5721c51 --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/postman/Core Api Environment.postman_environment.json @@ -0,0 +1,51 @@ +{ + "id": "8a0b769c-d731-46b7-a690-100966292e08", + "name": "Core Api Environment", + "values": [ + { + "key": "coreApiBaseUrl", + "value": "https://qa-api.lcu-internal.com/core-api-wrapper", + "type": "default", + "enabled": true + }, + { + "key": "updateKeyAccessChannel", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "updateKeyAccessType", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "apiClientName", + "value": "MembershipPreferences", + "type": "default", + "enabled": true + }, + { + "key": "apiClientKey", + "value": "85c3f03b-f412-4f8d-bc1e-438a7a69cbbe", + "type": "secret", + "enabled": true + }, + { + "key": "currentDate", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "addressNumber", + "value": "", + "type": "any", + "enabled": true + } + ], + "_postman_variable_scope": "environment", + "_postman_exported_at": "2024-02-05T20:34:19.098Z", + "_postman_exported_using": "Postman/10.22.9" +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/postman/CoreAPI Wrapper.postman_collection.json b/LCU.Api.Internal.CoreApiWrapper/postman/CoreAPI Wrapper.postman_collection.json new file mode 100644 index 0000000..5307b6f --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/postman/CoreAPI Wrapper.postman_collection.json @@ -0,0 +1,4401 @@ +{ + "info": { + "_postman_id": "9ebe5979-88d1-4205-b4a9-8cfeb76d6e67", + "name": "CoreAPI Wrapper", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "17301238" + }, + "item": [ + { + "name": "AccessChannelPersons", + "item": [ + { + "name": "Find Access Channel Person by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccessChannelPersons?personNumber=65142&activeOnly=true&includeCards=true", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccessChannelPersons" + ], + "query": [ + { + "key": "personNumber", + "value": "65142" + }, + { + "key": "activeOnly", + "value": "true" + }, + { + "key": "includeCards", + "value": "true" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Access Channel Person with Includes", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const responseJson = pm.response.json();\r", + "const updateKey = responseJson.messageHeader.updateKey;\r", + "pm.environment.set(\"updateKeyAccessChannel\", updateKey); \r", + "pm.globals.set(\"updateKeyAccessChannel\", updateKey);\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccessChannelPersons?personNumber=615944&activeOnly=true&includeCards=false&accessTypes=[\"AccessTypes\"]", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccessChannelPersons" + ], + "query": [ + { + "key": "personNumber", + "value": "615944" + }, + { + "key": "activeOnly", + "value": "true" + }, + { + "key": "includeCards", + "value": "false" + }, + { + "key": "accessTypes", + "value": "[\"AccessTypes\"]" + } + ] + } + }, + "response": [] + }, + { + "name": "Update Access Channel Person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"20433204_651742\",\r\n \"channelNumber\": 20433204,\r\n \"personNumber\": 651742,\r\n \"isActive\": true,\r\n \"nameFML\": \"Collin J Neumann\",\r\n \"nameLFM\": \"Neumann, Collin J.\",\r\n \"lastMaintained\": \"2023-10-30T14:22:24-05:00\",\r\n \"userId\": \"20433204-\",\r\n \"isPasswordChangeRequiredOnNextLogin\": false,\r\n \"isPinChangeRequiredOnNextLogin\": false,\r\n \"accessTypes\": null,\r\n \"uid\": \"BS1345668E_20433204_651742\",\r\n \"origin\": \"A\"\r\n}\r\n\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccessChannelPersons?updateKey={{updateKeyAccessChannel}}", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccessChannelPersons" + ], + "query": [ + { + "key": "updateKey", + "value": "{{updateKeyAccessChannel}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "AccessType", + "item": [ + { + "name": "Find Channel Access Type by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const responseJson = pm.response.json();\r", + "const updateKey = responseJson.messageHeader.updateKey;\r", + "pm.environment.set(\"updateKeyAccessType\", updateKey); \r", + "pm.globals.set(\"updateKeyAccessType\", updateKey);\r", + "\r", + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccessChannelPersons/getwithincludes?personNumber=89735&activeOnly=true&includeCards=false&includes=accesstypes", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccessChannelPersons", + "getwithincludes" + ], + "query": [ + { + "key": "personNumber", + "value": "89735" + }, + { + "key": "activeOnly", + "value": "true" + }, + { + "key": "includeCards", + "value": "false" + }, + { + "key": "includes", + "value": "accesstypes" + } + ] + } + }, + "response": [] + }, + { + "name": "Update Person Access Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accessType\": {\r\n \"id\": \"WWW\",\r\n \"channelNumber\": 491333,\r\n \"personNumber\": 33093,\r\n \"accessTypeCode\": \"WWW\",\r\n \"accessTypeDescription\": \"Internet\",\r\n \"isEnrolled\": false,\r\n \"userId\": null,\r\n \"isPasswordChangeRequiredOnNextLogin\": false,\r\n \"isDisclaimer\": false,\r\n \"isActive\": true,\r\n \"uid\": \"BS2C00529_491333_33093_WWW\",\r\n \"origin\": \"A\"\r\n },\r\n \"accessChannelPersonId\": \"491333_33093\",\r\n \"updateKey\": {{updateKeyAccessType}}\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccessType", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccessType" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Account", + "item": [ + { + "name": "Find Account Owners by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetOwnersByAccountNumber?accountNumber=19621297528&creationDate=2023-05-01", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetOwnersByAccountNumber" + ], + "query": [ + { + "key": "accountNumber", + "value": "19621297528" + }, + { + "key": "creationDate", + "value": "2023-05-01" + } + ] + } + }, + "response": [] + }, + { + "name": "Update Account Maintenance Delivery Method", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "[\r\n {\r\n \"accountNumber\": 19621062522,\r\n \"deliveryMethod\": \"WWW\"\r\n }\r\n]\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/AccountMaintenanceRequest", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "AccountMaintenanceRequest" + ] + } + }, + "response": [] + }, + { + "name": "Update Account Branch Code", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumber\": 19621062586,\r\n \"branchOrganizationNumber\": \"1210\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutAccountBranchCode", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutAccountBranchCode" + ] + } + }, + "response": [] + }, + { + "name": "Update Account Loan to Value", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumber\": 7013147,\r\n \"loanToValue\": 0.5\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutAccountLoanToValue", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutAccountLoanToValue" + ] + } + }, + "response": [] + }, + { + "name": "Update Account Analysis Group", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumber\": \"19621323399\",\r\n \"isGenerateAnalysisStatement\": true,\r\n \"isPrintAnalysisStatement\": true,\r\n \"isUseForServiceCharge\": true\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutAccountAnalysisGroup", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutAccountAnalysisGroup" + ] + } + }, + "response": [] + }, + { + "name": "Find Account for Group Analysis", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetAccountsForGroupAnalysis", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetAccountsForGroupAnalysis" + ] + } + }, + "response": [] + }, + { + "name": "Find Admin Branch Codes for Update", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetAdminBranchCodeChangeAccountNumbers", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetAdminBranchCodeChangeAccountNumbers" + ] + } + }, + "response": [] + }, + { + "name": "Get VIP Savings to Fund", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetVipSavingsToFund", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetVipSavingsToFund" + ] + } + }, + "response": [] + }, + { + "name": "Get Activity Account Details by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumbers\": [\r\n19621298309\r\n ]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/QueryActivityAccountDetails", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "QueryActivityAccountDetails" + ] + } + }, + "response": [] + }, + { + "name": "Find Primary Owners by Organization Name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetPrimaryOwnersByOrganizationName/Zeigler Toyota", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetPrimaryOwnersByOrganizationName", + "Zeigler Toyota" + ] + } + }, + "response": [] + }, + { + "name": "Find Primary Owners by Person Name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "Adam Smith", + "options": { + "raw": { + "language": "text" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetPrimaryOwnersByPersonName/Adam Smith", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetPrimaryOwnersByPersonName", + "Adam Smith" + ] + } + }, + "response": [] + }, + { + "name": "Add Person Account", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"PersonNumber\": 4273,\r\n \"FirstName\": \"Derek\",\r\n \"LastName\": \"Grayson\",\r\n \"SocialIdNumber\": 396196156,\r\n \"AccountDescription\": \"Test 2023\",\r\n \"BankOrganizationNumber\": 1,\r\n \"BranchOrganizationNumber\": 1101,\r\n \"CurrentMinorAccountTypeCode\": \"CK01\",\r\n \"DeliveryMethodCode\": \"PRNT\",\r\n \"MajorAccountTypeCode\": \"CK\",\r\n \"OwnershipCode\": \"S\",\r\n \"IsTaxReportedForOwner\": true,\r\n \"IsTaxReportedForSigner\": true,\r\n \"IsValid\": true,\r\n \"CurrentAccountStatusCode\": \"APPR\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PostPersonAccount", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PostPersonAccount" + ] + } + }, + "response": [] + }, + { + "name": "Add Organization Account", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"OrganizationNumber\": 36197,\r\n \"TaxIdNumber\": 611808367,\r\n \"AccountDescription\": \"Test 2023\",\r\n \"BankOrganizationNumber\": 1,\r\n \"BranchOrganizationNumber\": 1102,\r\n \"CurrentMinorAccountTypeCode\": \"CK01\",\r\n \"DeliveryMethodCode\": \"PRNT\",\r\n \"MajorAccountTypeCode\": \"CK\",\r\n \"OwnershipCode\": \"S\",\r\n \"IsTaxReportedForOwner\": true,\r\n \"IsTaxReportedForSigner\": true,\r\n \"IsValid\": true,\r\n \"CurrentAccountStatusCode\": \"APPR\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PostOrganizationAccount", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PostOrganizationAccount" + ] + } + }, + "response": [] + }, + { + "name": "Update Organization Account", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"organizationNumber\": 8893,\r\n \"controllingPersonNumber\": 168903\r\n}\r\n\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutOrganizationMaintenanceRequest", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutOrganizationMaintenanceRequest" + ] + } + }, + "response": [] + }, + { + "name": "Update Account NickName", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumber\": 19618795264,\r\n \"accountDescription\": \"Test Description\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutAccountNickNameUpdateRequest", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutAccountNickNameUpdateRequest" + ] + } + }, + "response": [] + }, + { + "name": "Update Account Credit Report Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"accountNumber\": 1281,\r\n \"creditReportType\": \"EXCL\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/PutAccountCreditReportType", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "PutAccountCreditReportType" + ] + } + }, + "response": [] + }, + { + "name": "Find Account by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetAccountByAccountNumber?accountNumber=19618795264", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetAccountByAccountNumber" + ], + "query": [ + { + "key": "accountNumber", + "value": "19618795264" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Account by Major Minor Branch and Status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Account/GetAccountsByMajorMinorBranchAndStatus?MajorTypes=SAV&MinorTypes=SV01&MinorTypes=BS01&AccountStatuses=APPR&BranchCodes=1310", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Account", + "GetAccountsByMajorMinorBranchAndStatus" + ], + "query": [ + { + "key": "MajorTypes", + "value": "SAV" + }, + { + "key": "MajorTypes", + "value": "CK", + "disabled": true + }, + { + "key": "MinorTypes", + "value": "SV01" + }, + { + "key": "MinorTypes", + "value": "BS01" + }, + { + "key": "AccountStatuses", + "value": "APPR" + }, + { + "key": "AccountStatuses", + "value": "ACT", + "disabled": true + }, + { + "key": "BranchCodes", + "value": "1310" + }, + { + "key": "BranchCodes", + "value": "1315", + "disabled": true + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "AccountUserField", + "item": [ + { + "name": "Find Account User Field by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccountUserField/?accountNumber=19618795264", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccountUserField", + "" + ], + "query": [ + { + "key": "accountNumber", + "value": "19618795264" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Account User Field by Account", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "[\r\n {\r\n \"accountNumber\": \"19620517171\",\r\n \"userFieldCode\": \"PROM\",\r\n \"value\": \"Test\"\r\n }\r\n]\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccountUserField/", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccountUserField", + "" + ] + } + }, + "response": [] + }, + { + "name": "Update Account User Field by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "[\r\n {\r\n \"accountNumber\": \"367188001\",\r\n \"userFieldCode\": \"PROM\",\r\n \"value\": null\r\n }\r\n]", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/AccountUserField/", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "AccountUserField", + "" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Activity", + "item": [ + { + "name": "Find Checking Account Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/Checking?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "Checking" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "afterActivityNumber", + "value": "", + "disabled": true + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Digital Banking Checking Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/DigitalBankingChecking?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "DigitalBankingChecking" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Atm Check Card Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/AtmCheckCard?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "AtmCheckCard" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Mortgage Account Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/MortgageAccount?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "MortgageAccount" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Vehicle Account Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/VehicleAccount?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "VehicleAccount" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find DP Eligible Account Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/DPEligibleAccounts?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "DPEligibleAccounts" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Activity Manager Incentive Referral by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/DPEligibleAccounts?newerThanDateTime={{currentDate}}&limitAmount=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "DPEligibleAccounts" + ], + "query": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + }, + { + "key": "limitAmount", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Get Referral Activity by Activity Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"activityIds\": [\r\n12367\r\n ]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/QueryActivityManagerActivity", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "QueryActivityManagerActivity" + ] + } + }, + "response": [] + }, + { + "name": "Find EStatement Delivery Activity by Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/GetEStatementDeliveryActivity?limitAmount=10&newerThanDateTime={{currentDate}}", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "GetEStatementDeliveryActivity" + ], + "query": [ + { + "key": "limitAmount", + "value": "10" + }, + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person Activity by Phone Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/GetPersonActivityByPhoneNumber/:phoneNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "GetPersonActivityByPhoneNumber", + ":phoneNumber" + ], + "variable": [ + { + "key": "phoneNumber", + "value": "2623873873" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person Activity by Tax Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Activity/GetPersonActivityByTaxId/:taxId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Activity", + "GetPersonActivityByTaxId", + ":taxId" + ], + "variable": [ + { + "key": "taxId", + "value": "666221234" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Address", + "item": [ + { + "name": "Find Person Number and Postal Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Address/GetByPersonNumberAndPostalAddressNumber?personNumber=216536&PostalAddressNumber=AL02", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Address", + "GetByPersonNumberAndPostalAddressNumber" + ], + "query": [ + { + "key": "personNumber", + "value": "216536" + }, + { + "key": "PostalAddressNumber", + "value": "AL02" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Address by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Address/GetByPersonNumber?personNumber=216536", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Address", + "GetByPersonNumber" + ], + "query": [ + { + "key": "personNumber", + "value": "216536" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Person Postal Address", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});\r", + "\r", + "var jsonData = JSON.parse(responseBody);\r", + "\r", + "postman.setEnvironmentVariable(\"addressNumber\", jsonData.addressNumber);" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressUseDescription\": null,\r\n \"addressNumber\": 1175037,\r\n \"addressLine1\": \"106 E Main St\",\r\n \"addressLineTypeCode1\": \"ST\",\r\n \"addressLine2\": null,\r\n \"addressLineTypeCode2\": null,\r\n \"addressLine3\": null,\r\n \"addressLineTypeCode3\": null,\r\n \"cityName\": \"Beaver Dam\",\r\n \"countrySubdivisionCode\": \"WI\",\r\n \"countrySubdivisionName\": null,\r\n \"postalCode\": \"53916\",\r\n \"zipPlus\": \"1837\",\r\n \"countryCode\": \"USA\",\r\n \"countryName\": null,\r\n \"censusTractNumber\": null,\r\n \"smsaNumber\": null,\r\n \"startDate\": null,\r\n \"stopDate\": null,\r\n \"startMonthCode\": null,\r\n \"startMonthName\": null,\r\n \"startDayNumber\": null,\r\n \"stopMonthCode\": null,\r\n \"stopMonthName\": null,\r\n \"stopDayNumber\": null,\r\n \"lastMaintained\": \"{{currentDate}}\",\r\n \"personAddressInfo\": [\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"Timmy Tester\",\r\n \"lineNumber\": 0\r\n },\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"106 E Main St\",\r\n \"lineNumber\": 0\r\n },\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"Beaver Dam WI 53916-1837\",\r\n \"lineNumber\": 0\r\n }\r\n ]\r\n }\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Address/InsertPersonPostalAddress", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Address", + "InsertPersonPostalAddress" + ] + } + }, + "response": [] + }, + { + "name": "Update Person Postal Address", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"AL06\",\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressNumber\": {{addressNumber}},\r\n \"addressLine1\": \"107 E Main St\",\r\n \"addressLineTypeCode1\": \"ST\",\r\n \"addressLine2\": null,\r\n \"addressLineTypeCode2\": null,\r\n \"addressLine3\": null,\r\n \"addressLineTypeCode3\": null,\r\n \"cityName\": \"Beaver Dam\",\r\n \"countrySubdivisionCode\": \"WI\",\r\n \"postalCode\": \"53916\",\r\n \"zipPlus\": \"1837\",\r\n \"postNetCode\": null,\r\n \"countryCode\": \"USA\",\r\n \"censusTractNumber\": null,\r\n \"smsaNumber\": null,\r\n \"startDate\": null,\r\n \"stopDate\": null,\r\n \"inactiveDate\": null,\r\n \"effectiveDate\": \"{{currentDate}}\",\r\n \"occupanceDate\": null,\r\n \"startMonthCode\": null,\r\n \"startDayNumber\": null,\r\n \"stopMonthCode\": null,\r\n \"stopDayNumber\": null,\r\n \"lastMaintained\": \"{{currentDate}}\",\r\n \"url\": null,\r\n \"isPerformIRSCorrection\": false\r\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Address/UpdatePersonAddrLine", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Address", + "UpdatePersonAddrLine" + ] + } + }, + "response": [] + }, + { + "name": "Delete Person Postal Address (obsolete)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"AL06\",\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressUseDescription\": null,\r\n \"addressNumber\": {{addressNumber}},\r\n \"addressLine1\": \"107 E Main St\",\r\n \"addressLineTypeCode1\": \"ST\",\r\n \"addressLine2\": null,\r\n \"addressLineTypeCode2\": null,\r\n \"addressLine3\": null,\r\n \"addressLineTypeCode3\": null,\r\n \"cityName\": \"Beaver Dam\",\r\n \"countrySubdivisionCode\": \"WI\",\r\n \"countrySubdivisionName\": null,\r\n \"postalCode\": \"53916\",\r\n \"zipPlus\": \"1837\",\r\n \"countryCode\": \"USA\",\r\n \"countryName\": null,\r\n \"censusTractNumber\": null,\r\n \"smsaNumber\": null,\r\n \"startDate\": null,\r\n \"stopDate\": null,\r\n \"startMonthCode\": null,\r\n \"startMonthName\": null,\r\n \"startDayNumber\": null,\r\n \"stopMonthCode\": null,\r\n \"stopMonthName\": null,\r\n \"stopDayNumber\": null,\r\n \"lastMaintained\": \"{{currentDate}}\",\r\n \"personAddressInfo\": [\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"Timmy Tester\",\r\n \"lineNumber\": 0\r\n },\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"106 E Main St\",\r\n \"lineNumber\": 0\r\n },\r\n {\r\n \"personNumber\": 216536,\r\n \"addressUseCode\": \"AL06\",\r\n \"addressLine\": \"Beaver Dam WI 53916-1837\",\r\n \"lineNumber\": 0\r\n }\r\n ]\r\n }", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Address/DeletePersonPostalAddress", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Address", + "DeletePersonPostalAddress" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Agree", + "item": [ + { + "name": "Find User Id by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreeUserByPersonNumber/:personNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreeUserByPersonNumber", + ":personNumber" + ], + "variable": [ + { + "key": "personNumber", + "value": "216536" + } + ] + } + }, + "response": [] + }, + { + "name": "Find User Id by Organization Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreeUserByOrganizationNumber/:organizationNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreeUserByOrganizationNumber", + ":organizationNumber" + ], + "variable": [ + { + "key": "organizationNumber", + "value": "8772" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Information by User Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementByUserId/:userId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementByUserId", + ":userId" + ], + "variable": [ + { + "key": "userId", + "value": "3671880" + } + ] + } + }, + "response": [] + }, + { + "name": "Find All Users with Agreements on Account", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementsByAccountId/:accountId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementsByAccountId", + ":accountId" + ], + "variable": [ + { + "key": "accountId", + "value": "9000310377" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Information by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAccountByAccountId/:accountId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAccountByAccountId", + ":accountId" + ], + "variable": [ + { + "key": "accountId", + "value": "9000310377" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Accounts by User Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAccountsByUserId/:userId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAccountsByUserId", + ":userId" + ], + "variable": [ + { + "key": "userId", + "value": "3671880" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement User by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreeUsersByAccounts?accountNumbers=19621190168", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreeUsersByAccounts" + ], + "query": [ + { + "key": "accountNumbers", + "value": "19621190168" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Account by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementsByAccountId/:accountId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementsByAccountId", + ":accountId" + ], + "variable": [ + { + "key": "accountId", + "value": "19621190168" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Accounts by Organization Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAccountsByOrganizationId/:organizationId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAccountsByOrganizationId", + ":organizationId" + ], + "variable": [ + { + "key": "organizationId", + "value": "8893" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Accounts Audit by Date Last Maintained", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAccountsAuditFromDateLastMaintained?dateLastMaintained={{currentDate}}", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAccountsAuditFromDateLastMaintained" + ], + "query": [ + { + "key": "dateLastMaintained", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agreement Audit by Date Last Maintained", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAuditFromDateLastMaintained?dateLastMaintained={{currentDate}}", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAuditFromDateLastMaintained" + ], + "query": [ + { + "key": "dateLastMaintained", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Organization Audit by Date Last Maintained", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Agree/AgreementAuditFromDateLastMaintained?dateLastMaintained={{currentDate}}", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Agree", + "AgreementAuditFromDateLastMaintained" + ], + "query": [ + { + "key": "dateLastMaintained", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "AgreePerson", + "item": [ + { + "name": "Find Agree Person", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/agreeperson?fetchSize=3", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "agreeperson" + ], + "query": [ + { + "key": "fetchSize", + "value": "3" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Agree Person with Hyphen in UserId", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/agreeperson/GetAgreePersonsWithHyphenatedUserId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "agreeperson", + "GetAgreePersonsWithHyphenatedUserId" + ] + } + }, + "response": [] + }, + { + "name": "Find Active Custodial Agreement Person Numbers", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/agreeperson/GetActiveCustodialAgreePersonNumbers", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "agreeperson", + "GetActiveCustodialAgreePersonNumbers" + ] + } + }, + "response": [] + }, + { + "name": "Find Active Custodial Vru Agreement Person Numbers", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/agreeperson/GetActiveCustodialVruCardAgreementAgreePersons", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "agreeperson", + "GetActiveCustodialVruCardAgreementAgreePersons" + ] + } + }, + "response": [] + }, + { + "name": "Update Person Agreement Detail Type", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"personNumber\": 615944,\r\n \"agreeNumber\": 8996238505,\r\n \"agreeTypeCode\": \"VRU\",\r\n \"detailTypes\": [\r\n {\r\n \"detailTypeCode\": \"NEWSTATCD\",\r\n \"detailValue\": \"CLOS\"\r\n },\r\n {\r\n \"detailTypeCode\": \"NEWSTATREAS\",\r\n \"detailValue\": \"Automated System Cleanup\"\r\n }\r\n ]\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/agreeperson/PutPersonAgreementDetailTypes", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "agreeperson", + "PutPersonAgreementDetailTypes" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "ApplicationHistory", + "item": [ + { + "name": "Find Application History by Application Number and Effective Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/ApplicationHistory/GetApplicationHistory?ApplicationNumbers=1238301&EffectiveDate=2021-10-31 00:00:00", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "ApplicationHistory", + "GetApplicationHistory" + ], + "query": [ + { + "key": "ApplicationNumbers", + "value": "1238301" + }, + { + "key": "EffectiveDate", + "value": "2021-10-31 00:00:00" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Associate", + "item": [ + { + "name": "Find Associate Details by Ssn", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Associate/GetAssociateDetailsBySsn/:taxId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Associate", + "GetAssociateDetailsBySsn", + ":taxId" + ], + "variable": [ + { + "key": "taxId", + "value": "666221234" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Branch", + "item": [ + { + "name": "Find Branches", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Branch", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Branch" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "IndirectLoan", + "item": [ + { + "name": "Find Indirect Loan by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/IndirectLoan/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "IndirectLoan", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "19621324514" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Indirect Active Loan newer Origination Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/IndirectLoan/:newerThanDateTime", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "IndirectLoan", + ":newerThanDateTime" + ], + "variable": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Indirect Closed Loan newer Origination Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/IndirectLoan/Closed/:newerThanDateTime", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "IndirectLoan", + "Closed", + ":newerThanDateTime" + ], + "variable": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Indirect Closed Loan with Detail newer Origination Date", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "var moment = require('moment');\r", + "\r", + "pm.environment.set('currentDate', moment().format((\"YYYY-MM-DD\")));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/IndirectLoan/ClosedWithDetail/:newerThanDateTime", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "IndirectLoan", + "ClosedWithDetail", + ":newerThanDateTime" + ], + "variable": [ + { + "key": "newerThanDateTime", + "value": "{{currentDate}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Update Dealer Original Balance", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "\"19621324514\"", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/IndirectLoan/PutDealerOriginalBalance", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "IndirectLoan", + "PutDealerOriginalBalance" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Individual", + "item": [ + { + "name": "Get Individuals by User Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/individuals?userId=6607270", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "individuals" + ], + "query": [ + { + "key": "userId", + "value": "6607270" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Loan", + "item": [ + { + "name": "Find Loan Details by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Loan/GetLoanDetails/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Loan", + "GetLoanDetails", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "221299017933" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Loan Collateral by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Loan/GetLoanCollateral/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Loan", + "GetLoanCollateral", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "221299017933" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Property Information by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Loan/GetLoanCollateral/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Loan", + "GetLoanCollateral", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "221299017933" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "LoanPayoff", + "item": [ + { + "name": "Find Loan Payoff by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/LoanPayoff/LoanPayoffByAccountNumber/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "LoanPayoff", + "LoanPayoffByAccountNumber", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "19621323812" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Member", + "item": [ + { + "name": "Find Person or Organization Number by Member Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/members/GetPersonOrOrganizationNumberByMemberId/:memberId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "members", + "GetPersonOrOrganizationNumberByMemberId", + ":memberId" + ], + "variable": [ + { + "key": "memberId", + "value": "8996268917" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person Number or Organization Number by Member Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/members/GetPersonOrOrganizationNumberByMemberId/:memberId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "members", + "GetPersonOrOrganizationNumberByMemberId", + ":memberId" + ], + "variable": [ + { + "key": "memberId", + "value": "3671880" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Member by Account Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/members/GetMemberByAccountNumber/:accountNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "members", + "GetMemberByAccountNumber", + ":accountNumber" + ], + "variable": [ + { + "key": "accountNumber", + "value": "19621301191" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Owners by Member Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/members/:memberId/owners", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "members", + ":memberId", + "owners" + ], + "variable": [ + { + "key": "memberId", + "value": "8996268917" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Organization", + "item": [ + { + "name": "Find Organizations by Name (Like)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Organization/Like/:organizationName?limit=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Organization", + "Like", + ":organizationName" + ], + "query": [ + { + "key": "limit", + "value": "10" + } + ], + "variable": [ + { + "key": "organizationName", + "value": "John Paul" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Count of Organizations by Name (Like)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Organization/Like/:organizationName/Count", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Organization", + "Like", + ":organizationName", + "Count" + ], + "variable": [ + { + "key": "organizationName", + "value": "John Paul" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Organization Information by Organization Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Organization/GetOrganization/:organizationNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Organization", + "GetOrganization", + ":organizationNumber" + ], + "variable": [ + { + "key": "organizationNumber", + "value": "10160" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Organization Information by Member Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Organization/GetOrganizationByMemberAgreementNumber/:memberId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Organization", + "GetOrganizationByMemberAgreementNumber", + ":memberId" + ], + "variable": [ + { + "key": "memberId", + "value": "12" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Organization by Organization Name", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Organization/:organizationName", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Organization", + ":organizationName" + ], + "variable": [ + { + "key": "organizationName", + "value": "DNAUAT Landmark CU UAT" + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Person", + "item": [ + { + "name": "Find Persons by Name (Like)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Person/Name/Like?FirstName=Timmy&LastName=Tester&limit=5", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Person", + "Name", + "Like" + ], + "query": [ + { + "key": "FirstName", + "value": "Timmy" + }, + { + "key": "LastName", + "value": "Tester" + }, + { + "key": "MdlName", + "value": "", + "disabled": true + }, + { + "key": "limit", + "value": "5" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Count of Persons by Name (Like)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Person/Name/Like/Count?FirstName=Timmy&LastName=Tester&MdlName=", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Person", + "Name", + "Like", + "Count" + ], + "query": [ + { + "key": "FirstName", + "value": "Timmy" + }, + { + "key": "LastName", + "value": "Tester" + }, + { + "key": "MdlName", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person Information by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Person/GetPerson/:personNumber", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Person", + "GetPerson", + ":personNumber" + ], + "variable": [ + { + "key": "personNumber", + "value": "216536" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person Information by Member Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Person/GetPersonByMemberAgreementNumber/:memberId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Person", + "GetPersonByMemberAgreementNumber", + ":memberId" + ], + "variable": [ + { + "key": "memberId", + "value": "5984990" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person by Full Name with Includes", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Person/GetPerson?PageSize=2&FirstName=John&LastName=John", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Person", + "GetPerson" + ], + "query": [ + { + "key": "Include", + "value": "null", + "disabled": true + }, + { + "key": "PageSize", + "value": "2" + }, + { + "key": "FirstName", + "value": "John" + }, + { + "key": "LastName", + "value": "John" + }, + { + "key": "MdlName", + "value": "\"\"", + "disabled": true + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "PersonUserField", + "item": [ + { + "name": "Find Person User Field by Person Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PersonUserField?personNumber=660824", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PersonUserField" + ], + "query": [ + { + "key": "personNumber", + "value": "660824" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Person for Atm Check Holds", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PersonUserField/GetPersonsForAtmCheckHolds?fetchSize=10", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PersonUserField", + "GetPersonsForAtmCheckHolds" + ], + "query": [ + { + "key": "resetStartDate", + "value": "null", + "disabled": true + }, + { + "key": "resetEndDate", + "value": "null", + "disabled": true + }, + { + "key": "fetchSize", + "value": "10" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Person User Field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"personNumber\": 74998,\r\n \"userFieldCode\": \"PER1\",\r\n \"value\": \"Y\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PersonUserField/PostPersonUserField", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PersonUserField", + "PostPersonUserField" + ] + } + }, + "response": [] + }, + { + "name": "Update Person User Field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"personNumber\": 660824,\r\n \"userFieldCode\": \"MBRH\",\r\n \"value\": \"N\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PersonUserField/PutPersonUserField", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PersonUserField", + "PutPersonUserField" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "PropertyUserField", + "item": [ + { + "name": "Find Property User Field by Prop Number", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PropertyUserField?propertyNumber=621", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PropertyUserField" + ], + "query": [ + { + "key": "propertyNumber", + "value": "621" + } + ] + } + }, + "response": [] + }, + { + "name": "Add Property User Field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"PMIU\",\r\n \"propertyNumber\": 621,\r\n \"userFieldCode\": \"PMIU\",\r\n \"value\": \"2033-01-01\",\r\n \"lastMaintained\": \"2023-10-27T19:06:27.535Z\",\r\n \"uid\": \"BSD5BC154E_621_CONV\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PropertyUserField/PostPropertyUserField", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PropertyUserField", + "PostPropertyUserField" + ] + } + }, + "response": [] + }, + { + "name": "Update Property User Field", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"id\": \"PMIU\",\r\n \"propertyNumber\": 621,\r\n \"userFieldCode\": \"PMIU\",\r\n \"value\": \"2033-01-01\",\r\n \"lastMaintained\": \"2023-10-27T19:06:27.535Z\",\r\n \"uid\": \"BSD5BC154E_621_CONV\"\r\n}\r\n", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/PropertyUserField/PutPropertyUserField", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "PropertyUserField", + "PutPropertyUserField" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Saf", + "item": [ + { + "name": "Find Saf User Information", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Saf/UserInfo", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Saf", + "UserInfo" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Status", + "item": [ + { + "name": "Find Api Status", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/Status", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "Status" + ] + } + }, + "response": [] + } + ] + }, + { + "name": "Tax", + "item": [ + { + "name": "Find Persons Tax Information by Tax Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Tax/GetPersonsTaxIdData/:taxId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Tax", + "GetPersonsTaxIdData", + ":taxId" + ], + "variable": [ + { + "key": "taxId", + "value": "666227890" + } + ] + } + }, + "response": [] + }, + { + "name": "Find Organizations Tax Information by Tax Id", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{coreApiBaseUrl}}/api/core/Tax/GetOrganizationsTaxIdData/:taxId", + "host": [ + "{{coreApiBaseUrl}}" + ], + "path": [ + "api", + "core", + "Tax", + "GetOrganizationsTaxIdData", + ":taxId" + ], + "variable": [ + { + "key": "taxId", + "value": "205465649" + } + ] + } + }, + "response": [] + } + ] + } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "pm.request.headers.add({", + " key: \"ApiKey\",", + " value: \"{{apiClientKey}}\"", + "})", + "pm.request.headers.add({", + " key: \"Client\",", + " value: \"{{apiClientName}}\"", + "})", + "", + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ] +} \ No newline at end of file diff --git a/LCU.Api.Internal.CoreApiWrapper/postman/README_Postman.md b/LCU.Api.Internal.CoreApiWrapper/postman/README_Postman.md new file mode 100644 index 0000000..6e775fd --- /dev/null +++ b/LCU.Api.Internal.CoreApiWrapper/postman/README_Postman.md @@ -0,0 +1,103 @@ + # Introduction +The Core Api Wrapper postman collection is available to test all endpoints that are part of the Core Api Wrapper solution. +Please reach out to your development lead or someone who has access to vault to get any necessary security information setup. + +The setup variables are located in the Enviroments section named Core Api Environment and used primarily for the core url and for select endpoints in the Tests section within endpoint see Endpoint Tests Section in this readme. + +# NOTE: Endpoint Failures +There are a few endpoints where we don't have any supporting variable information to complete a Post request. +In this readme under Supporting Test Information, we have started a list for this and have a way to manually populate necessary values to create new records. + +# Getting Started +The following tools can be used for Postman testing and supporting data validation: +1. Postman installed with access credentials +2. Join LMCU Postman Group (bold-space-847526) https://protect-us.mimecast.com/s/SR6oCNk2PpsZXl73Im81_-?domain=links.getpostman.com +3. Postman Collection and Environment files available in DevOps and LMCU Postman Group +3. Swagger endpoint reference QA Core Api Wrapper Url: https://qa-api.lcu-internal.com/core-api-wrapper/swagger/index.html +4. For DNA Queries and data validation use DBeaver Oracle SQL Tool or equivalent. Use Microsoft SQL Server for LMCU databases. +5. DNA-UAT application navigation associated to the endpoint can also be used for data validation. + +# Automated Testing +Postman Endpoints should exist for all endpoints in this project. Run the entire Core Api Collection in Postman by right clicking ellipsis and choosing Run Collection. +You should see all the results of every endpoint, it may take longer for some endpoints to complete, if not you may need to select your environment in Postman upper right and choose Core Api Environment. + +# Postman environment variables: + +coreApiBaseUrl +clientId +clientSecret +updateKeyAccessChannel +updateKeyAccessType +apiClientName +apiClientKey +currentDate +addressNumber + +# Postman Pre-request Script for collection + +pm.request.headers.add({ + key: "ApiKey", + value: "{{apiClientKey}}" +}) +pm.request.headers.add({ + key: "Client", + value: "{{apiClientName}}" +}) + +# Endpoint Tests Section: Example using Environment Variables + +Endpoint Name: AccessType: Get - Find Channel Access Type by Person Number + +const responseJson = pm.response.json(); +const updateKey = responseJson.messageHeader.updateKey; +pm.environment.set("updateKeyAccessType", updateKey); +pm.globals.set("updateKeyAccessType", updateKey); + +pm.test("Status code is 200", function () { + pm.response.to.have.status(200); +}); + +Environment Variables Set: The response to this endpoint will populate the updateKey Parameter variable for the Put: Update Person Access Type + +{ + "accessType": { + "id": "WWW", + "channelNumber": 491333, + "personNumber": 33093, + "accessTypeCode": "WWW", + "accessTypeDescription": "Internet", + "isEnrolled": false, + "userId": null, + "isPasswordChangeRequiredOnNextLogin": false, + "isDisclaimer": false, + "isActive": true, + "uid": "BS2C00529_491333_33093_WWW", + "origin": "A" + }, + "accessChannelPersonId": "491333_33093", + "updateKey": {{updateKeyAccessType}} +} + +# Supporting Test Information +For endpoints that aren't automated with parameter information, this is a reference to manually supply the request parameters and associated endpoint name. + +Endpoint: Add Account User Field by Account + +DNA Query: Select distinct(ac.acctnbr), ac.currmiaccttypcd from acct ac inner join acctuserfield auf on auf.acctnbr = ac.acctnbr where auf.userfieldcd != 'PROM' and ac.currmiaccttypcd = 'SV01'; + +--Take one acctnbr returned and place in the appropriate account number parameter. + + +Endpoint: Add Person User Field + +DNA Query: Select distinct(puf.persnbr), pe.firstname, pe.lastname from persuserfield puf inner join pers pe on pe.persnbr = puf.persnbr where puf.userfieldcd != 'PER1' and puf.persnbr > 8000; + +--Take one persnbr returned and place in the appropriate person number parameter. + +Endpoint: Find Account by Major Minor Branch and Status + +--The response will be 204 No Content and should not be considered a failure. + +# Additional Troubleshooting information +For troubleshooting any DNA Token and Security Token errors responsible for request failures please speak with Development" +