mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-17 22:14:26 +01:00
Ensure that there is no LN/Bitcoin specific logic in the Invoice UI endpoint
This commit is contained in:
@@ -875,7 +875,7 @@ normal:
|
|||||||
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
||||||
{
|
{
|
||||||
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
||||||
new LightningLikePaymentHandler(null, null, networkProvider, null),
|
new LightningLikePaymentHandler(null, null, networkProvider, null, null),
|
||||||
});
|
});
|
||||||
var networkBTC = networkProvider.GetNetwork("BTC");
|
var networkBTC = networkProvider.GetNetwork("BTC");
|
||||||
var networkLTC = networkProvider.GetNetwork("LTC");
|
var networkLTC = networkProvider.GetNetwork("LTC");
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ namespace BTCPayServer.Tests
|
|||||||
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
||||||
{
|
{
|
||||||
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
||||||
new LightningLikePaymentHandler(null, null, networkProvider, null),
|
new LightningLikePaymentHandler(null, null, networkProvider, null, null),
|
||||||
});
|
});
|
||||||
var entity = new InvoiceEntity();
|
var entity = new InvoiceEntity();
|
||||||
entity.Networks = networkProvider;
|
entity.Networks = networkProvider;
|
||||||
@@ -563,7 +563,7 @@ namespace BTCPayServer.Tests
|
|||||||
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
var paymentMethodHandlerDictionary = new PaymentMethodHandlerDictionary(new IPaymentMethodHandler[]
|
||||||
{
|
{
|
||||||
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
new BitcoinLikePaymentHandler(null, networkProvider, null, null, null),
|
||||||
new LightningLikePaymentHandler(null, null, networkProvider, null),
|
new LightningLikePaymentHandler(null, null, networkProvider, null, null),
|
||||||
});
|
});
|
||||||
var entity = new InvoiceEntity();
|
var entity = new InvoiceEntity();
|
||||||
entity.Networks = networkProvider;
|
entity.Networks = networkProvider;
|
||||||
|
|||||||
@@ -464,12 +464,9 @@ namespace BTCPayServer.Controllers
|
|||||||
var paymentMethod = invoice.GetPaymentMethod(paymentMethodId);
|
var paymentMethod = invoice.GetPaymentMethod(paymentMethodId);
|
||||||
var paymentMethodDetails = paymentMethod.GetPaymentMethodDetails();
|
var paymentMethodDetails = paymentMethod.GetPaymentMethodDetails();
|
||||||
var dto = invoice.EntityToDTO();
|
var dto = invoice.EntityToDTO();
|
||||||
var cryptoInfo = dto.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
|
||||||
var storeBlob = store.GetStoreBlob();
|
var storeBlob = store.GetStoreBlob();
|
||||||
var currency = invoice.Currency;
|
|
||||||
var accounting = paymentMethod.Calculate();
|
var accounting = paymentMethod.Calculate();
|
||||||
|
|
||||||
|
|
||||||
CoinSwitchSettings coinswitch = (storeBlob.CoinSwitchSettings != null && storeBlob.CoinSwitchSettings.Enabled &&
|
CoinSwitchSettings coinswitch = (storeBlob.CoinSwitchSettings != null && storeBlob.CoinSwitchSettings.Enabled &&
|
||||||
storeBlob.CoinSwitchSettings.IsConfigured())
|
storeBlob.CoinSwitchSettings.IsConfigured())
|
||||||
? storeBlob.CoinSwitchSettings
|
? storeBlob.CoinSwitchSettings
|
||||||
@@ -492,12 +489,11 @@ namespace BTCPayServer.Controllers
|
|||||||
CryptoImage = Request.GetRelativePathOrAbsolute(paymentMethodHandler.GetCryptoImage(paymentMethodId)),
|
CryptoImage = Request.GetRelativePathOrAbsolute(paymentMethodHandler.GetCryptoImage(paymentMethodId)),
|
||||||
BtcAddress = paymentMethodDetails.GetPaymentDestination(),
|
BtcAddress = paymentMethodDetails.GetPaymentDestination(),
|
||||||
BtcDue = accounting.Due.ShowMoney(divisibility),
|
BtcDue = accounting.Due.ShowMoney(divisibility),
|
||||||
|
InvoiceCurrency = invoice.Currency,
|
||||||
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ShowMoney(divisibility),
|
OrderAmount = (accounting.TotalDue - accounting.NetworkFee).ShowMoney(divisibility),
|
||||||
OrderAmountFiat = OrderAmountFromInvoice(network.CryptoCode, invoice),
|
OrderAmountFiat = OrderAmountFromInvoice(network.CryptoCode, invoice),
|
||||||
CustomerEmail = invoice.RefundMail,
|
CustomerEmail = invoice.RefundMail,
|
||||||
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
|
RequiresRefundEmail = storeBlob.RequiresRefundEmail,
|
||||||
ShowRecommendedFee = storeBlob.ShowRecommendedFee,
|
|
||||||
FeeRate = paymentMethodDetails.GetFeeRate(),
|
|
||||||
ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds),
|
ExpirationSeconds = Math.Max(0, (int)(invoice.ExpirationTime - DateTimeOffset.UtcNow).TotalSeconds),
|
||||||
MaxTimeSeconds = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalSeconds,
|
MaxTimeSeconds = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalSeconds,
|
||||||
MaxTimeMinutes = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalMinutes,
|
MaxTimeMinutes = (int)(invoice.ExpirationTime - invoice.InvoiceTime).TotalMinutes,
|
||||||
@@ -506,7 +502,6 @@ namespace BTCPayServer.Controllers
|
|||||||
MerchantRefLink = invoice.RedirectURL?.AbsoluteUri ?? "/",
|
MerchantRefLink = invoice.RedirectURL?.AbsoluteUri ?? "/",
|
||||||
RedirectAutomatically = invoice.RedirectAutomatically,
|
RedirectAutomatically = invoice.RedirectAutomatically,
|
||||||
StoreName = store.StoreName,
|
StoreName = store.StoreName,
|
||||||
PeerInfo = (paymentMethodDetails as LightningLikePaymentMethodDetails)?.NodeInfo,
|
|
||||||
TxCount = accounting.TxRequired,
|
TxCount = accounting.TxRequired,
|
||||||
BtcPaid = accounting.Paid.ShowMoney(divisibility),
|
BtcPaid = accounting.Paid.ShowMoney(divisibility),
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
@@ -544,12 +539,7 @@ namespace BTCPayServer.Controllers
|
|||||||
.OrderByDescending(a => a.CryptoCode == "BTC").ThenBy(a => a.PaymentMethodName).ThenBy(a => a.IsLightning ? 1 : 0)
|
.OrderByDescending(a => a.CryptoCode == "BTC").ThenBy(a => a.PaymentMethodName).ThenBy(a => a.IsLightning ? 1 : 0)
|
||||||
.ToList()
|
.ToList()
|
||||||
};
|
};
|
||||||
|
paymentMethodHandler.PreparePaymentModel(model, dto, storeBlob, paymentMethod);
|
||||||
paymentMethodHandler.PreparePaymentModel(model, dto, storeBlob);
|
|
||||||
if (model.IsLightning && storeBlob.LightningAmountInSatoshi && model.CryptoCode == "Sats")
|
|
||||||
{
|
|
||||||
model.Rate = _CurrencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, paymentMethod.ParentEntity.Currency);
|
|
||||||
}
|
|
||||||
model.UISettings = paymentMethodHandler.GetCheckoutUISettings();
|
model.UISettings = paymentMethodHandler.GetCheckoutUISettings();
|
||||||
model.PaymentMethodId = paymentMethodId.ToString();
|
model.PaymentMethodId = paymentMethodId.ToString();
|
||||||
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
|
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
|
||||||
|
|||||||
@@ -25,10 +25,8 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||||||
public string CustomLogoLink { get; set; }
|
public string CustomLogoLink { get; set; }
|
||||||
public string HtmlTitle { get; set; }
|
public string HtmlTitle { get; set; }
|
||||||
public string DefaultLang { get; set; }
|
public string DefaultLang { get; set; }
|
||||||
public bool LightningAmountInSatoshi { get; set; }
|
|
||||||
public List<AvailableCrypto> AvailableCryptos { get; set; } = new List<AvailableCrypto>();
|
public List<AvailableCrypto> AvailableCryptos { get; set; } = new List<AvailableCrypto>();
|
||||||
public bool IsModal { get; set; }
|
public bool IsModal { get; set; }
|
||||||
public bool IsLightning { get; set; }
|
|
||||||
public string CryptoCode { get; set; }
|
public string CryptoCode { get; set; }
|
||||||
public string InvoiceId { get; set; }
|
public string InvoiceId { get; set; }
|
||||||
public string BtcAddress { get; set; }
|
public string BtcAddress { get; set; }
|
||||||
@@ -71,5 +69,6 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||||||
public string RootPath { get; set; }
|
public string RootPath { get; set; }
|
||||||
public decimal CoinSwitchAmountMarkupPercentage { get; set; }
|
public decimal CoinSwitchAmountMarkupPercentage { get; set; }
|
||||||
public bool RedirectAutomatically { get; set; }
|
public bool RedirectAutomatically { get; set; }
|
||||||
|
public string InvoiceCurrency { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -8,10 +7,8 @@ using BTCPayServer.HostedServices;
|
|||||||
using BTCPayServer.Logging;
|
using BTCPayServer.Logging;
|
||||||
using BTCPayServer.Models;
|
using BTCPayServer.Models;
|
||||||
using BTCPayServer.Models.InvoicingModels;
|
using BTCPayServer.Models.InvoicingModels;
|
||||||
using BTCPayServer.Rating;
|
|
||||||
using BTCPayServer.Services;
|
using BTCPayServer.Services;
|
||||||
using BTCPayServer.Services.Invoices;
|
using BTCPayServer.Services.Invoices;
|
||||||
using BTCPayServer.Services.Rates;
|
|
||||||
using NBitcoin;
|
using NBitcoin;
|
||||||
using NBXplorer.Models;
|
using NBXplorer.Models;
|
||||||
using StoreData = BTCPayServer.Data.StoreData;
|
using StoreData = BTCPayServer.Data.StoreData;
|
||||||
@@ -47,13 +44,13 @@ namespace BTCPayServer.Payments.Bitcoin
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
||||||
StoreBlob storeBlob)
|
StoreBlob storeBlob, IPaymentMethod paymentMethod)
|
||||||
{
|
{
|
||||||
var paymentMethodId = new PaymentMethodId(model.CryptoCode, PaymentTypes.BTCLike);
|
var paymentMethodId = paymentMethod.GetId();
|
||||||
|
|
||||||
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
||||||
var network = _networkProvider.GetNetwork<BTCPayNetwork>(model.CryptoCode);
|
var network = _networkProvider.GetNetwork<BTCPayNetwork>(model.CryptoCode);
|
||||||
model.IsLightning = false;
|
model.ShowRecommendedFee = storeBlob.ShowRecommendedFee;
|
||||||
|
model.FeeRate = ((BitcoinLikeOnChainPaymentMethod) paymentMethod.GetPaymentMethodDetails()).GetFeeRate();
|
||||||
model.PaymentMethodName = GetPaymentMethodName(network);
|
model.PaymentMethodName = GetPaymentMethodName(network);
|
||||||
model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21;
|
model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BIP21;
|
||||||
model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21;
|
model.InvoiceBitcoinUrlQR = cryptoInfo.PaymentUrls.BIP21;
|
||||||
|
|||||||
@@ -16,10 +16,5 @@ namespace BTCPayServer.Payments
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
decimal GetNextNetworkFee();
|
decimal GetNextNetworkFee();
|
||||||
/// <summary>
|
|
||||||
/// Returns recommended fee rate for a transaction
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
decimal GetFeeRate();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ namespace BTCPayServer.Payments
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
object PreparePayment(ISupportedPaymentMethod supportedPaymentMethod, StoreData store, BTCPayNetworkBase network);
|
object PreparePayment(ISupportedPaymentMethod supportedPaymentMethod, StoreData store, BTCPayNetworkBase network);
|
||||||
|
|
||||||
void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob);
|
void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob,
|
||||||
|
IPaymentMethod paymentMethod);
|
||||||
string GetCryptoImage(PaymentMethodId paymentMethodId);
|
string GetCryptoImage(PaymentMethodId paymentMethodId);
|
||||||
string GetPaymentMethodName(PaymentMethodId paymentMethodId);
|
string GetPaymentMethodName(PaymentMethodId paymentMethodId);
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ namespace BTCPayServer.Payments
|
|||||||
PaymentMethod paymentMethod, StoreData store, TBTCPayNetwork network, object preparePaymentObject);
|
PaymentMethod paymentMethod, StoreData store, TBTCPayNetwork network, object preparePaymentObject);
|
||||||
|
|
||||||
public abstract void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
public abstract void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
||||||
StoreBlob storeBlob);
|
StoreBlob storeBlob, IPaymentMethod paymentMethod);
|
||||||
public abstract string GetCryptoImage(PaymentMethodId paymentMethodId);
|
public abstract string GetCryptoImage(PaymentMethodId paymentMethodId);
|
||||||
public abstract string GetPaymentMethodName(PaymentMethodId paymentMethodId);
|
public abstract string GetPaymentMethodName(PaymentMethodId paymentMethodId);
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,20 @@ namespace BTCPayServer.Payments.Lightning
|
|||||||
private readonly LightningClientFactoryService _lightningClientFactory;
|
private readonly LightningClientFactoryService _lightningClientFactory;
|
||||||
private readonly BTCPayNetworkProvider _networkProvider;
|
private readonly BTCPayNetworkProvider _networkProvider;
|
||||||
private readonly SocketFactory _socketFactory;
|
private readonly SocketFactory _socketFactory;
|
||||||
|
private readonly CurrencyNameTable _currencyNameTable;
|
||||||
|
|
||||||
public LightningLikePaymentHandler(
|
public LightningLikePaymentHandler(
|
||||||
NBXplorerDashboard dashboard,
|
NBXplorerDashboard dashboard,
|
||||||
LightningClientFactoryService lightningClientFactory,
|
LightningClientFactoryService lightningClientFactory,
|
||||||
BTCPayNetworkProvider networkProvider,
|
BTCPayNetworkProvider networkProvider,
|
||||||
SocketFactory socketFactory)
|
SocketFactory socketFactory,
|
||||||
|
CurrencyNameTable currencyNameTable)
|
||||||
{
|
{
|
||||||
_Dashboard = dashboard;
|
_Dashboard = dashboard;
|
||||||
_lightningClientFactory = lightningClientFactory;
|
_lightningClientFactory = lightningClientFactory;
|
||||||
_networkProvider = networkProvider;
|
_networkProvider = networkProvider;
|
||||||
_socketFactory = socketFactory;
|
_socketFactory = socketFactory;
|
||||||
|
_currencyNameTable = currencyNameTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override PaymentType PaymentType => PaymentTypes.LightningLike;
|
public override PaymentType PaymentType => PaymentTypes.LightningLike;
|
||||||
@@ -159,28 +162,27 @@ namespace BTCPayServer.Payments.Lightning
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
||||||
StoreBlob storeBlob)
|
StoreBlob storeBlob, IPaymentMethod paymentMethod)
|
||||||
{
|
{
|
||||||
var paymentMethodId = new PaymentMethodId(model.CryptoCode, PaymentTypes.LightningLike);
|
var paymentMethodId = paymentMethod.GetId();
|
||||||
|
|
||||||
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
||||||
var network = _networkProvider.GetNetwork<BTCPayNetwork>(model.CryptoCode);
|
var network = _networkProvider.GetNetwork<BTCPayNetwork>(model.CryptoCode);
|
||||||
model.IsLightning = true;
|
|
||||||
model.PaymentMethodName = GetPaymentMethodName(network);
|
model.PaymentMethodName = GetPaymentMethodName(network);
|
||||||
model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BOLT11;
|
model.InvoiceBitcoinUrl = cryptoInfo.PaymentUrls.BOLT11;
|
||||||
model.InvoiceBitcoinUrlQR = $"lightning:{cryptoInfo.PaymentUrls.BOLT11.ToUpperInvariant().Substring("LIGHTNING:".Length)}";
|
model.InvoiceBitcoinUrlQR = $"lightning:{cryptoInfo.PaymentUrls.BOLT11.ToUpperInvariant().Substring("LIGHTNING:".Length)}";
|
||||||
model.LightningAmountInSatoshi = storeBlob.LightningAmountInSatoshi;
|
|
||||||
|
model.PeerInfo = ((LightningLikePaymentMethodDetails) paymentMethod.GetPaymentMethodDetails()).NodeInfo;
|
||||||
if (storeBlob.LightningAmountInSatoshi && model.CryptoCode == "BTC")
|
if (storeBlob.LightningAmountInSatoshi && model.CryptoCode == "BTC")
|
||||||
{
|
{
|
||||||
var satoshiCulture = new CultureInfo(CultureInfo.InvariantCulture.Name);
|
var satoshiCulture = new CultureInfo(CultureInfo.InvariantCulture.Name);
|
||||||
satoshiCulture.NumberFormat.NumberGroupSeparator = " ";
|
satoshiCulture.NumberFormat.NumberGroupSeparator = " ";
|
||||||
|
|
||||||
model.CryptoCode = "Sats";
|
model.CryptoCode = "Sats";
|
||||||
model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
||||||
model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
||||||
model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
|
||||||
|
|
||||||
model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi);
|
model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi);
|
||||||
|
model.Rate = _currencyNameTable.DisplayFormatCurrency(paymentMethod.Rate / 100_000_000, model.InvoiceCurrency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override string GetCryptoImage(PaymentMethodId paymentMethodId)
|
public override string GetCryptoImage(PaymentMethodId paymentMethodId)
|
||||||
|
|||||||
@@ -71,12 +71,11 @@ namespace BTCPayServer.Services.Altcoins.Ethereum.Payments
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
||||||
StoreBlob storeBlob)
|
StoreBlob storeBlob, IPaymentMethod paymentMethod)
|
||||||
{
|
{
|
||||||
var paymentMethodId = new PaymentMethodId(model.CryptoCode, PaymentType);
|
var paymentMethodId = paymentMethod.GetId();
|
||||||
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
||||||
var network = _networkProvider.GetNetwork<EthereumBTCPayNetwork>(model.CryptoCode);
|
var network = _networkProvider.GetNetwork<EthereumBTCPayNetwork>(model.CryptoCode);
|
||||||
model.IsLightning = false;
|
|
||||||
model.PaymentMethodName = GetPaymentMethodName(network);
|
model.PaymentMethodName = GetPaymentMethodName(network);
|
||||||
model.CryptoImage = GetCryptoImage(network);
|
model.CryptoImage = GetCryptoImage(network);
|
||||||
model.InvoiceBitcoinUrl = "";
|
model.InvoiceBitcoinUrl = "";
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ namespace BTCPayServer.Services.Altcoins.Monero.Payments
|
|||||||
public Func<string, Task<CreateAddressResponse>> ReserveAddress;
|
public Func<string, Task<CreateAddressResponse>> ReserveAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse, StoreBlob storeBlob)
|
public override void PreparePaymentModel(PaymentModel model, InvoiceResponse invoiceResponse,
|
||||||
|
StoreBlob storeBlob, IPaymentMethod paymentMethod)
|
||||||
{
|
{
|
||||||
var paymentMethodId = new PaymentMethodId(model.CryptoCode, PaymentType);
|
var paymentMethodId = paymentMethod.GetId();
|
||||||
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
var cryptoInfo = invoiceResponse.CryptoInfo.First(o => o.GetpaymentMethodId() == paymentMethodId);
|
||||||
var network = _networkProvider.GetNetwork<MoneroLikeSpecificBtcPayNetwork>(model.CryptoCode);
|
var network = _networkProvider.GetNetwork<MoneroLikeSpecificBtcPayNetwork>(model.CryptoCode);
|
||||||
model.IsLightning = false;
|
|
||||||
model.PaymentMethodName = GetPaymentMethodName(network);
|
model.PaymentMethodName = GetPaymentMethodName(network);
|
||||||
model.CryptoImage = GetCryptoImage(network);
|
model.CryptoImage = GetCryptoImage(network);
|
||||||
model.InvoiceBitcoinUrl = MoneroPaymentType.Instance.GetPaymentLink(network, new MoneroLikeOnChainPaymentMethodDetails()
|
model.InvoiceBitcoinUrl = MoneroPaymentType.Instance.GetPaymentLink(network, new MoneroLikeOnChainPaymentMethodDetails()
|
||||||
|
|||||||
@@ -908,7 +908,14 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
public Money MinimumTotalDue { get; set; }
|
public Money MinimumTotalDue { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PaymentMethod
|
public interface IPaymentMethod
|
||||||
|
{
|
||||||
|
PaymentMethodId GetId();
|
||||||
|
decimal Rate { get; set; }
|
||||||
|
IPaymentMethodDetails GetPaymentMethodDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PaymentMethod : IPaymentMethod
|
||||||
{
|
{
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public InvoiceEntity ParentEntity { get; set; }
|
public InvoiceEntity ParentEntity { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user