Cashier. Вроде по нему всё, кроме очётов.
This commit is contained in:
parent
f2eb8081d5
commit
93cbad30f8
@ -82,17 +82,17 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model.CreditingId.HasValue)
|
//проверка на то, что это зачисление на карту, а не перевод между счетами
|
||||||
|
if (model.CreditingId.HasValue)
|
||||||
{
|
{
|
||||||
throw new Exception();
|
_creditingStorage.Update(new CreditingBindingModel
|
||||||
}
|
{
|
||||||
|
Id = model.CreditingId.Value,
|
||||||
|
DateClose = DateTime.Now,
|
||||||
|
Status = StatusEnum.Закрыта
|
||||||
|
});
|
||||||
|
|
||||||
_creditingStorage.Update(new CreditingBindingModel
|
}
|
||||||
{
|
|
||||||
Id = model.CreditingId.Value,
|
|
||||||
DateClose = DateTime.Now,
|
|
||||||
Status = StatusEnum.Закрыта
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -249,30 +249,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
return View(APICashier.GetRequest<List<CreditingViewModel>>($"/api/Account/FindOpenCrediting"));
|
return View(APICashier.GetRequest<List<CreditingViewModel>>($"/api/Account/FindOpenCrediting"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//для страницы "Переводы"
|
|
||||||
[HttpGet]
|
|
||||||
public IActionResult MoneyTransfers()
|
|
||||||
{
|
|
||||||
if (APICashier.Cashier == null)
|
|
||||||
{
|
|
||||||
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
|
||||||
}
|
|
||||||
|
|
||||||
return View(APICashier.GetRequest<List<DebitingViewModel>>($"/api/Account/FindOpenDebiting"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//открытие вьюхи одобрения заявки на зачисление
|
//открытие вьюхи одобрения заявки на зачисление
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CloseCrediting()
|
public IActionResult CloseCrediting()
|
||||||
{
|
{
|
||||||
ViewBag.Creditings = APICashier.GetRequest<List<CreditingViewModel>>("/api/Account/FindOpenCrediting");
|
ViewBag.Creditings = APICashier.GetRequest<List<CreditingViewModel>>("/api/Account/FindOpenCrediting");
|
||||||
|
|
||||||
|
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>("/api/Account/GetAllAccounts");
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//одобрения заявки на зачисление Post-запросом
|
//одобрения заявки на зачисление Post-запросом
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CloseCrediting(int creditingId)
|
public void CloseCrediting(int creditingId, int accountPayeeId)
|
||||||
{
|
{
|
||||||
if (APICashier.Cashier == null)
|
if (APICashier.Cashier == null)
|
||||||
{
|
{
|
||||||
@ -284,8 +274,13 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
throw new Exception("Некорректный номер заявки на зачисление");
|
throw new Exception("Некорректный номер заявки на зачисление");
|
||||||
}
|
}
|
||||||
|
|
||||||
//получаем необходимые данные для запроса
|
if (accountPayeeId < 0)
|
||||||
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindCrediting?id={creditingId}");
|
{
|
||||||
|
throw new Exception("Некорректный id счёта для зацисления средств");
|
||||||
|
}
|
||||||
|
|
||||||
|
//получаем необходимые данные для запроса
|
||||||
|
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindCrediting?id={creditingId}");
|
||||||
|
|
||||||
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Crediting.CardId}");
|
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Crediting.CardId}");
|
||||||
|
|
||||||
@ -294,7 +289,7 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
CashierId = APICashier.Cashier.Id,
|
CashierId = APICashier.Cashier.Id,
|
||||||
CreditingId = creditingId,
|
CreditingId = creditingId,
|
||||||
Sum = APICashier.Crediting.Sum,
|
Sum = APICashier.Crediting.Sum,
|
||||||
AccountPayeeId = APICashier.Card.AccountId
|
AccountPayeeId = accountPayeeId
|
||||||
});
|
});
|
||||||
|
|
||||||
//очистка данных
|
//очистка данных
|
||||||
@ -329,6 +324,11 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
throw new Exception("Некорректный номер заявки на снятие");
|
throw new Exception("Некорректный номер заявки на снятие");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (accountId < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Некорректный номер заявки на снятие");
|
||||||
|
}
|
||||||
|
|
||||||
//получаем необходимые данные для запроса
|
//получаем необходимые данные для запроса
|
||||||
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={debitingId}");
|
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={debitingId}");
|
||||||
|
|
||||||
@ -350,11 +350,20 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
|
|
||||||
//получение номера запрашиваемого счёта для снятия
|
//получение номера запрашиваемого счёта для снятия
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public string GetAccountNumber(int debitingId)
|
public string GetAccountNumber(int id)
|
||||||
{
|
{
|
||||||
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={debitingId}");
|
APICashier.Debiting = APICashier.GetRequest<DebitingViewModel>($"/api/Account/FindDebiting?id={id}");
|
||||||
|
|
||||||
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Debiting.CardId}");
|
APICashier.Crediting = APICashier.GetRequest<CreditingViewModel>($"/api/Account/FindDebiting?id={id}");
|
||||||
|
|
||||||
|
if(APICashier.Debiting == null)
|
||||||
|
{
|
||||||
|
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Crediting.CardId}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
APICashier.Card = APICashier.GetRequest<CardViewModel>($"/api/Card/FindCard?id={APICashier.Debiting.CardId}");
|
||||||
|
}
|
||||||
|
|
||||||
APICashier.Account = APICashier.GetRequest<AccountViewModel>($"/api/Account/GetAccount?accountId={APICashier.Card.AccountId}");
|
APICashier.Account = APICashier.GetRequest<AccountViewModel>($"/api/Account/GetAccount?accountId={APICashier.Card.AccountId}");
|
||||||
|
|
||||||
@ -366,5 +375,42 @@ namespace BankYouBankruptCashierApp.Controllers
|
|||||||
|
|
||||||
return AccountNumber;
|
return AccountNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult MoneyTransfers()
|
||||||
|
{
|
||||||
|
ViewBag.Accounts = APICashier.GetRequest<List<AccountViewModel>>("/api/Account/GetAllAccounts");
|
||||||
|
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void MoneyTransfers(int accountSenderId, int accountPayeeId, int sumMoneyTransfer)
|
||||||
|
{
|
||||||
|
if (APICashier.Cashier == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Вы как сюда попали? Суда вход только авторизованным");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountSenderId < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Некорректный id счёта отправителя");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accountPayeeId < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Некорректный id счёта получателя");
|
||||||
|
}
|
||||||
|
|
||||||
|
APICashier.PostRequest("/api/Account/CloseCrediting", new MoneyTransferBindingModel
|
||||||
|
{
|
||||||
|
CashierId = APICashier.Cashier.Id,
|
||||||
|
Sum = sumMoneyTransfer,
|
||||||
|
AccountPayeeId = accountPayeeId,
|
||||||
|
AccountSenderId = accountSenderId
|
||||||
|
});
|
||||||
|
|
||||||
|
Response.Redirect("Index");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,23 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Номер запроса на зачисление:</div>
|
<div class="col-4">Номер запроса на зачисление:</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<select id="creditig" name="creditingId" class="form-control" asp-items="@(new SelectList( @ViewBag.Creditings, "Id", "Id"))"></select>
|
<select id="creditigId" name="creditingId" class="form-control" asp-items="@(new SelectList( @ViewBag.Creditings, "Id", "Id"))">
|
||||||
|
<option disabled selected>Выберите запрос</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Запрашиваемый счёт для зачисления:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="text" id="accountNumber" name="accountNumber" readonly />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Номер счёта для зачисления:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="accountPayeeId" name="accountPayeeId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||||
|
<option disabled selected>Выберите счёт</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -18,4 +34,23 @@
|
|||||||
<input type="submit" value="Начислить" class="btn btn-primary" />
|
<input type="submit" value="Начислить" class="btn btn-primary" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- подгрузка номера запрашиваемого клиентом счёта в реальном времени -->
|
||||||
|
<script>
|
||||||
|
$('#creditigId').on('change', function () {
|
||||||
|
check();
|
||||||
|
});
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
var creditigId = $('#creditigId').val();
|
||||||
|
$.ajax({
|
||||||
|
method: "Post",
|
||||||
|
url: "/Home/GetAccountNumber",
|
||||||
|
data: { id: creditigId },
|
||||||
|
success: function (result) {
|
||||||
|
$("#accountNumber").val(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
@ -47,7 +47,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
method: "Post",
|
method: "Post",
|
||||||
url: "/Home/GetAccountNumber",
|
url: "/Home/GetAccountNumber",
|
||||||
data: { debitingId: debitingId },
|
data: { id: debitingId },
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
$("#accountNumber").val(result);
|
$("#accountNumber").val(result);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Перевод меджу счетами";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
<h2 class="display-4">Перевод меджу счетами</h2>
|
||||||
|
</div>
|
||||||
|
<form method="post">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Номер счёта для снятия:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="accountSenderId" name="accountSenderId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||||
|
<option disabled selected>Выберите счёт</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Номер счёта для начисления:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<select id="accountPayeeId" name="accountPayeeId" class="form-control" asp-items="@(new SelectList( @ViewBag.Accounts, "Id", "AccountNumber"))">
|
||||||
|
<option disabled selected>Выберите счёт</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Сумма перевода:</div>
|
||||||
|
<div class="col-8">
|
||||||
|
<input type="text" id="sumMoneyTransfer" name="sumMoneyTransfer" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4">
|
||||||
|
<input type="submit" value="Перевести" class="btn btn-primary" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -223,7 +223,7 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
|
|
||||||
bool flag = true;
|
bool flag = true;
|
||||||
|
|
||||||
//если нет отправителя, т. е. операция на перевод денег из нала в виртуал на карту
|
//если есть отправитель, т. е. операция на перевод денег со счёта на счёт
|
||||||
if (moneyTransfer.AccountSenderId.HasValue)
|
if (moneyTransfer.AccountSenderId.HasValue)
|
||||||
{
|
{
|
||||||
flag = _accountLogic.ChangeBalance(new AccountSearchModel
|
flag = _accountLogic.ChangeBalance(new AccountSearchModel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user