コード例 #1
0
        public IEnumerable <ISupportedPaymentMethod> GetSupportedPaymentMethod(BTCPayNetworkProvider networks)
        {
#pragma warning disable CS0618
            bool btcReturned = false;
            if (!string.IsNullOrEmpty(DerivationStrategies))
            {
                JObject strategies = JObject.Parse(DerivationStrategies);
                foreach (var strat in strategies.Properties())
                {
                    var paymentMethodId = PaymentMethodId.Parse(strat.Name);
                    var network         = networks.GetNetwork(paymentMethodId.CryptoCode);
                    if (network != null)
                    {
                        if (network == networks.BTC && paymentMethodId.PaymentType == PaymentTypes.BTCLike)
                        {
                            btcReturned = true;
                        }
                        yield return(PaymentMethodExtensions.Deserialize(paymentMethodId, strat.Value, network));
                    }
                }
            }

            if (!btcReturned && !string.IsNullOrEmpty(DerivationStrategy))
            {
                if (networks.BTC != null)
                {
                    yield return(BTCPayServer.DerivationStrategy.Parse(DerivationStrategy, networks.BTC));
                }
            }
#pragma warning restore CS0618
        }
コード例 #2
0
ファイル: StoreData.cs プロジェクト: hoangbinh/btcpayserver
        public IEnumerable <ISupportedPaymentMethod> GetSupportedPaymentMethods(BTCPayNetworkProvider networks)
        {
#pragma warning disable CS0618
            bool btcReturned = false;

            // Legacy stuff which should go away
            if (!string.IsNullOrEmpty(DerivationStrategy))
            {
                if (networks.BTC != null)
                {
                    btcReturned = true;
                    yield return(DerivationSchemeSettings.Parse(DerivationStrategy, networks.BTC));
                }
            }


            if (!string.IsNullOrEmpty(DerivationStrategies))
            {
                JObject strategies = JObject.Parse(DerivationStrategies);
                foreach (var strat in strategies.Properties())
                {
                    var paymentMethodId = PaymentMethodId.Parse(strat.Name);
                    var network         = networks.GetNetwork(paymentMethodId.CryptoCode);
                    if (network != null)
                    {
                        if (network == networks.BTC && paymentMethodId.PaymentType == PaymentTypes.BTCLike && btcReturned)
                        {
                            continue;
                        }
                        if (strat.Value.Type == JTokenType.Null)
                        {
                            continue;
                        }
                        yield return(PaymentMethodExtensions.Deserialize(paymentMethodId, strat.Value, network));
                    }
                }
            }
#pragma warning restore CS0618
        }