mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 14:04:26 +01:00
Public Invoice receipt (#3612)
* Public Invoice receipt * implement payment,s qr, better ui, and fix invoice bug * General view updates * Update admin details link * Update view * add missing check * Refactor * make payments and qr shown by default * move cusotmization options to own ReceiptOptions * Make sure to sanitize values inside PosData partial * Refactor * Make sure that ReceiptOptions for the StoreData is never null, and that values are always set in API * add receipt link to checkout and add tests * add receipt link to lnurl * Use ReceiptOptions.Merge * fix lnurl * fix chrome * remove i18n parameterization * Fix swagger * Update translations * Fix warning Co-authored-by: Dennis Reimann <mail@dennisreimann.de> Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
@@ -342,7 +342,8 @@ namespace BTCPayServer
|
||||
return NotFound("Store not found");
|
||||
}
|
||||
|
||||
currencyCode ??= store.GetStoreBlob().DefaultCurrency ?? cryptoCode;
|
||||
var storeBlob = store.GetStoreBlob();
|
||||
currencyCode ??= storeBlob.DefaultCurrency ?? cryptoCode;
|
||||
var pmi = new PaymentMethodId(cryptoCode, PaymentTypes.LNURLPay);
|
||||
var lnpmi = new PaymentMethodId(cryptoCode, PaymentTypes.LightningLike);
|
||||
var methods = store.GetSupportedPaymentMethods(_btcPayNetworkProvider);
|
||||
@@ -429,7 +430,6 @@ namespace BTCPayServer
|
||||
{
|
||||
lnurlMetadata.Add(new[] {"text/identifier", lnAddress});
|
||||
}
|
||||
|
||||
return Ok(new LNURLPayRequest
|
||||
{
|
||||
Tag = "payRequest",
|
||||
@@ -513,6 +513,18 @@ namespace BTCPayServer
|
||||
return BadRequest(new LNUrlStatusResponse {Status = "ERROR", Reason = "Amount is out of bounds."});
|
||||
}
|
||||
|
||||
LNURLPayRequest.LNURLPayRequestCallbackResponse.ILNURLPayRequestSuccessAction successAction = null;
|
||||
|
||||
if ((i.ReceiptOptions?.Enabled ??blob.ReceiptOptions.Enabled ) is true)
|
||||
{
|
||||
successAction =
|
||||
new LNURLPayRequest.LNURLPayRequestCallbackResponse.LNURLPayRequestSuccessActionUrl()
|
||||
{
|
||||
Tag = "url",
|
||||
Description = "Thank you for your purchase. Here is your receipt",
|
||||
Url = _linkGenerator.GetUriByAction(HttpContext, "InvoiceReceipt", "UIInvoice", new { invoiceId})
|
||||
};
|
||||
}
|
||||
if (amount.HasValue && string.IsNullOrEmpty(paymentMethodDetails.BOLT11) ||
|
||||
paymentMethodDetails.GeneratedBoltAmount != amount)
|
||||
{
|
||||
@@ -573,7 +585,8 @@ namespace BTCPayServer
|
||||
paymentMethodDetails, pmi));
|
||||
return Ok(new LNURLPayRequest.LNURLPayRequestCallbackResponse
|
||||
{
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11,
|
||||
SuccessAction = successAction
|
||||
});
|
||||
}
|
||||
|
||||
@@ -588,7 +601,8 @@ namespace BTCPayServer
|
||||
|
||||
return Ok(new LNURLPayRequest.LNURLPayRequestCallbackResponse
|
||||
{
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11
|
||||
Disposable = true, Routes = Array.Empty<string>(), Pr = paymentMethodDetails.BOLT11,
|
||||
SuccessAction = successAction
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user