public PaymentMethodDictionary GetPaymentMethods() { PaymentMethodDictionary paymentMethods = new PaymentMethodDictionary(); var serializer = new Serializer(null); #pragma warning disable CS0618 if (PaymentMethod != null) { foreach (var prop in PaymentMethod.Properties()) { var r = serializer.ToObject <PaymentMethod>(prop.Value.ToString()); if (!PaymentMethodId.TryParse(prop.Name, out var paymentMethodId)) { continue; } r.CryptoCode = paymentMethodId.CryptoCode; r.PaymentType = paymentMethodId.PaymentType.ToString(); r.ParentEntity = this; if (Networks != null) { r.Network = Networks.GetNetwork <BTCPayNetworkBase>(r.CryptoCode); if (r.Network is null) { continue; } } paymentMethods.Add(r); } } #pragma warning restore CS0618 return(paymentMethods); }
public PaymentMethodDictionary GetPaymentMethods(BTCPayNetworkProvider networkProvider) { PaymentMethodDictionary paymentMethods = new PaymentMethodDictionary(); var serializer = new Serializer(Dummy); #pragma warning disable CS0618 if (PaymentMethod != null) { foreach (var prop in PaymentMethod.Properties()) { var r = serializer.ToObject <PaymentMethod>(prop.Value.ToString()); var paymentMethodId = PaymentMethodId.Parse(prop.Name); r.CryptoCode = paymentMethodId.CryptoCode; r.PaymentType = paymentMethodId.PaymentType.ToString(); r.ParentEntity = this; r.Network = networkProvider?.GetNetwork(r.CryptoCode); if (r.Network != null || networkProvider == null) { paymentMethods.Add(r); } } } #pragma warning restore CS0618 return(paymentMethods); }
public PaymentMethodDictionary GetPaymentMethods(BTCPayNetworkProvider networkProvider, bool alwaysIncludeBTC = false) { PaymentMethodDictionary rates = new PaymentMethodDictionary(networkProvider); var serializer = new Serializer(Dummy); PaymentMethod phantom = null; #pragma warning disable CS0618 // Legacy if (alwaysIncludeBTC) { var btcNetwork = networkProvider?.GetNetwork("BTC"); phantom = new PaymentMethod() { ParentEntity = this, IsPhantomBTC = true, Rate = Rate, CryptoCode = "BTC", TxFee = TxFee, FeeRate = new FeeRate(TxFee, 100), DepositAddress = DepositAddress, Network = btcNetwork }; if (btcNetwork != null || networkProvider == null) { rates.Add(phantom); } } if (PaymentMethod != null) { foreach (var prop in PaymentMethod.Properties()) { if (prop.Name == "BTC" && phantom != null) { rates.Remove(phantom); } var r = serializer.ToObject <PaymentMethod>(prop.Value.ToString()); var paymentMethodId = PaymentMethodId.Parse(prop.Name); r.CryptoCode = paymentMethodId.CryptoCode; r.PaymentType = paymentMethodId.PaymentType.ToString(); r.ParentEntity = this; r.Network = networkProvider?.GetNetwork(r.CryptoCode); if (r.Network != null || networkProvider == null) { rates.Add(r); } } } #pragma warning restore CS0618 return(rates); }
public PaymentMethodDictionary GetPaymentMethods() { PaymentMethodDictionary paymentMethods = new PaymentMethodDictionary(); var serializer = new Serializer(null); #pragma warning disable CS0618 if (PaymentMethod != null) { foreach (var prop in PaymentMethod.Properties()) { var r = serializer.ToObject <PaymentMethod>(prop.Value.ToString()); var paymentMethodId = PaymentMethodId.Parse(prop.Name); r.bitcoinCode = paymentMethodId.bitcoinCode; r.PaymentType = paymentMethodId.PaymentType.ToString(); r.ParentEntity = this; r.Network = Networks?.UnfilteredNetworks.GetNetwork <BTCPayNetworkBase>(r.bitcoinCode); paymentMethods.Add(r); } } #pragma warning restore CS0618 return(paymentMethods); }