protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!IsPostBack) { BindPricingGroups(); if (!string.IsNullOrWhiteSpace(CustomerId)) { pnlPassword.Visible = false; pnlConfirmPassword.Visible = false; blkUserProfile.Visible = true; lnkDnnUserProfile.NavigateUrl = HccUrlBuilder.RouteHccUrl(HccRoute.EditUserProfile, new { userId = CustomerId }); colCustomerHistory.Visible = true; if (!string.IsNullOrEmpty(ReturnUrl) && ReturnUrl == "Y") { lnkBacktoAbandonedCartsReport.Visible = true; lnkBacktoAbandonedCartsReport.NavigateUrl = "~/DesktopModules/Hotcakes/Core/Admin/reports/AbandonedCarts/view.aspx"; } else { lnkBacktoAbandonedCartsReport.Visible = false; } LoadUser(); LoadOrders(); LoadSearchResults(); LoadWishList(); } } }
private Product ParseProductFromSlug(string slug) { Product result = null; if (!string.IsNullOrEmpty(slug)) { result = HccApp.CatalogServices.Products.FindBySlug(slug); if (result == null || result.Status == ProductStatus.Disabled) { // Check for custom URL var url = HccApp.ContentServices.CustomUrls.FindByRequestedUrl(slug, CustomUrlType.Product); if (url != null) { var redirectUrl = HccUrlBuilder.RouteHccUrl(HccRoute.ProductReview, new { slug = url.RedirectToUrl }); if (url.IsPermanentRedirect) { Response.RedirectPermanent(redirectUrl); } else { Response.Redirect(redirectUrl); } } StoreExceptionHelper.ShowInfo(Localization.GetString("ProductNotFound")); } } return(result); }
public override bool ProcessCheckout(OrderTaskContext context) { if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null) { try { var settings = new MyPaymentMethodSettings(); var methodSettings = context.HccApp.CurrentStore.Settings.MethodSettingsGet(PaymentMethodId); settings.Merge(methodSettings); // Here you can do custom processing of your payment. // It can be direct post to payment service or redirection to hosted payment page // In either case you have to end up on HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment) page // So either you have to do such redirect here on your own // or make sure that third party hosted pay page will make it in case of successfull or failed payment HttpContextBase httpContext = new HccHttpContextWrapper(HttpContext.Current); httpContext.Response.Redirect(HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment)); } catch (Exception ex) { EventLog.LogEvent("My Custom Checkout", "Exception occurred during call to Moneris: " + ex, EventLogSeverity.Error); context.Errors.Add(new WorkflowMessage("My Custom Checkout Error", GlobalLocalization.GetString("MonerisCheckoutError"), true)); return(false); } } return(false); }
private void AddProductToCart() { /* * Example based on the code at the following documentation page: * * https://hotcakescommerce.zendesk.com/hc/en-us/articles/204725889-Add-a-Product-to-Cart-Programmatically * */ // create a reference to the Hotcakes store var HccApp = HccAppHelper.InitHccApp(); // find the first product returned that doesn't have options or variants if (product == null) { GetProductFromTheStore(); } // set the quantity var quantity = 1; // create a reference to the current shopping cart Order currentCart = HccApp.OrderServices.EnsureShoppingCart(); // create a line item for the cart using the product LineItem li = product.ConvertToLineItem(HccApp, quantity, new OptionSelections()); // add the line item to the current cart HccApp.AddToOrderWithCalculateAndSave(currentCart, li); // send the customer to the shopping cart page Response.Redirect(HccUrlBuilder.RouteHccUrl(HccRoute.Cart)); }
public static string BuildUrlForProduct(Product p, object additionalParams = null) { var parameters = Merge(new { slug = p.UrlSlug }, additionalParams); var routeValues = new RouteValueDictionary(parameters); return(HccUrlBuilder.RouteHccUrl(HccRoute.Product, routeValues)); }
private ProductPageViewModel LoadProductModel(string slug) { CustomUrl customUrl; var product = HccApp.ParseProductBySlug(slug, out customUrl); if (customUrl != null && !IsConcreteItemModule) { var redirectUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Product, new { slug = customUrl.RedirectToUrl }); if (customUrl.IsPermanentRedirect) { Response.RedirectPermanent(redirectUrl); } else { Response.Redirect(redirectUrl); } } if (product == null) { StoreExceptionHelper.ShowInfo(Localization.GetString("ProductNotFound")); } else if (product.Status != ProductStatus.Active) { StoreExceptionHelper.ShowInfo(Localization.GetString("ProductNotActive")); } else if (!HccApp.CatalogServices.TestProductAccess(product)) { StoreExceptionHelper.ShowInfo(Localization.GetString("ProductNotEnoughPermission")); } var model = new ProductPageViewModel { LocalProduct = product }; LoadImageUrls(model); model.Prices = CreateProductPrices(product); LoadRelatedItems(model); LoadBundledItems(model); model.IsAvailableForWishList = SessionManager.IsUserAuthenticated(HccApp); model.AllowReviews = product.AllowReviews.HasValue ? product.AllowReviews.Value : HccApp.CurrentStore.Settings.AllowProductReviews; LoadAlternateImages(model); model.PreRenderedTypeValues = product.RenderTypeProperties(); model.SwatchHtml = ImageHelper.GenerateSwatchHtmlForProduct(product, HccApp); model.LineItemId = Request.QueryString["LineItemId"].ConvertToNullable <long>(); // make the minimum quantity be the new default if necessary, otherwise use the actual default (1) if (product.MinimumQty > 0) { model.Quantity = product.MinimumQty; } LoadGiftCardAmounts(model); return(model); }
private SitemapUrl GetPageUrl(Product product) { var pageUrl = new SitemapUrl(); pageUrl.Url = HccUrlBuilder.RouteHccUrl(HccRoute.Product, new { slug = product.UrlSlug }); pageUrl.Priority = 0.5F; pageUrl.LastModified = product.LastUpdated; pageUrl.ChangeFrequency = SitemapChangeFrequency.Daily; return(pageUrl); }
public static string BuildUrlForProductAddToCart(Product p) { if (p.HasOptions() || p.IsGiftCard) { return(string.Empty); } var route = string.Format(CART_ROUTE_FORMAT, HccUrlBuilder.RouteHccUrl(HccRoute.Cart), p.Sku); return(route); }
protected JournalItem EnsureJournalItem(Product product, bool updateExisting = false) { var journalTypeId = EnsureJournalType(JORNALTYPE_PRODUCTADD); var dnnUser = DnnUserController.Instance.GetCurrentUserInfo(); var dnnUserId = dnnUser != null ? dnnUser.UserID : CurrentPortalSettings.AdministratorId; var jItem = ServiceLocator <IJournalController, JournalController> .Instance.GetJournalItemByKey( CurrentPortalSettings.PortalId, product.Bvin); if (jItem != null && !updateExisting) { return(jItem); } var isCreateRequired = false; if (jItem == null) { jItem = new JournalItem { JournalTypeId = journalTypeId, ObjectKey = product.Bvin, PortalId = CurrentPortalSettings.PortalId }; isCreateRequired = true; } var contentItemId = EnsureProductContentItem(product, jItem.ContentItemId); jItem.ContentItemId = contentItemId; jItem.Title = product.ProductName; jItem.Summary = product.MetaDescription; jItem.UserId = dnnUserId; jItem.ItemData = new ItemData { Title = product.ProductName, Url = HccUrlBuilder.RouteHccUrl(HccRoute.Product, new { slug = product.UrlSlug }) }; #pragma warning disable 618 if (isCreateRequired) { ServiceLocator <IJournalController, JournalController> .Instance.SaveJournalItem(jItem, Null.NullInteger); } else { ServiceLocator <IJournalController, JournalController> .Instance.UpdateJournalItem(jItem, Null.NullInteger); } #pragma warning restore 618 return(jItem); }
public override void LoadData() { var settings = new MonerisSettings(); var methodSettings = HccApp.CurrentStore.Settings.MethodSettingsGet(MethodId); settings.Merge(methodSettings); txtHostedPayPageId.Text = settings.HostedPayPageId; txtHostedPayPageToken.Text = settings.HostedPayPageToken; chkDeveloperMode.Checked = settings.DeveloperMode; chkDebugMode.Checked = settings.DebugMode; lblUrl.Text = HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment); }
public static string BuildUrlForCategory(CategorySnapshot c, string pageNumber, object additionalParams = null) { if (c.SourceType == CategorySourceType.CustomLink) { if (c.CustomPageUrl != string.Empty) { return(c.CustomPageUrl); } } var parameters = Merge(new { slug = c.RewriteUrl, page = pageNumber }, additionalParams); var routeValues = new RouteValueDictionary(parameters); return(HccUrlBuilder.RouteHccUrl(HccRoute.Category, routeValues)); }
private CategoryPageViewModel LoadCategoryModel(string slug, string preContentColumnId, string postContentColumnId) { Category cat = null; if (!string.IsNullOrWhiteSpace(slug)) { CustomUrl customUrl; cat = HccApp.ParseCategoryBySlug(slug, out customUrl); if (customUrl != null && !IsConcreteItemModule) { var redirectUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Category, new { slug = customUrl.RedirectToUrl }); if (customUrl.IsPermanentRedirect) { Response.RedirectPermanent(redirectUrl); } else { Response.Redirect(redirectUrl); } } if (cat == null) { StoreExceptionHelper.ShowInfo(Localization.GetString("CategoryNotFound")); } else if (!HccApp.CatalogServices.TestCategoryAccess(cat)) { StoreExceptionHelper.ShowInfo(Localization.GetString("CategoryNotEnoughPermission")); } } else { cat = new Category { Bvin = string.Empty, PreContentColumnId = preContentColumnId, PostContentColumnId = postContentColumnId }; } return(new CategoryPageViewModel { LocalCategory = cat }); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { // do base action first to ensure we have our context objects like hccApp base.OnActionExecuting(filterContext); if (filterContext.Controller is BaseStoreController) { var app = ((BaseStoreController)filterContext.Controller).HccApp; if (app != null) { if (!SessionManager.IsUserAuthenticated(app)) { var url = HccUrlBuilder.RouteHccUrl(HccRoute.Login, new { returnUrl = filterContext.HttpContext.Request.RawUrl }); filterContext.HttpContext.Response.Redirect(url); } } } }
private void LoadOrders(OrderHistoryViewModel model) { var pageSize = 20; var totalCount = 0; var pageNumber = GetPageNumber(); // pull all Orders model.Orders = HccApp.OrderServices.Orders.FindByUserId(HccApp.CurrentCustomerId, pageNumber, pageSize, ref totalCount); model.PagerData = new PagerViewModel { PageSize = pageSize, TotalItems = totalCount, CurrentPage = pageNumber, PagerUrlFormat = HccUrlBuilder.RouteHccUrl(HccRoute.OrderHistory, new { page = "{0}" }), PagerUrlFormatFirst = HccUrlBuilder.RouteHccUrl(HccRoute.OrderHistory) }; }
private void RenderFacebookMetaTags(ProductPageViewModel model) { if (ViewBag.UseFaceBook) { var faceBookAdmins = HccApp.CurrentStore.Settings.FaceBook.Admins; var faceBookAppId = HccApp.CurrentStore.Settings.FaceBook.AppId; var canonicalUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Product, new { slug = model.LocalProduct.UrlSlug.ToLower() }); var currencyInfo = HccApp.GlobalizationServices.Countries.FindAllForCurrency() .FirstOrDefault(c => c.CultureCode == HccApp.CurrentStore.Settings.CurrencyCultureCode); var sb = new StringBuilder(); sb.AppendFormat(Constants.TAG_CANONICAL, canonicalUrl); sb.AppendFormat(Constants.TAG_OGTITLE, PageTitle); sb.Append(Constants.TAG_OGTYPE); sb.AppendFormat(Constants.TAG_OGURL, ViewBag.CurrentUrl); sb.AppendFormat(Constants.TAG_OGIMAGE, model.ImageUrls.MediumlUrl); sb.AppendFormat(Constants.TAG_IOGPRICEAMOUNT, model.Prices.SitePrice.Text); // TODO: Replace this with ISO 4217-3 currency code // // This will require: // - Adding the necessary column to hcc_Countries table // - Updating the upgrade script to include the official currency codes for all out of the box currencies // - Adding the necessary column to DAL classes (updating EF) // - Adding the currency to the Settings > Countries admin view to edit // // Documentation: // https://developers.facebook.com/docs/payments/product // https://developers.pinterest.com/rich_pins_product/ // http://www.nationsonline.org/oneworld/currencies.htm sb.AppendFormat(Constants.TAG_IOGPRICECURRENCY, currencyInfo.IsoAlpha3); sb.AppendFormat(Constants.TAG_OGSITENAME, ViewBag.StoreName); sb.AppendFormat(Constants.TAG_OGFBADMIN, faceBookAdmins); sb.AppendFormat(Constants.TAG_OGFBAPPID, faceBookAppId); RenderToHead("FaceBookMetaTags", sb.ToString()); } }
private void RenderFacebookMetaTags(CategoryPageViewModel model) { if (ViewBag.UseFaceBook) { var faceBookAdmins = HccApp.CurrentStore.Settings.FaceBook.Admins; var faceBookAppId = HccApp.CurrentStore.Settings.FaceBook.AppId; var canonicalUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Category, new { slug = model.LocalCategory.RewriteUrl.ToLower() }); var sb = new StringBuilder(); sb.AppendFormat(Constants.TAG_CANONICAL, canonicalUrl); sb.AppendFormat(Constants.TAG_OGTITLE, PageTitle); sb.Append(Constants.TAG_OGTYPE); sb.AppendFormat(Constants.TAG_OGURL, canonicalUrl); sb.AppendFormat(Constants.TAG_OGIMAGE, model.LocalCategory.ImageUrl); sb.AppendFormat(Constants.TAG_OGSITENAME, ViewBag.StoreName); sb.AppendFormat(Constants.TAG_OGFBADMIN, faceBookAdmins); sb.AppendFormat(Constants.TAG_OGFBAPPID, faceBookAppId); RenderToHead("FaceBookMetaTags", sb.ToString()); } }
public List <MenuNode> ManipulateNodes(List <MenuNode> nodes, DotNetNuke.Entities.Portals.PortalSettings portalSettings) { MenuNode categoriesMenu = new MenuNode { Text = "Product Categories" }; nodes.Insert(0, categoriesMenu); //Find Categories to Display in Menu HotcakesApplication hccApp = HccAppHelper.InitHccApp(); List <CategorySnapshot> categories = hccApp.CatalogServices.Categories.FindForMainMenu(); foreach (CategorySnapshot category in categories) { string url = HccUrlBuilder.RouteHccUrl(HccRoute.Category, new { slug = category.RewriteUrl }); categoriesMenu.Children.Add(new MenuNode { Text = category.Name, Url = url, Enabled = true, Parent = categoriesMenu }); } return(nodes); }
public override bool ProcessCheckout(OrderTaskContext context) { if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null) { try { PayPalAPI ppAPI = Utilities.PaypalExpressUtilities.GetPaypalAPI(context.HccApp.CurrentStore); string cartReturnUrl = HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment, null, Uri.UriSchemeHttps); string cartCancelUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Checkout, null, Uri.UriSchemeHttps); EventLog.LogEvent("PayPal Express Checkout", "CartCancelUrl=" + cartCancelUrl, EventLogSeverity.Information); EventLog.LogEvent("PayPal Express Checkout", "CartReturnUrl=" + cartReturnUrl, EventLogSeverity.Information); PaymentActionCodeType mode = PaymentActionCodeType.Authorization; if (!context.HccApp.CurrentStore.Settings.PayPal.ExpressAuthorizeOnly) { mode = PaymentActionCodeType.Sale; } // Accelerated boarding if (string.IsNullOrWhiteSpace(context.HccApp.CurrentStore.Settings.PayPal.UserName)) { mode = PaymentActionCodeType.Sale; } var solutionType = context.HccApp.CurrentStore.Settings.PayPal.RequirePayPalAccount ? SolutionTypeType.Mark : SolutionTypeType.Sole; bool isNonShipping = !context.Order.HasShippingItems; bool addressSupplied = false; if (context.Inputs["ViaCheckout"] != null && context.Inputs["ViaCheckout"].Value == "1") { addressSupplied = true; context.Order.CustomProperties.Add("hcc", "ViaCheckout", "1"); } PaymentDetailsItemType[] itemsDetails = GetOrderItemsDetails(context); SetExpressCheckoutResponseType expressResponse; if (addressSupplied) { Contacts.Address address = context.Order.ShippingAddress; // in some cases, this logic will be hit with non-shipping orders, causing an exception if (address == null || string.IsNullOrEmpty(address.Bvin)) { // this is a workaround for that use case address = context.Order.BillingAddress; } if (address.CountryData != null) { var itemsTotalWithoutTax = context.Order.TotalOrderAfterDiscounts; if (context.HccApp.CurrentStore.Settings.ApplyVATRules) { itemsTotalWithoutTax -= context.Order.ItemsTax; } string itemsTotal = itemsTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture); string taxTotal = context.Order.TotalTax.ToString("N", CultureInfo.InvariantCulture); var shippingTotalWithoutTax = context.Order.TotalShippingAfterDiscounts; if (context.HccApp.CurrentStore.Settings.ApplyVATRules) { shippingTotalWithoutTax -= context.Order.ShippingTax; } string shippingTotal = shippingTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture); string orderTotal = context.Order.TotalGrand.ToString("N", CultureInfo.InvariantCulture); expressResponse = ppAPI.SetExpressCheckout( itemsDetails, itemsTotal, taxTotal, shippingTotal, orderTotal, cartReturnUrl, cartCancelUrl, mode, PayPalAPI.GetCurrencyCodeType(context.HccApp.CurrentStore.Settings.PayPal.Currency), solutionType, address.FirstName + " " + address.LastName, address.CountryData.IsoCode, address.Line1, address.Line2, address.City, address.RegionBvin, address.PostalCode, address.Phone, context.Order.OrderNumber + Guid.NewGuid().ToString(), isNonShipping); if (expressResponse == null) { EventLog.LogEvent("PayPal Express Checkout", "Express Response Was Null!", EventLogSeverity.Error); } } else { EventLog.LogEvent("StartPaypalExpressCheckout", "Country with bvin " + address.CountryBvin + " was not found.", EventLogSeverity.Error); return(false); } } else { decimal includedTax = 0; if (context.HccApp.CurrentStore.Settings.ApplyVATRules) { includedTax = context.Order.ItemsTax; } string taxTotal = includedTax.ToString("N", CultureInfo.InvariantCulture); var itemsTotalWithoutTax = context.Order.TotalOrderAfterDiscounts; if (context.HccApp.CurrentStore.Settings.ApplyVATRules) { itemsTotalWithoutTax -= context.Order.ItemsTax; } string itemsTotal = itemsTotalWithoutTax.ToString("N", CultureInfo.InvariantCulture); string orderTotal = context.Order.TotalOrderAfterDiscounts.ToString("N", CultureInfo.InvariantCulture); expressResponse = ppAPI.SetExpressCheckout(itemsDetails, itemsTotal, taxTotal, orderTotal, cartReturnUrl, cartCancelUrl, mode, PayPalAPI.GetCurrencyCodeType(context.HccApp.CurrentStore.Settings.PayPal.Currency), solutionType, context.Order.OrderNumber + Guid.NewGuid().ToString(), isNonShipping); if (expressResponse == null) { EventLog.LogEvent("PayPal Express Checkout", "Express Response2 Was Null!", EventLogSeverity.Error); } } if (expressResponse.Ack == AckCodeType.Success || expressResponse.Ack == AckCodeType.SuccessWithWarning) { context.Order.ThirdPartyOrderId = expressResponse.Token; // Recording of this info is handled on the paypal express // checkout page instead of here. //Orders.OrderPaymentManager payManager = new Orders.OrderPaymentManager(context.Order); //payManager.PayPalExpressAddInfo(context.Order.TotalGrand, expressResponse.Token); EventLog.LogEvent("PayPal Express Checkout", "Response SUCCESS", EventLogSeverity.Information); Orders.OrderNote note = new Orders.OrderNote(); note.IsPublic = false; note.Note = "Paypal Order Accepted With Paypal Order Number: " + expressResponse.Token; context.Order.Notes.Add(note); if (context.HccApp.OrderServices.Orders.Update(context.Order)) { string urlTemplate; if (string.Compare(context.HccApp.CurrentStore.Settings.PayPal.Mode, "Live", true) == 0) { urlTemplate = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}"; } else { urlTemplate = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}"; } HttpContextBase httpContext = new HccHttpContextWrapper(HttpContext.Current); httpContext.Response.Redirect(string.Format(urlTemplate, expressResponse.Token), true); } return(true); } else { foreach (ErrorType ppError in expressResponse.Errors) { context.Errors.Add(new WorkflowMessage(ppError.ErrorCode, ppError.ShortMessage, true)); //create a note to save the paypal error info onto the order Orders.OrderNote note = new Orders.OrderNote(); note.IsPublic = false; note.Note = "Paypal error number: " + ppError.ErrorCode + " Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage; context.Order.Notes.Add(note); EventLog.LogEvent("Paypal error number: " + ppError.ErrorCode, "Paypal Error: '" + ppError.ShortMessage + "' Message: '" + ppError.LongMessage + "' " + " Values passed to SetExpressCheckout: Total=" + string.Format("{0:c}", context.Order.TotalOrderBeforeDiscounts) + " Cart Return Url: " + cartReturnUrl + " Cart Cancel Url: " + cartCancelUrl, EventLogSeverity.Error); } context.Errors.Add(new WorkflowMessage("Paypal checkout error", GlobalLocalization.GetString("PaypalCheckoutCustomerError"), true)); return(false); } } catch (Exception ex) { EventLog.LogEvent("Paypal Express Checkout", "Exception occurred during call to Paypal: " + ex.ToString(), EventLogSeverity.Error); context.Errors.Add(new WorkflowMessage("Paypal checkout error", GlobalLocalization.GetString("PaypalCheckoutCustomerError"), true)); return(false); } } return(false); }
public override bool ProcessCheckout(OrderTaskContext context) { if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null) { try { var settings = new OgoneSettings(); var methodSettings = context.HccApp.CurrentStore.Settings.MethodSettingsGet(PaymentMethodId); settings.Merge(methodSettings); var order = context.Order; var decimalAmount = order.TotalGrandAfterStoreCredits(context.HccApp.OrderServices); var intAmount = (int)(decimalAmount * 100); var parameters = new NameValueCollection(); parameters.Add("PSPID", settings.PaymentServiceProviderId); // We can't use order.bvin here because Ogone won't allow us try to pay failed order again parameters.Add("ORDERID", "order" + DateTime.UtcNow.Ticks); parameters.Add("AMOUNT", intAmount.ToString()); var regionInfo = new RegionInfo(context.HccApp.CurrentStore.Settings.CurrencyCultureCode); parameters.Add("CURRENCY", regionInfo.ISOCurrencySymbol); var language = CultureInfo.CurrentCulture.Name.Replace("-", "_"); parameters.Add("LANGUAGE", language); parameters.Add("EMAIL", order.UserEmail); var address = order.BillingAddress; parameters.Add("CN", string.Join(" ", address.FirstName, address.LastName)); parameters.Add("OWNERADDRESS", string.Join(", ", address.Line2, address.Line1)); parameters.Add("OWNERZIP", address.PostalCode); parameters.Add("OWNERTOWN", address.City); parameters.Add("OWNERCTY", address.CountryDisplayName); parameters.Add("OWNERTELNO", address.Phone); parameters.Add("OPERATION", "SAL"); if (!string.IsNullOrWhiteSpace(settings.TemplatePage)) { parameters.Add("TP", settings.TemplatePage); } var returnUrl = HccUrlBuilder.RouteHccUrl(HccRoute.ThirdPartyPayment); var cancelUrl = HccUrlBuilder.RouteHccUrl(HccRoute.Checkout); parameters.Add("ACCEPTURL", returnUrl); parameters.Add("DECLINEURL", returnUrl); parameters.Add("EXCEPTIONURL", returnUrl); parameters.Add("CANCELURL", cancelUrl); var shaSign = OgoneUtils.CalculateShaHash(parameters, settings.HashAlgorithm, settings.ShaInPassPhrase); parameters.Add("SHASIGN", shaSign); HttpContextBase httpContext = new HccHttpContextWrapper(HttpContext.Current); var url = settings.DeveloperMode ? DevelopmentUTF8Url : ProductionUTF8Url; var urlParams = Url.BuldQueryString(parameters); if (settings.DebugMode) { EventLog.LogEvent("Ogone Checkout", urlParams, EventLogSeverity.Debug); } var urlTemplate = "{0}?{1}"; httpContext.Response.Redirect(string.Format(urlTemplate, url, urlParams), true); } catch (Exception ex) { EventLog.LogEvent("Ogone Checkout", "Exception occurred during call to Ogone: " + ex, EventLogSeverity.Error); context.Errors.Add(new WorkflowMessage("Ogone Checkout Error", GlobalLocalization.GetString("OgoneCheckoutError"), true)); return(false); } } return(false); }
private void LoadAffiliate() { var aff = HccApp.ContactServices.Affiliates.Find(AffiliateId.Value); if (aff != null) { var dnnUserDeleted = aff.UserId < 0; chkEnabled.Checked = aff.Enabled; chkApproved.Checked = aff.Approved; txtUsername.Text = aff.Username; txtEmail.Text = aff.Email; txtAffiliateID.Text = aff.AffiliateId; txtReferralId.Text = aff.ReferralAffiliateId; lstCommissionType.ClearSelection(); switch (aff.CommissionType) { case AffiliateCommissionType.PercentageCommission: lstCommissionType.SelectedValue = "1"; break; case AffiliateCommissionType.FlatRateCommission: case AffiliateCommissionType.None: lstCommissionType.SelectedValue = "2"; break; default: lstCommissionType.SelectedValue = "1"; break; } CommissionAmountField.Text = aff.CommissionAmount.ToString("N"); txtReferralDays.Text = aff.ReferralDays.ToString(); TaxIdField.Text = aff.TaxId; DriversLicenseField.Text = aff.DriversLicenseNumber; WebsiteUrlField.Text = aff.WebSiteUrl; NotesTextBox.Text = aff.Notes; if (!string.IsNullOrEmpty(aff.AffiliateId)) { SampleUrlLabel.Text = HccApp.CurrentStore.RootUrl() + "?" + WebAppSettings.AffiliateQueryStringName + "=" + aff.AffiliateId; } ucAddress.LoadFromAddress(aff.Address); txtUsername.Enabled = false; divPassword.Visible = false; divPassword2.Visible = false; lnkDnnUserProfile.Visible = !dnnUserDeleted; lnkDnnUserProfile.NavigateUrl = HccUrlBuilder.RouteHccUrl(HccRoute.EditUserProfile, new { userId = aff.UserId }); if (aff.Approved) { chkApproved.Enabled = false; } if (dnnUserDeleted) { btnSaveChanges.Visible = false; } } }
protected void btnUninstall_Click(object sender, EventArgs e) { HotcakesController.Uninstall(chkDeleteModuleFiles.Checked, chkDeleteStoreFiles.Checked); Response.Redirect(HccUrlBuilder.RouteHccUrl(HccRoute.Home)); }