private Task <ResponseOfdCheckDesk> RequestOfd(RequestOfdCashDesk kkmRequest) { var kkm = new OfdKkm { SerialNumber = kkmRequest.SerialNumber, PointOfPaymentNumber = "1", FnsKkmId = kkmRequest.FnsKkmId, TerminalNumber = "1" }; var org = new global::Models.DTO.RequestOperatorOfd.Org { Inn = kkmRequest.Iin, Okved = "", TaxationType = 0, Title = kkmRequest.NameOrg }; Request requestOfd = new Request { Command = 5, DeviceId = kkmRequest.DeviceId, ReqNum = kkmRequest.ReqNum++, Token = kkmRequest.TokenOfd, Service = new Service(new RegInfo(org, kkm)) }; Task <ResponseOfdCheckDesk> res = GetResponse(requestOfd); return(res); }
public IActionResult ChangeToken(Kkm kkmChange) { if (User.IsInRole("blocked") || User.IsInRole("operator")) { return(RedirectToAction("BlockPage", "BlockedUser")); } try { if (ModelState.IsValid) { var kkm = _context.Kkms.FirstOrDefault(i => i.Id == kkmChange.Id); if (kkm != null) { RequestOfdCashDesk kkmRequest = new RequestOfdCashDesk { FnsKkmId = kkm.FnsKkmId, DeviceId = kkm.DeviceId, TokenOfd = kkmChange.OfdToken, SerialNumber = kkm.SerialNumber, Iin = kkm.Iin, NameOrg = kkm.NameOrg, ReqNum = 56 }; var response = RequestOfd(kkmRequest); if (response.Result.Result.ResultCode == 0) { ResponseWeb(response, kkm.Id); } else { ModelState.AddModelError(string.Empty, "Некорректный запрос, попробуйте снова"); return(View(new Kkm() { Id = kkmChange.Id })); } } } else { ModelState.AddModelError(string.Empty, "Некорректный запрос, попробуйте снова"); } } catch (Exception) { ModelState.AddModelError(string.Empty, "Некорректный запрос, попробуйте снова"); } return(RedirectToAction("GetCashDesk", "InitializeCashDesk", new { id = kkmChange.UserId })); }