Refactor StatusMessage and remove ExternalLogin

This commit is contained in:
nicolas.dorier
2019-10-31 12:29:59 +09:00
parent 99095f25d9
commit aad586232c
75 changed files with 185 additions and 516 deletions

View File

@@ -71,9 +71,7 @@ namespace BTCPayServer.Controllers
ProductInformation = invoice.ProductInformation,
StatusException = invoice.ExceptionStatus,
Events = invoice.Events,
PosData = PosDataParser.ParsePosData(invoice.PosData),
StatusMessage = StatusMessage,
PosData = PosDataParser.ParsePosData(invoice.PosData)
};
model.Addresses = invoice.HistoricalAddresses.Select(h =>
@@ -405,7 +403,6 @@ namespace BTCPayServer.Controllers
SearchTerm = searchTerm,
Skip = skip,
Count = count,
StatusMessage = StatusMessage,
TimezoneOffset = timezoneOffset
};
InvoiceQuery invoiceQuery = GetInvoiceQuery(searchTerm, timezoneOffset);
@@ -497,7 +494,7 @@ namespace BTCPayServer.Controllers
var stores = new SelectList(await _StoreRepository.GetStoresByUserId(GetUserId()), nameof(StoreData.Id), nameof(StoreData.StoreName), null);
if (stores.Count() == 0)
{
StatusMessage = "Error: You need to create at least one store before creating a transaction";
TempData[WellKnownTempData.ErrorMessage] = "You need to create at least one store before creating a transaction";
return RedirectToAction(nameof(UserStoresController.ListStores), "UserStores");
}
@@ -518,22 +515,13 @@ namespace BTCPayServer.Controllers
{
return View(model);
}
StatusMessage = null;
if (store.GetSupportedPaymentMethods(_NetworkProvider).Count() == 0)
{
ModelState.AddModelError(nameof(model.StoreId), "You need to configure the derivation scheme in order to create an invoice");
return View(model);
}
if (StatusMessage != null)
{
return RedirectToAction(nameof(StoresController.UpdateStore), "Stores", new
{
storeId = store.Id
});
}
try
{
var result = await CreateInvoiceCore(new CreateInvoiceRequest()
@@ -554,7 +542,7 @@ namespace BTCPayServer.Controllers
})
}, store, HttpContext.Request.GetAbsoluteRoot(), cancellationToken: cancellationToken);
StatusMessage = $"Invoice {result.Data.Id} just created!";
TempData[WellKnownTempData.SuccessMessage] = $"Invoice {result.Data.Id} just created!";
return RedirectToAction(nameof(ListInvoices));
}
catch (BitpayHttpException ex)
@@ -603,13 +591,6 @@ namespace BTCPayServer.Controllers
public string StatusString { get; set; }
}
[TempData]
public string StatusMessage
{
get;
set;
}
private string GetUserId()
{
return _UserManager.GetUserId(User);