public InvoiceResponse EntityToDTO() { ServerUrl = ServerUrl ?? ""; InvoiceResponse dto = new InvoiceResponse { Id = Id, StoreId = StoreId, OrderId = Metadata.OrderId, PosData = Metadata.PosData, CurrentTime = DateTimeOffset.UtcNow, InvoiceTime = InvoiceTime, ExpirationTime = ExpirationTime, #pragma warning disable CS0618 // Type or member is obsolete Status = StatusString, ExceptionStatus = ExceptionStatus == InvoiceExceptionStatus.None ? new JValue(false) : new JValue(ExceptionStatusString), #pragma warning restore CS0618 // Type or member is obsolete Currency = Currency, Flags = new Flags() { Refundable = Refundable }, PaymentSubtotals = new Dictionary <string, decimal>(), PaymentTotals = new Dictionary <string, decimal>(), SupportedTransactionCurrencies = new Dictionary <string, InvoiceSupportedTransactionCurrency>(), Addresses = new Dictionary <string, string>(), PaymentCodes = new Dictionary <string, InvoicePaymentUrls>(), ExchangeRates = new Dictionary <string, Dictionary <string, decimal> >() }; dto.Url = ServerUrl.WithTrailingSlash() + $"invoice?id=" + Id; dto.CryptoInfo = new List <NBitpayClient.InvoiceCryptoInfo>(); dto.MinerFees = new Dictionary <string, MinerFeeInfo>(); foreach (var info in this.GetPaymentMethods()) { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var details = info.GetPaymentMethodDetails(); var address = details?.GetPaymentDestination(); var exrates = new Dictionary <string, decimal> { { Currency, cryptoInfo.Rate } }; cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.TotalDue = accounting.TotalDue.ToString(); cryptoInfo.NetworkFee = accounting.NetworkFee.ToString(); cryptoInfo.TxCount = accounting.TxCount; cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString(); cryptoInfo.Address = address; cryptoInfo.ExRates = exrates; var paymentId = info.GetId(); cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}"; cryptoInfo.Payments = GetPayments(info.Network).Select(entity => { var data = entity.GetCryptoPaymentData(); return(new InvoicePaymentInfo() { Id = data.GetPaymentId(), Fee = entity.NetworkFee, Value = data.GetValue(), Completed = data.PaymentCompleted(entity), Confirmed = data.PaymentConfirmed(entity, SpeedPolicy), Destination = data.GetDestination(), PaymentType = data.GetPaymentType().ToString(), ReceivedDate = entity.ReceivedTime.DateTime }); }).ToList(); if (paymentId.PaymentType == PaymentTypes.LightningLike) { cryptoInfo.PaymentUrls = new InvoicePaymentUrls() { BOLT11 = paymentId.PaymentType.GetPaymentLink(info.Network, details, cryptoInfo.Due, ServerUrl) }; } else if (paymentId.PaymentType == PaymentTypes.BTCLike) { var minerInfo = new MinerFeeInfo(); minerInfo.TotalFee = accounting.NetworkFee.Satoshi; minerInfo.SatoshiPerBytes = ((BitcoinLikeOnChainPaymentMethod)details).FeeRate .GetFee(1).Satoshi; dto.MinerFees.TryAdd(cryptoInfo.CryptoCode, minerInfo); cryptoInfo.PaymentUrls = new InvoicePaymentUrls() { BIP21 = paymentId.PaymentType.GetPaymentLink(info.Network, details, cryptoInfo.Due, ServerUrl) }; #pragma warning disable 618 if (info.CryptoCode == "BTC") { dto.BTCPrice = cryptoInfo.Price; dto.Rate = cryptoInfo.Rate; dto.ExRates = cryptoInfo.ExRates; dto.BitcoinAddress = cryptoInfo.Address; dto.BTCPaid = cryptoInfo.Paid; dto.BTCDue = cryptoInfo.Due; dto.PaymentUrls = cryptoInfo.PaymentUrls; } #pragma warning restore 618 } dto.CryptoInfo.Add(cryptoInfo); dto.PaymentCodes.Add(paymentId.ToString(), cryptoInfo.PaymentUrls); dto.PaymentSubtotals.Add(paymentId.ToString(), subtotalPrice.Satoshi); dto.PaymentTotals.Add(paymentId.ToString(), accounting.TotalDue.Satoshi); dto.SupportedTransactionCurrencies.TryAdd(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true }); dto.Addresses.Add(paymentId.ToString(), address); dto.ExchangeRates.TryAdd(cryptoCode, exrates); } //dto.AmountPaid dto.MinerFees & dto.TransactionCurrency are not supported by btcpayserver as we have multi currency payment support per invoice dto.ItemCode = Metadata.ItemCode; dto.ItemDesc = Metadata.ItemDesc; dto.TaxIncluded = Metadata.TaxIncluded ?? 0m; dto.Price = Price; dto.Currency = Currency; dto.Buyer = new JObject(); dto.Buyer.Add(new JProperty("name", Metadata.BuyerName)); dto.Buyer.Add(new JProperty("address1", Metadata.BuyerAddress1)); dto.Buyer.Add(new JProperty("address2", Metadata.BuyerAddress2)); dto.Buyer.Add(new JProperty("locality", Metadata.BuyerCity)); dto.Buyer.Add(new JProperty("region", Metadata.BuyerState)); dto.Buyer.Add(new JProperty("postalCode", Metadata.BuyerZip)); dto.Buyer.Add(new JProperty("country", Metadata.BuyerCountry)); dto.Buyer.Add(new JProperty("phone", Metadata.BuyerPhone)); dto.Buyer.Add(new JProperty("email", string.IsNullOrWhiteSpace(Metadata.BuyerEmail) ? RefundMail : Metadata.BuyerEmail)); dto.Token = Encoders.Base58.EncodeData(RandomUtils.GetBytes(16)); //No idea what it is useful for dto.Guid = Guid.NewGuid().ToString(); return(dto); }
public InvoiceResponse EntityToDTO(BTCPayNetworkProvider networkProvider) { ServerUrl = ServerUrl ?? ""; InvoiceResponse dto = new InvoiceResponse { Id = Id, StoreId = StoreId, OrderId = OrderId, PosData = PosData, CurrentTime = DateTimeOffset.UtcNow, InvoiceTime = InvoiceTime, ExpirationTime = ExpirationTime, #pragma warning disable CS0618 // Type or member is obsolete Status = StatusString, ExceptionStatus = ExceptionStatus == InvoiceExceptionStatus.None ? new JValue(false) : new JValue(ExceptionStatusString), #pragma warning restore CS0618 // Type or member is obsolete Currency = ProductInformation.Currency, Flags = new Flags() { Refundable = Refundable }, PaymentSubtotals = new Dictionary <string, long>(), PaymentTotals = new Dictionary <string, long>(), SupportedTransactionCurrencies = new Dictionary <string, InvoiceSupportedTransactionCurrency>(), Addresses = new Dictionary <string, string>(), PaymentCodes = new Dictionary <string, InvoicePaymentUrls>(), ExchangeRates = new Dictionary <string, Dictionary <string, decimal> >() }; dto.Url = ServerUrl.WithTrailingSlash() + $"invoice?id=" + Id; dto.CryptoInfo = new List <NBitpayClient.InvoiceCryptoInfo>(); dto.MinerFees = new Dictionary <string, MinerFeeInfo>(); foreach (var info in this.GetPaymentMethods(networkProvider)) { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var address = info.GetPaymentMethodDetails()?.GetPaymentDestination(); var exrates = new Dictionary <string, decimal> { { ProductInformation.Currency, cryptoInfo.Rate } }; cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.TotalDue = accounting.TotalDue.ToString(); cryptoInfo.NetworkFee = accounting.NetworkFee.ToString(); cryptoInfo.TxCount = accounting.TxCount; cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString(); cryptoInfo.Address = address; cryptoInfo.ExRates = exrates; var paymentId = info.GetId(); var scheme = info.Network.UriScheme; cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}"; if (paymentId.PaymentType == PaymentTypes.BTCLike) { var minerInfo = new MinerFeeInfo(); minerInfo.TotalFee = accounting.NetworkFee.Satoshi; minerInfo.SatoshiPerBytes = ((BitcoinLikeOnChainPaymentMethod)info.GetPaymentMethodDetails()).FeeRate.GetFee(1).Satoshi; dto.MinerFees.TryAdd(paymentId.CryptoCode, minerInfo); var cryptoSuffix = cryptoInfo.CryptoCode == "BTC" ? "" : "/" + cryptoInfo.CryptoCode; cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls() { BIP21 = $"{scheme}:{cryptoInfo.Address}?amount={cryptoInfo.Due}", }; } if (paymentId.PaymentType == PaymentTypes.LightningLike) { cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls() { BOLT11 = $"lightning:{cryptoInfo.Address}" }; } #pragma warning disable CS0618 if (info.CryptoCode == "BTC" && paymentId.PaymentType == PaymentTypes.BTCLike) { dto.BTCPrice = cryptoInfo.Price; dto.Rate = cryptoInfo.Rate; dto.ExRates = cryptoInfo.ExRates; dto.BitcoinAddress = cryptoInfo.Address; dto.BTCPaid = cryptoInfo.Paid; dto.BTCDue = cryptoInfo.Due; dto.PaymentUrls = cryptoInfo.PaymentUrls; } #pragma warning restore CS0618 dto.CryptoInfo.Add(cryptoInfo); dto.PaymentCodes.Add(paymentId.ToString(), cryptoInfo.PaymentUrls); dto.PaymentSubtotals.Add(paymentId.ToString(), subtotalPrice.Satoshi); dto.PaymentTotals.Add(paymentId.ToString(), accounting.TotalDue.Satoshi); dto.SupportedTransactionCurrencies.TryAdd(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true }); dto.Addresses.Add(paymentId.ToString(), address); dto.ExchangeRates.TryAdd(cryptoCode, exrates); } //dto.AmountPaid dto.MinerFees & dto.TransactionCurrency are not supported by btcpayserver as we have multi currency payment support per invoice Populate(ProductInformation, dto); dto.Buyer = new JObject(); dto.Buyer.Add(new JProperty("name", BuyerInformation.BuyerName)); dto.Buyer.Add(new JProperty("address1", BuyerInformation.BuyerAddress1)); dto.Buyer.Add(new JProperty("address2", BuyerInformation.BuyerAddress2)); dto.Buyer.Add(new JProperty("locality", BuyerInformation.BuyerCity)); dto.Buyer.Add(new JProperty("region", BuyerInformation.BuyerState)); dto.Buyer.Add(new JProperty("postalCode", BuyerInformation.BuyerZip)); dto.Buyer.Add(new JProperty("country", BuyerInformation.BuyerCountry)); dto.Buyer.Add(new JProperty("phone", BuyerInformation.BuyerPhone)); dto.Buyer.Add(new JProperty("email", string.IsNullOrWhiteSpace(BuyerInformation.BuyerEmail) ? RefundMail : BuyerInformation.BuyerEmail)); dto.Token = Encoders.Base58.EncodeData(RandomUtils.GetBytes(16)); //No idea what it is useful for dto.Guid = Guid.NewGuid().ToString(); return(dto); }
public InvoiceResponse EntityToDTO() { ServerUrl = ServerUrl ?? ""; InvoiceResponse dto = new InvoiceResponse { Id = Id, StoreId = StoreId, OrderId = OrderId, PosData = PosData, CurrentTime = DateTimeOffset.UtcNow, InvoiceTime = InvoiceTime, ExpirationTime = ExpirationTime, #pragma warning disable CS0618 // Type or member is obsolete Status = StatusString, ExceptionStatus = ExceptionStatus == InvoiceExceptionStatus.None ? new JValue(false) : new JValue(ExceptionStatusString), #pragma warning restore CS0618 // Type or member is obsolete Currency = ProductInformation.Currency, Flags = new Flags() { Refundable = Refundable }, PaymentSubtotals = new Dictionary <string, long>(), PaymentTotals = new Dictionary <string, long>(), SupportedTransactionCurrencies = new Dictionary <string, InvoiceSupportedTransactionCurrency>(), Addresses = new Dictionary <string, string>(), PaymentCodes = new Dictionary <string, InvoicePaymentUrls>(), ExchangeRates = new Dictionary <string, Dictionary <string, decimal> >() }; dto.Url = ServerUrl.WithTrailingSlash() + $"invoice?id=" + Id; dto.CryptoInfo = new List <NBitpayClient.InvoiceCryptoInfo>(); dto.MinerFees = new Dictionary <string, MinerFeeInfo>(); foreach (var info in this.GetPaymentMethods()) { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var address = info.GetPaymentMethodDetails()?.GetPaymentDestination(); var exrates = new Dictionary <string, decimal> { { ProductInformation.Currency, cryptoInfo.Rate } }; cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.TotalDue = accounting.TotalDue.ToString(); cryptoInfo.NetworkFee = accounting.NetworkFee.ToString(); cryptoInfo.TxCount = accounting.TxCount; cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString(); cryptoInfo.Address = address; cryptoInfo.ExRates = exrates; var paymentId = info.GetId(); cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}"; cryptoInfo.Payments = GetPayments(info.Network).Select(entity => { var data = entity.GetCryptoPaymentData(); return(new InvoicePaymentInfo() { Id = data.GetPaymentId(), Fee = entity.NetworkFee, Value = data.GetValue(), Completed = data.PaymentCompleted(entity, info.Network), Confirmed = data.PaymentConfirmed(entity, SpeedPolicy, info.Network), Destination = data.GetDestination(info.Network), PaymentType = data.GetPaymentType().ToString(), ReceivedDate = entity.ReceivedTime.DateTime }); }).ToList(); PaymentMethodHandlerDictionary[paymentId].PrepareInvoiceDto(dto, this, cryptoInfo, accounting, info); dto.CryptoInfo.Add(cryptoInfo); dto.PaymentCodes.Add(paymentId.ToString(), cryptoInfo.PaymentUrls); dto.PaymentSubtotals.Add(paymentId.ToString(), subtotalPrice.Satoshi); dto.PaymentTotals.Add(paymentId.ToString(), accounting.TotalDue.Satoshi); dto.SupportedTransactionCurrencies.TryAdd(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true }); dto.Addresses.Add(paymentId.ToString(), address); dto.ExchangeRates.TryAdd(cryptoCode, exrates); } //dto.AmountPaid dto.MinerFees & dto.TransactionCurrency are not supported by btcpayserver as we have multi currency payment support per invoice Populate(ProductInformation, dto); dto.Buyer = new JObject(); dto.Buyer.Add(new JProperty("name", BuyerInformation.BuyerName)); dto.Buyer.Add(new JProperty("address1", BuyerInformation.BuyerAddress1)); dto.Buyer.Add(new JProperty("address2", BuyerInformation.BuyerAddress2)); dto.Buyer.Add(new JProperty("locality", BuyerInformation.BuyerCity)); dto.Buyer.Add(new JProperty("region", BuyerInformation.BuyerState)); dto.Buyer.Add(new JProperty("postalCode", BuyerInformation.BuyerZip)); dto.Buyer.Add(new JProperty("country", BuyerInformation.BuyerCountry)); dto.Buyer.Add(new JProperty("phone", BuyerInformation.BuyerPhone)); dto.Buyer.Add(new JProperty("email", string.IsNullOrWhiteSpace(BuyerInformation.BuyerEmail) ? RefundMail : BuyerInformation.BuyerEmail)); dto.Token = Encoders.Base58.EncodeData(RandomUtils.GetBytes(16)); //No idea what it is useful for dto.Guid = Guid.NewGuid().ToString(); return(dto); }
public InvoiceResponse EntityToDTO(BTCPayNetworkProvider networkProvider) { ServerUrl = ServerUrl ?? ""; InvoiceResponse dto = new InvoiceResponse { Id = Id, OrderId = OrderId, PosData = PosData, CurrentTime = DateTimeOffset.UtcNow, InvoiceTime = InvoiceTime, ExpirationTime = ExpirationTime, Status = Status, Currency = ProductInformation.Currency, Flags = new Flags() { Refundable = Refundable }, PaymentSubtotals = new Dictionary <string, long>(), PaymentTotals = new Dictionary <string, long>(), SupportedTransactionCurrencies = new Dictionary <string, InvoiceSupportedTransactionCurrency>(), Addresses = new Dictionary <string, string>(), PaymentCodes = new Dictionary <string, InvoicePaymentUrls>(), ExchangeRates = new Dictionary <string, Dictionary <string, decimal> >() }; dto.Url = ServerUrl.WithTrailingSlash() + $"invoice?id=" + Id; dto.CryptoInfo = new List <NBitpayClient.InvoiceCryptoInfo>(); foreach (var info in this.GetPaymentMethods(networkProvider)) { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var address = info.GetPaymentMethodDetails()?.GetPaymentDestination(); var exrates = new Dictionary <string, decimal> { { ProductInformation.Currency, cryptoInfo.Rate } }; cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.TotalDue = accounting.TotalDue.ToString(); cryptoInfo.NetworkFee = accounting.NetworkFee.ToString(); cryptoInfo.TxCount = accounting.TxCount; cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString(); cryptoInfo.Address = address; cryptoInfo.ExRates = exrates; var paymentId = info.GetId(); var scheme = info.Network.UriScheme; cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}"; if (paymentId.PaymentType == PaymentTypes.BTCLike) { var cryptoSuffix = cryptoInfo.CryptoCode == "BTC" ? "" : "/" + cryptoInfo.CryptoCode; cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls() { BIP72 = $"{scheme}:{cryptoInfo.Address}?amount={cryptoInfo.Due}&r={ServerUrl.WithTrailingSlash() + ($"i/{Id}{cryptoSuffix}")}", BIP72b = $"{scheme}:?r={ServerUrl.WithTrailingSlash() + ($"i/{Id}{cryptoSuffix}")}", BIP73 = ServerUrl.WithTrailingSlash() + ($"i/{Id}{cryptoSuffix}"), BIP21 = $"{scheme}:{cryptoInfo.Address}?amount={cryptoInfo.Due}", }; } if (paymentId.PaymentType == PaymentTypes.LightningLike) { cryptoInfo.PaymentUrls = new NBitpayClient.InvoicePaymentUrls() { BOLT11 = $"lightning:{cryptoInfo.Address}" }; } #pragma warning disable CS0618 if (info.CryptoCode == "BTC" && paymentId.PaymentType == PaymentTypes.BTCLike) { dto.BTCPrice = cryptoInfo.Price; dto.Rate = cryptoInfo.Rate; dto.ExRates = cryptoInfo.ExRates; dto.BitcoinAddress = cryptoInfo.Address; dto.BTCPaid = cryptoInfo.Paid; dto.BTCDue = cryptoInfo.Due; dto.PaymentUrls = cryptoInfo.PaymentUrls; } #pragma warning restore CS0618 dto.CryptoInfo.Add(cryptoInfo); dto.PaymentCodes.Add(paymentId.ToString(), cryptoInfo.PaymentUrls); dto.PaymentSubtotals.Add(paymentId.ToString(), subtotalPrice.Satoshi); dto.PaymentTotals.Add(paymentId.ToString(), accounting.TotalDue.Satoshi); dto.SupportedTransactionCurrencies.TryAdd(cryptoCode, new InvoiceSupportedTransactionCurrency() { Enabled = true }); dto.Addresses.Add(paymentId.ToString(), address); dto.ExchangeRates.TryAdd(cryptoCode, exrates); } //dto.AmountPaid dto.MinerFees & dto.TransactionCurrency are not supported by btcpayserver as we have multi currency payment support per invoice Populate(ProductInformation, dto); Populate(BuyerInformation, dto); dto.Token = Encoders.Base58.EncodeData(RandomUtils.GetBytes(16)); //No idea what it is useful for dto.Guid = Guid.NewGuid().ToString(); dto.ExceptionStatus = ExceptionStatus == null ? new JValue(false) : new JValue(ExceptionStatus); return(dto); }
public InvoiceResponse EntityToDTO() { ServerUrl = ServerUrl ?? ""; InvoiceResponse dto = new InvoiceResponse { Id = Id, StoreId = StoreId, OrderId = Metadata.OrderId, PosData = Metadata.PosData, CurrentTime = DateTimeOffset.UtcNow, InvoiceTime = InvoiceTime, ExpirationTime = ExpirationTime, #pragma warning disable CS0618 // Type or member is obsolete Status = StatusString, ExceptionStatus = ExceptionStatus == InvoiceExceptionStatus.None ? new JValue(false) : new JValue(ExceptionStatusString), #pragma warning restore CS0618 // Type or member is obsolete Currency = Currency, Flags = new Flags() { Refundable = Refundable }, PaymentSubtotals = new Dictionary <string, decimal>(), PaymentTotals = new Dictionary <string, decimal>(), SupportedTransactionCurrencies = new Dictionary <string, InvoiceSupportedTransactionCurrency>(), Addresses = new Dictionary <string, string>(), PaymentCodes = new Dictionary <string, InvoicePaymentUrls>(), ExchangeRates = new Dictionary <string, Dictionary <string, decimal> >() }; dto.Url = ServerUrl.WithTrailingSlash() + $"invoice?id=" + Id; dto.CryptoInfo = new List <NBitpayClient.InvoiceCryptoInfo>(); dto.MinerFees = new Dictionary <string, MinerFeeInfo>(); foreach (var info in this.GetPaymentMethods()) { var accounting = info.Calculate(); var cryptoInfo = new NBitpayClient.InvoiceCryptoInfo(); var subtotalPrice = accounting.TotalDue - accounting.NetworkFee; var cryptoCode = info.GetId().CryptoCode; var details = info.GetPaymentMethodDetails(); var address = details?.GetPaymentDestination(); var exrates = new Dictionary <string, decimal> { { Currency, cryptoInfo.Rate } }; cryptoInfo.CryptoCode = cryptoCode; cryptoInfo.PaymentType = info.GetId().PaymentType.ToString(); cryptoInfo.Rate = info.Rate; cryptoInfo.Price = subtotalPrice.ToString(); cryptoInfo.Due = accounting.Due.ToString(); cryptoInfo.Paid = accounting.Paid.ToString(); cryptoInfo.TotalDue = accounting.TotalDue.ToString(); cryptoInfo.NetworkFee = accounting.NetworkFee.ToString(); cryptoInfo.TxCount = accounting.TxCount; cryptoInfo.CryptoPaid = accounting.CryptoPaid.ToString(); cryptoInfo.Address = address; cryptoInfo.ExRates = exrates; var paymentId = info.GetId(); cryptoInfo.Url = ServerUrl.WithTrailingSlash() + $"i/{paymentId}/{Id}"; cryptoInfo.Payments = GetPayments(info.Network).Select(entity => { var data = entity.GetCryptoPaymentData(); return(new InvoicePaymentInfo() { Id = data.GetPaymentId(), Fee = entity.NetworkFee, Value = data.GetValue(), Completed = data.PaymentCompleted(entity), Confirmed = data.PaymentConfirmed(entity, SpeedPolicy), Destination = data.GetDestination(), PaymentType = data.GetPaymentType().ToString(), ReceivedDate = entity.ReceivedTime.DateTime }); }).ToList(); if (details?.Activated is true && paymentId.PaymentType == PaymentTypes.LightningLike) { cryptoInfo.PaymentUrls = new InvoicePaymentUrls() { BOLT11 = paymentId.PaymentType.GetPaymentLink(info.Network, details, cryptoInfo.Due, ServerUrl) }; }