You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

171 lines
8.5 KiB

using RemitInboundAPI.Common.Model.RemitModel;
using RemitInboundAPI.Common.Model;
using RemitInboundAPI.Common.Helper;
namespace RemitInboundAPI.Business.Helper.ValidationHelper
{
public class SendTransactionValidationHelper
{
public async Task<ApiResponse> SendTransactionValidationRequest(SendRemittanceModel model)
{
ApiResponse _response;
if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCountryCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SendingCountryCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutCountryCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutCountryCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutTypeCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutTypeCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutCurrencyCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutCurrencyCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.CollectionAmount))
{
_response = new ApiResponse(ResponseHelper.FAILED, "CollectionAmount can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.TransferAmount))
{
_response = new ApiResponse(ResponseHelper.FAILED, "TransferAmount can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutAmount))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutAmount can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.ServiceCharge))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ServiceCharge can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.ExchangeRate))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ExchangeRate can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.SendingCurrencyCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SendingCurrencyCode can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.RemittancePurpose))
{
_response = new ApiResponse(ResponseHelper.FAILED, "RemittancePurpose can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.SourceOfFund))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SourceOfFund can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.Relationship))
{
_response = new ApiResponse(ResponseHelper.FAILED, "Relationship can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.Occupation))
{
_response = new ApiResponse(ResponseHelper.FAILED, "Occupation can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.CalcBy))
{
_response = new ApiResponse(ResponseHelper.FAILED, "CalcBy can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderFirstName))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderFirstName can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderDOB))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderDOB can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderLastName))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderLastName can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdType))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderIdType can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdNo))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderIdNo can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdIssuedDate))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderIdIssuedDate can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderIdValidDate))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderIdValidDate can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderMobile))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderMobile can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderAddress))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderAddress can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitSenderDetails.SenderGender))
{
_response = new ApiResponse(ResponseHelper.FAILED, "SenderGender can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverFirstName))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverFirstName can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverLastName))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverLastName can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverMobile))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverMobile can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverCity))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverCity can not be empty.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverAddress))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverAddress can not be empty.");
}
else
{
_response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS);
}
//conditional
if (_response.ResponseCode == ResponseHelper.SUCCESS)
{
if (model.RemittanceDetails.PayoutTypeCode.ToLower() == "bd")
{
if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutBankCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutBankCode can not be empty for payment type Bank Deposit.");
}
else if (string.IsNullOrEmpty(model.RemittanceDetails.PayoutBankBranchCode))
{
_response = new ApiResponse(ResponseHelper.FAILED, "PayoutBankBranchCode can not be empty for payment type Bank Deposit.");
}
else if (string.IsNullOrEmpty(model.RemitReceiverDetails.ReceiverAccountNo))
{
_response = new ApiResponse(ResponseHelper.FAILED, "ReceiverAccountNo can not be empty for payment type Bank Deposit.");
}
else
{
_response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS);
}
}
}
return _response;
}
}
}