Exemple #1
0
    protected void btnDepositBTC_Click(object sender, EventArgs e)
    {
        try
        {
            if (BtcCryptocurrency.DepositEnabled)
            {
                if (CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons())
                {
                    BTCDepositInfopanel.Visible = false;

                    var amount = Money.Parse(BTCAmountTextBox.Text).FromMulticurrency();
                    var bg     = new DepositCryptocurrencyButtonGenerator(user, amount);
                    BTCPaymentButton.Text = GenerateHTMLButtons.GetBtcButton(bg);
                }

                else
                {
                    classicbtcDepositBTC.Visible = false;
                    BTCValuePanel.Visible        = true;

                    string adminAddress = CryptocurrencyApiFactory.Get(BtcCryptocurrency.DepositApiProcessor).TryGetAdminAddress();

                    WalletToBTCPanel.Visible = true;
                    ClassicBTCPanel.Visible  = true;

                    if (!string.IsNullOrWhiteSpace(adminAddress))
                    {
                        multipleDepositWarningLiteral.Visible = true;
                        multipleDepositWarningLiteral.Text    = "<p class='alert alert-warning'>" + U5005.MUSTWAITTODEPOSIT + "</p>";

                        BitcoinQRCode.ImageUrl = "~/Handlers/Utils/BitcoinQRCode.ashx?address=" + adminAddress;

                        depositBTCLabel.Text = adminAddress;

                        DepositBTCInfoPanel.Visible = true;
                        DepositBTCInfoLabel.Text    = string.Format(U4200.DEPOSITBTCDESCRIPTION, "<b>" + adminAddress + "</b>", "<br/>", BtcCryptocurrency.DepositMinimumConfirmations.ToString());
                    }
                    else
                    {
                        depositBTCLabel.Text = "<p class='alert alert-danger'>" + U4200.DEPOSITUNAVAILABLE + "</p>";
                    }
                }
            }
            else
            {
                throw new MsgException(U4200.DEPOSITUNAVAILABLE);
            }
        }
        catch (MsgException ex)
        {
            ErrorMessagePanelBTC.Visible = true;
            ErrorMessageBTC.Text         = ex.Message;
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            ErrorMessagePanelBTC.Visible = true;
            ErrorMessageBTC.Text         = ex.Message;
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyTransferEnabled);

        user = Member.Current;
        AppSettings.Reload();

        BtcCryptocurrency   = CryptocurrencyFactory.Get <BitcoinCryptocurrency>();
        EthCryptocurrency   = CryptocurrencyFactory.Get <EthereumCryptocurrency>();
        XrpCryptocurrency   = CryptocurrencyFactory.Get <RippleCryptocurrency>();
        TokenCryptocurrency = CryptocurrencyFactory.Get <RippleCryptocurrency>();

        DepositButton.Visible = AppSettings.Representatives.RepresentativesHelpDepositEnabled;

        if (!Page.IsPostBack)
        {
            if (BtcCryptocurrency.DepositEnabled)
            {
                BTCButton.Visible = !CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons();

                if (TitanFeatures.IsRofriqueWorkMines)
                {
                    BTCButton.Text = "BTC Deposits";
                }
                else
                {
                    BTCButton.Text = "BTC";
                }
            }

            if (TitanFeatures.IsFlotrading)
            {
                BalanceButton.CssClass        = "";
                BTCButton.CssClass            = "ViewSelected";
                MenuMultiView.ActiveViewIndex = 1;
            }

            if (TitanFeatures.IsTrafficThunder)
            {
                UserBalancesPlaceHolder.Visible = false;
            }

            AppSettings.Reload();

            LangAdder.Add(DepositButton, U6010.DEPOSITVIAREPRESENTATIVE);
            LangAdder.Add(btnTransfer, L1.TRANSFER);
            LangAdder.Add(DepositViaRepresentativeButton, U6010.SENDTRANSFERMESSAGE);
            LangAdder.Add(MPesaConfirmButton, L1.CONFIRM);
            LangAdder.Add(BTCAmountRequiredFieldValidator, U2502.INVALIDMONEYFORMAT);
            LangAdder.Add(CalculatePointsValueButton, U6007.CALCULATE);

            //MPesa?
            if (Request.QueryString["mpesa"] != null)
            {
                StandardTransferPlaceHolder.Visible = false;
                MPesaTransferPlaceHolder2.Visible   = true;
                var gateway = PaymentAccountDetails.GetFirstIncomeGateway <MPesaSapamaAccountDetails>();
                MPesaAmount.Text = String.Format(U6005.TODEPOSITVIAMPESA, gateway.Username, gateway.Username,
                                                 Money.Parse(Request.QueryString["mpesa"]).ToString());
            }

            //Pre-selected tab
            if (Request.QueryString["button"] != null)
            {
                var button = (Button)MenuButtonPlaceHolder.FindControl("Button" + Request.QueryString["button"]);
                MenuButton_Click(button, null);
            }

            RadioFrom.Items.AddRange(GenerateHTMLButtons.DepositBalanceFromItems);

            if (TitanFeatures.IsRofriqueWorkMines && !CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons())
            {
                RadioFrom.Items.Add(new ListItem("", "BTC"));
            }

            BTCTo.Items.AddRange(GenerateHTMLButtons.BTCToItems);

            if (BtcCryptocurrency.DepositEnabled)
            {
                BTCValueLabel.Text    = ClassicBTCValueLabel.Text = string.Format("<p class='alert alert-info'>{0}: <b>{1}</b></p>", U5003.ESTIMATEDBTCVALUE, BtcCryptocurrency.GetValue().ToString());
                BTCValueLabel.Visible = ClassicBTCValueLabel.Visible = AppSettings.Site.CurrencyCode != "BTC"; //We don't want to show 1B = 1B

                BTCPointsFrom.Items.AddRange(GenerateHTMLButtons.BTCFromItems);

                BTCPointsFrom.SelectedIndex = 0;

                if (BTCPointsFrom.SelectedValue == "Wallet")
                {
                    btnDepositBTC.Visible = true;

                    if (BtcCryptocurrency.DepositTarget == DepositTargetBalance.PurchaseBalance)
                    {
                        BTCTo.SelectedValue = "AdBalance";
                    }
                    else if (BtcCryptocurrency.DepositTarget == DepositTargetBalance.CashBalance)
                    {
                        BTCTo.SelectedValue = "CashBalance";
                    }
                    else if (BtcCryptocurrency.DepositTarget == DepositTargetBalance.Wallet)
                    {
                        BTCTo.SelectedValue = "BTCWallet";
                    }
                }

                BTCButtonPanel.Visible  = CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons();
                ClassicBTCPanel.Visible = !CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons();
            }

            if (((AppSettings.Payments.CommissionToMainBalanceEnabled && !TitanFeatures.UserCommissionToMainBalanceEnabled) ||
                 (TitanFeatures.UserCommissionToMainBalanceEnabled && user.CommissionToMainBalanceEnabled) ||
                 TitanFeatures.IsRevolca) && user.CheckAccessCustomizeTradeOwnSystem)
            {
                RadioTo.Items.Add(new ListItem("", "Main balance"));
            }

            if (!AppSettings.Payments.CashBalanceEnabled)
            {
                ListItem cb = RadioTo.Items.FindByValue("Cash balance");
                if (cb != null)
                {
                    RadioTo.Items.Remove(cb);
                }
            }

            if (!AppSettings.Payments.MarketplaceBalanceEnabled)
            {
                ListItem cb = RadioTo.Items.FindByValue("Marketplace balance");
                if (cb != null)
                {
                    RadioTo.Items.Remove(cb);
                }
            }

            SetRadioToValues();
            SetProcessorValues();
            SetupSpecialTransfersProperties();

            if (RadioFrom.Items.Count == 0 || RadioTo.Items.Count == 0)
            {
                //No transfers available
                transferInputRow.Visible = false;
                TransferSameCommissionToMainLiteral.Visible = true;
                TransferSameCommissionToMainLiteral.Text    = U5006.NOTRANSFEROPTIONS;
                transfertable.Visible = false;
            }

            if (TitanFeatures.IsTradeOwnSystem)
            {
                //Checking condition to display appropriate message
                if (!user.CheckAccessCustomizeTradeOwnSystem && user.CommissionToMainBalanceRequiredViewsMessageInt > 0)
                {
                    CommissionTransferInfoDiv.Visible = true;
                    CommissionTransferInfo.Text       = String.Format(U6010.COMMISSIONBALANCETRANSFERINFO, user.CommissionToMainBalanceRequiredViewsMessageInt, AppSettings.RevShare.AdPack.AdPackName);
                }
                else if (!user.CheckAccessCustomizeTradeOwnSystem && user.CommissionToMainBalanceRequiredViewsMessageInt == 0)
                {
                    CommissionTransferInfoDiv.Visible = true;
                    CommissionTransferInfo.Text       = String.Format(U6010.COMMISSIONBALANCETRANSFERNOACTIVEADPACKINFO, AppSettings.RevShare.AdPack.AdPackName);
                }
                else
                {
                    CommissionTransferInfoDiv.Visible = false;
                }
            }

            if (BtcCryptocurrency.DepositEnabled && BtcCryptocurrency.DepositMinimum > 0)
            {
                AdditionalInfoPlaceHolder.Visible = true;
                AdditionalInfoLiteral.Text        = String.Format(U6012.WARNINGMINBTCDEPOSIT, CryptocurrencyMoney.Parse(BtcCryptocurrency.DepositMinimum.ToString(), CryptocurrencyType.BTC).ToString());
            }
        }

        SetRadioItemsValues(RadioFrom);
        SetRadioItemsValues(RadioTo);
        SetRadioItemsValues(BTCTo);

        RemoveDuplicatesFromList();

        foreach (ListItem item in BTCPointsFrom.Items)
        {
            item.Attributes.Add("data-content", "<img src='../Images/OneSite/TransferMoney/GoCoin.png' /> BTC");
        }

        if (!TitanFeatures.IsRofriqueWorkMines)
        {
            LangAdder.Add(BalanceButton, U5009.BALANCE);
        }
        else
        {
            LangAdder.Add(BalanceButton, "Cash Deposits");
        }

        LangAdder.Add(btnDepositBTC, U4200.DEPOSIT);
        LangAdder.Add(classicbtcDepositBTC, U4200.DEPOSIT);
    }
Exemple #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.MoneyPayoutEnabled);
        User = Member.Current;

        if (CreditLineManager.UserHasUnpaidLoans(User.Id))
        {
            CashoutButton.Enabled = CashoutButtonConfirm.Enabled =
                WithdrawCryptocurrencyButton.Enabled = WithdrawCryptocurrencyConfirmButton.Enabled =
                    CommissionCashoutButton.Enabled  = false;
            UnpaidCreditLineInfo.Visible             = true;
        }

        if (!Page.IsPostBack)
        {
            AppSettings.Reload();

            #region Langs & Texts

            WithdrawCryptocurrencyButton.Text        = L1.CASHOUT;
            WithdrawCryptocurrencyConfirmButton.Text = L1.CONFIRM;
            CashoutButtonConfirm.Text = L1.CONFIRM;
            SendWithdrawViaRepresentativeButton.Text = U6010.SENDTRANSFERMESSAGE;
            ProportionsGridView.EmptyDataText        = U5004.NOPAYOUTHISTORY;
            MainBalanceButton.Text                = L1.MAINBALANCE;
            MaxWithdrawalsButton.Text             = U5004.MAXIMUMWITHDRAWAL;
            CommissionButton.Text                 = U5004.COMMISSIONBALANCE;
            WithdrawHistoryButton.Text            = L1.HISTORY;
            CashoutButton.Text                    = CommissionCashoutButton.Text = L1.CASHOUT;
            MainBalanceLiteral.Text               = User.MainBalance.ToString();
            CommissionBalanceLiteral.Text         = User.CommissionBalance.ToString();
            WithdrawHistoryGridView.EmptyDataText = L1.NODATA;

            LangAdder.Add(RegularExpressionValidator3, L1.ER_BADPIN, true);
            LangAdder.Add(RegularExpressionValidator1, L1.ER_BADPIN, true);
            LangAdder.Add(RegularExpressionValidator2, L1.ER_BADPIN, true);
            LangAdder.Add(WithdrawViaRepresentativeButton, U6010.WITHDRAWVIAREPRESENTATIVE);
            LangAdder.Add(RequiredFieldValidator2, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator4, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator6, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator1, L1.REQ_PP, true);
            LangAdder.Add(RequiredFieldValidator3, L1.REQ_PP, true);
            LangAdder.Add(RequiredFieldValidator7, U2502.INVALIDMONEYFORMAT, true);
            LangAdder.Add(BtcCodeValidator, U6000.INVALIDSECURITYCODE, true);
            LangAdder.Add(FiatCodeValidator, U6000.INVALIDSECURITYCODE, true);
            LangAdder.Add(REValidator, U3500.ILLEGALCHARS);
            #endregion

            PINDiv1.Visible = PINDiv2.Visible = BtcPinDiv.Visible = AppSettings.Registration.IsPINEnabled;

            var BtcCryptocurrency   = CryptocurrencyFactory.Get <BitcoinCryptocurrency>();
            var XrpCryptocurrency   = CryptocurrencyFactory.Get <RippleCryptocurrency>();
            var TokenCryptocurrency = CryptocurrencyFactory.Get <ERC20TokenCryptocurrency>();

            //Check if user has some manual payouts waiting
            var UnpaidRequests = User.GetUnpaidPayoutRequests();
            WarningPanel.Visible = UnpaidRequests.exists;
            WarningLiteral.Text  = UnpaidRequests.text;

            //Generate proper Cashout options
            RadioFrom.Items.AddRange(GenerateHTMLButtons.CashoutFromItems);

            if (TitanFeatures.IsRofriqueWorkMines && !CryptocurrencyApiFactory.GetDepositApi(BtcCryptocurrency).AllowToUsePaymentButtons())
            {
                RadioFrom.Items.Add(new ListItem("", "BTC"));
            }

            CommissionRadioFrom.Items.AddRange(GenerateHTMLButtons.CashoutFromItems);

            if (RadioFrom.Items.Count < 1)
            {
                PayoutPlaceHolder.Visible = false;
                WarningPanel.Visible      = true;
                WarningLiteral.Text       = U5006.PAYOUTUNAVAILABLE;
            }

            if (CommissionRadioFrom.Items.Count < 1)
            {
                CommissionPayoutPlaceHolder.Visible = false;
                CommissionWarningPanel.Visible      = true;
                CommissionWarningLiteral.Text       = U5006.PAYOUTUNAVAILABLE;
            }

            CommissionButton.Visible = AppSettings.Payments.CommissionBalanceWithdrawalEnabled;
            WithdrawViaRepresentativeButton.Visible = AppSettings.Representatives.RepresentativesHelpWithdrawalEnabled;

            //Lang
            CashoutButton.Text = CommissionCashoutButton.Text = L1.CASHOUT;

            LangAdder.Add(RegularExpressionValidator3, L1.ER_BADPIN, true);
            LangAdder.Add(RegularExpressionValidator1, L1.ER_BADPIN, true);
            LangAdder.Add(RegularExpressionValidator2, L1.ER_BADPIN, true);
            LangAdder.Add(WithdrawViaRepresentativeButton, U6010.WITHDRAWVIAREPRESENTATIVE);
            LangAdder.Add(RequiredFieldValidator2, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator4, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator6, L1.REG_REQ_PIN, true);
            LangAdder.Add(RequiredFieldValidator1, L1.REQ_PP, true);
            LangAdder.Add(RequiredFieldValidator3, L1.REQ_PP, true);
            LangAdder.Add(RequiredFieldValidator7, U2502.INVALIDMONEYFORMAT, true);
            LangAdder.Add(BtcCodeValidator, U6000.INVALIDSECURITYCODE, true);
            LangAdder.Add(FiatCodeValidator, U6000.INVALIDSECURITYCODE, true);

            //Pre-selected tab
            if (Request.QueryString["b"] != null)
            {
                var button = (Button)MenuButtonPlaceHolder.FindControl(Request.QueryString["b"] + "Button");
                MenuButton_Click(button, null);
            }

            bool PercentOfInvestmentWIthdrawalEnabled = User.Membership.MaxWithdrawalAllowedPerInvestmentPercent < 1000000000;

            MaxWithdrawalsButton.Visible = AppSettings.Payments.ProportionalPayoutLimitsEnabled || PercentOfInvestmentWIthdrawalEnabled;

            if (PercentOfInvestmentWIthdrawalEnabled)
            {
                MaxWithdrawalAllowedPerInvestmentPercentPlaceHolder.Visible = true;
                PaymentProportionsManager ppm = new PaymentProportionsManager(User);
                Money invested    = ppm.TotalPaidIn;
                Money withdrawn   = ppm.TotalPaidOut;
                Money canwithdraw = Money.MultiplyPercent(invested, User.Membership.MaxWithdrawalAllowedPerInvestmentPercent);
                TotalPaidInLiteral.Text  = invested.ToString();
                TotalCashoutLiteral.Text = withdrawn.ToString();
                HowmuchMoreCanBeWithdrawnLiteral.Text = String.Format(U6005.YOUCANWITHDRAWOFINVESTED,
                                                                      NumberUtils.FormatPercents(User.Membership.MaxWithdrawalAllowedPerInvestmentPercent), canwithdraw.ToString(),
                                                                      "<b>" + (canwithdraw - withdrawn).ToString() + "</b>");
            }

            //Pre-selected tab
            if (Request.QueryString["b"] != null)
            {
                var button = (Button)MenuButtonPlaceHolder.FindControl(Request.QueryString["b"] + "Button");
                MenuButton_Click(button, null);
            }

            BTCWithdrawalButton.Visible = BtcCryptocurrency.WithdrawalEnabled;
            XRPWithdrawalButton.Visible = XrpCryptocurrency.WithdrawalEnabled;
            ERC20TokenButton.Visible    = TokenCryptocurrency.WithdrawalEnabled;

            BTCWithdrawalButton.Text = "BTC";
            ERC20TokenButton.Text    = String.Format("{0} ({1})", TokenCryptocurrency.Name, TokenCryptocurrency.Code);
            XRPWithdrawalButton.Text = "XRP";

            if (RadioFrom.Items.Count < 1)//No payment processors, let's move to BTC/XRP/ETH tab on start
            {
                MainBalanceButton.Visible = false;

                if (BtcCryptocurrency.WithdrawalEnabled)
                {
                    MenuButton_Click(BTCWithdrawalButton, null);
                }
                else if (XrpCryptocurrency.WithdrawalEnabled)
                {
                    MenuButton_Click(XRPWithdrawalButton, null);
                }
                else if (TokenCryptocurrency.WithdrawalEnabled)
                {
                    MenuButton_Click(ERC20TokenButton, null);
                }
                else
                {
                    MainBalanceButton.Visible = true;
                }

                if (TitanFeatures.IsClickmyad)
                {
                    MenuButton_Click(XRPWithdrawalButton, null);
                }
            }

            RadioFrom.SelectedIndex = 0;
            SetProcessorValues();
        }

        SetDropdownItemsValues(RadioFrom);

        if (TitanFeatures.IsClickmyad)
        {
            BTCWithdrawalButton.Visible = false;
        }

        if (TitanFeatures.IsTrafficThunder)
        {
            MainBalanceButton.Visible    = false;
            MaxWithdrawalsButton.Visible = false;
        }
    }