...
This commit is contained in:
@@ -37,8 +37,8 @@ namespace Back.Controllers
|
||||
{
|
||||
if (logo == null)
|
||||
return BadRequest();
|
||||
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var result = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var company = result?.RolUsers.First().Company;
|
||||
@@ -50,25 +50,25 @@ namespace Back.Controllers
|
||||
//کاهش سایز تصویر
|
||||
image.Mutate(x => x.Resize(200, 200));
|
||||
var img = new MemoryStream();
|
||||
image.Save(img, image.Metadata.DecodedImageFormat );
|
||||
image.Save(img, image.Metadata.DecodedImageFormat);
|
||||
company.Logo = img.ToArray();
|
||||
|
||||
//-------------
|
||||
|
||||
|
||||
|
||||
return Ok(await _servCompany.AddORUpdateCompanyBoolResult(company));
|
||||
}
|
||||
[HttpGet("ChangeName/{name}")]
|
||||
public async Task<ActionResult<bool>> ChangeName(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name) || name.Length<=3)
|
||||
return BadRequest(new List<string> { "نام صحیح نمی باشد"});
|
||||
if (string.IsNullOrEmpty(name) || name.Length <= 3)
|
||||
return BadRequest(new List<string> { "نام صحیح نمی باشد" });
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
var company = user?.RolUsers.First().Company;
|
||||
company.Name = name;
|
||||
user.Fullname=name;
|
||||
user.Fullname = name;
|
||||
await _servUser.UpdateUser(user);
|
||||
return Ok(await _servCompany.AddORUpdateCompanyBoolResult(company));
|
||||
}
|
||||
@@ -82,9 +82,9 @@ namespace Back.Controllers
|
||||
return Ok(new TaxPayerInfoDto
|
||||
{
|
||||
EconomicCode = company.EconomicCode,
|
||||
PrivateKey = company.PrivateKey ,
|
||||
UniqeMemory = company.UniqeMemory ,
|
||||
BranchID=company.BranchID,
|
||||
PrivateKey = company.PrivateKey,
|
||||
UniqeMemory = company.UniqeMemory,
|
||||
BranchID = company.BranchID,
|
||||
});
|
||||
}
|
||||
[HttpPut("ChangeTaxPayerInfo")]
|
||||
@@ -94,10 +94,16 @@ namespace Back.Controllers
|
||||
var UserID = claim.Value;
|
||||
var user = await _servUser.GetUserByUserID(Convert.ToInt32(UserID));
|
||||
|
||||
if (!string.IsNullOrEmpty(model.BranchID) && (model.BranchID.Length > 10 || !int.TryParse(model.BranchID, out int a)))
|
||||
return BadRequest(new List<string> {"مقدار کد شعبه صحیح نمی باشد" });
|
||||
if (!string.IsNullOrEmpty(model.BranchID))
|
||||
{
|
||||
if (!int.TryParse(model.BranchID, out int a))
|
||||
return BadRequest(new List<string> { "مقدار کد شعبه صحیح نمی باشد" });
|
||||
if(model.BranchID.Length!=4)
|
||||
return BadRequest(new List<string> { "مقدار کد شعبه یاید 4عددی باشد" });
|
||||
|
||||
if (!string.IsNullOrEmpty(model.UniqeMemory) && (model.UniqeMemory.Length !=6 ))
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(model.UniqeMemory) && (model.UniqeMemory.Length != 6))
|
||||
return BadRequest(new List<string> { "مقدار حافظه مالیاتی صحیح نمی باشد" });
|
||||
|
||||
var company = user?.RolUsers.First().Company;
|
||||
@@ -109,9 +115,9 @@ namespace Back.Controllers
|
||||
if (await _servTaxPayer.CheckingTheCompanyKeyInformation(company.ID, model.UniqeMemory, model.PrivateKey, model.EconomicCode))
|
||||
return BadRequest(new List<string> { "فیلدهای کلیدی شامل (کداقتصادی،شناسه حافظه مالیاتی،کلید خصوصی)" + " برای شرکت دیگری ثبت شده است" });
|
||||
|
||||
|
||||
|
||||
company.EconomicCode = model.EconomicCode;
|
||||
company.PrivateKey = model.PrivateKey;
|
||||
company.PrivateKey = model.PrivateKey;
|
||||
company.UniqeMemory = model.UniqeMemory;
|
||||
company.BranchID = model.BranchID;
|
||||
return Ok(await _servCompany.AddORUpdateCompanyBoolResult(company));
|
||||
|
@@ -152,7 +152,7 @@ namespace Back.Controllers
|
||||
[HttpGet("SendInvoice/{InvoiceID}")]
|
||||
public async Task<ActionResult<bool>> SendInvoice(int InvoiceID)
|
||||
{
|
||||
return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
//return BadRequest(new List<string> { "در حال حاضر سامانه مودیان در دسترس نمی باشد" });
|
||||
|
||||
var claim = HttpContext.User.Claims.First(c => c.Type == "UserID");
|
||||
var UserID = claim.Value;
|
||||
@@ -255,7 +255,7 @@ namespace Back.Controllers
|
||||
// مجموع سایر مالیات، عوارض و وجوه قانونی
|
||||
Todam = result.todam ?? null,
|
||||
//صورتحساب مجموع
|
||||
Tbill =-10 /* result.tbill ?? null*/,
|
||||
Tbill = result.tbill ?? null,
|
||||
//مجموع وزن خالض
|
||||
Tonw = level == 10 ? result.tonw : null,
|
||||
//مجموع ارزش ریالی
|
||||
@@ -302,7 +302,7 @@ namespace Back.Controllers
|
||||
// مبلغ واحد
|
||||
Fee = level == 4 ? null : bitem.fee,
|
||||
//میزان ارز
|
||||
Cfee = level==8 || level==10 ?null: bitem.cfee,
|
||||
Cfee = bitem.cfee == 0|| level ==8 || level==10 ?null: bitem.cfee ,
|
||||
//نوع ارز
|
||||
Cut = level == 8 || string.IsNullOrEmpty(bitem.cut) ? null : bitem.cut,
|
||||
//نرخ برابری ارز با ریال
|
||||
|
@@ -14,7 +14,12 @@ namespace Back.Data.Models
|
||||
#region autofild
|
||||
//تاریخ و زمان پرداخت
|
||||
[MaxLength(13)]
|
||||
public long? pdt { get { return new DateTimeOffset(PaymentDateTime.Trim().ToMiladi()).ToUnixTimeSeconds(); } }
|
||||
public long? pdt { get
|
||||
{
|
||||
return null;
|
||||
return new DateTimeOffset(PaymentDateTime.Trim().ToMiladi().Date).ToUnixTimeSeconds();
|
||||
|
||||
} }
|
||||
#endregion
|
||||
|
||||
#region fild
|
||||
|
@@ -16,10 +16,14 @@ namespace Back.Services
|
||||
private string _UniqueMemory;
|
||||
private string _PrivateKey;
|
||||
private readonly servCompany _servCompany;
|
||||
public ActionTaxPayer(servCompany servCompany)
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public ActionTaxPayer(servCompany servCompany, IConfiguration configuration)
|
||||
{
|
||||
_servCompany = servCompany;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string GenerateTaxid(string FactorNo, string InvoiceDate)
|
||||
{
|
||||
//return "testTaxid";
|
||||
@@ -70,12 +74,14 @@ namespace Back.Services
|
||||
|
||||
if (!string.IsNullOrEmpty(resquth.UniqueMemory) && !string.IsNullOrEmpty(resquth.PrivateKey))
|
||||
{
|
||||
// "https://sandboxrc.tax.gov.ir/req/api/"
|
||||
|
||||
//string taxapi = _configuration.GetSection("TaxPayerApi").Value;
|
||||
string taxapi = "https://sandboxrc.tax.gov.ir/req/api/";
|
||||
_UniqueMemory = resquth.UniqueMemory;
|
||||
_PrivateKey = resquth.PrivateKey;
|
||||
TaxApiService.Instance.Init(_UniqueMemory,
|
||||
new SignatoryConfig(_PrivateKey, null),
|
||||
new NormalProperties(ClientType.SELF_TSP), "https://tp.tax.gov.ir/req/api/");
|
||||
new NormalProperties(ClientType.SELF_TSP), taxapi);
|
||||
await TaxApiService.Instance.TaxApis.GetServerInformationAsync();
|
||||
}
|
||||
#endregion
|
||||
|
@@ -65,8 +65,8 @@ namespace Back.Validations
|
||||
RuleFor(r => r.Item2.BranchID)
|
||||
.Custom((model, context) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model) && (model.Length > 10))
|
||||
context.AddFailure("تعداد کارکتر کد شعبه صحبح نمی باشد");
|
||||
if (!string.IsNullOrEmpty(model) && (model.Length !=4))
|
||||
context.AddFailure("مقدار کد شعبه یاید 4عددی باشد");
|
||||
});
|
||||
RuleFor(r => r.Item2.ZipCode)
|
||||
.Custom((model, context) =>
|
||||
|
@@ -5,5 +5,6 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
"AllowedHosts": "*",
|
||||
"TaxPayerApi": "https://tp.tax.gov.ir/req/api/"
|
||||
}
|
||||
|
Reference in New Issue
Block a user