Esempio n. 1
0
        public void PopulateGateways()
        {
            //Arrange
            var pgcount       = _irepo.GetTotalGatewayCount();
            var resultpgcount = PaymentGateways.FindAll().Count;

            //Assert
            Assert.AreEqual(pgcount, resultpgcount);
        }
Esempio n. 2
0
 private void PopulateGatewayList()
 {
     lstGateway.Items.Add(new ListItem(Localization.GetString("GatewayEmptyValue"), string.Empty));
     lstGateway.AppendDataBoundItems = true;
     lstGateway.DataSource           = PaymentGateways.FindAll();
     lstGateway.DataValueField       = "Id";
     lstGateway.DataTextField        = "Name";
     lstGateway.DataBind();
 }
Esempio n. 3
0
        public ViewResult Payment(int id)
        {
            string ExternalOrderID = id.ToString();
            var    _OrderDetail    = _repository.Find(od => od.ID == id).EagerLoad(od => od.CertificateRequest, od => od.Order, od => od.Product).FirstOrDefault();

            Site Site = GetSite(_OrderDetail.Order.SiteID);

            SetSiteIDInSession();

            var PGInstance = _service.GetPGInstances(Site.ID);

            ViewBag.SiteID = Site.ID;
            PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault();

            if (PG != null)
            {
                ViewBag.ISCC = true;
            }
            else
            {
                ViewBag.ISCC = false;
            }

            PG = null;
            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault();
            if (PG != null)
            {
                ViewBag.IsPayPal = true;
            }
            else
            {
                ViewBag.IsPayPal = false;
            }
            PG = null;

            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.Moneybookers).FirstOrDefault();
            if (PG != null)
            {
                ViewBag.IsMoneybookers = true;
            }
            else
            {
                ViewBag.IsMoneybookers = false;
            }
            PG = null;

            var            _ProdPricing      = DependencyResolver.Current.GetService <IRepository <ProductPricing> >();
            int            CuttentContractID = WBSSLStore.Web.Helpers.WBHelper.GetCurrentContractID(_OrderDetail.Order.UserID, Site.ID);
            ProductPricing objPricing        = _ProdPricing.Find(pp => pp.ProductID == _OrderDetail.ProductID && pp.NumberOfMonths == _OrderDetail.NumberOfMonths && pp.ContractID == CuttentContractID && pp.RecordStatusID == (int)RecordStatus.ACTIVE).FirstOrDefault();

            ViewBag.Pricing         = objPricing;
            ViewBag.AvailableCredit = _service.GetCreditAmount(_OrderDetail.Order.UserID, Site.ID);
            return(View(_OrderDetail));
        }
Esempio n. 4
0
        private bool ProcessTransaction(OrderTaskContext context, OrderTransaction p)
        {
            bool result = true;

            try
            {
                var         payManager  = new OrderPaymentManager(context.Order, context.HccApp);
                var         orderNumber = !string.IsNullOrEmpty(p.OrderNumber) ? p.OrderNumber : context.Order.OrderNumber;
                Transaction t           = payManager.CreateEmptyTransaction();
                t.Card = p.CreditCard;
                t.Card.SecurityCode = context.Inputs.GetProperty("hcc", "CardSecurityCode");
                t.Amount            = p.Amount;
                t.Items             = GetLineItemsForTransaction(context, orderNumber);

                if (context.HccApp.CurrentStore.Settings.PaymentCreditCardAuthorizeOnly)
                {
                    t.Action = ActionType.CreditCardHold;
                }
                else
                {
                    t.Action = ActionType.CreditCardCharge;
                }

                PaymentGateway proc = PaymentGateways.CurrentPaymentProcessor(context.HccApp.CurrentStore);
                proc.ProcessTransaction(t);

                OrderTransaction ot = new OrderTransaction(t);
                ot.LinkedToTransaction = p.IdAsString;
                context.HccApp.OrderServices.AddPaymentTransactionToOrder(context.Order, ot);

                if (!t.Result.Succeeded || t.Action == ActionType.CreditCardIgnored)
                {
                    foreach (var m in t.Result.Messages)
                    {
                        if (m.Severity == MessageType.Error ||
                            m.Severity == MessageType.Warning)
                        {
                            context.Errors.Add(new WorkflowMessage("Payment Error:", m.Description, true));
                        }
                    }
                    result = false;
                }
            }
            catch (Exception ex)
            {
                context.Errors.Add(new WorkflowMessage("Exception During Receive Credit Card", ex.Message + ex.StackTrace, false));
                OrderNote note = new OrderNote();
                note.IsPublic = false;
                note.Note     = "EXCEPTION: " + ex.Message + " | " + ex.StackTrace;
                context.Order.Notes.Add(note);
            }

            return(result);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var settings = HccApp.CurrentStore.Settings;

            if (settings.PaymentMethodsEnabled.Contains(PaymentMethods.CreditCardId) &&
                PaymentGateways.CurrentPaymentProcessor(HccApp.CurrentStore).Id == new TestGateway().Id)
            {
                var url     = VirtualPathUtility.ToAbsolute(string.Format(URL_TEMPLATE, CreditCard.Id()));
                var message = string.Format(Localization.GetString(LOCALIZATION_GATEWAY_MESSAGE), url);
                ucMessageBox.ShowWarning(message);
            }

            ucStep0Dashboard.EditingComplete += ucStep0Dashboard_EditingComplete;
        }
        public ActionResult addfund()
        {
            //Get Setting For Payment
            SSLStoreUser loginuser = (SSLStoreUser)Membership.GetUser();

            if (loginuser != null && loginuser.Details != null)
            {
                User CurrentUser = loginuser.Details;
                Site = GetSite(CurrentUser.SiteID);
                SetSiteIDInSession();
                var PGInstance = _service.GetPGInstances(Site.ID);
                ViewBag.SiteID = Site.ID;
                PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault();
                if (PG != null)
                {
                    ViewBag.ISCC = true;
                }
                else
                {
                    ViewBag.ISCC = false;
                }

                PG = null;
                PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault();
                if (PG != null)
                {
                    ViewBag.IsPayPal = true;
                }
                else
                {
                    ViewBag.IsPayPal = false;
                }
                PG = null;
                PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.Moneybookers).FirstOrDefault();
                if (PG != null)
                {
                    ViewBag.IsMoneybookers = true;
                }
                else
                {
                    ViewBag.IsMoneybookers = false;
                }
            }
            return(View());
        }
        public void LoadEditor(string gatewayId)
        {
            var gateway = PaymentGateways.Find(gatewayId);

            Editor = HccPartController.LoadCreditCardGatewayEditor(gateway.Name, Page) as HccCreditCardGatewayPart;

            if (Editor != null)
            {
                Editor.ID        = "GatewayEditor_" + gateway.Name;
                Editor.GatewayId = gateway.Id;
                phEditor.Controls.Clear();
                phEditor.Controls.Add(Editor);
                Editor.EditingComplete += Editor_EditingComplete;
                Editor.LoadData();
            }
            else
            {
                msg.ShowError("Error, editor is not based on HccCreditCardGatewayPart class");
            }
        }
Esempio n. 8
0
        public ActionResult Payment(OrderDetail model, FormCollection collection)
        {
            model = _repository.Find(od => od.ID == model.ID).EagerLoad(od => od.CertificateRequest, od => od.Order, od => od.Order.Site, od => od.Product, od => od.AuditDetails, od => od.Order.User).FirstOrDefault();
            Site Site = GetSite(model.Order.SiteID);

            SetSiteIDInSession();
            var            _ProdPricing      = DependencyResolver.Current.GetService <IRepository <ProductPricing> >();
            int            CuttentContractID = WBSSLStore.Web.Helpers.WBHelper.GetCurrentContractID(model.Order.UserID, Site.ID);
            ProductPricing objPricing        = _ProdPricing.Find(pp => pp.ProductID == model.ProductID && pp.NumberOfMonths == model.NumberOfMonths && pp.ContractID == CuttentContractID && pp.RecordStatusID == (int)RecordStatus.ACTIVE).FirstOrDefault();
            decimal        AvailableCredit   = _service.GetCreditAmount(model.Order.UserID, Site.ID);
            int            NewAddedSAN       = Convert.ToInt32(collection["drpNewSAN"]);

            if (NewAddedSAN > 0)
            {
                if (model.CertificateRequest.AdditionalDomains < model.Product.SanMin)
                {
                    NewAddedSAN = NewAddedSAN - (Convert.ToInt32(model.Product.SanMin) - model.CertificateRequest.AdditionalDomains);
                }
                if (NewAddedSAN > 0)
                {
                    decimal SANAmount = NewAddedSAN * objPricing.AdditionalSanPrice;
                    if (SANAmount > AvailableCredit)
                    {
                        _viewModel                = new ReIssueViewModel();
                        _viewModel.ISCC           = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("cc") ? true : false;
                        _viewModel.IsPayPal       = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("paypal") ? true : false;
                        _viewModel.IsMoneybookers = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("moneybookers") ? true : false;

                        _viewModel.user          = model.Order.User;
                        _viewModel.PayableAmount = (SANAmount - AvailableCredit);
                        _viewModel.NewSANAdded   = NewAddedSAN;
                        _viewModel.SANAmount     = SANAmount;
                        _viewModel.OrderDetailID = model.ID;

                        _viewModel.BillingCountry = _viewModel.user.Address.Country.CountryName;

                        if (_viewModel.IsPayPal || _viewModel.ISCC || _viewModel.IsMoneybookers)
                        {
                            if (_viewModel.IsPayPal && !string.IsNullOrEmpty(collection["txtPaypalID"]))
                            {
                                _viewModel.PayPalID    = collection["txtPaypalID"].ToString();
                                _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.PAYPAL;
                            }
                            else if (_viewModel.IsPayPal)
                            {
                                ViewBag.ErrorMessage = "Please enter paypalid.";
                            }
                            else if (_viewModel.IsMoneybookers)
                            {
                                _viewModel.MoneybookersID = collection["txtMoneybookersID"].ToString();
                                _viewModel.paymentmode    = WBSSLStore.Domain.PaymentMode.MONEYBOOKERS;
                            }
                            else if (_viewModel.ISCC)
                            {
                                _viewModel.CCName      = Convert.ToString(collection["txtNameOnCard"]);
                                _viewModel.CCNumber    = Convert.ToString(collection["txtCCNumber"]);
                                _viewModel.CVV         = Convert.ToString(collection["txtCCV"]);
                                _viewModel.Month       = Convert.ToInt32(collection["drpMonth"]);
                                _viewModel.Year        = Convert.ToInt32(collection["drpYear"]);
                                _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.CC;
                            }

                            string Message = _service.AddFundAndReIssue(_viewModel, Site);
                            if (!string.IsNullOrEmpty(Message) && (Message.ToLower().Equals("https://")))
                            {
                                ViewBag.TransferToEnterCsr = true;
                            }
                            else if (!string.IsNullOrEmpty(Message))
                            {
                                ViewBag.ErrorMessage = Message;
                            }
                            else
                            {
                                ViewBag.ErrorMessage = "No payment gateway selected.";
                            }
                        }
                        else
                        {
                            ViewBag.ErrorMessage = "No payment gateway selected.";
                        }
                    }
                    else
                    {
                        _service.ReIssueAndUpdateOrderREST(model, SANAmount, NewAddedSAN);

                        ViewBag.TransferToEnterCsr = true;
                    }
                }
                else
                {
                    model.CertificateRequest.AdditionalDomains = Convert.ToInt32(model.Product.SanMin);
                    model.AuditDetails.DateModified            = DateTimeWithZone.Now;
                    model.Order   = null;
                    model.Product = null;
                    _repository.Update(model);
                    _unitOfWork.Commit();
                    ViewBag.TransferToEnterCsr = true;
                }
            }
            else
            {
                ViewBag.TransferToEnterCsr = true;
            }

            if (Convert.ToBoolean(ViewBag.TransferToEnterCsr))
            {
                return(RedirectToAction("entercsr", new { id = model.ID }));
            }

            var PGInstance = _service.GetPGInstances(Site.ID);

            ViewBag.SiteID = Site.ID;
            PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault();

            if (PG != null)
            {
                ViewBag.ISCC = true;
            }
            else
            {
                ViewBag.ISCC = false;
            }

            PG = null;
            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault();
            if (PG != null)
            {
                ViewBag.IsPayPal = true;
            }
            else
            {
                ViewBag.IsPayPal = false;
            }
            PG = null;
            ViewBag.Pricing         = objPricing;
            ViewBag.AvailableCredit = AvailableCredit;
            return(View(model));
        }
        public ActionResult addfund(FormCollection collection)
        {
            string Message = string.Empty;
            int    SiteID  = Convert.ToInt32(collection["hndSiteID"]);
            int    UserID  = Convert.ToInt32(collection["hndUserID"]);

            Site = GetSite(SiteID);
            currentsitesettings = new Domain.CurrentSiteSettings(Site);
            SetSiteIDInSession();
            var  _UserRepo = DependencyResolver.Current.GetService <IRepository <User> >();
            User _objUser  = _UserRepo.FindByID(UserID);

            _viewModel.ISCC           = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("cc") ? true : false;
            _viewModel.IsPayPal       = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("paypal") ? true : false;
            _viewModel.IsMoneybookers = Convert.ToString(collection["rbtPaymentMethod"]).ToLower().Equals("moneybookers") ? true : false;
            _viewModel.user           = _objUser;
            _viewModel.PayableAmount  = Convert.ToDecimal(collection["txtAmount"]);

            // Set Country Name
            if (_viewModel.user.Address.CountryID > 0 && _viewModel.user.Address.Country == null)
            {
                Country c = CountryList.Find(x => x.ID == _viewModel.user.Address.CountryID & x.RecordStatusID == (int)RecordStatus.ACTIVE);
                if (c != null)
                {
                    _viewModel.BillingCountry = c.CountryName;
                }
                else
                {
                    _viewModel.BillingCountry = "US";
                }
                c = null;
            }
            else if (_viewModel.user.Address.CountryID > 0 && _viewModel.user.Address.Country != null)
            {
                _viewModel.BillingCountry = _viewModel.user.Address.Country.CountryName;
            }
            else
            {
                _viewModel.BillingCountry = "US";
            }
            //End

            if (_viewModel.IsPayPal || _viewModel.ISCC || _viewModel.IsMoneybookers)
            {
                //if (_viewModel.IsPayPal && !string.IsNullOrEmpty(collection["txtPaypalID"]))--
                if (_viewModel.IsPayPal)
                {
                    _viewModel.PayPalID    = !string.IsNullOrEmpty(Convert.ToString(collection["txtPaypalID"])) ? Convert.ToString(collection["txtPaypalID"]) : string.Empty;
                    _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.PAYPAL;
                }
                else if (_viewModel.IsMoneybookers)
                {
                    _viewModel.MoneybookersID = !string.IsNullOrEmpty(Convert.ToString(collection["txtMoneybookers"])) ? Convert.ToString(collection["txtMoneybookers"]) : string.Empty;
                    _viewModel.paymentmode    = WBSSLStore.Domain.PaymentMode.MONEYBOOKERS;
                }
                else if (_viewModel.IsPayPal)
                {
                    ViewBag.ErrorMessage = WBSSLStore.Resources.ErrorMessage.Message.PaypalIdRequired;
                }
                else if (_viewModel.ISCC)
                {
                    _viewModel.CCName      = Convert.ToString(collection["txtNameOnCard"]);
                    _viewModel.CCNumber    = Convert.ToString(collection["txtCCNumber"]);
                    _viewModel.CVV         = Convert.ToString(collection["txtCCV"]);
                    _viewModel.Month       = Convert.ToInt32(collection["drpMonth"]);
                    _viewModel.Year        = Convert.ToInt32(collection["drpYear"]);
                    _viewModel.paymentmode = WBSSLStore.Domain.PaymentMode.CC;
                }

                Message = _service.AddFund(_viewModel, Site);

                AddFundResponse objResponse = new AddFundResponse();
                if (string.IsNullOrEmpty(Message))
                {
                    Host = currentsitesettings.USESSL ? "https://" : "http://" + (string.IsNullOrEmpty(currentsitesettings.CurrentSite.Alias) ? currentsitesettings.CurrentSite.CName : currentsitesettings.CurrentSite.Alias);
                    if (currentsitesettings.IsRunWithWWW && !Host.Contains("www."))
                    {
                        Host = currentsitesettings.USESSL ? "https://" : "http://" + Host.Replace(Host, "www." + Host);
                    }
                    else if (!currentsitesettings.IsRunWithWWW && Host.Contains("www."))
                    {
                        Host = currentsitesettings.USESSL ? "https://" : "http://" + Host.Replace("www.", "");
                    }

                    return(Redirect(Host + "/client/orders"));
                }
                else
                {
                    ViewBag.ErrorMessage = Message;
                }
            }
            else
            {
                ViewBag.ErrorMessage = WBSSLStore.Resources.ErrorMessage.Message.NoGatewaySelected;
            }


            var PGInstance = _service.GetPGInstances(Site.ID);

            ViewBag.SiteID = Site.ID;
            PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault();

            if (PG != null)
            {
                ViewBag.ISCC = true;
            }
            else
            {
                ViewBag.ISCC = false;
            }

            PG = null;
            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault();
            if (PG != null)
            {
                ViewBag.IsPayPal = true;
            }
            else
            {
                ViewBag.IsPayPal = false;
            }
            PG = null;
            return(View());
        }
        public ActionResult Index(int id)
        {
            SetDefaultData(id);


            _viewModel.ShoppingCartID  = id;
            _viewModel.VatCountry      = currentsitesettings.VatCountry;
            _viewModel.VATNumber       = String.Empty;
            _viewModel.VatPercent      = currentsitesettings.VATTax;
            _viewModel.ISVatApplicable = currentsitesettings.IsVatApplicable;
            _viewModel.Tax             = 0;

            if (!User.Identity.IsAuthenticated)
            {
                _viewModel.user            = new Domain.User();
                _viewModel.user.Address    = new Address();
                _viewModel.IsNewuser       = true;
                _viewModel.AvailableCredit = 0;
                _viewModel.user.Email      = Request.QueryString["eid"];
            }
            else
            {
                _viewModel.user            = CurrentUser;
                _viewModel.IsNewuser       = false;
                _viewModel.AvailableCredit = _service.GetCreditAmount(_viewModel.user.ID, _viewModel.user.SiteID);
            }

            _viewModel.PayableAmount = _viewModel.OrderAmount - _viewModel.PromoDiscount - _viewModel.AvailableCredit;

            _viewModel.PayableAmount = _viewModel.PayableAmount <= 0 ? 0 : _viewModel.PayableAmount;


            //Get Setting For Payment
            var PGInstance = _service.GetPGInstances(Site.ID);

            PaymentGateways PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.AuthorizeNet).FirstOrDefault();

            if (PG != null)
            {
                _viewModel.ISCC        = true;
                _viewModel.paymentmode = Domain.PaymentMode.CC;
            }
            else
            {
                _viewModel.ISCC = false;
            }

            PG = null;
            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.PayPalIPN).FirstOrDefault();
            if (PG != null)
            {
                _viewModel.paymentmode = Domain.PaymentMode.PAYPAL;
                _viewModel.IsPayPal    = true;
            }
            else
            {
                _viewModel.IsPayPal = false;
            }

            PG = null;
            PG = PGInstance.Where(p => p.InstancesID == (int)PGInstances.Moneybookers).FirstOrDefault();
            if (PG != null)
            {
                _viewModel.paymentmode    = Domain.PaymentMode.MONEYBOOKERS;
                _viewModel.IsMoneybookers = true;
            }
            else
            {
                _viewModel.IsMoneybookers = false;
            }

            if (_viewModel.ISCC && _viewModel.IsPayPal && _viewModel.IsMoneybookers)
            {
                _viewModel.paymentmode = Domain.PaymentMode.CC;
            }
            PG = null;

            if (currentsitesettings != null)
            {
                currentsitesettings.Dispose();
            }

            return(View("index", _viewModel));
        }