Ejemplo n.º 1
0
        public static GridRow BindGridData(Business_Subscription source)
        {
            var row = new GridRow {
                IdentityValue = source.Id
            };

            row.AddCell(source.StartDate.ToString("dd/MM/yyyy"));
            row.AddCell(source.EndDate.ToString("dd/MM/yyyy"));
            row.AddCell(source.Currency + "" + source.PaidAmount.ToString("#,##0.00"));
            row.AddCell(source.PaymentReceived ? "Paid" : "Pendinng");
            row.AddCell(source.PaymentReceipt);
            row.AddCell(Convert.ToDateTime(source.PaymentReceivedDate).ToString("dd/MM/yyyy"));
            row.AddCell(source.PaymentVia);
            return(row);
        }
Ejemplo n.º 2
0
        public IActionResult ExecutePayment(string paymentId, string token, string PayerID)
        {
            Payment payment = _PaypalServices.ExecutePayment(paymentId, PayerID);

            if (payment.state == "approved")
            {
                int PackagePlanId = Convert.ToInt32(payment.transactions[0].custom);
                var plan          = packagePlanService.GetPackagePlanById(PackagePlanId);

                DateTime StartDate = DateTime.Now;
                DateTime EndDate   = DateTime.Now;
                if (plan.Duration == "Monthly")
                {
                    EndDate = DateTime.Now.AddMonths(1);
                }
                else if (plan.Duration == "Annual")
                {
                    EndDate = DateTime.Now.AddYears(1);
                }

                Business_Subscription model = new Business_Subscription
                {
                    IdentityUserId      = CurrentUserName,
                    PackagePlanId       = PackagePlanId,
                    StartDate           = StartDate,
                    EndDate             = EndDate,
                    PaidAmount          = Convert.ToDecimal(payment.transactions[0].amount.total),
                    Currency            = payment.transactions[0].amount.currency,
                    PaymentReceived     = true,
                    PaymentVia          = payment.payer.payment_method,
                    PaymentReceipt      = payment.id,
                    PaymentReceivedDate = Convert.ToDateTime(payment.create_time),
                    PaymentNotes        = payment.cart + " - " + payment.transactions[0].related_resources[0].sale.payment_mode
                };

                var response = subscriptionService.MapViewModelToBusiness_Subscription(model, CurrentUserName, true);
            }
            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> SignUp(BusinessViewModel model)
        {
            int paymentID = 0;

            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.ContactEmail, Email = model.ContactEmail
                };
                IdentityResult result = null;
                if (string.IsNullOrEmpty(model.IdentityUserId) || model.Id.Equals("0"))
                {
                    result = await _userManager.CreateAsync(user, model.Password);

                    if (result.Succeeded)
                    {
                        user = _userManager.FindByEmailAsync(model.ContactEmail).Result;
                        if (user != null)
                        {
                            model.IdentityUserId = user.Email;
                            model.Id             = businessService.MapViewModelToSite(model, user.Email, true);

                            var plan = packagePlanService.GetPackagePlanById(model.PackageID);

                            DateTime StartDate = DateTime.Now;
                            DateTime EndDate   = DateTime.Now;
                            if (plan.Duration == "Monthly")
                            {
                                EndDate = DateTime.Now.AddMonths(1);
                            }
                            else if (plan.Duration == "Annual")
                            {
                                EndDate = DateTime.Now.AddYears(1);
                            }

                            Business_Subscription models = new Business_Subscription
                            {
                                IdentityUserId  = user.Email,
                                PackagePlanId   = model.PackageID,
                                StartDate       = StartDate,
                                EndDate         = EndDate,
                                PaymentReceived = false,
                            };

                            paymentID = subscriptionService.MapViewModelToBusiness_Subscription(models, user.Id, true);
                        }

                        ViewBag.IsSuccess = result.Succeeded;
                        return(RedirectToAction("Payment", "Home", new { id = paymentID }));
                    }
                    else
                    {
                        return(View("SignUp", model));
                    }
                }
                else
                {
                    return(View("SignUp", model));
                }
            }
            else
            {
                return(View("SignUp", model));
            }
        }
Ejemplo n.º 4
0
 public int MapViewModelToBusiness_Subscription(Business_Subscription model, string user, bool performSave)
 {
     model.SetCreateDetails(user);
     repository.SaveNew(model);
     return(model.Id);
 }