Compare commits
merge into: IME-LONDON:master
IME-LONDON:#28058-Inbound-api
IME-LONDON:master
pull from: IME-LONDON:#28058-Inbound-api
IME-LONDON:#28058-Inbound-api
IME-LONDON:master
11 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
Dinesh | 19ba877ea1 |
#34488 service charge
|
1 week ago |
Dinesh | 8ece153be1 |
#34488 service charge
|
3 weeks ago |
Dinesh | bfb5211497 |
#29883 update sp
|
4 months ago |
Dinesh | 32c09b2951 |
#29883 inbound api log script
|
4 months ago |
Dinesh | 8694280cc1 |
#28683 update
|
5 months ago |
Dinesh | 0e80e65c9a |
#28683 validation attribute for inbound api
|
5 months ago |
Dinesh | 1c30eeaf4c |
#28683 validate attribute
|
6 months ago |
Dinesh | 83f675f97b |
#28058 add bank code
|
6 months ago |
Dinesh | bcb9c8d7ef |
#28058 missing code
|
6 months ago |
Dinesh | 3baa0ecad4 |
#28058 inbound api table script
|
6 months ago |
Dinesh | 03118559c4 |
#28058-InboundAPI-CodeTable
|
6 months ago |
22 changed files with 800 additions and 12 deletions
-
BINDB/#28058-inbound-CodeTable/proc_InboundApi_StaticData.sql
-
BINDB/#34488-inbound-api-service-charge/PROC_REMIT_INBOUND_TRANSACTION_SEND.sql
-
9DB/29883-inbound-api-log/AlterTable.sql
-
132DB/29883-inbound-api-log/proc_inboundApiLogs.sql
-
BINDB/SP's/PROC_REMIT_INBOUND_EXRATE.sql
-
2RemitInboundAPI/RemitInboundAPI.Business/Business/RemitBusiness/IRemitBusiness.cs
-
56RemitInboundAPI/RemitInboundAPI.Business/Business/RemitBusiness/RemitBusiness.cs
-
29RemitInboundAPI/RemitInboundAPI.Business/Helper/ValidationHelper/BankValidationHelper.cs
-
8RemitInboundAPI/RemitInboundAPI.Business/Helper/ValidationHelper/SendTransactionValidationHelper.cs
-
30RemitInboundAPI/RemitInboundAPI.Business/Helper/ValidationHelper/StaticValueValidationHelper.cs
-
2RemitInboundAPI/RemitInboundAPI.Business/obj/Debug/net8.0/RemitInboundAPI.Business.AssemblyInfo.cs
-
160RemitInboundAPI/RemitInboundAPI.Common/Model/RemitModel/ExRateModel.cs
-
2RemitInboundAPI/RemitInboundAPI.Common/obj/Debug/net8.0/RemitInboundAPI.Common.AssemblyInfo.cs
-
24RemitInboundAPI/RemitInboundAPI.Repository/Enums.cs
-
2RemitInboundAPI/RemitInboundAPI.Repository/Repository/RemitRepository/IRemitRepository.cs
-
168RemitInboundAPI/RemitInboundAPI.Repository/Repository/RemitRepository/RemitRepository.cs
-
2RemitInboundAPI/RemitInboundAPI.Repository/obj/Debug/net8.0/RemitInboundAPI.Repository.AssemblyInfo.cs
-
50RemitInboundAPI/RemitInboundAPI/Controllers/RemitController.cs
-
18RemitInboundAPI/RemitInboundAPI/Program.cs
-
95RemitInboundAPI/RemitInboundAPI/ValidateModelFilter.cs
-
2RemitInboundAPI/RemitInboundAPI/obj/Debug/net8.0/RemitInboundAPI.AssemblyInfo.cs
-
17RemitInboundAPI/RemitInboundAPI/obj/Debug/net8.0/RemitInboundAPI.MvcApplicationPartsAssemblyInfo.cs
@ -0,0 +1,9 @@ |
|||||
|
use fastmoneypro_remit |
||||
|
|
||||
|
|
||||
|
alter table TBL_REMIT_INBOUND_LOG |
||||
|
add |
||||
|
ControlNo VARCHAR(50) NULL, |
||||
|
PartnerId VARCHAR(50) NULL |
||||
|
|
||||
|
|
@ -0,0 +1,132 @@ |
|||||
|
|
||||
|
ALTER PROCEDURE [dbo].[proc_inboundApiLogs]( |
||||
|
@flag VARCHAR(10) = NULL |
||||
|
,@user VARCHAR(30) = NULL |
||||
|
,@REQUESTEDBY VARCHAR(100) = NULL |
||||
|
,@rowId INT = NULL |
||||
|
,@pageSize INT = NULL |
||||
|
,@pageNumber INT = NULL |
||||
|
,@sortBy VARCHAR(50) = NULL |
||||
|
,@sortOrder VARCHAR(50) = NULL |
||||
|
,@agentId varchar(10) = NULL |
||||
|
,@logType VARCHAR(20) = NULL |
||||
|
,@date VARCHAR(10) = NULL |
||||
|
,@logby VARCHAR(50) = NULL |
||||
|
,@controlno VARCHAR(30) = NULL |
||||
|
,@processid VARCHAR(100) = NULL |
||||
|
)AS |
||||
|
SET NOCOUNT ON |
||||
|
SET XACT_ABORT ON |
||||
|
BEGIN |
||||
|
DECLARE |
||||
|
@table VARCHAR(MAX) |
||||
|
,@select_field_list VARCHAR(MAX) |
||||
|
,@extra_field_list VARCHAR(MAX) |
||||
|
,@sql_filter VARCHAR(MAX) |
||||
|
if @flag = 'method' |
||||
|
BEGIN |
||||
|
SELECT * |
||||
|
FROM ( |
||||
|
SELECT '' [value] |
||||
|
,'Select Log Type' [text] |
||||
|
|
||||
|
UNION ALL |
||||
|
|
||||
|
SELECT 'sendRemittance' [value] |
||||
|
,'Send Transaction' [text] |
||||
|
|
||||
|
UNION ALL |
||||
|
|
||||
|
SELECT 'calculateExRate' [value] |
||||
|
,'Exchange Rate' [text] |
||||
|
|
||||
|
UNION ALL |
||||
|
|
||||
|
SELECT 'getCode' [value] |
||||
|
,'Static Value' [text] |
||||
|
) x |
||||
|
|
||||
|
END |
||||
|
|
||||
|
else IF @flag='s' |
||||
|
BEGIN |
||||
|
SET @sortBy='rowId' |
||||
|
SET @sortOrder='DESC' |
||||
|
SET @table=' |
||||
|
( |
||||
|
SELECT rowId |
||||
|
,ProcessIdentifier |
||||
|
,RequestedDate |
||||
|
,MethodName |
||||
|
,RequestJson |
||||
|
,ResponseJson |
||||
|
,RequestedBy |
||||
|
,controlno |
||||
|
FROM TBL_REMIT_INBOUND_LOG (NOLOCK) |
||||
|
WHERE 1=1 |
||||
|
)x' |
||||
|
|
||||
|
SET @sql_filter = '' |
||||
|
IF @agentId IS NOT NULL |
||||
|
SET @sql_filter=@sql_filter + ' AND MethodName = ''' +@agentId+'''' |
||||
|
|
||||
|
IF @logby IS NOT NULL |
||||
|
SET @sql_filter=@sql_filter + ' AND RequestedBy = ''' +@logby+'''' |
||||
|
|
||||
|
IF @date IS NOT NULL |
||||
|
SET @sql_filter=@sql_filter + ' AND CONVERT(varchar(10),RequestedDate,121) = ''' +@date+'''' |
||||
|
|
||||
|
IF @logType IS NOT NULL |
||||
|
BEGIN |
||||
|
if(@logType='sendTxn') |
||||
|
SET @sql_filter=@sql_filter + ' AND right(processId,7) = '''+@logType+'''' |
||||
|
END |
||||
|
IF @controlno IS NOT NULL |
||||
|
SET @sql_filter=@sql_filter + ' AND controlno = ''' +@controlno+'''' |
||||
|
|
||||
|
IF @processid IS NOT NULL |
||||
|
SET @sql_filter=@sql_filter + ' AND ProcessIdentifier = ''' +@processid+'''' |
||||
|
|
||||
|
SET @select_field_list = ' |
||||
|
rowId |
||||
|
,ProcessIdentifier |
||||
|
,RequestedDate |
||||
|
,MethodName |
||||
|
,RequestJson |
||||
|
,ResponseJson |
||||
|
,RequestedBy |
||||
|
,controlno |
||||
|
' |
||||
|
|
||||
|
EXEC dbo.proc_paging |
||||
|
@table |
||||
|
,@sql_filter |
||||
|
,@select_field_list |
||||
|
,@extra_field_list |
||||
|
,@sortBy |
||||
|
,@sortOrder |
||||
|
,@pageSize |
||||
|
,@pageNumber |
||||
|
|
||||
|
|
||||
|
|
||||
|
END |
||||
|
IF @flag='a' |
||||
|
BEGIN |
||||
|
SELECT rowId |
||||
|
,ProcessIdentifier providerName |
||||
|
,MethodName methodName |
||||
|
,controlNo |
||||
|
,[RequestJson] requestXml |
||||
|
,'' requestXml |
||||
|
,[ResponseJson] responseXml |
||||
|
,'' responseXml |
||||
|
,RequestedBy requestedBy |
||||
|
,[RequestedDate] requestedDate |
||||
|
,'' responseDate |
||||
|
|
||||
|
|
||||
|
FROM TBL_REMIT_INBOUND_LOG (NOLOCK) |
||||
|
WHERE rowId=@rowId |
||||
|
END |
||||
|
END |
@ -0,0 +1,29 @@ |
|||||
|
using RemitInboundAPI.Common.Helper; |
||||
|
using RemitInboundAPI.Common.Model.RemitModel; |
||||
|
using RemitInboundAPI.Common.Model; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace RemitInboundAPI.Business.Helper.ValidationHelper |
||||
|
{ |
||||
|
public class BankValidationHelper |
||||
|
{ |
||||
|
public async Task<ApiResponse> BankValidationRequest(BankResponseModel model) |
||||
|
{ |
||||
|
ApiResponse _response; |
||||
|
if (string.IsNullOrEmpty(model.CountryId)) |
||||
|
{ |
||||
|
_response = new ApiResponse(ResponseHelper.FAILED, "Country can not be empty."); |
||||
|
} |
||||
|
|
||||
|
else |
||||
|
{ |
||||
|
_response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS); |
||||
|
} |
||||
|
return _response; |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
using RemitInboundAPI.Common.Helper; |
||||
|
using RemitInboundAPI.Common.Model.RemitModel; |
||||
|
using RemitInboundAPI.Common.Model; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace RemitInboundAPI.Business.Helper.ValidationHelper |
||||
|
{ |
||||
|
public class StaticValueValidationHelper |
||||
|
{ |
||||
|
|
||||
|
//public async Task<ApiResponse> ValidateExraStaticRequest(CDDIResponseModel model)
|
||||
|
//{
|
||||
|
// ApiResponse _response;
|
||||
|
// if (string.IsNullOrEmpty(model.SourceOfFund.ToArray))
|
||||
|
// {
|
||||
|
// _response = new ApiResponse(ResponseHelper.FAILED, "StaticValue can not be empty.");
|
||||
|
// }
|
||||
|
|
||||
|
// else
|
||||
|
// {
|
||||
|
// _response = new ApiResponse(ResponseHelper.SUCCESS, ResponseMessageHelper.SUCCESS);
|
||||
|
// }
|
||||
|
// return _response;
|
||||
|
//}
|
||||
|
} |
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace RemitInboundAPI.Repository |
||||
|
{ |
||||
|
public class Enums |
||||
|
{ |
||||
|
public enum MasterData |
||||
|
{ |
||||
|
All, |
||||
|
sourceOfFund, |
||||
|
purposeOfRemittance, |
||||
|
idType, |
||||
|
relationship, |
||||
|
occupation, |
||||
|
country, |
||||
|
paymentType |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,95 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.AspNetCore.Mvc.Filters; |
||||
|
using Microsoft.Extensions.Logging; |
||||
|
using Newtonsoft.Json; |
||||
|
using RemitInboundAPI.Common.Helper; |
||||
|
using Serilog.Context; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace RemitInboundAPI |
||||
|
{ |
||||
|
public class MGErrorResponse |
||||
|
{ |
||||
|
public Error error { get; set; } |
||||
|
} |
||||
|
|
||||
|
public class Error |
||||
|
{ |
||||
|
public string responseCode { get; set; } |
||||
|
public string responseMessage { get; set; } |
||||
|
public string target { get; set; } |
||||
|
|
||||
|
} |
||||
|
public class ValidationError |
||||
|
{ |
||||
|
public string Property { get; set; } |
||||
|
public string Display { get; set; } |
||||
|
public string Errors { get; set; } |
||||
|
} |
||||
|
|
||||
|
public class ValidateModelFilter : ActionFilterAttribute |
||||
|
{ |
||||
|
private readonly ILogger<ValidateModelFilter> _logger; |
||||
|
|
||||
|
public ValidateModelFilter(ILogger<ValidateModelFilter> logger) |
||||
|
{ |
||||
|
_logger = logger; |
||||
|
} |
||||
|
|
||||
|
public override async void OnActionExecuting(ActionExecutingContext context) |
||||
|
{ |
||||
|
if (!context.ModelState.IsValid) |
||||
|
{ |
||||
|
var response = new MGErrorResponse |
||||
|
{ |
||||
|
error = new Error() |
||||
|
{ |
||||
|
responseCode = "101" |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
if (context.ModelState.ErrorCount > 0) |
||||
|
{ |
||||
|
var modelType = context.ActionDescriptor.Parameters |
||||
|
.FirstOrDefault(p => p.BindingInfo.BindingSource.Id.Equals("Body", StringComparison.InvariantCultureIgnoreCase))?.ParameterType; //Get model type
|
||||
|
|
||||
|
List<string> _exclude = new List<string>() { "command", "model" }; |
||||
|
List<ValidationError> list = new List<ValidationError>(); |
||||
|
|
||||
|
foreach (var e in context.ModelState) |
||||
|
{ |
||||
|
var property = modelType.GetProperties().FirstOrDefault(p => p.Name.Equals(e.Key, StringComparison.InvariantCultureIgnoreCase)); |
||||
|
String propertyName = property != null ? property.Name : e.Key; |
||||
|
String displayName = propertyName; |
||||
|
|
||||
|
if (property != null) |
||||
|
{ |
||||
|
var displayNameAttributeValue = property.GetCustomAttributes(typeof(DisplayNameAttribute), true).Cast<DisplayNameAttribute>().SingleOrDefault()?.DisplayName; |
||||
|
displayName = displayNameAttributeValue ?? displayName; |
||||
|
} |
||||
|
|
||||
|
if (!_exclude.Contains(propertyName)) |
||||
|
{ |
||||
|
list.Add(new ValidationError |
||||
|
{ |
||||
|
Property = propertyName, |
||||
|
Display = displayName, |
||||
|
Errors = string.Join(",", e.Value.Errors.Select(r => r.ErrorMessage).ToArray()) |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
response.error.responseMessage = string.Join(",", list.Select(x => x.Errors).ToArray()); |
||||
|
// response.error.responseMessage = "InvalidRequest";//string.Join(",", list.Select(x => x.Errors).ToArray());
|
||||
|
response.error.target = string.Join(",", list.Select(x => x.Display).ToArray()); |
||||
|
|
||||
|
context.Result = new BadRequestObjectResult(response); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
//------------------------------------------------------------------------------
|
||||
|
// <auto-generated>
|
||||
|
// This code was generated by a tool.
|
||||
|
// Runtime Version:4.0.30319.42000
|
||||
|
//
|
||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
|
// the code is regenerated.
|
||||
|
// </auto-generated>
|
||||
|
//------------------------------------------------------------------------------
|
||||
|
|
||||
|
using System; |
||||
|
using System.Reflection; |
||||
|
|
||||
|
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")] |
||||
|
|
||||
|
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue