Ejemplo n.º 1
0
    private void upgradeMembershipFromBalance(PurchaseBalances balanceType)
    {
        SuccMessagePanel.Visible  = false;
        ErrorMessagePanel.Visible = false;

        try
        {
            AppSettings.DemoCheck();

            MembershipPack pack = new MembershipPack(Int32.Parse(ddlOptions.SelectedValue));
            Member         user = Member.Current;

            Membership.BuyPack(user, pack, balanceType);

            Response.Redirect("~/status.aspx?type=upgradeok");
        }
        catch (MsgException ex)
        {
            ErrorMessagePanel.Visible = true;

            if (!TitanFeatures.IsRofriqueWorkMines)
            {
                ErrorMessage.Text = ex.Message;
            }
            else
            {
                ErrorMessage.Text = "YOU DONT HAVE ENOUGH FUNDS IN YOUR CASH BALANCE. PLEASE CLICK ON DEPOSIT FUNDS TO TOP UP YOUR CASH BALANCE.";
            }
        }
        catch (Exception ex)
        {
            ErrorLogger.Log(ex);
            throw ex;
        }
    }
Ejemplo n.º 2
0
        protected override ApiResultMessage HandleRequest(object args)
        {
            var token            = ((JObject)args)["token"].ToString();
            var membershipPackId = Convert.ToInt32(((JObject)args)["membershipPackId"]);
            var htmlResponse     = false;
            var balance          = (PurchaseBalances)Convert.ToInt32(((JObject)args)["balance"]);

            var userId        = ApiAccessToken.ValidateAndGetUserId(token);
            var pack          = new MembershipPack(membershipPackId);
            var User          = new Member(userId);
            var ResultMessage = U3501.UPGRADEOK;

            if (balance == PurchaseBalances.PaymentProcessor)
            {
                var PackPrice = pack.GetPrice(User);
                var bg        = new UpgradeMembershipButtonGenerator(User, PackPrice, pack);
                ResultMessage = GenerateHTMLButtons.GetPaymentButtons(bg);
                htmlResponse  = true;
            }
            else
            {
                Membership.BuyPack(User, pack, balance);
            }

            return(new ApiResultMessage
            {
                success = true,
                message = ResultMessage,
                messageIsHtml = htmlResponse,
                data = null
            });
        }
Ejemplo n.º 3
0
    protected void upgradeViaPaymentProcessor_Click(object sender, EventArgs e)
    {
        User = Member.Current;

        PaymentProcessorsButtonPlaceholder.Visible = true;
        BuyUpgradePlaceHolder.Visible = false;

        MembershipPack pack      = new MembershipPack(Int32.Parse(ddlOptions.SelectedValue));
        Money          PackPrice = pack.GetPrice(User);

        PriceLiteral.Text = PackPrice.ToString();

        // Buy membership directly via Paypal, etc.
        var bg = new UpgradeMembershipButtonGenerator(User, PackPrice, pack);

        PaymentButtons.Text = GenerateHTMLButtons.GetPaymentButtons(bg);
    }
Ejemplo n.º 4
0
        protected void UpgradeMembership(Member user, Money amount, MembershipPack pack, string from, string transId, string cryptoCurrencyInfo)
        {
            bool successful = false;

            try
            {
                Membership.AddPack(user, pack, amount);
                successful = true;
            }
            catch (Exception ex)
            {
                successful = false;
                ErrorLogger.Log(ex);
            }

            PaymentProcessor PP = PaymentAccountDetails.GetFromStringType(from);

            CompletedPaymentLog.Create(PP, "Upgrade", transId, false, user.Name, amount, Money.Zero, successful, cryptoCurrencyInfo);
        }
Ejemplo n.º 5
0
        /// <exception cref="DbException" />
        public void Upgrade(MembershipPack pack)
        {
            if (this.Membership.Name == pack.Membership.Name)
            {
                //The same bought, lets sum up
                DateTime Expires = (DateTime)this.MembershipExpires;
                setMembership(pack.Membership, AppSettings.ServerTime, Expires.AddDays(pack.TimeDays));
            }
            else
            {
                setMembership(pack.Membership, AppSettings.ServerTime, AppSettings.ServerTime.AddDays(pack.TimeDays));
            }
            ResolveReferralLimits(pack.Membership);

            if (AppSettings.Misc.SpilloverEnabled)
            {
                SpilloverManager spillover = new SpilloverManager(this);
                spillover.ResolveReferrals();
            }
        }
Ejemplo n.º 6
0
 public ApiMembershipPack(Member user, MembershipPack pack)
 {
     this.description = UpgradePageHelper.GetMembershipPackDescription(user, pack);
     this.packId      = pack.Id;
     this.price       = new ApiMoney(pack.GetPrice(user));
 }
Ejemplo n.º 7
0
 public UpgradeMembershipButtonGenerator(Member member, Money amount, MembershipPack membershipPack)
 {
     this.Amount         = amount;
     this.Member         = member;
     this.MembershipPack = membershipPack;
 }
Ejemplo n.º 8
0
 public static string GetMembershipPackDescription(Member User, MembershipPack membershipPack)
 {
     return(membershipPack.Membership.Name + " (" + membershipPack.TimeDays.ToString() + " " + L1.DAYS + ") - " + membershipPack.GetPrice(User).ToString());
 }