Exemplo n.º 1
0
        /// <summary>
        /// Fired when credited
        /// </summary>
        /// <param name="Input"></param>
        /// <param name="As"></param>
        /// <param name="OfferwallName"></param>
        /// <param name="RequiresConversion"></param>
        /// <returns></returns>               //Wall.CreditAs, Wall.DisplayName, Wall.RequiresConversion
        public Money CreditMember(Money Input, Offerwall Wall)
        {
            Money Calculated = Credit(Input, Wall.CreditAs, Wall.DisplayName, Wall.RequiresConversion);

            User.CompletedOffersFromOfferwallsToday += 1;

            if (Calculated.GetRealTotals() >= 100)
            {
                User.CompletedOffersMoreThan100pFromOfferwallsToday += 1;
            }

            if (Wall.DisplayName.Contains("Wannads"))
            {
                User.CompletedDailyOffersFromOfferwallsToday += 1;
            }

            //Slot machine chances
            SlotMachine.SlotMachine.TryAddChances(User);

            User.Save();

            ContestManager.IMadeAnAction(ContestType.Offerwalls, User.Name, null, 1);

            //Offerwalls included in Clicks Contest
            if (Wall.IsIncludedInPTCContest)
            {
                ContestManager.IMadeAnAction(ContestType.Click, User.Name, null, 1);
            }

            return(Calculated);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fired when reversed
        /// </summary>
        /// <param name="Input"></param>
        /// <param name="As"></param>
        /// <param name="OfferwallName"></param>
        /// <param name="RequiresConversion"></param>
        /// <returns></returns>
        public Money ReverseCredit(Money Input, CreditAs creditAs, string OfferwallName, bool RequiresConversion = false)
        {
            Money Calculated = Credit(Input.Negatify(), creditAs, OfferwallName + " - REVERSAL", RequiresConversion);

            User.CompletedOffersFromOfferwallsToday -= 1;

            if (Calculated.GetRealTotals() <= -100)
            {
                User.CompletedOffersMoreThan100pFromOfferwallsToday -= 1;
            }

            if (OfferwallName.Contains("Wannads"))
            {
                User.CompletedDailyOffersFromOfferwallsToday -= 1;
            }

            User.Save();

            ContestManager.IMadeAnAction(ContestType.Offerwalls, User.Name, null, -1);

            //Offerwalls included in Clicks Contest
            Offerwall currentOfferWall = new Offerwall(OfferwallName);

            if (currentOfferWall.IsIncludedInPTCContest)
            {
                ContestManager.IMadeAnAction(ContestType.Click, User.Name, null, -1);
            }

            return(Calculated);
        }
Exemplo n.º 3
0
        private void DepositCryptocurrency(Member user, decimal amountInCryptocurrency)
        {
            Money   moneyAmount = ConvertToMoney(amountInCryptocurrency);
            LogType LogType     = ErrorLoggerHelper.GetTypeFromProcessor(DepositApiProcessor);

            user.Reload();

            if (DepositTarget == DepositTargetBalance.PurchaseBalance)
            {
                user.AddToPurchaseBalance(moneyAmount, Code + " deposit", BalanceLogType.Other);
                user.SaveBalances();
            }
            if (DepositTarget == DepositTargetBalance.CashBalance)
            {
                user.AddToCashBalance(moneyAmount, Code + " deposit", BalanceLogType.Other);
                user.SaveBalances();

                //Referral commission for sponsors when user does Cash Balance deposit
                CashBalanceCrediter Crediter = (CashBalanceCrediter)CrediterFactory.Acquire(user, CreditType.CashBalanceDeposit);
                Crediter.TryCreditReferer(moneyAmount);
            }
            if (DepositTarget == DepositTargetBalance.Wallet)
            {
                user.AddToCryptocurrencyBalance(Type, amountInCryptocurrency, Code + " Wallet deposit", BalanceLogType.WalletDeposit);
            }

            PaymentProportionsManager.MemberPaidIn(moneyAmount, CryptocurrencyTypeHelper.ConvertToPaymentProcessor(Type), user);
            History.AddTransfer(user.Name, moneyAmount, Code + " deposit", DepositTarget.ToString());

            ContestManager.IMadeAnAction(ContestType.Transfer, user.Name, moneyAmount, 0);
        }
Exemplo n.º 4
0
        public Money Credit(Money Calculated, CreditAs As, int offerId, string OfferTitle, int CPACompletedIncreasedBy = 1, bool isReversal = false,
                            string NetworkName = "")
        {
            string balanceLogsNote    = "CPA offer (" + (NetworkName != "" ? NetworkName + ": " : "") + OfferTitle + ") ";
            string balanceLogsNoteRef = "CPA offer " + "/ref/" + User.Name + " (" + (NetworkName != "" ? NetworkName + ": " : "") + OfferTitle + ") ";


            if (As == CreditAs.Points)
            {
                Calculated = CLP.CLPManager.ProceedWithCPA(Calculated.GetRealTotals(), User, isReversal);
                base.CreditPoints(Calculated.GetRealTotals(), balanceLogsNote, BalanceLogType.Other);
                base.CreditReferersPoints(Calculated.GetRealTotals(), balanceLogsNoteRef, BalanceLogType.Other);

                if (isReversal == false)
                {
                    History.AddCPAOfferCompleted(User.Name, OfferTitle, Calculated.GetRealTotals().ToString() + " " + AppSettings.PointsName, NetworkName, offerId);
                }

                Mailer.TryToSendCPACreditedMessage(User, Resources.L1.HISTORY_10 + ": " + OfferTitle + "(" + Calculated.GetRealTotals().ToString() + " " + AppSettings.PointsName + ")");
            }
            if (As == CreditAs.MainBalance)
            {
                Calculated = CLP.CLPManager.ProceedWithCPA(Calculated, User, isReversal);
                base.CreditMainBalance(Calculated, balanceLogsNote, BalanceLogType.Other);
                base.CreditReferersMainBalance(Calculated, balanceLogsNoteRef, BalanceLogType.Other, 1, null, true);

                if (isReversal == false)
                {
                    History.AddCPAOfferCompleted(User.Name, OfferTitle, Calculated.ToString(), NetworkName, offerId);
                }

                Mailer.TryToSendCPACreditedMessage(User, Resources.L1.HISTORY_10 + ": " + OfferTitle + "(" + Calculated.ToString() + ")");
            }

            //Slot machine chances
            SlotMachine.SlotMachine.TryAddChances(User);

            //Achievements trial
            User.TryToAddAchievements(
                Prem.PTC.Achievements.Achievement.GetProperAchievements(
                    Prem.PTC.Achievements.AchievementType.AfterCPAOffersCompleted, User.TotalCPACompleted));

            User.Save();

            if (!isReversal)
            {
                if (CPAOfferContestManager.IsIncludedInContest(offerId))
                {
                    ContestManager.IMadeAnAction(Prem.PTC.Contests.ContestType.Offer, User.Name, null, 1);
                }
            }
            else
            {
                if (CPAOfferContestManager.IsIncludedInContest(offerId))
                {
                    ContestManager.IMadeAnAction(Prem.PTC.Contests.ContestType.Offer, User.Name, null, -1);
                }
            }

            return(Calculated);
        }