From 560ea04f33608852063a667bcc7d91dd9866d899 Mon Sep 17 00:00:00 2001 From: mahan Date: Sat, 11 Oct 2025 13:28:04 +0330 Subject: [PATCH] refactor: remove unused ExtensionInquiry method and clean up IInstitutionContractApplication interface --- .../IInstitutionContractApplication.cs | 4 - .../InstitutionContractApplication.cs | 103 ------------------ .../institutionContractController.cs | 8 -- 3 files changed, 115 deletions(-) diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs index e91e5492..5e54eb15 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs @@ -218,11 +218,7 @@ public interface IInstitutionContractApplication Task GetExtensionPaymentMethod( InstitutionContractExtensionPaymentRequest request); - //TODO:Complete Data. - - Task ExtensionComplete(InstitutionContractExtensionCompleteRequest request); - Task ExtensionInquiry(InstitutionContractExtensionInquiryRequest command); } public class InstitutionContractExtensionInquiryResponse diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index 8e68bc8e..14fa1f47 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -1302,109 +1302,6 @@ public class InstitutionContractApplication : IInstitutionContractApplication return await _institutionContractRepository.ExtensionComplete(request); } - public async Task ExtensionInquiry(InstitutionContractExtensionInquiryRequest command) - { - var op = new OperationResult(); - - #region Validations - if (string.IsNullOrWhiteSpace(command.NationalCode) || string.IsNullOrWhiteSpace(command.BirthDate) || - string.IsNullOrWhiteSpace(command.Mobile)) - throw new BadRequestException("هیچ یک از فیلد ها نمیتواند خالی باشد"); - - if (command.NationalCode.NationalCodeValid() != "valid") - throw new BadRequestException("کد ملی نا معتبر است"); - - if (!command.BirthDate.TryToGeorgianDateTime(out var dateOfBirthGr)) - throw new BadRequestException("تاریخ تولد نا معتبر است"); - - if (!command.Mobile.IsMobileValid()) - throw new BadRequestException("شماره همراه نا معتبر است"); - #endregion - - var contractingParty = _contractingPartyRepository.Get(command.ContractingPartyId); - - if (contractingParty == null) - throw new BadRequestException("طرف حسابی یافت نشد"); - - // بررسی اینکه آیا طرف حساب قبلا احراز هویت شده یا نه - if (contractingParty.IsAuthenticated) - throw new BadRequestException("طرف حساب قبلا احراز هویت شده است"); - - - - // // بررسی تطابق تاریخ تولد - // if (contractingParty.DateOfBirth != null && contractingParty.DateOfBirth != dateOfBirthGr) - // return op.Failed("تاریخ تولد مطابقت ندارد"); - - // // بررسی تطابق شماره تماس - // if (contractingParty.Phone != command.Mobile) - // return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید"); - - // چک کردن مطابقت شماره همراه و کد ملی - var isMachMobilAndNationalCode = await _uidService.IsMachPhoneWithNationalCode(command.NationalCode, command.Mobile); - if (isMachMobilAndNationalCode == null) - throw new BadRequestException("خطا در سرویس احراز هویت"); - if (!isMachMobilAndNationalCode.IsMatched) - throw new BadRequestException("شماره همراه وارد شده با کد ملی مطابقت ندارد"); - - // دریافت اطلاعات احراز هویت - var apiResponse = await _uidService.GetPersonalInfo(command.NationalCode, command.BirthDate); - - if (apiResponse == null) - throw new InternalServerException("خطا در سرویس احراز هویت"); - - if (apiResponse.ResponseContext.Status.Code == 14) - throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد"); - - if (apiResponse.ResponseContext.Status.Code != 0) - throw new BadRequestException($"{apiResponse.ResponseContext.Status.Message}"); - - var idNumber = apiResponse.IdentificationInformation.ShenasnamehNumber == "0" - ? apiResponse.IdentificationInformation.NationalId - : apiResponse.IdentificationInformation.ShenasnamehNumber; - - if (contractingParty.IsLegal =="حقیقی") - { - // انجام احراز هویت طرف حساب - contractingParty.Authentication(apiResponse.BasicInformation.FirstName, - apiResponse.BasicInformation.LastName, - apiResponse.BasicInformation.FatherName, - idNumber, - apiResponse.IdentificationInformation.ShenasnameSeri, - apiResponse.IdentificationInformation.ShenasnameSerial, - command.BirthDate, - apiResponse.BasicInformation.GenderEnum); - } - else - { - contractingParty.LegalAuthentication(apiResponse.BasicInformation.FirstName, - apiResponse.BasicInformation.LastName, - apiResponse.BasicInformation.FatherName, - idNumber, - apiResponse.IdentificationInformation.ShenasnameSeri, - apiResponse.IdentificationInformation.ShenasnameSerial, - command.BirthDate, - apiResponse.BasicInformation.GenderEnum); - } - // ذخیره تغییرات - await _contractingPartyRepository.SaveChangesAsync(); - - var result = new InstitutionContractExtensionInquiryResponse(); - result.Id = contractingParty.id; - result.FName = contractingParty.FName; - result.LName = contractingParty.LName; - result.DateOfBirthFa = command.BirthDate; - result.FatherName = contractingParty.FatherName; - result.IdNumberSerial = contractingParty.IdNumberSerial; - result.IdNumber = idNumber; - result.Address = contractingParty.Address; - result.Phone = contractingParty.Phone; - result.City = contractingParty.City; - result.State = contractingParty.State; - result.RepresentativeId = contractingParty.RepresentativeId; - result.NationalCode = contractingParty.Nationalcode; - return result; - } private async Task> CreateLegalContractingPartyEntity( CreateInstitutionContractLegalPartyRequest request, long representativeId, string address, string city, diff --git a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs index ef09b0cb..9459b6be 100644 --- a/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs +++ b/ServiceHost/Areas/Admin/Controllers/institutionContractController.cs @@ -512,14 +512,6 @@ public class institutionContractController : AdminBaseController var res =await _institutionContractApplication.ExtensionComplete(request); return res; } - - [HttpPost("extenstion/inquiry")] - public async Task> ExtensionInquiry([FromBody] InstitutionContractExtensionInquiryRequest command) - { - var res = await _institutionContractApplication.ExtensionInquiry(command); - return res; - } - }