public ActionResult ActivateMemberShip(CustomerPlanModel customerPlanModel) { TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = 1; //Move to setting transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = 0; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = 0; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transactionModel.StatusId = (int)Status.Pending; transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.TranscationNote = "Membership"; _transactionService.InsertTransaction(transcation); PaymentMethod paymentmethod = (PaymentMethod)customerPlanModel.ProcessorId; ViewBag.SaveSuccess = true; customerPlanModel.Id = 0; customerPlanModel.PlanName = "Membership"; customerPlanModel.ProcessorName = paymentmethod.ToString(); customerPlanModel.PaymentMethod = paymentmethod; customerPlanModel.TransactionId = transcation.Id; customerPlanModel.AmountInvested = (decimal)transactionModel.Amount; return(RedirectToAction("ConfirmPayment", "Investment", customerPlanModel)); }
public ActionResult CheckOut(CustomerPlanModel customerPlanModel) { if (customerPlanModel.PaymentMethod == PaymentMethod.CoinPayment) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.SolidTrustPay) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.Payza) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.PM) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.Payeer) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } return(View()); }
public ActionResult Index(CustomerPlanModel model) { if (model.AmountInvested <= 0) { NotifyInfo("Enter correct amount"); return(RedirectToAction("Index", "AddFund")); } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = Convert.ToInt64(model.AmountInvested); transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = 0; transactionModel.TransactionDate = DateTime.Now; transactionModel.ProcessorId = model.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Funding; var transcation = transactionModel.ToEntity(); transcation.StatusId = (int)Status.Pending; transcation.TranscationTypeId = (int)TransactionType.Funding; _transactionService.InsertTransaction(transcation); int value = model.ProcessorId; PaymentMethod paymentmethod = (PaymentMethod)value; model.Id = 0; model.ProcessorName = paymentmethod.ToString(); model.PaymentMethod = paymentmethod; model.TransactionId = transcation.Id; model.AmountInvested = (decimal)transactionModel.Amount; return(RedirectToAction("ConfirmPayment", "Investment", model)); }
// GET: Investment public ActionResult BuyPosition() { var Status = _workContext.CurrentCustomer.Transaction.Where(x => x.StatusId == 2 && x.TranscationNote == "Membership").Sum(x => x.Amount) > 0 ? "Active" : "Inactive"; var AllowPurchase = System.Configuration.ConfigurationManager.AppSettings["AllowPurchase"].ToSafe(); if (AllowPurchase == "false") { NotifyInfo("Purchase is disabled now"); return(RedirectToAction("Index", "Home")); } CustomerPlanModel model = new CustomerPlanModel(); ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; model.NoOfPosition = 1; model.AvailableProcessor.Add(new SelectListItem() { Text = "Available Balance", Value = "5" }); var boards = _boardService.GetAllBoards().OrderBy(x => x.Price); foreach (var plan in boards) { model.AvailablePlans.Add(new SelectListItem() { Text = plan.Name + " ($" + plan.Price + ")", Value = plan.Id.ToString() }); } model.AvailableBalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); return(View("Deposit", model)); }
public ActionResult ActivateMemberShip() { CustomerPlanModel model = new CustomerPlanModel(); var storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext); var coinpaymentSettings = _services.Settings.LoadSetting <CoinPaymentSettings>(storeScope); var SolitTrustPaySettings = _services.Settings.LoadSetting <SolidTrustPaySettings>(storeScope); var PayzaSettings = _services.Settings.LoadSetting <PayzaSettings>(storeScope); var PMSettings = _services.Settings.LoadSetting <PMSettings>(storeScope); var PayeerSettings = _services.Settings.LoadSetting <PayeerSettings>(storeScope); if (coinpaymentSettings.CP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Bitcoin", Value = "0" }); } if (PayzaSettings.PZ_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payza", Value = "1" }); } if (PMSettings.PM_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "PM", Value = "2" }); } if (PayeerSettings.PY_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payeer", Value = "3" }); } if (SolitTrustPaySettings.STP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "SolidTrustPay", Value = "4" }); } return(View(model)); }
// GET: Investment public ActionResult Purchase() { CustomerPlanModel model = new CustomerPlanModel(); ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; model.NoOfPosition = 1; PrepareCustomerPlanModel(model); return(View(model)); }
public ActionResult Purchase(CustomerPlanModel customerPlanModel) { try { if (ModelState.IsValid) { var plan = _planService.GetPlanById(customerPlanModel.PlanId); if (customerPlanModel.PlanId > 0) { TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = Convert.ToInt64(plan.MinimumInvestment) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.StatusId = (int)Status.Pending; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.SharePurchase; var transcation = transactionModel.ToEntity(); transcation.TranscationTypeId = (int)TransactionType.SharePurchase; transcation.NoOfPosition = customerPlanModel.NoOfPosition; _transactionService.InsertTransaction(transcation); int value = customerPlanModel.ProcessorId; PaymentMethod paymentmethod = (PaymentMethod)value; ViewBag.SaveSuccess = true; customerPlanModel.Id = plan.Id; customerPlanModel.PlanName = plan.Name; customerPlanModel.ProcessorName = paymentmethod.ToString(); customerPlanModel.PaymentMethod = paymentmethod; customerPlanModel.TransactionId = transcation.Id; customerPlanModel.AmountInvested = (decimal)transactionModel.Amount; return(RedirectToAction("ConfirmPayment", customerPlanModel)); } else { NotifyError("Please select Package"); } } } catch (Exception ex) { ViewBag.SaveSuccess = false; NotifyError(T("Invesment.Deposit.FundingError")); } PrepareCustomerPlanModel(customerPlanModel); return(View(customerPlanModel)); }
// GET: Investment public ActionResult Deposit() { var Status = _workContext.CurrentCustomer.Transaction.Where(x => x.StatusId == 2 && x.TranscationNote == "Membership").Sum(x => x.Amount) > 0 ? "Active" : "Inactive"; var AllowPurchase = System.Configuration.ConfigurationManager.AppSettings["AllowPurchase"].ToSafe(); if (AllowPurchase == "false") { NotifyInfo("Purchase is disabled now"); return(RedirectToAction("Index", "Home")); } CustomerPlanModel model = new CustomerPlanModel(); ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; model.NoOfPosition = 1; PrepareCustomerPlanModel(model); model.AvailableBalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); return(View(model)); }
private CoinPaymentModel PrepareCoinPaymentModel(CustomerPlanModel customerPlanModel) { var storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext); var coinpaymentSettings = _services.Settings.LoadSetting <CoinPaymentSettings>(storeScope); CoinPaymentModel coinPaymentModel = new CoinPaymentModel(); coinPaymentModel.MerchantAcc = coinpaymentSettings.CP_MerchantId; coinPaymentModel.Amount = customerPlanModel.AmountInvested; coinPaymentModel.FinalAmount = customerPlanModel.AmountInvested + ((customerPlanModel.AmountInvested * coinpaymentSettings.DepositFees) / 100); coinPaymentModel.CustomerPlanId = customerPlanModel.Id; coinPaymentModel.PlanName = customerPlanModel.PlanName; coinPaymentModel.ProcessorName = customerPlanModel.ProcessorName; coinPaymentModel.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; coinPaymentModel.PaymentMemo = T("Hyip.PaymentMemo"); coinPaymentModel.DepositFees = coinpaymentSettings.DepositFees; coinPaymentModel.TransactionId = customerPlanModel.TransactionId; return(coinPaymentModel); }
public ActionResult SubscriptionActive(ActiveSubscriptionModel model) { if (model.NoOfMonths > 0) { var amountreq = 1 * model.NoOfMonths; TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = amountreq; transactionModel.NoOfPosition = model.NoOfMonths; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = 0; transactionModel.ProcessorId = model.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; transactionModel.TranscationNote = "subscription"; var transcation = transactionModel.ToEntity(); transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Pending; _transactionService.InsertTransaction(transcation); int value = model.ProcessorId; PaymentMethod paymentmethod = (PaymentMethod)value; CustomerPlanModel custmodel = new CustomerPlanModel(); custmodel.Id = 0; custmodel.ProcessorName = paymentmethod.ToString(); custmodel.PaymentMethod = paymentmethod; custmodel.TransactionId = transcation.Id; custmodel.AmountInvested = (decimal)transactionModel.Amount; return(RedirectToAction("ConfirmPayment", "Investment", custmodel)); } else { NotifyError("Enter Valid Months"); return(View(model)); } }
public void PrepareCustomerPlanModel(CustomerPlanModel model) { var plans = _planService.GetAllPlans(); foreach (var plan in plans) { model.AvailablePlans.Add(new SelectListItem() { Text = plan.Name, Value = plan.Id.ToString() }); } var storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext); var coinpaymentSettings = _services.Settings.LoadSetting <CoinPaymentSettings>(storeScope); var SolitTrustPaySettings = _services.Settings.LoadSetting <SolidTrustPaySettings>(storeScope); var PayzaSettings = _services.Settings.LoadSetting <PayzaSettings>(storeScope); var PMSettings = _services.Settings.LoadSetting <PMSettings>(storeScope); var PayeerSettings = _services.Settings.LoadSetting <PayeerSettings>(storeScope); if (coinpaymentSettings.CP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Bitcoin", Value = "0" }); } if (PayzaSettings.PZ_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payza", Value = "1" }); } if (PMSettings.PM_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "PM", Value = "2" }); } if (PayeerSettings.PY_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payeer", Value = "3" }); } if (SolitTrustPaySettings.STP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "SolidTrustPay", Value = "4" }); } }
public ActionResult BuyPosition(CustomerPlanModel customerPlanModel) { try { if (ModelState.IsValid) { if (customerPlanModel.PlanId > 0) { var plan = _boardService.GetBoardById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); var amountreq = Convert.ToInt64(plan.Price) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); if (customerPlanModel.ProcessorId == 5) { if (repurchasebalance < amountreq) { NotifyError("You do not have enough balance"); return(RedirectToAction("BuyPosition")); } } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; if (customerPlanModel.ProcessorId == 5) { transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Completed; } else { transcation.StatusId = (int)Status.Pending; transcation.TranscationTypeId = (int)TransactionType.Purchase; } _transactionService.InsertTransaction(transcation); for (int i = 0; i < transcation.NoOfPosition; i++) { PurchasePosition(_workContext.CurrentCustomer, plan.Id); } NotifySuccess("Your purchase was successfull"); return(RedirectToAction("BuyPosition")); } else { NotifyError("Please select Board"); } } } catch (Exception ex) { ViewBag.SaveSuccess = false; NotifyError(T("Invesment.Deposit.FundingError")); } return(RedirectToAction("BuyPosition")); }
public ActionResult Deposit(CustomerPlanModel customerPlanModel) { try { if (ModelState.IsValid) { ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; PrepareCustomerPlanModel(customerPlanModel); customerPlanModel.AvailableBalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); if (!CheckIfPositionExists(customerPlanModel.PlanId)) { NotifyError("You require same level board position to buy this Ad Pack"); return(View(customerPlanModel)); } if (customerPlanModel.PlanId != 30) { var noOfPack = _workContext.CurrentCustomer.Transaction.Where(x => x.RefId == customerPlanModel.PlanId - 1 && x.TranscationTypeId == 2 && x.StatusId == 2).Sum(x => x.NoOfPosition); if (noOfPack < 10) { NotifyError("You require minimum 10 previous Ad Pack"); return(View(customerPlanModel)); } } if (customerPlanModel.PlanId > 0) { var plan = _planService.GetPlanById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); var amountreq = Convert.ToInt64(plan.MinimumInvestment) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); if (customerPlanModel.ProcessorId == 5) { if (repurchasebalance < amountreq) { NotifyError("You do not have enough balance"); ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; PrepareCustomerPlanModel(customerPlanModel); customerPlanModel.AvailableBalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); return(RedirectToAction("Deposit")); } } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = _workContext.CurrentCustomer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; if (customerPlanModel.ProcessorId == 5) { transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Completed; } else { transcation.StatusId = (int)Status.Pending; transcation.TranscationTypeId = (int)TransactionType.Purchase; } _transactionService.InsertTransaction(transcation); for (int i = 0; i < transcation.NoOfPosition; i++) { var customerplan = new CustomerPlan(); customerplan.CustomerId = transcation.CustomerId; customerplan.PurchaseDate = DateTime.Now; customerplan.CreatedOnUtc = DateTime.Now; customerplan.UpdatedOnUtc = DateTime.Now; customerplan.PlanId = plan.Id; customerplan.AmountInvested = plan.MinimumInvestment; customerplan.ROIToPay = plan.MaximumInvestment; customerplan.NoOfPayout = 0; customerplan.ExpiredDate = DateTime.Today; customerplan.IsActive = true; if (plan.StartROIAfterHours > 0) { customerplan.LastPaidDate = DateTime.Today.AddHours(plan.StartROIAfterHours); } else { customerplan.LastPaidDate = DateTime.Today; } _customerPlanService.InsertCustomerPlan(customerplan); } if (customerPlanModel.ProcessorId == 5) { NotifySuccess("Your purchase was successfull"); ReleaseLevelCommission(plan.Id, _workContext.CurrentCustomer.Id, transactionModel.Amount); } else { int value = customerPlanModel.ProcessorId; PaymentMethod paymentmethod = (PaymentMethod)value; ViewBag.SaveSuccess = true; customerPlanModel.Id = plan.Id; customerPlanModel.PlanName = plan.Name; customerPlanModel.ProcessorName = paymentmethod.ToString(); customerPlanModel.PaymentMethod = paymentmethod; customerPlanModel.TransactionId = transcation.Id; customerPlanModel.AmountInvested = (decimal)transactionModel.Amount; return(RedirectToAction("ConfirmPayment", customerPlanModel)); } } else { NotifyError("Please select Package"); } } } catch (Exception ex) { ViewBag.SaveSuccess = false; NotifyError(T("Invesment.Deposit.FundingError")); } ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; customerPlanModel.AvailableBalance = _customerService.GetAvailableBalance(_workContext.CurrentCustomer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); PrepareCustomerPlanModel(customerPlanModel); return(View(customerPlanModel)); }
public ActionResult CheckOut(CustomerPlanModel customerPlanModel) { var storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext); if (customerPlanModel.PaymentMethod == PaymentMethod.CoinPayment) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); ViewBag.StoreUrl = _commonServices.StoreContext.CurrentStore.Url; return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.SolidTrustPay) { var STPSettings = _services.Settings.LoadSetting <SolidTrustPaySettings>(storeScope); ViewBag.AccountNo = STPSettings.STP_Sci_Name; ViewBag.MerchantName = STPSettings.STP_MerchantAccount; ViewBag.TransactionId = customerPlanModel.TransactionId; ViewBag.IPNUrl = STPSettings.STP_NotifyUrl; ViewBag.ReturnUrl = STPSettings.STP_CancelUrl; ViewBag.Amount = String.Format("{0:0.00}", customerPlanModel.AmountInvested); ViewBag.CustomerId = customerPlanModel.CustomerId; ViewBag.FinalAmount = customerPlanModel.AmountInvested + ((customerPlanModel.AmountInvested * STPSettings.DepositFees) / 100); ViewBag.CustomerPlanId = customerPlanModel.Id; ViewBag.PlanName = customerPlanModel.PlanName; ViewBag.ProcessorName = customerPlanModel.ProcessorName; ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; ViewBag.PaymentMemo = T("Hyip.PaymentMemo"); return(View("_STPPayment")); } if (customerPlanModel.PaymentMethod == PaymentMethod.Payza) { var coinpaymentmodel = PrepareCoinPaymentModel(customerPlanModel); return(View("_CoinPayment", coinpaymentmodel)); } if (customerPlanModel.PaymentMethod == PaymentMethod.PM) { var PMSettings = _services.Settings.LoadSetting <PMSettings>(storeScope); ViewBag.AccountNo = PMSettings.PM_PayeeAccount; ViewBag.TransactionId = customerPlanModel.TransactionId; ViewBag.IPNUrl = PMSettings.PM_NotifyUrl; ViewBag.ReturnUrl = PMSettings.PM_ReturnUrl; ViewBag.Amount = String.Format("{0:0.00}", customerPlanModel.AmountInvested); ViewBag.CustomerId = customerPlanModel.CustomerId; ViewBag.FinalAmount = customerPlanModel.AmountInvested + ((customerPlanModel.AmountInvested * PMSettings.DepositFees) / 100); ViewBag.CustomerPlanId = customerPlanModel.Id; ViewBag.PlanName = customerPlanModel.PlanName; ViewBag.ProcessorName = customerPlanModel.ProcessorName; ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; ViewBag.StoreName = "MyTrafficHub"; ViewBag.PaymentMemo = T("Hyip.PaymentMemo"); return(View("_PMPayment")); } if (customerPlanModel.PaymentMethod == PaymentMethod.Payeer) { var payeerpaymentSettings = _services.Settings.LoadSetting <PayeerSettings>(storeScope); string hashkey = payeerpaymentSettings.PY_MerchantShop + ":" + customerPlanModel.TransactionId + ":" + String.Format("{0:0.00}", customerPlanModel.AmountInvested) + ":USD:membership:" + customerPlanModel.CustomerId.ToString() + ":" + payeerpaymentSettings.PY_SecretKey; hashkey = GetSha256FromString(hashkey).ToUpper(); ViewBag.AccountNo = payeerpaymentSettings.PY_MerchantShop; ViewBag.TransactionId = customerPlanModel.TransactionId; ViewBag.Amount = String.Format("{0:0.00}", customerPlanModel.AmountInvested); ViewBag.CustomerId = customerPlanModel.CustomerId; ViewBag.FinalAmount = customerPlanModel.AmountInvested + ((customerPlanModel.AmountInvested * payeerpaymentSettings.DepositFees) / 100); ViewBag.CustomerPlanId = customerPlanModel.Id; ViewBag.PlanName = customerPlanModel.PlanName; ViewBag.ProcessorName = customerPlanModel.ProcessorName; ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; ViewBag.PaymentMemo = T("Hyip.PaymentMemo"); ViewBag.Hash = hashkey; return(View("_PayeerPayment")); } return(View()); }
public ActionResult ConfirmPayment(CustomerPlanModel customerPlanModel) { return(View(customerPlanModel)); }
public HttpResponseMessage BuyShare(CustomerPlanModel customerPlanModel) { string message = ""; try { var customerguid = Request.Headers.GetValues("CustomerGUID").FirstOrDefault(); if (customerguid != null) { var cust = _customerService.GetCustomerByGuid(Guid.Parse(customerguid)); if (customerPlanModel.CustomerId != cust.Id) { return(Request.CreateResponse(HttpStatusCode.Unauthorized, new { code = 0, Message = "something went wrong" })); } } var Customer = _customerService.GetCustomerById(customerPlanModel.CustomerId); if (ModelState.IsValid) { PrepareCustomerPlanModel(customerPlanModel); customerPlanModel.AvailableBalance = _customerService.GetAvailableBalance(Customer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); if (customerPlanModel.PlanId > 0) { var plan = _planService.GetPlanById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableBalance(Customer.Id); var amountreq = Convert.ToInt64(plan.MinimumInvestment) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); if (repurchasebalance < amountreq) { message = "You do not have enough balance, Please add funds"; return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = message })); } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = Customer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Completed; _transactionService.InsertTransaction(transcation); for (int i = 0; i < transcation.NoOfPosition; i++) { var customerplan = new CustomerPlan(); customerplan.CustomerId = transcation.CustomerId; customerplan.PurchaseDate = DateTime.Now; customerplan.CreatedOnUtc = DateTime.Now; customerplan.UpdatedOnUtc = DateTime.Now; customerplan.PlanId = plan.Id; customerplan.AmountInvested = plan.MinimumInvestment; customerplan.ROIToPay = plan.MaximumInvestment; customerplan.NoOfPayout = plan.NoOfPayouts; customerplan.ExpiredDate = DateTime.Today; customerplan.IsActive = true; if (plan.StartROIAfterHours > 0) { customerplan.LastPaidDate = DateTime.Today.AddHours(plan.StartROIAfterHours); } else { customerplan.LastPaidDate = DateTime.Today; } _customerPlanService.InsertCustomerPlan(customerplan); } message = "Your purchase was successfull"; ReleaseLevelCommission(plan.Id, Customer, transactionModel.Amount); return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success" })); } else { message = "Please select Package"; } } } catch (Exception ex) { message = T("Invesment.Deposit.FundingError").Text; } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = message })); }
public HttpResponseMessage BuyPosition(CustomerPlanModel customerPlanModel) { try { var Customer = _customerService.GetCustomerById(customerPlanModel.CustomerId); if (ModelState.IsValid) { if (customerPlanModel.PlanId > 0) { var plan = _boardService.GetBoardById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableBalance(Customer.Id); var amountreq = Convert.ToInt64(plan.Price) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); if (repurchasebalance < amountreq) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "You do not have enough balance" })); } if (customerPlanModel.NoOfPosition <= 0) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Enter correct amount" })); } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = Customer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; if (customerPlanModel.ProcessorId == 5) { transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Completed; } else { transcation.StatusId = (int)Status.Pending; transcation.TranscationTypeId = (int)TransactionType.Purchase; } _transactionService.InsertTransaction(transcation); for (int i = 0; i < customerPlanModel.NoOfPosition; i++) { ReleaseLevelCommission(plan.Id, Customer); } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success" })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Please select Board" })); } } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = T("Invesment.Deposit.FundingError") })); } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "something went wrong" })); }
public void PrepareCustomerPlanModel(CustomerPlanModel model) { var plans = _planService.GetAllPlans().OrderBy(x => x.Name); foreach (var plan in plans) { model.AvailablePlans.Add(new SelectListItem() { Text = plan.Name + "(" + plan.PlanDetails + ")", Value = plan.Id.ToString() }); } var storeScope = _storeContext.CurrentStore.Id; var coinpaymentSettings = _services.Settings.LoadSetting <CoinPaymentSettings>(storeScope); var SolitTrustPaySettings = _services.Settings.LoadSetting <SolidTrustPaySettings>(storeScope); var PayzaSettings = _services.Settings.LoadSetting <PayzaSettings>(storeScope); var PMSettings = _services.Settings.LoadSetting <PMSettings>(storeScope); var PayeerSettings = _services.Settings.LoadSetting <PayeerSettings>(storeScope); //if (coinpaymentSettings.CP_IsActivePaymentMethod) //{ // model.AvailableProcessor.Add(new SelectListItem() // { // Text = "Bitcoin", // Value = "0" // }); //} //if (PayzaSettings.PZ_IsActivePaymentMethod) //{ // model.AvailableProcessor.Add(new SelectListItem() // { // Text = "Payza", // Value = "1" // }); //} //if (PMSettings.PM_IsActivePaymentMethod) //{ // model.AvailableProcessor.Add(new SelectListItem() // { // Text = "PM", // Value = "2" // }); //} //if (PayeerSettings.PY_IsActivePaymentMethod) //{ // model.AvailableProcessor.Add(new SelectListItem() // { // Text = "Payeer", // Value = "3" // }); //} //if (SolitTrustPaySettings.STP_IsActivePaymentMethod) //{ // model.AvailableProcessor.Add(new SelectListItem() // { // Text = "SolidTrustPay", // Value = "4" // }); //} model.AvailableProcessor.Add(new SelectListItem() { Text = "Available Balance", Value = "5" }); }
public static CustomerPlan ToEntity(this CustomerPlanModel model) { return(Mapper.Map <CustomerPlanModel, CustomerPlan>(model)); }
public HttpResponseMessage BuyPosition(CustomerPlanModel customerPlanModel) { try { var customerguid = Request.Headers.GetValues("CustomerGUID").FirstOrDefault(); if (customerguid != null) { var cust = _customerService.GetCustomerByGuid(Guid.Parse(customerguid)); if (customerPlanModel.CustomerId != cust.Id) { return(Request.CreateResponse(HttpStatusCode.Unauthorized, new { code = 0, Message = "something went wrong" })); } } var Customer = _customerService.GetCustomerById(customerPlanModel.CustomerId); var noOfPosition = Customer.CustomerPosition.Where(x => x.BoardId == customerPlanModel.PlanId).Count(); var openpurchase = System.Configuration.ConfigurationManager.AppSettings["openpurchase"]; if (customerPlanModel.PlanId > 1) { if (openpurchase == "false") { var Upline = _customerService.GetCustomerById(Customer.AffiliateId); if (Upline.CustomerPosition.Count == 0) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Please wait for your upline to upgrade" })); } } } if (ModelState.IsValid) { if (customerPlanModel.PlanId > 0) { var plan = _boardService.GetBoardById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableBalance(Customer.Id); var amountreq = Convert.ToInt64(plan.Price) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); if (noOfPosition > 0) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "You already have active position for this Phase" })); } if (repurchasebalance < amountreq) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "You do not have enough balance" })); } if (customerPlanModel.NoOfPosition <= 0) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Enter correct amount" })); } TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = amountreq; transactionModel.CustomerId = Customer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.Purchase; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; transcation.TranscationTypeId = (int)TransactionType.Purchase; transcation.StatusId = (int)Status.Completed; _transactionService.InsertTransaction(transcation); for (int i = 0; i < customerPlanModel.NoOfPosition; i++) { ReleaseLevelCommission(plan.Id, Customer); } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success" })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "Please select Phase" })); } } } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = T("Invesment.Deposit.FundingError").Text })); } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "something went wrong" })); }
// GET: AddFund public ActionResult Index() { CustomerPlanModel model = new CustomerPlanModel(); var plans = _planService.GetAllPackage(); var storeScope = this.GetActiveStoreScopeConfiguration(_services.StoreService, _services.WorkContext); var coinpaymentSettings = _services.Settings.LoadSetting <CoinPaymentSettings>(storeScope); var SolitTrustPaySettings = _services.Settings.LoadSetting <SolidTrustPaySettings>(storeScope); var PayzaSettings = _services.Settings.LoadSetting <PayzaSettings>(storeScope); var PMSettings = _services.Settings.LoadSetting <PMSettings>(storeScope); var PayeerSettings = _services.Settings.LoadSetting <PayeerSettings>(storeScope); if (coinpaymentSettings.CP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Bitcoin", Value = "0" }); } if (PayzaSettings.PZ_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payza", Value = "1" }); } if (PMSettings.PM_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "PM", Value = "2" }); } if (PayeerSettings.PY_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "Payeer", Value = "3" }); } if (SolitTrustPaySettings.STP_IsActivePaymentMethod) { model.AvailableProcessor.Add(new SelectListItem() { Text = "SolidTrustPay", Value = "4" }); } //model.AvailableProcessor.Add(new SelectListItem() //{ // Text = "Bank Transfer(Only For Indian)", // Value = "5" //}); var Status = _workContext.CurrentCustomer.Transaction.Where(x => x.StatusId == 2 && x.TranscationNote == "Membership").Sum(x => x.Amount) > 0 ? "Active" : "Inactive"; var AllowPurchase = System.Configuration.ConfigurationManager.AppSettings["AllowPurchase"].ToSafe(); if (AllowPurchase == "false") { NotifyInfo("Purchase is disabled now"); return(RedirectToAction("Index", "AddFund")); } ViewBag.CurrencyCode = _workContext.WorkingCurrency.CurrencyCode; return(View(model)); }
public HttpResponseMessage BuyShareWithCoin(CustomerPlanModel customerPlanModel) { string message = ""; try { var customerguid = Request.Headers.GetValues("CustomerGUID").FirstOrDefault(); if (customerguid != null) { var cust = _customerService.GetCustomerByGuid(Guid.Parse(customerguid)); if (customerPlanModel.CustomerId != cust.Id) { return(Request.CreateResponse(HttpStatusCode.Unauthorized, new { code = 0, Message = "something went wrong" })); } } var Customer = _customerService.GetCustomerById(customerPlanModel.CustomerId); if (ModelState.IsValid) { PrepareCustomerPlanModel(customerPlanModel); customerPlanModel.AvailableBalance = _customerService.GetAvailableCoin(Customer.Id); // _customerService.GetRepurchaseBalance(_workContext.CurrentCustomer.Id); if (customerPlanModel.PlanId > 0) { var plan = _planService.GetPlanById(customerPlanModel.PlanId); var repurchasebalance = _customerService.GetAvailableCoin(Customer.Id); var amountreq = Convert.ToInt64(plan.MinimumInvestment); //Convert.ToInt64(plan.MinimumInvestment) * ((customerPlanModel.NoOfPosition == 0) ? 1 : customerPlanModel.NoOfPosition); var Count = _customerService.GetPlanCount(Customer.Id); if (Count < 2) { var PlanId = _customerService.GetCurrentPlan(Customer.Id); var List = _customerService.GetCurrentPlanList(Customer.Id); var Previousplan = _planService.GetPlanById(PlanId); if (PlanId != 0) { var Date = DateTime.Now; if (List.PurchaseDate.Date == Date.Date) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 1, Message = "You can not Upgrade Plan Within 24 Hrs" })); } else if (Previousplan.MinimumInvestment == plan.MinimumInvestment) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 1, Message = "You Have Already Purchased this Plan" })); } else if (Previousplan.MinimumInvestment > plan.MinimumInvestment) { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 1, Message = "You Have Already Purchased Higer Plan" })); } else if (Previousplan.MinimumInvestment < plan.MinimumInvestment) { amountreq = Convert.ToInt64(plan.MinimumInvestment) - Convert.ToInt64(Previousplan.MinimumInvestment); } } if (repurchasebalance < amountreq) { message = "You do not have enough coin, Please add coins"; return(Request.CreateResponse(HttpStatusCode.OK, new { code = 1, Message = message })); } _customerPlanService.DiseableOldCustomerPlan(Customer.Id); TransactionModel transactionModel = new TransactionModel(); transactionModel.Amount = plan.MinimumInvestment; transactionModel.CustomerId = Customer.Id; transactionModel.FinalAmount = transactionModel.Amount; transactionModel.NoOfPosition = customerPlanModel.NoOfPosition; transactionModel.TransactionDate = DateTime.Now; transactionModel.RefId = plan.Id; transactionModel.ProcessorId = customerPlanModel.ProcessorId; transactionModel.TranscationTypeId = (int)TransactionType.PurchaseByCoin; var transcation = transactionModel.ToEntity(); transcation.NoOfPosition = customerPlanModel.NoOfPosition; transcation.TranscationTypeId = (int)TransactionType.PurchaseByCoin; transcation.StatusId = (int)Status.Completed; _transactionService.InsertTransaction(transcation); var customerplan = new CustomerPlan(); customerplan.CustomerId = transcation.CustomerId; customerplan.PurchaseDate = DateTime.Now; customerplan.CreatedOnUtc = DateTime.Now; customerplan.UpdatedOnUtc = DateTime.Now; customerplan.PlanId = plan.Id; customerplan.AmountInvested = plan.MinimumInvestment; //plan.ROIPercentage; customerplan.ROIToPay = 0; customerplan.NoOfPayout = 0; customerplan.ExpiredDate = DateTime.Today; customerplan.IsActive = true; if (plan.StartROIAfterHours > 0) { customerplan.LastPaidDate = DateTime.Today.AddHours(plan.StartROIAfterHours); } else { customerplan.LastPaidDate = DateTime.Today; } _customerPlanService.InsertCustomerPlan(customerplan); _customerService.SpPayNetworkIncome(customerplan.CustomerId, customerplan.PlanId); message = "Your purchase was successfull"; ReleaseLevelCommission(plan.Id, Customer, transactionModel.Amount); return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = "success" })); } else { return(Request.CreateResponse(HttpStatusCode.OK, new { code = 1, Message = "You Have Already Reached Maximum Package Limit" })); } } else { message = "Please select Package"; } } } catch (Exception ex) { message = T("Invesment.Deposit.FundingError").Text; } return(Request.CreateResponse(HttpStatusCode.OK, new { code = 0, Message = message })); }