122 lines
3.1 KiB
C#
122 lines
3.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Security.Permissions;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace _0_Framework.Application.UID;
|
|
|
|
#region PersonalInfoResponseDTO
|
|
|
|
/// <summary>
|
|
/// ویو مدل اطلاعات شخصی کاربر که از سرویس یو آیدی دریافت می شود
|
|
/// </summary>
|
|
/// <param name="command"></param>
|
|
/// <param name="IdentificationInformation"></param>
|
|
/// <param name="RegistrationStatus"></param>
|
|
/// <param name="ResponseContext"></param>
|
|
public record PersonalInfoResponse(
|
|
UidBasicInformation BasicInformation,
|
|
IdentificationInformation IdentificationInformation,
|
|
RegistrationStatus RegistrationStatus,
|
|
ResponseContext ResponseContext);
|
|
|
|
|
|
|
|
public class UidBasicInformation
|
|
{
|
|
public string FirstName { get; set; }
|
|
public string LastName { get; set; }
|
|
public string FatherName { get; set; }
|
|
|
|
[JsonProperty("gender")]
|
|
public string Gender { get; set; }
|
|
|
|
public Gender GenderEnum => Gender switch
|
|
{
|
|
"GENDER_MALE" => Application.Gender.Male,
|
|
"GENDER_FEMALE" => Application.Gender.Female,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
}
|
|
public record IdentificationInformation(string NationalId, string BirthDate, string ShenasnameSeri, string ShenasnameSerial, string ShenasnamehNumber);
|
|
|
|
public class RegistrationStatus
|
|
{
|
|
[JsonProperty("deathStatus")]
|
|
public string DeathStatus { get; set; }
|
|
|
|
public DeathStatus DeathStatusEnum => DeathStatus switch
|
|
{
|
|
"DEATH_STATUS_ALIVE" => UID.DeathStatus.Alive,
|
|
"DEATH_STATUS_DEATH" => UID.DeathStatus.Dead,
|
|
_ => throw new ArgumentOutOfRangeException()
|
|
};
|
|
};
|
|
public record ResponseContext(UidStatus Status);
|
|
|
|
public record UidStatus(int Code, string Message);
|
|
|
|
public enum DeathStatus
|
|
{
|
|
Alive,
|
|
Dead,
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region PersonalInfoRequestDTO
|
|
/// <summary>
|
|
/// درخواست اطلاعات شخصی کاربر از سرویس یو آیدی
|
|
/// </summary>
|
|
public class PersonalInfoRequest
|
|
{
|
|
[JsonProperty("requestContext")]
|
|
public UidRequestContext RequestContext { get; set; }
|
|
|
|
[JsonProperty("nationalId")]
|
|
public string NationalId { get; set; }
|
|
|
|
[JsonProperty("birthDate")]
|
|
public string BirthDate { get; set; }
|
|
|
|
[JsonProperty("mobileNumber")]
|
|
public string MobileNumber { get; set; }
|
|
}
|
|
|
|
public class UidRequestContext
|
|
{
|
|
[JsonProperty("apiInfo")]
|
|
public ApiInfo ApiInfo => new ApiInfo();
|
|
|
|
};
|
|
|
|
public record ApiInfo
|
|
{
|
|
[JsonProperty("businessToken")]
|
|
public string BusinessToken => "5e03dd4e-999d-466f-92d8-7c0b1f66a8e9";
|
|
|
|
[JsonProperty("businessId")]
|
|
public string BusinessId => "98ed67ca-d441-4978-a748-e8bebce010eb";
|
|
}
|
|
#endregion
|
|
|
|
public interface IUidService
|
|
{
|
|
Task<PersonalInfoResponse> GetPersonalInfo(string nationalCode , string birthDate);
|
|
Task<MatchMobileWithNationalCodeResponse> IsMachPhoneWithNationalCode(string nationalCode , string phoneNumber);
|
|
}
|
|
|
|
public class MatchMobileWithNationalCodeResponse
|
|
{
|
|
[JsonProperty("isMatched")] public bool IsMatched { get; set; }
|
|
|
|
public ResponseContext ResponseContext { get; set; }
|
|
}
|
|
|