public ActionResult CurrencySettings() { var result = _configApi.GetConfig(); var data = result?.Result; var model = new CurrencySettingModel { countries = data?.ShippingCountries, currencies = data?.Currencies, languages = data?.Languages }; return(PartialView(CustomViews.CURRENCY_VIEW, model)); }
public ActionResult CurrencySettings() { var result = _configApi.GetConfig(); var data = result?.Result; var model = new CurrencySettingModel { countries = data?.ShippingCountries, currencies = data?.Currencies, languages = data?.Languages }; return(JsonSuccess(model, JsonRequestBehavior.AllowGet)); }
protected CheckoutViewModel GetCheckoutData(string basketId) { var response = _checkoutApi.Checkout(Sanitizer.GetSafeHtmlFragment(basketId)); var checkout = response.Result; if (checkout == null || checkout.BasketId == null || checkout.Basket == null || checkout.Basket.LineItems.Count < 1) { return(null); } foreach (var pay in checkout.PaymentOptions) { pay.CardInfo.Amount = checkout.BalanceAmount.Raw.WithTax; } checkout.LanuguageCode = _sessionContext.CurrentSiteConfig.RegionalSettings.DefaultLanguageCulture; checkout.CurrencyCode = _sessionContext.CurrentSiteConfig.RegionalSettings.DefaultCurrencyCode; var result = _configApi.GetConfig(); var data = result.Result; //checkout.Basket.shippingMethods = 0 is simpl check this implementation later data.ShippingCountries = data.ShippingCountries.Where(x => checkout.Basket.shippingMethods.Any(y => y.CountryCode == x.TwoLetterIsoCode) || checkout.Basket.shippingMethods.Count() == 0).Distinct().ToList(); var model = new CheckoutViewModel { Checkout = checkout, Register = new RegistrationModel(), Login = new LoginViewModel(), BillingCountries = data.BillingCountries, ShippingCountries = data.ShippingCountries, CurrentDate = DateTime.Today.Date.AddDays(1) }; if (_sessionContext.CurrentUser == null) { model.RegistrationPrompt = Convert.ToBoolean(_sessionContext.CurrentSiteConfig.BasketSettings.RegistrationPrompt); } string returnUrl = string.Empty; //So that the user can be referred back to where they were when they click logon if (Request.UrlReferrer != null) { returnUrl = Server.UrlEncode(Request.UrlReferrer.PathAndQuery); } //if (Url.IsLocalUrl(returnUrl) && !string.IsNullOrEmpty(returnUrl)) if (!string.IsNullOrEmpty(returnUrl)) { TempData["ReturnURL"] = returnUrl; } if (_sessionContext.CurrentUser == null) { if (Guid.Parse(checkout.CustomerId) != Guid.Empty) { var customerresult = _customerRepository.GetUserdetailsById <CustomerDetailModel>(checkout.CustomerId); if (customerresult != null) { checkout.Email = customerresult.Result.Email; checkout.CompanyId = customerresult.Result.CompanyId; } } else { _checkoutApi.UpdateUserToBasket(checkout.BasketId, Guid.Empty.ToString()); checkout.Stage = BasketStage.Anonymous.GetHashCode(); } SetDataLayerVariables(response.Result?.Basket, WebhookEventTypes.CheckoutStarted); return(model); } model.Checkout.CustomerId = _sessionContext.CurrentUser.UserId.ToString(); model.Checkout.Email = _sessionContext.CurrentUser.Email; var WishlistResponse = _customerRepository.GetWishlist(model.Checkout.CustomerId, true); model.Checkout.WishlistProducts = WishlistResponse.Result; SetDataLayerVariables(response.Result?.Basket, WebhookEventTypes.CheckoutStarted); return(model); }
public ActionResult GetBillingCountries() { var result = _configApi.GetConfig(); return(JsonSuccess(result.Result.BillingCountries, JsonRequestBehavior.AllowGet)); }