set authorize data
This commit is contained in:
@@ -58,7 +58,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
string dateOfBirth, string mobile)
|
||||
{
|
||||
var op = new OperationResult<ContractingPartyTempViewModel>();
|
||||
|
||||
var result = new ContractingPartyTempViewModel();
|
||||
#region Validations
|
||||
|
||||
if (string.IsNullOrWhiteSpace(nationalCode) || string.IsNullOrWhiteSpace(dateOfBirth) ||
|
||||
@@ -96,6 +96,66 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
var contractingParty =await _personalContractingPartyRepository.GetByNationalCode(nationalCode);
|
||||
|
||||
if (contractingParty != null)
|
||||
{
|
||||
result.Id = contractingParty.id;
|
||||
result.FName = contractingParty.FName;
|
||||
result.LName = contractingParty.LName;
|
||||
result.DateOfBirthFa = dateOfBirth;
|
||||
result.FatherName = contractingParty.FatherName;
|
||||
result.IdNumberSerial = contractingParty.IdNumberSerial;
|
||||
result.IdNumber = contractingParty.IdNumber;
|
||||
|
||||
if (contractingParty.DateOfBirth != null &&contractingParty.DateOfBirth != dateOfBirthGr)
|
||||
return op.Failed("تاریخ تولد مطابقت ندارد");
|
||||
|
||||
if (contractingParty.Phone != mobile)
|
||||
return op.Failed("شما قبلا با شماره همراه دیگری ثبت نام نموده اید");
|
||||
|
||||
var idNumberParty = contractingParty.IdNumber;
|
||||
if (!contractingParty.IsAuthenticated)
|
||||
{
|
||||
//دریافت اطلاعات احراز هویت
|
||||
var apiResponsParty = await _uidService.GetPersonalInfo(nationalCode, dateOfBirth);
|
||||
|
||||
if (apiResponsParty == null)
|
||||
throw new InternalServerException("خطا در سرویس احراز هویت");
|
||||
|
||||
if (apiResponsParty.ResponseContext.Status.Code ==14)
|
||||
throw new InternalServerException("سیستم احراز هویت در دسترس نمی باشد");
|
||||
|
||||
if (apiResponsParty.ResponseContext.Status.Code != 0)
|
||||
return op.Failed($"{apiResponsParty.ResponseContext.Status.Message}");
|
||||
|
||||
idNumberParty = apiResponsParty.IdentificationInformation.ShenasnamehNumber == "0"
|
||||
? apiResponsParty.IdentificationInformation.NationalId
|
||||
: apiResponsParty.IdentificationInformation.ShenasnamehNumber;
|
||||
|
||||
contractingParty.Authentication(apiResponsParty.BasicInformation.FirstName, apiResponsParty.BasicInformation.LastName,
|
||||
apiResponsParty.BasicInformation.FatherName,idNumberParty,apiResponsParty.IdentificationInformation.ShenasnameSeri,
|
||||
apiResponsParty.IdentificationInformation.ShenasnameSerial,dateOfBirth,apiResponsParty.BasicInformation.GenderEnum);
|
||||
|
||||
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
}
|
||||
|
||||
result.Id = contractingParty.id;
|
||||
result.FName = contractingParty.FName;
|
||||
result.LName = contractingParty.LName;
|
||||
result.DateOfBirthFa = dateOfBirth;
|
||||
result.FatherName = contractingParty.FatherName;
|
||||
result.IdNumberSerial = contractingParty.IdNumberSerial;
|
||||
result.IdNumber = idNumberParty;
|
||||
result.Address = contractingParty.Address;
|
||||
result.Phone = contractingParty.Phone;
|
||||
result.City = contractingParty.City;
|
||||
result.State = contractingParty.State;
|
||||
result.RepresentativeId = contractingParty.RepresentativeId;
|
||||
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
|
||||
if (getExistTemp != null)
|
||||
{
|
||||
@@ -107,6 +167,8 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
if (institutionContractTemp.RegistrationStatus == InstitutionContractTempStatus.Completed)
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (getExistTemp.DateOfBirth != dateOfBirthGr)
|
||||
return op.Failed("تاریخ تولد مطابقت ندارد");
|
||||
@@ -147,8 +209,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
dateOfBirthGr);
|
||||
await _contractingPartyTempRepository.CreateAsync(createTemp);
|
||||
await _contractingPartyTempRepository.SaveChangesAsync();
|
||||
|
||||
var result = new ContractingPartyTempViewModel();
|
||||
|
||||
result.Id = createTemp.id;
|
||||
result.FName = createTemp.FName;
|
||||
result.LName = createTemp.LName;
|
||||
@@ -156,14 +217,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
result.FatherName = createTemp.FatherName;
|
||||
result.IdNumberSerial = createTemp.IdNumberSerial;
|
||||
result.IdNumber = idNumber;
|
||||
|
||||
if (contractingParty != null)
|
||||
{
|
||||
result.Address = contractingParty.Address;
|
||||
result.City = contractingParty.City;
|
||||
result.State = contractingParty.State;
|
||||
result.RepresentativeId = contractingParty.RepresentativeId;
|
||||
}
|
||||
|
||||
|
||||
return op.Succcedded(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user