Exemplo n.º 1
0
    private void CheckBaseLimits()
    {
        if (IsCustomPayoutProcessor)
        {
            CheckMaxPayout(PaymentProcessor.CustomPayoutProcessor, User, AmountToPayout, CustomPayoutProcessorId);
        }
        else
        {
            CheckMaxPayout(PaymentAccountDetails.GetFromStringType(TargetPaymentProcessor), User, AmountToPayout);
        }

        PaymentAccountDetails TheGateway = null;

        if (!IsCustomPayoutProcessor)
        {
            TheGateway = PaymentAccountDetails.GetFirstGateway(TargetPaymentProcessor);
        }

        if (TheGateway == null && !IsCustomPayoutProcessor)
        {
            throw new MsgException("Sorry, no payment gateway available at the moment. Please try again soon.");
        }

        Money minPayout = Money.Zero;

        if (IsCustomPayoutProcessor)
        {
            minPayout = PayoutLimit.GetProperLimitValue(User, new CustomPayoutProcessor(CustomPayoutProcessorId));
        }
        else
        {
            minPayout = PayoutLimit.GetProperLimitValue(User, TheGateway);
        }

        if (AmountToPayout < minPayout)
        {
            throw new MsgException(U2502.AMOUNTHIGHER + ": " + minPayout.ToString());
        }

        //Cashout limits for automatic
        if (TheGateway != null && AppSettings.Payments.IsInstantPayout)
        {
            TheLimit = TheGateway.ManualCashoutAfterExceeding;

            if (AmountToPayout > TheGateway.ManualCashoutAfterExceeding)
            {
                IsAutomaticButAvoveTheLimit = true;
            }
        }
    }
Exemplo n.º 2
0
        public Money GetMinimumWithdrawalAmount(Member user, WithdrawalSourceBalance withdrawalSource)
        {
            if (withdrawalSource == WithdrawalSourceBalance.MainBalance)
            {
                var withdrawLimitInMembership     = PayoutLimit.GetGlobalLimitValue(user);
                var minimumCryptocurrencyWithdraw = WithdrawalMinimum * GetValue();

                var list = new List <Money>
                {
                    minimumCryptocurrencyWithdraw,
                    withdrawLimitInMembership
                };

                return(list.Max());
            }
            else //Wallet
            {
                return(new CryptocurrencyMoney(Type, WithdrawalMinimum));
            }
        }
Exemplo n.º 3
0
    protected void SetProcessorValues()
    {
        Account.Enabled             = true;
        ChangeAccountButton.Visible = false;
        AddNewAccount.Visible       = false;
        var   userAccountAddress = "";
        Money GlobalLimit        = PayoutLimit.GetGlobalLimitValue(User);
        var   errorNote          = "";

        try
        {
            //Custom Processor
            var CustomProcessor = new CustomPayoutProcessor(int.Parse(RadioFrom.SelectedValue));
            userAccountAddress = User.GetPaymentAddress(CustomProcessor.Id);
            Account.Text       = userAccountAddress;

            //Limits
            string limit     = (CustomProcessor.OverrideGlobalLimit ? CustomProcessor.CashoutLimit : GlobalLimit).ToShortString();
            Money  maxPayout = PayoutManager.GetMaxPossiblePayout(PaymentProcessor.CustomPayoutProcessor, User, out errorNote);

            if (maxPayout > User.MainBalance)
            {
                maxPayout = User.MainBalance;
            }

            MinLimitLabel.Text = limit;
            MaxLimitLabel.Text = maxPayout.ToShortString();
            InfoLabel.Text     = CustomProcessor.Description;
            FeesLabel.Text     = CustomProcessor.FeesToString();
        }
        catch (Exception)
        {
            //Automatic processor
            var selectedProcessor = RadioFrom.SelectedValue;

            if (!String.IsNullOrEmpty(selectedProcessor))
            {
                PaymentProcessor targetprocessor = PaymentAccountDetails.GetFromStringType(selectedProcessor);
                userAccountAddress = User.GetPaymentAddress(targetprocessor);
                var gateway = PaymentAccountDetails.GetFirstGateway(selectedProcessor);

                //Limits
                string limit     = (gateway.OverrideGlobalLimit ? gateway.CashoutLimit : GlobalLimit).ToShortString();
                Money  maxPayout = PayoutManager.GetMaxPossiblePayout(PaymentAccountDetails.GetFromStringType(gateway.AccountType), User, out errorNote);

                if (maxPayout > User.MainBalance)
                {
                    maxPayout = User.MainBalance;
                }

                MinLimitLabel.Text = limit;
                MaxLimitLabel.Text = maxPayout.ToShortString();
                FeesLabel.Text     = NumberUtils.FormatPercents(gateway.WithdrawalFeePercent.ToString());
            }
        }

        if (!string.IsNullOrWhiteSpace(userAccountAddress))
        {
            Account.Visible             = true;
            Account.Enabled             = false;
            Account.Text                = userAccountAddress;
            ChangeAccountButton.Text    = U6007.CHANGE;
            ChangeAccountButton.Visible = true;
        }
        else
        {
            Account.Visible       = false;
            AddNewAccount.Text    = L1.ADDNEW;
            AddNewAccount.Visible = true;
        }
    }