public static void ValidatePayoutNotConnectedToAmount(Member user) { //Check the status if (user.Status == MemberStatus.VacationMode) { throw new MsgException(U4000.YOUAREINVACATIONMODE); } //Account verification if (AppSettings.Authentication.IsDocumentVerificationEnabled && user.VerificationStatus != VerificationStatus.Verified) { throw new MsgException(U5006.ACCOUNTNOTVERIFIED); } if (user.NumberOfPayoutsToday + 1 > user.Membership.MaxDailyPayouts) { throw new MsgException(string.Format(U6000.TOOMANYWITHDRAWSTODAY, user.Membership.MaxDailyPayouts)); } //Payout Days if (!AppSettings.Representatives.RepresentativesIgnoreWitdrawalRules || !user.IsRepresentative()) { PayoutManager.CheckPayoutsDays(); } //Check negative balance if (user.IsAnyBalanceIsNegative()) { throw new MsgException(U6012.NEGATIVEBALANCEWITHDRAWAL); } //Validate Credit Loans if (CreditLineManager.UserHasUnpaidLoans(user.Id)) { throw new MsgException(U6008.REPAYCREDITLINETOWITHDRAW); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && CPAOffer.CheckCollectedLevelsAmount(user.Name) < 20) { throw new MsgException(String.Format("You didn't collect enaugh CPA/GPT offers from different levels yet. You have already collected and confirmed {0} levels.", CPAOffer.CheckCollectedLevelsAmount(user.Name))); } //Special Check amount of collected offers from different levels if (TitanFeatures.IsBobbyDonev && user.CashoutsProceed > 0) { throw new MsgException("You already did one payout. You can't do more."); } //Check days restriction between each withdrawals var lastWidthdrawalDate = user.GetLastWithdrawalDate(); if (lastWidthdrawalDate != null && lastWidthdrawalDate > AppSettings.ServerTime.AddDays(-user.Membership.BlockPayoutDays)) { throw new MsgException(string.Format(U6013.TIMEBETWEENPAYOUTERROR, user.Membership.BlockPayoutDays)); } }
private void ValidatePayout() { if (amountToPayout > user.CommissionBalance) { throw new MsgException(L1.NOTENOUGHFUNDS); } if (user.Status == MemberStatus.VacationMode) { throw new MsgException(U4000.YOUAREINVACATIONMODE); } //Validate Credit Loans if (CreditLineManager.UserHasUnpaidLoans(user.Id)) { throw new MsgException(U6008.REPAYCREDITLINETOWITHDRAW); } if (user.NumberOfCommissionPayoutsToday + 1 > user.Membership.MaxCommissionPayoutsPerDay) { throw new MsgException(string.Format(U6000.TOOMANYWITHDRAWSTODAY, user.Membership.MaxCommissionPayoutsPerDay)); } }
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; } }