mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-11 01:35:22 +01:00
Make sure NotificationUrl and RedirectUrl are of type Uri
This commit is contained in:
parent
f17a359893
commit
c247e275f6
3 changed files with 8 additions and 8 deletions
|
@ -67,7 +67,7 @@ namespace BTCPayServer.Controllers
|
|||
TaxIncluded = _CurrencyNameTable.DisplayFormatCurrency(prodInfo.TaxIncluded, prodInfo.Currency),
|
||||
NotificationEmail = invoice.NotificationEmail,
|
||||
NotificationUrl = invoice.NotificationURL,
|
||||
RedirectUrl = invoice.RedirectURL,
|
||||
RedirectUrl = invoice.RedirectURL.AbsoluteUri,
|
||||
ProductInformation = invoice.ProductInformation,
|
||||
StatusException = invoice.ExceptionStatus,
|
||||
Events = invoice.Events,
|
||||
|
@ -250,7 +250,7 @@ namespace BTCPayServer.Controllers
|
|||
MaxTimeMinutes = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalMinutes,
|
||||
ItemDesc = invoice.ProductInformation.ItemDesc,
|
||||
Rate = ExchangeRate(paymentMethod),
|
||||
MerchantRefLink = invoice.RedirectURL ?? "/",
|
||||
MerchantRefLink = invoice.RedirectURL?.AbsoluteUri ?? "/",
|
||||
RedirectAutomatically = invoice.RedirectAutomatically,
|
||||
StoreName = store.StoreName,
|
||||
PeerInfo = (paymentMethodDetails as LightningLikePaymentMethodDetails)?.NodeInfo,
|
||||
|
@ -424,7 +424,7 @@ namespace BTCPayServer.Controllers
|
|||
Date = invoice.InvoiceTime,
|
||||
InvoiceId = invoice.Id,
|
||||
OrderId = invoice.OrderId ?? string.Empty,
|
||||
RedirectUrl = invoice.RedirectURL ?? string.Empty,
|
||||
RedirectUrl = invoice.RedirectURL?.AbsoluteUri ?? string.Empty,
|
||||
AmountCurrency = _CurrencyNameTable.DisplayFormatCurrency(invoice.ProductInformation.Price, invoice.ProductInformation.Currency),
|
||||
CanMarkInvalid = state.CanMarkInvalid(),
|
||||
CanMarkComplete = state.CanMarkComplete(),
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace BTCPayServer.HostedServices
|
|||
Name = invoiceEvent.Name
|
||||
},
|
||||
ExtendedNotification = extendedNotification,
|
||||
NotificationURL = invoice.NotificationURL
|
||||
NotificationURL = invoice.NotificationURL?.AbsoluteUri
|
||||
};
|
||||
|
||||
// For lightning network payments, paid, confirmed and completed come all at once.
|
||||
|
|
|
@ -297,14 +297,14 @@ namespace BTCPayServer.Services.Invoices
|
|||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string RedirectURL => FillPlaceholdersUri(RedirectURLTemplate);
|
||||
public Uri RedirectURL => FillPlaceholdersUri(RedirectURLTemplate);
|
||||
|
||||
private string FillPlaceholdersUri(string v)
|
||||
private Uri FillPlaceholdersUri(string v)
|
||||
{
|
||||
var uriStr = (v ?? string.Empty).Replace("{OrderId}", OrderId ?? "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("{InvoiceId}", Id ?? "", StringComparison.OrdinalIgnoreCase);
|
||||
if (Uri.TryCreate(uriStr, UriKind.Absolute, out var uri) && (uri.Scheme == "http" || uri.Scheme == "https"))
|
||||
return uri.AbsoluteUri;
|
||||
return uri;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -339,7 +339,7 @@ namespace BTCPayServer.Services.Invoices
|
|||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string NotificationURL => FillPlaceholdersUri(NotificationURLTemplate);
|
||||
public Uri NotificationURL => FillPlaceholdersUri(NotificationURLTemplate);
|
||||
public string ServerUrl
|
||||
{
|
||||
get;
|
||||
|
|
Loading…
Add table
Reference in a new issue