This commit is contained in:
mmrbnjd
2024-07-09 23:04:19 +03:30
parent 414e52f19d
commit d67a9ae440
4 changed files with 59 additions and 8 deletions

View File

@@ -435,7 +435,7 @@ namespace Back.Controllers
{
foreach (var item in responseModel.Body.Result)
{
//ta imja
var ressenttax = new SentTax
{
@@ -447,8 +447,11 @@ namespace Back.Controllers
uId = item.Uid,
SentStatus = SentStatus.Send,
InvoiceModel = JsonConvert.SerializeObject(result, Formatting.Indented,new JsonSerializerSettings
{ PreserveReferencesHandling = PreserveReferencesHandling.Objects }),
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects
}),
ResponseModel = JsonConvert.SerializeObject(responseModel)
};
await _servTaxPayer.AddSentTax(ressenttax);
}
@@ -494,16 +497,17 @@ namespace Back.Controllers
if (string.IsNullOrEmpty(item.uId))
return BadRequest(new List<string> { "کد پیگیری یافت نشد" });
if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
//if (!await _actionTaxPayer.login(user.RolUsers.First().CompanyID))
// return BadRequest(new List<string> { "خطا در احراز هویت سازمان مالیاتی" });
DataInSendTaxDto desData = new DataInSendTaxDto();
if (item.SentStatus == SentStatus.Send
|| item.SentStatus == SentStatus.pending
|| item.SentStatus == SentStatus.IN_PROGRESS)
|| item.SentStatus == SentStatus.IN_PROGRESS
|| item.SentStatus == SentStatus.Unsuccessful)
{
//ta imja
var result = await _actionTaxPayer.GetResultByUid(user.RolUsers.First().CompanyID, item.uId);
if (result == null)
return BadRequest(new List<string> { "پاسخی از سازمان دریافت نشد" });
@@ -528,10 +532,13 @@ namespace Back.Controllers
: result.Status == "IN_PROGRESS" ? SentStatus.IN_PROGRESS
: SentStatus.Unknown;
}
if (await _servTaxPayer.UpdateSentTax(item)) return Ok(desData);
else return BadRequest(new List<string> { "خطای در ذخیره سازی" });
}
else if (item.SentStatus == SentStatus.Unsuccessful && !string.IsNullOrEmpty(item.InquiryResultModel))
{
InquiryResultModel inquiryResult = JsonConvert.DeserializeObject<InquiryResultModel>(item.InquiryResultModel);

View File

@@ -5,7 +5,7 @@ using Back.Common;
using Shared.DTOs;
namespace Back.Data.Models
{
public class Invoice
public class Invoice : ICloneable
{
#region Key
public int ID { get; set; }
@@ -178,6 +178,12 @@ namespace Back.Data.Models
[ForeignKey("CompanyID")]
[JsonIgnore]
public virtual Company? company { get; set; }
public object Clone()
{
return this.MemberwiseClone();
}
#endregion
}

View File

@@ -0,0 +1,25 @@
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using System.Reflection;
namespace Back.Features
{
public class IgnorePropertiesResolver : DefaultContractResolver
{
private readonly HashSet<string> ignoreProps;
public IgnorePropertiesResolver(IEnumerable<string> propNamesToIgnore)
{
this.ignoreProps = new HashSet<string>(propNamesToIgnore);
}
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
JsonProperty property = base.CreateProperty(member, memberSerialization);
if (this.ignoreProps.Contains(property.PropertyName))
{
property.ShouldSerialize = _ => false;
}
return property;
}
}
}

View File

@@ -1,6 +1,7 @@
using Back.Common;
using Microsoft.IdentityModel.Tokens;
using Newtonsoft.Json;
using Shared.DTOs;
using TaxCollectData.Library.Business;
using TaxCollectData.Library.Dto.Config;
using TaxCollectData.Library.Dto.Content;
@@ -27,6 +28,18 @@ namespace Back.Services
}
public async Task<InquiryResultModel> GetResultByUid(int CompanyID, string uid)
{
return new InquiryResultModel("18084a18-1eb4-41cd-8bd3-2cad73c45398", "0a4a4ab2-8047-4c31-b765-456ddf0e9c53", "SUCCESS",
new DataInSendTaxDto()
{
error=new List<MessageInSendTaxDto>()
{
new MessageInSendTaxDto()
{
code="21001",message="یک خطای تست"
}
}
}
, "receive_invoice_confirm", "A2FFKZ");
if (!await login(CompanyID))
return null;
var uidAndFiscalId = new UidAndFiscalId(uid, _UniqueMemory);