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 /// /// ویو مدل اطلاعات شخصی کاربر که از سرویس یو آیدی دریافت می شود /// /// /// /// /// 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, _ => Application.Gender.None }; } 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 /// /// درخواست اطلاعات شخصی کاربر از سرویس یو آیدی /// 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 GetPersonalInfo(string nationalCode , string birthDate); Task IsMachPhoneWithNationalCode(string nationalCode , string phoneNumber); Task IbanInquiry (string iban); Task AccountToIban(string accountNumber, UidBanks bank); Task CardToIban(string cardNumber); } public class CardToNumberResponse:UidBaseResponse { public string Iban { get; set; } public string CardNumber { get; set; } } public class AccountToIbanResponse:UidBaseResponse { public string Iban { get; set; } } public class IbanInquiryResponse:UidBaseResponse { public IbanInquiryAccountBasicInformation AccountBasicInformation { get; set; } [JsonProperty("owners")] public List Owners { get; set; } } public class IbanInquiryAccountBasicInformation { public string Iban { get; set; } public string AccountNumber { get; set; } public IbanInquiryBankInformation BankInformation { get; set; } public string AccountStatus { get; set; } } public class IbanInquiryBankInformation { public string BankName { get; set; } } public class IbanInquiryOwner { [JsonProperty("firstName")] public string FirstName { get; set; } [JsonProperty("lastName")] public string LastName { get; set; } [JsonProperty("nationalIdentifier")] public string NationalIdentifier { get; set; } [JsonProperty("customerType")] public string CustomerType { get; set; } } public class MatchMobileWithNationalCodeResponse { [JsonProperty("isMatched")] public bool IsMatched { get; set; } public ResponseContext ResponseContext { get; set; } } public class UidBaseResponse { public ResponseContext ResponseContext { get; set; } }