Esempio n. 1
0
 private void SetCoinbaseEmailControls()
 {
     CoinbaseEmailSettings.Visible = true;
     CoinbaseEmailTextBox.Visible  = true;
     CoinbaseEmailTextBox_Watermark.WatermarkText = U6010.ENTERYOURCOINBASEEMAIL;
     CoinbaseEmailTextBox.Text = CoinbaseAddressHelper.GetAddress(User.Id);
 }
Esempio n. 2
0
    /// <summary>
    /// //BTC, XRP, TOKEN etc | all cryptocurrencies
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void CryptocurrencyPayout_Activate(object sender, EventArgs e)
    {
        CryptocurrencyErrorMessagePanel.Visible   = false;
        CryptocurrencySuccessMessagePanel.Visible = false;
        WithdrawCryptocurrencyAmountTextBox.Text  = string.Empty;
        CryptoPINTextBox.Enabled                  = true;
        CryptoPINTextBox.Text                     = string.Empty;
        CryptocurrencyFeeLiteral.Visible          = WithdrawTotalCryptocurrencyLiteral.Visible = false;
        WithdrawCryptocurrencyAddressTextBox.Text = string.Empty;
        string errorMessage = String.Empty;

        Cryptocurrency Cryptocurrency = CryptocurrencyFactory.Get(SelectedCryptocurrency);

        CryptocurrencyImage.ImageUrl    = Cryptocurrency.GetImageUrl();
        CryptocurrencyAddressLabel.Text = string.Format("{1} {0}", L1.ADDRESS, Cryptocurrency.Code);
        CryptocurrencyValueLiteral.Text = string.Format("1 {0} = <b>{1}</b>", Cryptocurrency.Code, Cryptocurrency.GetValue().ToString());

        if (TitanFeatures.IsTrafficThunder)
        {
            CryptocurrencyValueLiteral.Text = "1 BTC = <b>" + String.Format(new System.Globalization.CultureInfo("en-US"), "{0:n2}", CryptocurrencyFactory.Get(CryptocurrencyType.BTC).GetOriginalValue("USD").ToDecimal()) + " USD</b>";
        }

        CryptocurrencyWithdrawalSourceLiteral.Text = string.Format(U6012.WITHDRAWALSOURCE, Cryptocurrency.GetWithdrawalSourceName());

        MinimumCryptocurrencyAmountLiteral.Text = string.Format("{0}: {1}<br />", L1.LIMIT, Cryptocurrency.GetMinimumWithdrawalAmount(User, Cryptocurrency.WithdrawalSource).ToString());
        MaximumCryptocurrencyAmountLiteral.Text = string.Format("{0}: {1}", U5004.MAXIMUM, Cryptocurrency.GetMaximumWithdrawalAmount(User, Cryptocurrency.WithdrawalSource, out errorMessage).ToString());

        //Currency sign
        CurrencySignLiteral.Text = AppSettings.Site.MulticurrencySign;
        if (Cryptocurrency.WithdrawalSource == WithdrawalSourceBalance.Wallet)
        {
            CurrencySignLiteral.Text = Cryptocurrency.CurrencySign;
        }

        if (Cryptocurrency.WithdrawalApiProcessor == CryptocurrencyAPIProvider.Coinbase)
        {
            switch (AppSettings.Cryptocurrencies.CoinbaseAddressesPolicy)
            {
            case CoinbaseAddressesPolicy.CoinbaseEmail:
                CryptocurrencyAddressLabel.Text           = U6010.COINBASEEMAIL;
                WithdrawCryptocurrencyAddressTextBox.Text = CoinbaseAddressHelper.GetAddress(User.Id);

                if (string.IsNullOrEmpty(WithdrawCryptocurrencyAddressTextBox.Text))
                {
                    ChangeCryptocurrencyAddressButton.Text = L1.ADDNEW;
                }
                else
                {
                    ChangeCryptocurrencyAddressButton.Text = U6007.CHANGE;
                }
                break;

            case CoinbaseAddressesPolicy.BTCWallet:
                SetAndCheckCryptocurrencyAddress();
                break;

            case CoinbaseAddressesPolicy.CoinbaseEmailOrBTCWallet:
                CryptocurrencyAddressLabel.Text = U6010.COINBASEEMAILORBTCWALLET;
                CoinbaseAddressesDDL.Visible    = true;
                WithdrawCryptocurrencyAddressTextBox.Visible = false;

                var emailAddress = CoinbaseAddressHelper.GetAddress(User.Id, 1);
                //coinbase Email first
                if (string.IsNullOrEmpty(emailAddress))
                {
                    CoinbaseAddressesDDL.Items.Add(L1.ADDNEW);
                    ChangeCryptocurrencyAddressButton.Text = L1.ADDNEW;
                }
                else
                {
                    CoinbaseAddressesDDL.Items.Add(new ListItem(emailAddress, CoinbaseAddressesPolicy.CoinbaseEmail.ToString()));
                    ChangeCryptocurrencyAddressButton.Text = U6007.CHANGE;
                }
                //btc wallet
                var btcAddress = CoinbaseAddressHelper.GetAddress(User.Id, 2);
                if (string.IsNullOrEmpty(btcAddress))
                {
                    CoinbaseAddressesDDL.Items.Add(U6010.ADDNEWBTCWALLET);
                }
                else
                {
                    CoinbaseAddressesDDL.Items.Add(new ListItem(btcAddress, CoinbaseAddressesPolicy.BTCWallet.ToString()));
                }

                break;
            }
        }
        else
        {
            SetAndCheckCryptocurrencyAddress();
        }
    }
Esempio n. 3
0
    protected void PaymentSettingsView_Activate(object sender, EventArgs e)
    {
        tokenImage.ImageUrl = AppSettings.Ethereum.ERC20TokenImageUrl;
        //Coinbase addresses policy
        if (BtcCryptocurrency.WithdrawalApiProcessor == CryptocurrencyAPIProvider.Coinbase)
        {
            switch (AppSettings.Cryptocurrencies.CoinbaseAddressesPolicy)
            {
            case CoinbaseAddressesPolicy.BTCWallet:
                BtcAddressTextBox.Text = CoinbaseAddressHelper.GetAddress(User.Id);
                break;

            case CoinbaseAddressesPolicy.CoinbaseEmail:
                SetCoinbaseEmailControls();
                btcSettings.Visible = false;
                break;

            case CoinbaseAddressesPolicy.CoinbaseEmailOrBTCWallet:
                SetCoinbaseEmailControls();
                BtcAddressTextBox.Text    = CoinbaseAddressHelper.GetAddress(User.Id, 2);
                CoinbaseEmailTextBox.Text = CoinbaseAddressHelper.GetAddress(User.Id, 1);
                break;
            }
        }
        else
        {
            var currentAddress = CryptocurrencyWithdrawalAddress.GetAddress(User.Id, CryptocurrencyType.BTC);

            if (currentAddress != null)
            {
                BtcAddressTextBox.Text = currentAddress.Address;
            }
            else
            {
                BtcAddressWarning.Visible = false;
            }

            //Ripple
            if (XrpCryptocurrency.WithdrawalEnabled)
            {
                var currentRippleAddress = CryptocurrencyWithdrawalAddress.GetAddress(User.Id, CryptocurrencyType.XRP);

                if (currentRippleAddress != null)
                {
                    var rippleAddress = RippleAddress.FromString(currentRippleAddress.Address);
                    XrpAddressTextBox.Text = rippleAddress.Address;
                    XrpDestTagTextBox.Text = rippleAddress.DestinationTag;
                }
                else
                {
                    XrpAddressWarning.Visible = false;
                }
            }
        }

        //Ethereum
        if (EthCryptocurrency.WithdrawalEnabled)
        {
            var currentEthereumAddress = CryptocurrencyWithdrawalAddress.GetAddress(User.Id, CryptocurrencyType.ETH);

            if (currentEthereumAddress != null)
            {
                EthAddressTextBox.Text = currentEthereumAddress.Address;
            }
            else
            {
                EthAddressWarning.Visible = false;
            }
        }
    }