Allowing customization of expiry time for easier debugging

This commit is contained in:
lepipele
2017-10-20 17:32:52 -05:00
parent 8fe5835e09
commit 0f603ffb0a
2 changed files with 3 additions and 3 deletions

View File

@@ -268,7 +268,7 @@ namespace BTCPayServer.Controllers
ItemDesc = model.ItemDesc, ItemDesc = model.ItemDesc,
FullNotifications = true, FullNotifications = true,
BuyerEmail = model.BuyerEmail, BuyerEmail = model.BuyerEmail,
}, store, HttpContext.Request.GetAbsoluteRoot()); }, store, HttpContext.Request.GetAbsoluteRoot(), 120);
StatusMessage = $"Invoice {result.Data.Id} just created!"; StatusMessage = $"Invoice {result.Data.Id} just created!";
return RedirectToAction(nameof(ListInvoices)); return RedirectToAction(nameof(ListInvoices));

View File

@@ -75,7 +75,7 @@ namespace BTCPayServer.Controllers
_FeeProvider = feeProvider ?? throw new ArgumentNullException(nameof(feeProvider)); _FeeProvider = feeProvider ?? throw new ArgumentNullException(nameof(feeProvider));
} }
internal async Task<DataWrapper<InvoiceResponse>> CreateInvoiceCore(Invoice invoice, StoreData store, string serverUrl) internal async Task<DataWrapper<InvoiceResponse>> CreateInvoiceCore(Invoice invoice, StoreData store, string serverUrl, double expiryMinutes = 15)
{ {
var derivationStrategy = store.DerivationStrategy; var derivationStrategy = store.DerivationStrategy;
var entity = new InvoiceEntity var entity = new InvoiceEntity
@@ -87,7 +87,7 @@ namespace BTCPayServer.Controllers
if(notificationUri == null || (notificationUri.Scheme != "http" && notificationUri.Scheme != "https")) //TODO: Filer non routable addresses ? if(notificationUri == null || (notificationUri.Scheme != "http" && notificationUri.Scheme != "https")) //TODO: Filer non routable addresses ?
notificationUri = null; notificationUri = null;
EmailAddressAttribute emailValidator = new EmailAddressAttribute(); EmailAddressAttribute emailValidator = new EmailAddressAttribute();
entity.ExpirationTime = entity.InvoiceTime + TimeSpan.FromMinutes(15.0); entity.ExpirationTime = entity.InvoiceTime.AddMinutes(expiryMinutes);
entity.ServerUrl = serverUrl; entity.ServerUrl = serverUrl;
entity.FullNotifications = invoice.FullNotifications; entity.FullNotifications = invoice.FullNotifications;
entity.NotificationURL = notificationUri?.AbsoluteUri; entity.NotificationURL = notificationUri?.AbsoluteUri;