Skip to content

Commit

Permalink
UpdatedDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Kumar committed Nov 6, 2024
1 parent 5997869 commit 03c25e4
Show file tree
Hide file tree
Showing 86 changed files with 4,319 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Duc.Splitt.Common.Dtos.Requests
{
public class AuthConsumerUserDto
public class AuthConsumerUserRequestDto
{
public class RegisterDto
{
Expand All @@ -11,6 +11,17 @@ public class RegisterDto
public string MobileNo { get; set; } = null!;

}

public class CustomerRegistrationRequestDto
{
public string CivilId { get; set; } = null!;
public Guid OtpRequestId { get; set; }
}
public class CheckMIdRequestStatusDto
{
public Guid CustomerRegistrationRequestId { get; set; }
public int? CustomerRegistrationRequestStatusId { get; set; }
}
public class VerifyOtpDto
{
public string MobileNo { get; set; } = null!;
Expand Down
19 changes: 19 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Dtos/Requests/PACIMobileIdRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace Duc.Splitt.Common.Dtos.Requests
{
public class PACIMobileIdRequest
{
public class MobileAuthPNRequestDto
{
[Description("User Identifier to be sent to MID (For MID, this should be Civil ID) ")]
[Required]
public string CivilId { get; set; } = null!;

[Required]
public Guid CustomerRegistrationRequestId { get; set; }
}

}
}
12 changes: 11 additions & 1 deletion Duc.Splitt/Duc.Splitt.Common/Dtos/Responses/AuthTokens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
public class AuthTokens
{
public string Token { get; set; } = null!;
public string? RefreshToken { get; set; }
public string? RefreshToken { get; set; }
public DateTime? RefreshTokenExpiryTime { get; set; }
}
public class VerifyOtpResponse
{
public bool IsNewCustomer { get; set; }
public Guid OtpRequestId { get; set; }
public AuthTokens? AuthTokens { get; set; }
}
public class CustomerRegistrationResponseDto
{
public Guid CustomerRegistrationRequestId { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;

namespace Duc.Splitt.Common.Dtos.Responses
{
public class PACIMobileIdResponse
{

public class MobileAuthPNResponseDto
{
public string? DSPRefNo { get; set; }
}
}
}
13 changes: 13 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Enums/CustomerRegistrationStatuses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Duc.Splitt.Common.Enums
{
public enum CustomerRegistrationStatuses
{

OtpPending = 1,
OtpVerifed = 2,
PACIPending = 3,
PACIVerifed = 4,
PaciVerifiedComplete = 5
}

}
10 changes: 10 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Enums/CustomerStatuses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Duc.Splitt.Common.Enums
{
public enum CustomerStatuses
{

Registration = 1,
Login = 2
}

}
17 changes: 17 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Enums/MidRequestStatuses.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace Duc.Splitt.Common.Enums
{
public enum MidRequestStatuses
{

Initiate = 1,
InitiateSucess = 2,
CallBackReceived = 3,
CallBackProcessSucess = 4,
CallBackProcessFail = 5,
Reject = 6,
CallBackReceivedDataIssue = 7,
MIDIssue = 8,
Exception = 9
}

}
8 changes: 8 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Enums/MidRequestTypes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Duc.Splitt.Common.Enums
{
public enum MidRequestTypes
{
AuthenticationPN = 1
}

}
10 changes: 10 additions & 0 deletions Duc.Splitt/Duc.Splitt.Common/Enums/OtpPurposes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Duc.Splitt.Common.Enums
{
public enum OtpPurposes
{

Registration = 1,
Login = 2
}

}
12 changes: 9 additions & 3 deletions Duc.Splitt/Duc.Splitt.Common/Enums/ResponseStatusCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ public enum ResponseStatusCode
StratRemoteTransactionCustomMessage = 6010,

OTPExpired = 6233,
OTPMaxAttempts = 6234,
AlreadyUsed = 6235,
EmailNotSent=6236
OTPVerifyLimitExceeded = 6234,
OTPAlreadyUsed = 6235,
OTPRequestLimitExceeded = 5003,
OTPRequestNotFound = 6233,
OTPVerificationNotCompleted = 6233,
EmailNotSent = 6236,
MIDAPIIssue = 5001,
InvalidPACIData = 5002,

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Duc.Splitt.Common.Enums
{
public enum UserTypes
public enum Roles
{

Anonymous = 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace Duc.Splitt.Core.Contracts.Repositories
public interface IOtpRequestRepository : IRepository<OtpRequest>
{
Task<OtpRequest?> GetLatestOtpRequestByMobileNo(string mobileNo);
Task<OtpRequest?> GetOtpRequestById(Guid Id);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ namespace Duc.Splitt.Core.Contracts.Repositories
{
public interface ICustomerRegistrationRequestRepository : IRepository<CustomerRegistrationRequest>
{

Task<int?> CustomerRegistrationRequestWithin15Min(string civilId);
Task<CustomerRegistrationRequest?> CustomerRegistrationRequestById(Guid id);
Task<int?> CustomerRegistrationRequestStatusId(Guid id);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ namespace Duc.Splitt.Core.Contracts.Repositories
{
public interface ICustomerRepository : IRepository<Customer>
{
Task<Customer?> GetConsumerUserByMobileNo(string mobileNo);
Task<Customer?> GetCustomerByMobileNo(string mobileNo);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Duc.Splitt.Common.Dtos.Responses;
using System.Threading.Tasks;
using static Duc.Splitt.Common.Dtos.Requests.AuthConsumerUserRequestDto;

namespace Duc.Splitt.Core.Contracts.Services
{
public interface IAuthCustomerService
{

Task<ResponseDto<bool?>> RequestOTP(RequestHeader requestHeader, RegisterDto request);
Task<ResponseDto<VerifyOtpResponse?>> VerifyOTP(RequestHeader requestHeader, VerifyOtpDto request);
Task<ResponseDto<CustomerRegistrationResponseDto?>> CustomerRegistrationRequest(RequestHeader requestHeader, CustomerRegistrationRequestDto request);
Task<ResponseDto<CheckMIdRequestStatusDto?>> CheckMidStatus(RequestHeader requestHeader, CheckMIdRequestStatusDto request);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Duc.Splitt.Common.Dtos.Responses;
using Duc.Splitt.MIDIntegrationService;
using static Duc.Splitt.Common.Dtos.Requests.PACIMobileIdRequest;
using static Duc.Splitt.Common.Dtos.Responses.PACIMobileIdResponse;

namespace Duc.Splitt.Core.Contracts.Services
{
public interface IMIDServiceAuthenticationService
{

Task<ResponseDto<MobileAuthPNResponseDto?>> InitiateAuthRequestPN(RequestHeader requestHeader, MobileAuthPNRequestDto requestDto);
Task<ResponseDto<bool?>> CallBackPN(CallbackResponse PACIcallback);
}
}
4 changes: 3 additions & 1 deletion Duc.Splitt/Duc.Splitt.Core/Duc.Splitt.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@
<Compile Include="Contracts\Repositories\ILkNationalityRepository.cs" />
<Compile Include="Contracts\Repositories\ILkLocationRepository.cs" />
<Compile Include="Contracts\Repositories\ILkDocumentCategoryRepository.cs" />
<Compile Include="Contracts\Services\IAuthConsumerService.cs" />
<Compile Include="Contracts\Services\IAuthCustomerService.cs" />
<Compile Include="Contracts\Services\IAuthBackOfficeService.cs" />
<Compile Include="Contracts\Services\IAuthMerchantService.cs" />
<Compile Include="Contracts\Services\IBackOfficeMerchantService.cs" />
<Compile Include="Contracts\Services\IMIDServiceAuthenticationService.cs" />
<Compile Include="Contracts\Services\IOrderService.cs" />
<Compile Include="Contracts\Services\IUtilitiesService.cs" />
<Compile Include="Contracts\Services\IMerchantService.cs" />
Expand All @@ -76,6 +77,7 @@
<ProjectReference Include="..\Duc.Splitt.Common\Duc.Splitt.Common.csproj" />
<ProjectReference Include="..\Duc.Splitt.Data\Duc.Splitt.Data.csproj" />
<ProjectReference Include="..\Duc.Splitt.Identity\Duc.Splitt.Identity.csproj" />
<ProjectReference Include="..\Duc.Splitt.MIDIntegrationService\Duc.Splitt.MIDIntegrationService.csproj" />
</ItemGroup>

</Project>
14 changes: 7 additions & 7 deletions Duc.Splitt/Duc.Splitt.CustomerApi/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ namespace Duc.Splitt.CustomerApi.Controllers

public class AuthController : BaseAnonymous
{
private readonly IAuthConsumerService _authConsumerService;
private readonly IAuthCustomerService _authConsumerService;
private readonly ILoggerService _logger;
private IUtilsService _utilsService;
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public AuthController(ILookupService lookupService, ILoggerService logger, IUtilsService utilsService, IAuthConsumerService authConsumerService)
public AuthController(ILookupService lookupService, ILoggerService logger, IUtilsService utilsService, IAuthCustomerService authConsumerService)
{

_logger = logger;
Expand All @@ -25,7 +25,7 @@ public AuthController(ILookupService lookupService, ILoggerService logger, IUtil
}

[HttpPost]
public async Task<ResponseDto<bool?>> RequestConsumerUserOTP(AuthConsumerUserDto.RegisterDto requestDto)
public async Task<ResponseDto<bool?>> RequestConsumerUserOTP(AuthConsumerUserRequestDto.RegisterDto requestDto)
{
ResponseDto<bool?> response = new ResponseDto<bool?>
{
Expand All @@ -40,7 +40,7 @@ public AuthController(ILookupService lookupService, ILoggerService logger, IUtil
response.Code = ResponseStatusCode.InvalidToken;
return response;
}
var result = await _authConsumerService.RequestConsumerUserOTP(validateRequest, requestDto);
var result = await _authConsumerService.RequestOTP(validateRequest, requestDto);
return result;
}
catch (Exception ex)
Expand All @@ -54,9 +54,9 @@ public AuthController(ILookupService lookupService, ILoggerService logger, IUtil
}

[HttpPost]
public async Task<ResponseDto<AuthTokens?>> VerifyConsumerUserOTP(AuthConsumerUserDto.VerifyOtpDto requestDto)
public async Task<ResponseDto<VerifyOtpResponse?>> VerifyConsumerUserOTP(AuthConsumerUserRequestDto.VerifyOtpDto requestDto)
{
ResponseDto<AuthTokens?> response = new ResponseDto<AuthTokens?>
ResponseDto<VerifyOtpResponse?> response = new ResponseDto<VerifyOtpResponse?>
{
Code = ResponseStatusCode.NoDataFound
};
Expand All @@ -69,7 +69,7 @@ public AuthController(ILookupService lookupService, ILoggerService logger, IUtil
response.Code = ResponseStatusCode.InvalidToken;
return response;
}
var obj = await _authConsumerService.VerifyConsumerUserOTP(validateRequest, requestDto);
var obj = await _authConsumerService.VerifyOTP(validateRequest, requestDto);
return obj;
}
catch (Exception ex)
Expand Down
57 changes: 57 additions & 0 deletions Duc.Splitt/Duc.Splitt.CustomerApi/Controllers/PACIController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Duc.Splitt.Common.Dtos.Responses;
using Duc.Splitt.Common.Enums;
using Duc.Splitt.Core.Contracts.Services;
using Duc.Splitt.CustomerApi.Helper;
using Duc.Splitt.Logger;
using Microsoft.AspNetCore.Mvc;
using static Duc.Splitt.Common.Dtos.Requests.PACIMobileIdRequest;
using static Duc.Splitt.Common.Dtos.Responses.PACIMobileIdResponse;

namespace Duc.Splitt.CustomerApi.Controllers
{

public class PACIController : BaseAnonymous
{
private readonly IMIDServiceAuthenticationService _mIDServiceAuthentication;
private readonly ILoggerService _logger;
private IUtilsService _utilsService;
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
public PACIController(IMIDServiceAuthenticationService mIDServiceAuthentication, ILoggerService logger, IUtilsService utilsService)
{
_mIDServiceAuthentication = mIDServiceAuthentication;
_logger = logger;
_utilsService = utilsService;
}


[HttpPost()]
public async Task<ResponseDto<MobileAuthPNResponseDto?>> InitiateAuthRequestPN(MobileAuthPNRequestDto requestDto)
{
ResponseDto<MobileAuthPNResponseDto?> response = new ResponseDto<MobileAuthPNResponseDto?>
{
Code = ResponseStatusCode.NoDataFound
};
try
{
var validateRequest = await _utilsService.ValidateRequest(this.Request, null);
if (validateRequest == null)
{
response.Code = ResponseStatusCode.InvalidToken;
return response;
}
var obj = await _mIDServiceAuthentication.InitiateAuthRequestPN(validateRequest, requestDto);
return obj;
}
catch (Exception ex)
{
_logger.LogError(ex);
response.Code = ResponseStatusCode.ServerError;
response.Errors = _logger.ConvertExceptionToStringList(ex);
return response;
}
}

}
}


Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ItemGroup>
<ProjectReference Include="..\Duc.Splitt.Common\Duc.Splitt.Common.csproj" />
<ProjectReference Include="..\Duc.Splitt.Identity\Duc.Splitt.Identity.csproj" />
<ProjectReference Include="..\Duc.Splitt.MIDIntegrationService\Duc.Splitt.MIDIntegrationService.csproj" />
<ProjectReference Include="..\Duc.Splitt.Respository\Duc.Splitt.Respository.csproj" />
<ProjectReference Include="..\Duc.Splitt.Service\Duc.Splitt.Service.csproj" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 03c25e4

Please sign in to comment.