Adding
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class AccountDao : BaseDao, IAccountDao
|
||||
{
|
||||
private const string AvailableMethodCode = "ABHP";
|
||||
|
||||
public AccountDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
|
||||
{
|
||||
}
|
||||
|
||||
public AccountDetailInquiryResponse FindAccountByAccountNumber(long accountNumber)
|
||||
{
|
||||
var accountDetailInquiryRequest = new AccountDetailInquiryRequest()
|
||||
{
|
||||
AccountNumber = accountNumber,
|
||||
AvailableMethodCode = AvailableMethodCode,
|
||||
IsExternalEntity = false,
|
||||
IsGetRTXNData = false
|
||||
};
|
||||
|
||||
var response =
|
||||
_coreSoapRequest.SubmitRequest<AccountDetailInquiryRequest, AccountDetailInquiryResponse>(
|
||||
accountDetailInquiryRequest);
|
||||
return response;
|
||||
}
|
||||
|
||||
public AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest)
|
||||
{
|
||||
var response = _coreSoapRequest.SubmitRequest<AccountMaintenanceRequest, AccountMaintenanceResponse>(accountMaintenanceRequest);
|
||||
return response;
|
||||
}
|
||||
|
||||
public AccountAnalysisMaintenanceResponse SendAccountAnalysisMaintenanceRequest(AccountAnalysisMaintenanceRequest accountAnalysisMaintenanceRequest)
|
||||
{
|
||||
var response = _coreSoapRequest.SubmitRequest<AccountAnalysisMaintenanceRequest, AccountAnalysisMaintenanceResponse>(accountAnalysisMaintenanceRequest);
|
||||
return response;
|
||||
}
|
||||
|
||||
public OrgMaintenanceResponse SendOrgMaintenanceRequest(OrgMaintenanceRequest orgMaintenanceRequest)
|
||||
{
|
||||
var response = _coreSoapRequest.SubmitRequest<OrgMaintenanceRequest, OrgMaintenanceResponse>(orgMaintenanceRequest);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public abstract class BaseDao
|
||||
{
|
||||
protected readonly ICoreSoapRequest _coreSoapRequest;
|
||||
|
||||
public BaseDao(ICoreSoapRequest coreSoapRequest)
|
||||
{
|
||||
_coreSoapRequest = coreSoapRequest;
|
||||
}
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
using Serilog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class CollateralMaintenanceDao: BaseDao, ICollateralMaintenanceDao
|
||||
{
|
||||
public CollateralMaintenanceDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
|
||||
{
|
||||
}
|
||||
|
||||
public CollateralMaintenanceResponse AddCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request)
|
||||
{
|
||||
return _coreSoapRequest.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(request);
|
||||
}
|
||||
|
||||
public CollateralSearchResponse FindCollateralMaintenanceByPropertyNumber(long propertyNumber)
|
||||
{
|
||||
var collateralRequest = new CollateralSearchRequest();
|
||||
collateralRequest.PropertyCollateral = new PropertyCollateralRequest();
|
||||
collateralRequest.PropertyCollateral.PropertyNumber = propertyNumber;
|
||||
var response = _coreSoapRequest.SubmitRequest<CollateralSearchRequest, CollateralSearchResponse>(collateralRequest);
|
||||
return response;
|
||||
}
|
||||
|
||||
public CollateralMaintenanceResponse UpdateCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request)
|
||||
{
|
||||
return _coreSoapRequest.SubmitRequest<CollateralMaintenanceRequest, CollateralMaintenanceResponse>(request);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface IAccountDao
|
||||
{
|
||||
AccountDetailInquiryResponse FindAccountByAccountNumber(long accountNumber);
|
||||
AccountMaintenanceResponse SendAccountMaintenanceRequest(AccountMaintenanceRequest accountMaintenanceRequest);
|
||||
AccountAnalysisMaintenanceResponse SendAccountAnalysisMaintenanceRequest(AccountAnalysisMaintenanceRequest accountAnalysisMaintenanceRequest);
|
||||
OrgMaintenanceResponse SendOrgMaintenanceRequest(OrgMaintenanceRequest orgMaintenanceRequest);
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface ICollateralMaintenanceDao
|
||||
{
|
||||
CollateralSearchResponse FindCollateralMaintenanceByPropertyNumber(long propertyNumber);
|
||||
CollateralMaintenanceResponse AddCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request);
|
||||
CollateralMaintenanceResponse UpdateCollateralMaintenanceByPropertyNumber(CollateralMaintenanceRequest request);
|
||||
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface IIndirectLoanDao
|
||||
{
|
||||
Cmc.Transaction<TRequest> UpdateDealerOriginalBalance<TRequest>(Cmc.Transaction<TRequest> transaction);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface IMonetaryTransactionDao
|
||||
{
|
||||
List<MonetaryTransactionResponse> AddMonetaryTransactions (List<MonetaryTransactionRequest> request);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface IPersonAgreementDao
|
||||
{
|
||||
PersonAgreementMaintenanceResponse SendPersonAgreementMaintenanceRequest(PersonAgreementMaintenanceRequest personAgreementMaintenanceRequest);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public interface ITaxDao
|
||||
{
|
||||
GetTaxIdDataResponse GetTaxIdData(long taxId);
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using Serilog;
|
||||
using System.Xml.Serialization;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.Models;
|
||||
using Cmc = LCU.API.Internal.CoreSoapApiWrapper.Models.Cmc;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class IndirectLoanDao : IIndirectLoanDao
|
||||
{
|
||||
private readonly SoapConfiguration _soapConfiguration;
|
||||
|
||||
public IndirectLoanDao (SoapConfiguration soapConfiguration)
|
||||
{
|
||||
_soapConfiguration = soapConfiguration;
|
||||
}
|
||||
|
||||
public Cmc.Transaction<TRequest> UpdateDealerOriginalBalance<TRequest>(Cmc.Transaction<TRequest> transaction)
|
||||
{
|
||||
try
|
||||
{
|
||||
return SendRequest<TRequest>(transaction);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, $"There was an error while updating accounts");
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
private Cmc.Transaction<TRequest> SendRequest<TRequest>(Cmc.Transaction<TRequest> transaction)
|
||||
{
|
||||
byte[] byteBuffer = new byte[50000];
|
||||
byte[] message;
|
||||
int bytesSent;
|
||||
int bytesReceived;
|
||||
|
||||
IPAddress ipAddress = IPAddress.Parse(_soapConfiguration.IPAddress);
|
||||
IPEndPoint remoteEP = new IPEndPoint(ipAddress, _soapConfiguration.PortId);
|
||||
Socket socketSender = new Socket(ipAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
|
||||
|
||||
try
|
||||
{
|
||||
socketSender.SendTimeout = _soapConfiguration.SocketTimeout;
|
||||
socketSender.ReceiveTimeout = _soapConfiguration.SocketTimeout;
|
||||
socketSender.Connect(remoteEP);
|
||||
string xmlString;
|
||||
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Cmc.Transaction<TRequest>));
|
||||
|
||||
using (var stringWriter = new StringWriter())
|
||||
{
|
||||
using (XmlWriter writer = XmlWriter.Create(stringWriter))
|
||||
{
|
||||
xmlSerializer.Serialize(writer, transaction);
|
||||
xmlString = stringWriter.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
message = Encoding.ASCII.GetBytes(xmlString);
|
||||
bytesSent = socketSender.Send(message);
|
||||
bytesReceived = socketSender.Receive(byteBuffer);
|
||||
|
||||
string response = Encoding.ASCII.GetString(byteBuffer, 0, bytesReceived);
|
||||
|
||||
var transactionResult = new Cmc.Transaction<TRequest>();
|
||||
using (var stringReader = new StringReader(response))
|
||||
{
|
||||
transactionResult = (Cmc.Transaction<TRequest>)xmlSerializer.Deserialize(stringReader);
|
||||
}
|
||||
socketSender.Shutdown(SocketShutdown.Both);
|
||||
socketSender.Close();
|
||||
|
||||
return transactionResult;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
socketSender.Shutdown(SocketShutdown.Both);
|
||||
socketSender.Close();
|
||||
Log.Error(ex, $"There was an error while updating accounts.");
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class MonetaryTransactionDao : BaseDao, IMonetaryTransactionDao
|
||||
{
|
||||
public MonetaryTransactionDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
|
||||
{
|
||||
}
|
||||
|
||||
public List<MonetaryTransactionResponse> AddMonetaryTransactions (List<MonetaryTransactionRequest> requests)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _coreSoapRequest.SubmitRequests<MonetaryTransactionRequest, MonetaryTransactionResponse>(requests);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class PersonAgreementDao : BaseDao, IPersonAgreementDao
|
||||
{
|
||||
|
||||
public PersonAgreementDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
|
||||
{
|
||||
}
|
||||
|
||||
public PersonAgreementMaintenanceResponse SendPersonAgreementMaintenanceRequest(PersonAgreementMaintenanceRequest personAgreementMaintenanceRequest)
|
||||
{
|
||||
var response = _coreSoapRequest.SubmitRequest<PersonAgreementMaintenanceRequest, PersonAgreementMaintenanceResponse>(personAgreementMaintenanceRequest);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
using LCU.API.Internal.CoreSoapApiWrapper.CoreSoapUtilities;
|
||||
|
||||
namespace LCU.API.Internal.CoreSoapApiWrapper.DataAccess
|
||||
{
|
||||
public class TaxDao : BaseDao, ITaxDao
|
||||
{
|
||||
private const int MethodCodeForTaxIdRequest = 1;
|
||||
|
||||
public TaxDao(ICoreSoapRequest coreSoapConnection) : base(coreSoapConnection)
|
||||
{
|
||||
}
|
||||
|
||||
public GetTaxIdDataResponse GetTaxIdData(long taxId)
|
||||
{
|
||||
|
||||
var taxIdDataRequest = new GetTaxIdDataRequest
|
||||
{
|
||||
MethodNumber = MethodCodeForTaxIdRequest,
|
||||
ReferenceNumber = taxId.ToString()
|
||||
};
|
||||
|
||||
return _coreSoapRequest.SubmitRequest<GetTaxIdDataRequest, GetTaxIdDataResponse>(taxIdDataRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user