Ejemplo n.º 1
0
        public IViewComponentResult Invoke()
        {
            var allBank     = _bankService.GetBankAlls();
            var listaBancos = new List <SelectListItem>();

            foreach (var bank in allBank)
            {
                listaBancos.Add(new SelectListItem {
                    Text = bank.Name, Value = bank.Id.ToString()
                });
            }
            var allBankReceiver     = _bankService.GetBankReceiver();
            var listaBancosReceiver = new List <SelectListItem>();

            foreach (var bank in allBankReceiver)
            {
                listaBancosReceiver.Add(new SelectListItem {
                    Text = bank.Name, Value = bank.AccountNumber.ToString()
                });
            }
            var model = new PaymentInfoModel
            {
                BancoEmisor   = listaBancos,
                BancoReceptor = listaBancosReceiver
            };

            return(View("~/Plugins/Payments.Transfer/Views/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 2
0
        //Adds shippin info in the additional check out phase.
        public void AddOrderFinalized(CheckoutInputModel model, string userID)
        {
            var userOrder = (from o in _db.Orders
                             where o.UserID == userID && o.IsCurrentOrder == true
                             select o).FirstOrDefault();
            var shippingAddress = new AddressModel()
            {
                StreetName  = model.StreetName,
                HouseNumber = (int)model.HouseNumber,
                City        = model.City,
                Zip         = model.Zip,
                Country     = model.Country,
            };

            var paymentInfo = new PaymentInfoModel()
            {
                CardType   = model.CardType,
                CardHolder = model.CardHolder,
                CardNumber = model.CardNumber,
                Month      = model.Month,
                Year       = model.Year,
                CVC        = model.CVC,
            };

            userOrder.ShippingAddress = shippingAddress;
            userOrder.PaymentInfo     = paymentInfo;
            userOrder.IsWrapped       = model.IsWrapped;

            _db.Orders.Update(userOrder);
            _db.SaveChanges();
        }
Ejemplo n.º 3
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();

            model.IsJsPay = false;
            return(View("~/Plugins/Payments.WeiXin/Views/PaymentWeiXin/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 4
0
        public ActionResult PaymentInfo()
        {
            IEnumerable <ShoppingCartItem> shoppingCartItems = _workContext.CurrentCustomer.ShoppingCartItems;
            List <ShoppingCartItem>        list = shoppingCartItems.Where(i => i.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList();

            if (list.Count == 0)
            {
                return(Content(string.Empty));
            }

            if (!_orderProcessingService.ValidateMinOrderSubtotalAmount(list))
            {
                return(Content(string.Empty));
            }

            var privat24PaymentProcessor =
                _paymentService.LoadPaymentMethodBySystemName("Nop.Payments.Privat24") as Privat24PaymentProcessor;

            if (privat24PaymentProcessor == null || !privat24PaymentProcessor.IsPaymentMethodActive(_paymentSettings) ||
                !privat24PaymentProcessor.PluginDescriptor.Installed)
            {
                throw new NopException("Privat24 module cannot be loaded");
            }

            var paymentInfoModel = new PaymentInfoModel();

            if (privat24PaymentProcessor.PaymentMethodType == PaymentMethodType.Redirection)
            {
                return(View("Nop.Plugin.Payments.Privat24.Views.PaymentPrivat24.PaymentInfo", paymentInfoModel));
            }

            return(View("Nop.Plugin.Payments.Privat24.Views.PaymentPrivat24.PaymentInfoButton", paymentInfoModel));
        }
Ejemplo n.º 5
0
        public IViewComponentResult Invoke()
        {
            var model = new PaymentInfoModel()
            {
                //CreditCardTypes = new List<SelectListItem>
                //{
                //    new SelectListItem { Text = "Visa", Value = "visa" },
                //    new SelectListItem { Text = "Master card", Value = "MasterCard" },
                //    new SelectListItem { Text = "Discover", Value = "Discover" },
                //    new SelectListItem { Text = "Amex", Value = "Amex" },
                //}
            };

            //set postback values (we cannot access "Form" with "GET" requests)
            if (this.Request.Method != WebRequestMethods.Http.Get)
            {
                //var form = this.Request.Form;
                //model.CardholderName = form["CardholderName"];
                //model.CardNumber = form["CardNumber"];
                //model.CardCode = form["CardCode"];
                //var selectedCcType = model.CreditCardTypes.FirstOrDefault(x => x.Value.Equals(form["CreditCardType"], StringComparison.InvariantCultureIgnoreCase));
                //if (selectedCcType != null)
                //    selectedCcType.Selected = true;
                //var selectedMonth = model.ExpireMonths.FirstOrDefault(x => x.Value.Equals(form["ExpireMonth"], StringComparison.InvariantCultureIgnoreCase));
                //if (selectedMonth != null)
                //    selectedMonth.Selected = true;
                //var selectedYear = model.ExpireYears.FirstOrDefault(x => x.Value.Equals(form["ExpireYear"], StringComparison.InvariantCultureIgnoreCase));
                //if (selectedYear != null)
                //    selectedYear.Selected = true;
            }

            return(View("~/Plugins/Payments.Boleto/Views/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 6
0
        public PaymentModel CreatePaymentModel(string sessionKey, PaymentType paymentType,
                                               PaymentInfoModel paymentInfoModel)
        {
            var paymentModel = new PaymentModel
            {
                PaymentInfo = paymentInfoModel,
                PaymentType = paymentType,
            };

            ICollection <OrderItem> orderItems =
                _unitOfWork.OrderRepository.Get(order => order.SessionKey == sessionKey).First().OrderItems;

            paymentModel.OrderItems = Mapper.Map <ICollection <OrderItemModel> >(orderItems);

            var paymentStrategies = new Dictionary <PaymentType, IPaymentStrategy>
            {
                { PaymentType.Bank, new BankPaymentStrategy() },
                { PaymentType.Visa, new VisaPaymentStrategy() },
                { PaymentType.Terminal, new TerminalPaymentStrategy() },
            };

            PaymentStrategy = paymentStrategies[paymentType];

            PaymentModel finalPaymentModel = PaymentStrategy.GetFinalPaymentModel(paymentModel);

            return(finalPaymentModel);
        }
        /// <summary>
        /// Validate payment form
        /// </summary>
        /// <param name="form">The parsed form values</param>
        /// <returns>List of validating errors</returns>
        public IList <string> ValidatePaymentForm(IFormCollection form)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            var warnings = new List <string>();

            //validate
            var validator = new PaymentInfoValidator(_braintreePaymentSettings, _localizationService);
            var model     = new PaymentInfoModel
            {
                CardholderName = form["CardholderName"],
                CardNumber     = form["CardNumber"],
                CardCode       = form["CardCode"],
                ExpireMonth    = form["ExpireMonth"],
                ExpireYear     = form["ExpireYear"],
                CardNonce      = form["CardNonce"]
            };

            var validationResult = validator.Validate(model);

            if (validationResult.IsValid)
            {
                return(warnings);
            }

            warnings.AddRange(validationResult.Errors.Select(error => error.ErrorMessage));

            return(warnings);
        }
        public IViewComponentResult Invoke()
        {
            var model = new PaymentInfoModel();

            //prepare years
            for (var i = 0; i < 15; i++)
            {
                var year = (DateTime.Now.Year + i).ToString();
                model.ExpireYears.Add(new SelectListItem {
                    Text = year, Value = year,
                });
            }

            //prepare months
            for (var i = 1; i <= 12; i++)
            {
                model.ExpireMonths.Add(new SelectListItem {
                    Text = i.ToString("D2"), Value = i.ToString(),
                });
            }

            //prepare card types


            return(View("~/Plugins/Payments.PayBright/Views/PaymentInfo.cshtml", model));
        }
        public IViewComponentResult Invoke(int id)
        {
            try
            {
                if (id == 0)
                {
                    throw new ArgumentNullException(nameof(id));
                }

                var zelle = _zelleService.GetPaymentZelleByOrderId(id);

                var model = new PaymentInfoModel();
                if (zelle != null)
                {
                    model = new PaymentInfoModel
                    {
                        IdZelle            = zelle.Id,
                        Order              = zelle.OrderId,
                        IssuingEmail       = zelle.IssuingEmail,
                        Reference          = zelle.ReferenceNumber,
                        PaymentStatusOrder = zelle.PaymentStatusOrder
                    };
                }
                else
                {
                    model.Order = id;
                }
                return(View("~/Plugins/Payments.Zelle/Views/RegisterPayment.cshtml", model));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }
        public ActionResult PaymentInfo()
        {
            var cart = _payPalExpressCheckoutService.GetCart();

            if (cart.Count == 0)
            {
                return(Content(""));
            }


            bool minOrderSubtotalAmountOk = _orderProcessingService.ValidateMinOrderSubtotalAmount(cart);

            if (!minOrderSubtotalAmountOk)
            {
                return(Content(""));
            }

            var model = new PaymentInfoModel()
            {
                MerchantId = _payPalExpressCheckoutPaymentSettings.MerchantId,
                IsLive     = _payPalExpressCheckoutPaymentSettings.IsLive
            };

            return(View("~/Plugins/Payments.PayPalExpressCheckout/Views/PaymentPayPalExpressCheckout/PaymentInfo.cshtml", model));
        }
        public IViewComponentResult Invoke()
        {
            var model = new PaymentInfoModel();
            //load settings for a chosen store scope
            //ensure that we have 2 (or more) stores
            var storeId                   = _storeContext.CurrentStore.Id;
            var store                     = _storeService.GetStoreById(storeId);
            var orderSettings             = _settingService.LoadSetting <OrderSettings>(storeId);
            var payPalPlusPaymentSettings = _settingService.LoadSetting <PayPalPlusPaymentSettings>(storeId);

            string host = payPalPlusPaymentSettings.EnviromentSandBox;

            if (payPalPlusPaymentSettings.UseSandbox == false)
            {
                host = payPalPlusPaymentSettings.EnviromentLive;
            }

            //get current shopping cart
            var shoppingCart = _workContext.CurrentCustomer.ShoppingCartItems
                               .Where(shoppingCartItem => shoppingCartItem.ShoppingCartType == ShoppingCartType.ShoppingCart)
                               .ToList();
            //.LimitPerStore(_storeContext.CurrentStore.Id).ToList();

            decimal totalAdjust = 0;
            //items
            var items = GetItems(shoppingCart, _workContext.CurrentCustomer, _storeContext.CurrentStore.Id, payPalPlusPaymentSettings.Currency);

            //amount details
            var amountDetails = GetAmountDetails(shoppingCart, items, out totalAdjust);

            try
            {
                Task.Run(async() =>
                {
                    AuthToken authToken = await GetAccessToken(host, payPalPlusPaymentSettings.ClientId, payPalPlusPaymentSettings.SecretId);

                    PayPalPaymentCreatedResponse createdPayment = await CreatePaypalPaymentAsync(host, authToken, _workContext.CurrentCustomer, payPalPlusPaymentSettings, amountDetails, items, totalAdjust);

                    var approval_url = createdPayment.links.FirstOrDefault(x => x.rel == "approval_url").href;
                    if (authToken != null)
                    {
                        // Guarda el apiContext
                        _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer, "authTokenPPP", Newtonsoft.Json.JsonConvert.SerializeObject(authToken), _storeContext.CurrentStore.Id);
                        // Guarda Pago
                        _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer, "createdPaymentPPP", Newtonsoft.Json.JsonConvert.SerializeObject(createdPayment), _storeContext.CurrentStore.Id);

                        model.Scriptppp = GetScriptPayment(_workContext.CurrentCustomer, authToken, createdPayment, storeId);
                    }
                    model.OnePageCheckoutEnabled = orderSettings.OnePageCheckoutEnabled;
                    model.Respuesta = authToken.Access_Token;
                    model.Error     = false;
                }).Wait();
            }
            catch (Exception e)
            {
                model.Respuesta = e.Message;
                model.Error     = true;
            }
            return(View("~/Plugins/Payments.PayPalPlus/Views/PaymentInfo.cshtml", model));
        }
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();

            //years
            for (int i = 0; i < 15; i++)
            {
                string year = Convert.ToString(DateTime.Now.Year + i);
                model.ExpireYears.Add(new SelectListItem
                {
                    Text  = year,
                    Value = year,
                });
            }

            //months
            for (int i = 1; i <= 12; i++)
            {
                string text = (i < 10) ? "0" + i : i.ToString();
                model.ExpireMonths.Add(new SelectListItem
                {
                    Text  = text,
                    Value = text,
                });
            }

            ViewBag.PublicKey = _paylikePaymentSettings.PublicKey;
            return(View("~/Plugins/Payments.Paylike/Views/Paylike/PaymentInfo.cshtml", model));
        }
        public ActionResult PaymentInfo()
        {
            var model      = new PaymentInfoModel();
            var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
            var secureSubmitPaymentSettings = _settingService.LoadSetting <SecureSubmitPaymentSettings>(storeScope);

            for (int i = 0; i < 15; i++)
            {
                string year = Convert.ToString(DateTime.Now.Year + i);
                model.ExpireYears.Add(new SelectListItem()
                {
                    Text  = year,
                    Value = year,
                });
            }

            for (int i = 1; i <= 12; i++)
            {
                string text = (i < 10) ? "0" + i.ToString() : i.ToString();
                model.ExpireMonths.Add(new SelectListItem()
                {
                    Text  = text,
                    Value = i.ToString(),
                });
            }

            model.PublicApiKey = secureSubmitPaymentSettings.PublicApiKey.Trim();

            //set postback values
            var form = this.Request.Form;

            model.SecureSubmitToken = form["token_value"];

            return(View("~/Plugins/Payments.SecureSubmit/Views/PaymentSecureSubmit/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 14
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();

            WxPayData data  = new WxPayData(_weixinPayPaymentSettings.Key);
            Order     order = _orderService.SearchOrders(storeId: _storeContext.CurrentStore.Id,
                                                         customerId: _workContext.CurrentCustomer.Id, pageSize: 1)
                              .FirstOrDefault();

            if (order != null)
            {
                data.SetValue("body", _storeContext.CurrentStore.Name);                                                                                                                                                            //商品描述
                data.SetValue("attach", "weixincodepay");                                                                                                                                                                          //附加数据
                data.SetValue("out_trade_no", order.Id);                                                                                                                                                                           //随机字符串
                data.SetValue("total_fee", order.OrderTotal);                                                                                                                                                                      //总金额
                data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));                                                                                                                                              //交易起始时间
                data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));                                                                                                                              //交易结束时间
                data.SetValue("goods_tag", order.OrderItems.FirstOrDefault().Product.Name);                                                                                                                                        //商品标记
                data.SetValue("trade_type", "NATIVE");                                                                                                                                                                             //交易类型
                data.SetValue("product_id", order.OrderItems.FirstOrDefault().Product.Id);                                                                                                                                         //商品ID

                WxPayData result = WxPayApi.UnifiedOrder(_weixinPayPaymentSettings.AppId, _weixinPayPaymentSettings.MchId, _weixinPayPaymentSettings.Key, _weixinPayPaymentSettings.IP, WeiXinPayPaymentSettings.PROXY_URL, data); //调用统一下单接口
                model.URL = result.GetValue("code_url").ToString();                                                                                                                                                                //获得统一下单接口返回的二维码链接

                return(View("~/Plugins/Payments.WeiXinPay/Views/PaymentWeiXinPay/PaymentInfo.cshtml", model));
            }
            throw new Exception("未找到待支持的订单");
        }
        public ActionResult PaymentInfo()
        {
            var cart = _workContext.CurrentCustomer.ShoppingCartItems.Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart).ToList();

            if (cart.Count == 0)
            {
                return(Content(""));
            }

            bool minOrderSubtotalAmountOk = _orderProcessingService.ValidateMinOrderSubtotalAmount(cart);

            if (!minOrderSubtotalAmountOk)
            {
                return(Content(""));
            }

            var model = new PaymentInfoModel()
            {
                GifFileName    = "checkout",
                BackgroundType = BackgroundType.Transparent,
                MerchantId     = GCheckoutConfigurationHelper.MerchantID.ToString(),
                MerchantKey    = GCheckoutConfigurationHelper.MerchantKey,
                Environment    = GCheckoutConfigurationHelper.Environment,
                Currency       = _currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId).CurrencyCode,
                UseHttps       = _webHelper.IsCurrentConnectionSecured(),
            };

            return(View("Nop.Plugin.Payments.GoogleCheckout.Views.PaymentGoogleCheckout.PaymentInfo", model));
        }
Ejemplo n.º 16
0
        public IActionResult PaymentInfoDisplayPage()
        {
            var model = new PaymentInfoModel();

            if (_stripeSettings.UseRedirectionFlow)
            {
                model.RedirectionEnabled = true;
            }
            else
            {
                var baseYear = DateTime.UtcNow.Year;
                for (var i = 1; i < 13; i++)
                {
                    var value = i.ToString();
                    model.AvailableMonths.Add(new SelectListItem(value, value));
                }
                //50 years from now
                for (var i = 0; i < 51; i++)
                {
                    var value = (baseYear + i).ToString();
                    model.AvailableYears.Add(new SelectListItem(value, value));
                }
                model.Month = DateTime.UtcNow.Month;
                model.Year  = DateTime.UtcNow.Year;
            }

            return(R.With("paymentInfo", model).Result);
        }
Ejemplo n.º 17
0
        public override IList <string> ValidatePaymentForm(FormCollection form)
        {
            var warnings = new List <string>();

            //validate
            var validator = new PaymentInfoValidator(_localizationService);
            var model     = new PaymentInfoModel
            {
                CardholderName = form["CardholderName"],
                CardNumber     = form["CardNumber"],
                CardCode       = form["CardCode"],
                ExpireMonth    = form["ExpireMonth"],
                ExpireYear     = form["ExpireYear"]
            };
            var validationResult = validator.Validate(model);

            if (!validationResult.IsValid)
            {
                foreach (var error in validationResult.Errors)
                {
                    warnings.Add(error.ErrorMessage);
                }
            }
            return(warnings);
        }
Ejemplo n.º 18
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();

            //return View("Nop.Plugin.Payments.Payu.Views.PaymentPayu.PaymentInfo", model);
            return(View("~/Plugins/Payments.Payu/Views/PaymentPayu/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 19
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel
            {
                //whether current customer is guest
                IsGuest = _workContext.CurrentCustomer.IsGuest(),

                //get postal code from the billing address or from the shipping one
                PostalCode = _workContext.CurrentCustomer.BillingAddress?.ZipPostalCode
                             ?? _workContext.CurrentCustomer.ShippingAddress?.ZipPostalCode
            };

            //whether customer already has stored cards
            var customerId = _workContext.CurrentCustomer.GetAttribute <string>(SquarePaymentDefaults.CustomerIdAttribute);
            var customer   = _squarePaymentManager.GetCustomer(customerId);

            if (customer?.Cards != null)
            {
                var cardNumberMask = _localizationService.GetResource("Plugins.Payments.Square.Fields.StoredCard.Mask");
                model.StoredCards = customer.Cards.Select(card => new SelectListItem {
                    Text = string.Format(cardNumberMask, card.Last4), Value = card.Id
                }).ToList();
            }

            //add the special item for 'select card' with value 0
            if (model.StoredCards.Any())
            {
                var selectCardText = _localizationService.GetResource("Plugins.Payments.Square.Fields.StoredCard.SelectCard");
                model.StoredCards.Insert(0, new SelectListItem {
                    Text = selectCardText, Value = "0"
                });
            }

            return(View("~/Plugins/Payments.Square/Views/PaymentInfo.cshtml", model));
        }
        /// <summary>
        /// Invoke view component
        /// </summary>
        /// <param name="widgetZone">Widget zone name</param>
        /// <param name="additionalData">Additional data</param>
        /// <returns>View component result</returns>
        public IViewComponentResult Invoke(string widgetZone, object additionalData)
        {
            var model = new PaymentInfoModel();

            //prepare order GUID
            var paymentRequest = new ProcessPaymentRequest();

            _paymentService.GenerateOrderGuid(paymentRequest);

            //try to create an order
            var(order, errorMessage) = _serviceManager.CreateOrder(_settings, paymentRequest.OrderGuid);
            if (order != null)
            {
                model.OrderId = order.Id;

                //save order details for future using
                paymentRequest.CustomValues.Add(_localizationService.GetResource("Plugins.Payments.PayPalSmartPaymentButtons.OrderId"), order.Id);
            }
            else if (!string.IsNullOrEmpty(errorMessage))
            {
                model.Errors = errorMessage;
                if (_orderSettings.OnePageCheckoutEnabled)
                {
                    ModelState.AddModelError(string.Empty, errorMessage);
                }
                else
                {
                    _notificationService.ErrorNotification(errorMessage);
                }
            }

            HttpContext.Session.Set(Defaults.PaymentRequestSessionKey, paymentRequest);

            return(View("~/Plugins/Payments.PayPalSmartPaymentButtons/Views/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 21
0
        public async Task <IList <string> > ValidatePaymentForm(IFormCollection form)
        {
            var warnings = new List <string>();

            //validate
            var validator = new PaymentInfoValidator(_brainTreePaymentSettings, _translationService);
            var model     = new PaymentInfoModel
            {
                CardholderName = form["CardholderName"],
                CardNumber     = form["CardNumber"],
                CardCode       = form["CardCode"],
                ExpireMonth    = form["ExpireMonth"],
                ExpireYear     = form["ExpireYear"],
                CardNonce      = form["CardNonce"]
            };
            var validationResult = validator.Validate(model);

            if (!validationResult.IsValid)
            {
                foreach (var error in validationResult.Errors)
                {
                    warnings.Add(error.ErrorMessage);
                }
            }
            return(await Task.FromResult(warnings));
        }
        public async Task <IList <string> > ValidatePaymentForm(IFormCollection form)
        {
            var warnings = new List <string>();

            var creditCard = form["paymentRadio"];

            if (creditCard == "2")
            {
                //validate
                var validator = new PaymentInfoCreditCardValidator(_localizationService);
                var model     = new PaymentInfoModel {
                    CardholderName = form["CardholderName"],
                    CardNumber     = form["CardNumber"],
                    CardCode       = form["CardCode"],
                    ExpireDate     = form["ExpireDate"],
                };
                var validationResult = validator.Validate(model);
                if (!validationResult.IsValid)
                {
                    foreach (var error in validationResult.Errors)
                    {
                        warnings.Add(error.ErrorMessage);
                    }
                }
            }
            else if (creditCard == "1")
            {
                var bank = form["bank"];
                if (string.IsNullOrWhiteSpace(bank))
                {
                    warnings.Add("Selecteer de juiste bank om de bestelling af te ronden.");
                }
            }
            return(await Task.FromResult(warnings));
        }
Ejemplo n.º 23
0
        public ActionResult IndexPost(PaymentInfoModel model)
        {
            if (model == null || !ModelState.IsValid)
            {
                throw new ArgumentException("IndexPost");
            }

            //Generate Unique Reference for Order
            var MerchantReference = "O" + DateTime.Now.ToString("yyyyMMddhhmm") + new Random().Next(1000);

            //build form to post to page
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<form id='EpaymentForm' action='{0}' method='post'>", EcentricHPP.Helpers.ConfigHelper.HPPLink());

            var requestModel = new PaymentRequestModel(model.Amount, model.Currency, MerchantReference, model.TransactionType, model.UserID);

            PropertyInfo[] properties = requestModel.GetType().GetProperties();
            foreach (var prop in properties)
            {
                string name  = prop.Name;                         // Get string name
                object value = prop.GetValue(requestModel, null); // Get value
                sb.AppendFormat("<input type='hidden' name='{0}' value='{1}'/>", name, value);
            }

            sb.Append("</form>");
            sb.Append("<script type='text/javascript'>document.getElementById('EpaymentForm').submit();</script>");

            //write to response object
            Response.Write(sb.ToString());

            return(View());
        }
Ejemplo n.º 24
0
        //private async Task<PaystackSetting> GetPaystackSettings()
        //{
        //    //return null;
        //    return await _settingService.GetSetting<PaystackSetting>();
        //}

        public async Task <IViewComponentResult> InvokeAsync()
        {
            string rootPath = _hostEnvironment.ContentRootPath;

            PaymentInfoModel model = new PaymentInfoModel(rootPath);

            model.SupportedCurrencies = await _supportedCurrencyService.GetSupportedCurrencies();

            if (model.SupportedCurrencies != null && model.SupportedCurrencies.Count > 0)
            {
                foreach (PaystackSupportedCurrency currency in model.SupportedCurrencies)
                {
                    model.Currencies.Add(new SelectListItem {
                        Text = currency.Name, Value = currency.Id.ToString()
                    });
                }

                //model.Currencies.Add(new SelectListItem { Text = "Dollar", Value = "802" });

                //PaystackSetting paystackSetting = await _settingService.GetSetting<PaystackSetting>();
                //await httpContext.Session.SetComplexData(_gatewayLuncher.PaystackSettings, paystackSetting);
            }
            else
            {
                ViewBag.CurrencyLoadMessage = "Paystack currency list failed on load!";
            }

            return(await Task.FromResult(new ViewViewComponentResult()
            {
                ViewData = new ViewDataDictionary <PaymentInfoModel>(ViewData, model)
            }));
        }
Ejemplo n.º 25
0
        public virtual Response RemovePaymentInfo(Guid customerId, PaymentInfoModel paymentInfoModel, string storeName)
        {
            if (string.IsNullOrEmpty(storeName))
            {
                return(new Response
                {
                    Success = false,
                    Message = "storeName is null or empty"
                });
            }

            var customer = this.CustomerService.GetCustomerByGuid(customerId);

            if (customer == null)
            {
                return(new Response
                {
                    Success = false,
                    Message = string.Format("Customer not found. Customer Id: {0}", customerId)
                });
            }

            var store = this.storeService.GetAllStores()
                        .FirstOrDefault(s => s.Name.Equals(storeName, StringComparison.InvariantCultureIgnoreCase));

            var storeId = (store == null) ? 0 : store.Id;

            var cart = customer
                       .ShoppingCartItems
                       .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart && sci.StoreId == storeId)
                       .ToList();

            if (cart.Count == 0)
            {
                return(new Response
                {
                    Success = false,
                    Message = "Couldn't find cart."
                });
            }

            try
            {
                this.genericAttributeService.SaveAttribute <string>(customer, SystemCustomerAttributeNames.SelectedPaymentMethod, null, storeId);
            }
            catch (Exception e)
            {
                return(new Response
                {
                    Success = false,
                    Message = e.Message
                });
            }

            return(new Response
            {
                Success = true
            });
        }
Ejemplo n.º 26
0
        public IViewComponentResult Invoke()
        {
            var model = new PaymentInfoModel()
            {
            };

            return(View("~/Plugins/Payments.Paytm/Views/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Invoke view component
        /// </summary>
        /// <param name="widgetZone">Widget zone name</param>
        /// <param name="additionalData">Additional data</param>
        /// <returns>View component result</returns>
        public IViewComponentResult Invoke(string widgetZone, object additionalData)
        {
            var model = new PaymentInfoModel();

            if (_braintreePaymentSettings.Use3DS)
            {
                try
                {
                    var gateway = new BraintreeGateway
                    {
                        Environment = _braintreePaymentSettings.UseSandbox ? Environment.SANDBOX : Environment.PRODUCTION,
                        MerchantId  = _braintreePaymentSettings.MerchantId,
                        PublicKey   = _braintreePaymentSettings.PublicKey,
                        PrivateKey  = _braintreePaymentSettings.PrivateKey
                    };
                    var clientToken = gateway.ClientToken.Generate();

                    var cart = _shoppingCartService
                               .GetShoppingCart(_workContext.CurrentCustomer, ShoppingCartType.ShoppingCart, _storeContext.CurrentStore.Id);
                    var orderTotal = _orderTotalCalculationService.GetShoppingCartTotal(cart);

                    model.ClientToken = clientToken;
                    model.OrderTotal  = orderTotal;
                }
                catch (Exception exception)
                {
                    model.Errors = exception.Message;
                    if (_orderSettings.OnePageCheckoutEnabled)
                    {
                        ModelState.AddModelError(string.Empty, exception.Message);
                    }
                    else
                    {
                        _notificationService.ErrorNotification(exception);
                    }
                }

                return(View("~/Plugins/Payments.Braintree/Views/PaymentInfo.3DS.cshtml", model));
            }

            for (var i = 0; i < 15; i++)
            {
                var year = Convert.ToString(DateTime.Now.Year + i);
                model.ExpireYears.Add(new SelectListItem {
                    Text = year, Value = year,
                });
            }

            for (var i = 1; i <= 12; i++)
            {
                var text = (i < 10) ? "0" + i : i.ToString();
                model.ExpireMonths.Add(new SelectListItem {
                    Text = text, Value = i.ToString(),
                });
            }

            return(View("~/Plugins/Payments.Braintree/Views/PaymentInfo.cshtml", model));
        }
Ejemplo n.º 28
0
        public override IList <string> ValidatePaymentForm(FormCollection form)
        {
            var warnings  = new List <string>();
            var validator = new PaymentInfoValidator(_localizationService);
            var model     = new PaymentInfoModel
            {
                Country     = form["Country"],
                PhoneNumber = form["PhoneNumber"]
            };
            var validationResult = validator.Validate(model);

            if (!validationResult.IsValid)
            {
                foreach (var error in validationResult.Errors)
                {
                    warnings.Add(error.ErrorMessage);
                }
            }
            else
            {
                var storeScope            = this.GetActiveStoreScopeConfiguration(_storeService, _workContext);
                var manualPaymentSettings = _settingService.LoadSetting <SendSpendPaymentSettings>(storeScope);
                System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                using (var client = new HttpClient())
                {
                    var oAuth = new Models.ApiAuthRequest {
                        apiId = manualPaymentSettings.AppId, countryCode = model.Country, customer_fmm_UserNameOrMobileNo = model.PhoneNumber
                    };
                    var content = new StringContent(JsonConvert.SerializeObject(oAuth));
                    content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                    using (var res = client.PostAsync(String.Format("{0}api/v1/SecurePayment/Authentication", manualPaymentSettings.AppUrl), content))
                    {
                        res.Wait();
                        if (res.Result.IsSuccessStatusCode)
                        {
                            var data = res.Result.Content.ReadAsStringAsync();
                            var ret  = JsonConvert.DeserializeObject <Models.ApiResponse>(data.Result.ToString());
                            switch (ret.responseCode.ToUpper())
                            {
                            case "APPROVED":
                                warnings.Clear();
                                break;

                            default:
                                warnings.Add(ret.responseText);
                                break;
                            }
                        }
                        else
                        {
                            warnings.Add("Unable to authenticate your request, Please try again later.");
                        }
                    }
                }
            }

            return(warnings);
        }
Ejemplo n.º 29
0
        public IViewComponentResult Invoke()
        {
            var model = new PaymentInfoModel()
            {
                DescriptionText = _payInStorePaymentSettings.DescriptionText
            };

            return(View("/Plugins/Payments.PayInStore/Views/PaymentInfo.cshtml", model));
        }
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel()
            {
                DescriptionText = _checkMoneyOrderPaymentSettings.DescriptionText
            };

            return(View("Nop.Plugin.Payments.CheckMoneyOrder.Views.PaymentCheckMoneyOrder.PaymentInfo", model));
        }
Ejemplo n.º 31
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();

            //CC types
            model.CreditCardTypes.Add(new SelectListItem
            {
                Text = "Visa",
                Value = "Visa",
            });
            model.CreditCardTypes.Add(new SelectListItem
            {
                Text = "Master card",
                Value = "MasterCard",
            });
            model.CreditCardTypes.Add(new SelectListItem
            {
                Text = "Discover",
                Value = "Discover",
            });
            model.CreditCardTypes.Add(new SelectListItem
            {
                Text = "Amex",
                Value = "Amex",
            });

            //years
            for (int i = 0; i < 15; i++)
            {
                string year = Convert.ToString(DateTime.Now.Year + i);
                model.ExpireYears.Add(new SelectListItem
                {
                    Text = year,
                    Value = year,
                });
            }

            //months
            for (int i = 1; i <= 12; i++)
            {
                string text = (i < 10) ? "0" + i : i.ToString();
                model.ExpireMonths.Add(new SelectListItem
                {
                    Text = text,
                    Value = i.ToString(),
                });
            }

            //set postback values
            var form = this.Request.Form;
            model.CardholderName = form["CardholderName"];
            model.CardNumber = form["CardNumber"];
            model.CardCode = form["CardCode"];
            var selectedCcType = model.CreditCardTypes.FirstOrDefault(x => x.Value.Equals(form["CreditCardType"], StringComparison.InvariantCultureIgnoreCase));
            if (selectedCcType != null)
                selectedCcType.Selected = true;
            var selectedMonth = model.ExpireMonths.FirstOrDefault(x => x.Value.Equals(form["ExpireMonth"], StringComparison.InvariantCultureIgnoreCase));
            if (selectedMonth != null)
                selectedMonth.Selected = true;
            var selectedYear = model.ExpireYears.FirstOrDefault(x => x.Value.Equals(form["ExpireYear"], StringComparison.InvariantCultureIgnoreCase));
            if (selectedYear != null)
                selectedYear.Selected = true;

            return View("~/Plugins/Tameion.BridgePay/Views/BridgePay/PaymentInfo.cshtml", model);
        }
Ejemplo n.º 32
0
        public override IList<string> ValidatePaymentForm(FormCollection form)
        {
            var warnings = new List<string>();

            //validate
            var validator = new PaymentInfoValidator(_localizationService);
            var model = new PaymentInfoModel
            {
                CardholderName = form["CardholderName"],
                CardNumber = form["CardNumber"],
                CardCode = form["CardCode"],
                ExpireMonth = form["ExpireMonth"],
                ExpireYear = form["ExpireYear"]
            };
            var validationResult = validator.Validate(model);
            if (!validationResult.IsValid)
                foreach (var error in validationResult.Errors)
                    warnings.Add(error.ErrorMessage);
            return warnings;
        }
Ejemplo n.º 33
0
        public ActionResult PaymentInfo()
        {
            var model = new PaymentInfoModel();
            //return View("Nop.Plugin.Payments.Payu.Views.PaymentPayu.PaymentInfo", model);
            return View("~/Plugins/Payments.Emi/Views/PaymentEmi/PaymentInfo.cshtml", model);

        }
 public ActionResult PaymentInfo()
 {
     var model = new PaymentInfoModel();
     return View("~/Plugins/Payments.Paytm/Views/PaymentPaytm/PaymentInfo.cshtml", model);
 }
 public ActionResult PaymentInfo()
 {
     var model = new PaymentInfoModel();
     return View("Nop.Plugin.Payments.PayPalStandard.Views.PaymentPayPalStandard.PaymentInfo", model);
 }