protected void Page_Load(object sender, EventArgs e) { this.pnlWhatsNew.Visible = CommerceConfiguration.Get().Core.ShowWhatsNew; if (!this.Page.IsPostBack) { if (DataHelper.GetIntFromQueryString("c", -1) > 0) { this.SetupForCategory(); } else { this.NoCategory(); } } if (base.CurrentProductCategory != null) { this.lblTitle.Text = base.CurrentProductCategory.CategoryName; } else { this.lblTitle.Text = Properties.Resources.Products_All; } this.Page.Title = SueetieContext.Current.SiteSettings.SiteName + " : " + this.lblTitle.Text; }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { this.Visible = false; return; } // if not in test mode hide this warning if (!commerceConfig.PaymentGatewayUseTestMode) { this.Visible = false; return; } this.CssClass = "txterror warning commercewarning"; this.Text = Resource.CommerceTestModeWarning; //this.Style.Add(HtmlTextWriterStyle.FontSize, "large"); this.Style.Add(HtmlTextWriterStyle.FontWeight, "bold"); this.Style.Add(HtmlTextWriterStyle.Color, "red"); }
private void LoadSettings() { ScriptConfig.IncludeColorBox = true; storeCountry = new GeoCountry(siteSettings.DefaultCountryGuid); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); commerceConfig = SiteUtils.GetCommerceConfig(); store = StoreHelper.GetStore(); if (store == null) { return; } cart = StoreHelper.GetClerkCart(store); tblCountryList = GeoCountry.GetList(); if (WebUser.IsInRoles(siteSettings.RolesThatCanLookupUsers)) { SetupSelectUserScript(); //lnkUserLookup.Visible = true; lnkUserSearch.Visible = true; } AddClassToBody("webstore admincheckout"); }
private void SetupMarks() { if (commerceConfig == null) { commerceConfig = SiteUtils.GetCommerceConfig(); } if (commerceConfig == null) { return; } if (commerceConfig.CanProcessStandardCards) { SetupStandardCards(); } // we already have a button for paypal if its enabled and this is sufficient for an acceptance mark if (commerceConfig.PayPalIsEnabled) { SetupPayPal(); } if (commerceConfig.GoogleCheckoutIsEnabled) { SetupGoogleMark(); } }
private void LoadSettings() { IsAdminOrContentAdmin = WebUser.IsAdminOrContentAdmin; IsAdmin = WebUser.IsAdmin; isSiteEditor = SiteUtils.UserIsSiteEditor(); isCommerceReportViewer = WebUser.IsInRoles(siteSettings.CommerceReportViewRoles); commerceConfig = SiteUtils.GetCommerceConfig(); }
private void LoadSettings() { IsAdminOrContentAdmin = WebUser.IsAdminOrContentAdmin; IsAdmin = WebUser.IsAdmin; isSiteEditor = SiteUtils.UserIsSiteEditor(); isCommerceReportViewer = WebUser.IsInRoles(siteSettings.CommerceReportViewRoles); commerceConfig = SiteUtils.GetCommerceConfig(); AddClassToBody("administration"); AddClassToBody("adminmenu"); }
public CommerceControllerActivator(CommerceConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } this.configuration = configuration; // Create Singletons this.userContext = new AspNetUserContextAdapter(); this.timeProvider = new DefaultTimeProvider(); }
private void LoadSettings() { commerceConfig = SiteUtils.GetCommerceConfig(); store = StoreHelper.GetStore(); if (store == null) { return; } //currencyCulture = ResourceHelper.GetCurrencyCulture(store.DefaultCurrency); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if (productGuid != Guid.Empty) { product = new Product(productGuid); //offerPrice = offer.Price; } Hashtable Settings = ModuleSettings.GetModuleSettings(moduleId); enableRatingComments = WebUtils.ParseBoolFromHashtable( Settings, "EnableRatingCommentsSetting", enableRatingComments); teaserFileBaseUrl = WebUtils.GetSiteRoot() + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/webstoreproductpreviewfiles/"; if (displaySettings.UsejPlayerForMediaTeasers) { ScriptConfig.IncludejPlayer = true; ScriptConfig.IncludejPlayerPlaylist = true; } else { ScriptConfig.IncludeYahooMediaPlayer = true; } if (pageId > -1) { PageSettings pageSettings = new PageSettings(SiteId, pageId); if (pageSettings != null && !String.IsNullOrWhiteSpace(pageSettings.BodyCssClass)) { AddClassToBody(pageSettings.BodyCssClass.Replace("temp-ws-hide", string.Empty)); } } AddClassToBody("webstore webstoreproductdetail"); }
private void LoadSettings() { store = StoreHelper.GetStore(); if (store == null) { return; } canEdit = UserCanEditModule(moduleId, Store.FeatureGuid); timeOffset = SiteUtils.GetUserTimeOffset(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } orderGuid = WebUtils.ParseGuidFromQueryString("orderid", orderGuid); if (orderGuid == Guid.Empty) { orderGuid = WebUtils.ParseGuidFromQueryString("order", orderGuid); } if (orderGuid != Guid.Empty) { order = new Order(orderGuid); if (order.StoreGuid != store.Guid) { order = null; } if ((order.StatusGuid == OrderStatus.OrderStatusCancelledGuid) || (order.StatusGuid == OrderStatus.OrderStatusNoneGuid)) { order = null; } } commerceConfig = SiteUtils.GetCommerceConfig(); if (commerceConfig == null) { commerceConfig = new CommerceConfiguration(siteSettings); } AddClassToBody("webstore webstoreorderdetail"); }
private void LoadSettings() { store = StoreHelper.GetStore(); if (store == null) { return; } commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } if (StoreHelper.UserHasCartCookie(store.Guid)) { cart = StoreHelper.GetCart(); if (cart != null) { cartOffers = cart.GetOffers(); canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); if (cart.LastModified < DateTime.UtcNow.AddDays(-1) && cart.DiscountCodesCsv.Length > 0) { StoreHelper.EnsureValidDiscounts(store, cart); } if (cart.UserGuid == Guid.Empty && siteUser != null) { cart.UserGuid = siteUser.UserGuid; cart.Save(); } cart.RefreshTotals(); } } ConfigureCheckoutButtons(); AddClassToBody("webstore webstorecheckout"); }
private void LoadSettings() { commerceConfig = SiteUtils.GetCommerceConfig(); store = StoreHelper.GetStore(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if ((store != null) && (offerGuid != Guid.Empty)) { offer = new Offer(offerGuid); offerPrice = offer.Price; } teaserFileBaseUrl = WebUtils.GetSiteRoot() + "/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/webstoreproductpreviewfiles/"; AddClassToBody("webstore webstoreofferdetail"); }
public override bool HandleRequest( WorldPayPaymentResponse wpResponse, PayPalLog worldPayLog, Page page) { bool result = false; if (worldPayLog.SerializedObject.Length == 0) { return(result); } Cart cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), worldPayLog.SerializedObject); Store store = new Store(cart.StoreGuid); //SiteSettings siteSettings = new SiteSettings(store.SiteGuid); config = SiteUtils.GetCommerceConfig(); switch (wpResponse.TransStatus) { case "Y": //success ProcessOrder(cart, store, wpResponse, worldPayLog, page); result = true; break; case "C": // cancelled default: ProcessCancellation(cart, store, wpResponse, worldPayLog, page); break; } return(result); }
private void SetupMarks() { if (commerceConfig == null) { commerceConfig = SiteUtils.GetCommerceConfig(); } if (commerceConfig == null) { return; } if (commerceConfig.CanProcessStandardCards) { SetupStandardCards(); } // we already have a button for paypal if its enabled and this is sufficient for an acceptance mark if (commerceConfig.PayPalIsEnabled) { SetupPayPal(); } }
public override string HandleRequestAndReturnUrlForRedirect( HttpContext context, string payPalToken, string payPalPayerId, PayPalLog setExpressCheckoutLog) { string redirectUrl = string.Empty; if ((payPalToken == null) || (payPalToken.Length == 0)) { log.Error("WebStorePayPalReturnHandler received empty payPalToken"); return(redirectUrl); } if (setExpressCheckoutLog == null) { log.Error("WebStorePayPalReturnHandler received null setExpressCheckoutLog for payPalToken " + payPalToken); return(redirectUrl); } if (setExpressCheckoutLog.SerializedObject.Length == 0) { log.Error("WebStorePayPalReturnHandler cart was not previously serialized for payPalToken " + payPalToken); return(redirectUrl); } if (setExpressCheckoutLog.CreatedUtc.AddHours(4) < DateTime.UtcNow) { log.Error("payPalToken " + payPalToken + " was more than 4 hours old, it should expire after 3 hours "); return(redirectUrl); } CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig(); PayPalExpressGateway gateway = new PayPalExpressGateway( commerceConfig.PayPalAPIUsername, commerceConfig.PayPalAPIPassword, commerceConfig.PayPalAPISignature, commerceConfig.PayPalStandardEmailAddress); gateway.UseTestMode = commerceConfig.PaymentGatewayUseTestMode; gateway.PayPalToken = payPalToken; gateway.PayPalPayerId = payPalPayerId; Cart savedCart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), setExpressCheckoutLog.SerializedObject); savedCart.DeSerializeCartOffers(); string siteRoot = SiteUtils.GetNavigationSiteRoot(); gateway.MerchantCartId = savedCart.CartGuid.ToString(); gateway.ChargeTotal = savedCart.OrderTotal; gateway.ReturnUrl = siteRoot + "/Services/PayPalReturnHandler.ashx"; gateway.CancelUrl = siteRoot; //gateway.PayPalPayerId = payPalPayerId; gateway.CallGetExpressCheckoutDetails(); PayPalLog payPalLog = new PayPalLog(); payPalLog.ProviderName = WebStorePayPalReturnHandler.ProviderName; payPalLog.SerializedObject = setExpressCheckoutLog.SerializedObject; payPalLog.ReturnUrl = setExpressCheckoutLog.ReturnUrl; payPalLog.RawResponse = gateway.RawResponse; payPalLog.TransactionId = gateway.TransactionId; payPalLog.CurrencyCode = gateway.CurrencyCode; // TODO: add versions to gateways //log.ApiVersion = gateway. payPalLog.CartGuid = savedCart.CartGuid; Store store = new Store(savedCart.StoreGuid); payPalLog.Token = payPalToken; payPalLog.PayerId = payPalPayerId; payPalLog.RequestType = "GetExpressCheckoutDetails"; payPalLog.SiteGuid = store.SiteGuid; payPalLog.StoreGuid = store.Guid; payPalLog.UserGuid = savedCart.UserGuid; // update the order with customer shipping info savedCart.OrderInfo.DeliveryCompany = gateway.ShipToCompanyName; savedCart.OrderInfo.DeliveryAddress1 = gateway.ShipToAddress; savedCart.OrderInfo.DeliveryAddress2 = gateway.ShipToAddress2; savedCart.OrderInfo.DeliveryCity = gateway.ShipToCity; savedCart.OrderInfo.DeliveryFirstName = gateway.ShipToFirstName; savedCart.OrderInfo.DeliveryLastName = gateway.ShipToLastName; savedCart.OrderInfo.DeliveryPostalCode = gateway.ShipToPostalCode; savedCart.OrderInfo.DeliveryState = gateway.ShipToState; savedCart.OrderInfo.DeliveryCountry = gateway.ShipToCountry; //Note that PayPal only returns a phone number if your Merchant accounts is configured to require the // buyer to provide it. if (gateway.ShipToPhone.Length > 0) { savedCart.OrderInfo.CustomerTelephoneDay = gateway.ShipToPhone; } if (gateway.BuyerEmail.Length > 0) { savedCart.OrderInfo.CustomerEmail = gateway.BuyerEmail; } // if customer and billing aren't populated already, user was anonymous when checkout began, make them the same as shipping //if (savedCart.UserGuid == Guid.Empty) //{ //2013-12-23 since all we get is shipping address this can be considered as the same thing as billing address for paypal purposes so always use it // especially because we may need to calculate tax for express checkout // based on the address provided by paypal savedCart.CopyShippingToBilling(); savedCart.CopyShippingToCustomer(); //} GeoCountry country = new GeoCountry(savedCart.OrderInfo.DeliveryCountry); GeoZone taxZone = GeoZone.GetByCode(country.Guid, savedCart.OrderInfo.DeliveryState); savedCart.OrderInfo.TaxZoneGuid = taxZone.Guid; savedCart.OrderInfo.Save(); // refresh totals to calculate tax or shipping now that we have an address savedCart.RefreshTotals(); savedCart.Save(); savedCart.SerializeCartOffers(); payPalLog.SerializedObject = SerializationHelper.SerializeToString(savedCart); payPalLog.Save(); if (gateway.Response == PaymentGatewayResponse.Error) { redirectUrl = siteRoot + "/WebStore/PayPalGatewayError.aspx?plog=" + payPalLog.RowGuid.ToString(); return(redirectUrl); } if (gateway.PayPalPayerId.Length == 0) { redirectUrl = siteRoot + "/WebStore/PayPalGatewayError.aspx?plog=" + payPalLog.RowGuid.ToString(); return(redirectUrl); } int pageId = -1; List <PageModule> pageModules = PageModule.GetPageModulesByModule(store.ModuleId); foreach (PageModule pm in pageModules) { // use first pageid found, really a store should only // be on one page pageId = pm.PageId; break; } // after the CallGetExpressCheckoutDetails // we have the option of directing to a final review page before // calling CallDoExpressCheckoutPayment redirectUrl = siteRoot + "/WebStore/PayPalExpressCheckout.aspx?pageid=" + pageId.ToString(CultureInfo.InvariantCulture) + "&mid=" + store.ModuleId.ToString(CultureInfo.InvariantCulture) + "&plog=" + payPalLog.RowGuid.ToString(); return(redirectUrl); }
private void LoadSettings() { //avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/"); #if!MONO divTimeZone.Visible = true; #endif QuestionRequired.Enabled = siteSettings.RequiresQuestionAndAnswer; AnswerRequired.Enabled = siteSettings.RequiresQuestionAndAnswer; //lnkAvatarUpload.Visible = false; switch (siteSettings.AvatarSystem) { case "gravatar": allowGravatars = true; disableAvatars = false; break; case "internal": allowGravatars = false; disableAvatars = false; if (siteUser != null) { // lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString(); // lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarHeading) + "', this.href, GBCallback)"; lnkAvatarUpld.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString(); } if (WebConfigSettings.AvatarsCanOnlyBeUploadedByAdmin) { //lnkAvatarUpload.Visible = false; lnkAvatarUpld.Visible = false; //lblMaxAvatarSize.Visible = false; //avatarFile.Visible = false; // progressBar.Visible = false; //btnUploadAvatar.Visible = false; // regexAvatarFile.Visible = false; // regexAvatarFile.Enabled = false; avatarHelp.Visible = false; } break; case "none": default: allowGravatars = false; disableAvatars = true; break; } if (displaySettings.OverrideAvatarLabel.Length > 0) { lblAvatar.ConfigKey = displaySettings.OverrideAvatarLabel; } if (displaySettings.HidePostCount) { divForumPosts.Visible = false; } allowUserSkin = ((siteSettings.AllowUserSkins) || ((WebConfigSettings.AllowEditingSkins) && (WebUser.IsInRoles(siteSettings.RolesThatCanManageSkins)))); if (allowUserSkin) { this.divSkin.Visible = true; ScriptConfig.IncludeColorBox = true; } else { this.divSkin.Visible = false; SkinSetting.Visible = false; } if (siteSettings.UseLdapAuth && !siteSettings.AllowDbFallbackWithLdap) { this.lnkChangePassword.Visible = false; } divEditorPreference.Visible = siteSettings.AllowUserEditorPreference; timeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); divOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth; rpxApiKey = siteSettings.RpxNowApiKey; rpxApplicationName = siteSettings.RpxNowApplicationName; if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig) { if (WebConfigSettings.OpenIdRpxApiKey.Length > 0) { rpxApiKey = WebConfigSettings.OpenIdRpxApiKey; } if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0) { rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName; } } if (rpxApiKey.Length > 0) { lnkOpenIDUpdate.Visible = false; rpxLink.Visible = divOpenID.Visible; } if (!mojoSetup.RunningInFullTrust()) { divOpenID.Visible = false; } if ( (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) ||(!siteSettings.AllowWindowsLiveMessengerForMembers) || ((siteSettings.WindowsLiveAppId.Length == 0) && (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] == null)) ) { divLiveMessenger.Visible = false; } int countOfNewsLetters = LetterInfo.GetCount(siteSettings.SiteGuid); liNewsletters.Visible = (WebConfigSettings.EnableNewsletter && (countOfNewsLetters > 0)); tabNewsletters.Visible = liNewsletters.Visible; newsLetterPrefs.Visible = liNewsletters.Visible; commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { liOrderHistory.Visible = false; tabOrderHistory.Visible = false; } if ((WebConfigSettings.UserNameValidationExpression.Length > 0) && (siteSettings.AllowUserFullNameChange)) { regexUserName.ValidationExpression = WebConfigSettings.UserNameValidationExpression; regexUserName.ErrorMessage = WebConfigSettings.UserNameValidationWarning; regexUserName.Enabled = true; } FailSafeUserNameValidator.ErrorMessage = Resource.UserNameHasInvalidCharsWarning; FailSafeUserNameValidator.ServerValidate += new ServerValidateEventHandler(FailSafeUserNameValidator_ServerValidate); AddClassToBody("userprofile"); }
private void LoadSettings() { //avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/"); #if !MONO divTimeZone.Visible = true; #endif QuestionRequired.Enabled = siteSettings.RequiresQuestionAndAnswer; AnswerRequired.Enabled = siteSettings.RequiresQuestionAndAnswer; //lnkAvatarUpload.Visible = false; switch (siteSettings.AvatarSystem) { case "gravatar": allowGravatars = true; disableAvatars = false; break; case "internal": allowGravatars = false; disableAvatars = false; if (siteUser != null) { // lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString(); // lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarHeading) + "', this.href, GBCallback)"; lnkAvatarUpld.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString(); } if (WebConfigSettings.AvatarsCanOnlyBeUploadedByAdmin) { //lnkAvatarUpload.Visible = false; lnkAvatarUpld.Visible = false; //lblMaxAvatarSize.Visible = false; //avatarFile.Visible = false; // progressBar.Visible = false; //btnUploadAvatar.Visible = false; // regexAvatarFile.Visible = false; // regexAvatarFile.Enabled = false; avatarHelp.Visible = false; } break; case "none": default: allowGravatars = false; disableAvatars = true; break; } if (displaySettings.OverrideAvatarLabel.Length > 0) { lblAvatar.ConfigKey = displaySettings.OverrideAvatarLabel; } if (displaySettings.HidePostCount) { divForumPosts.Visible = false; } allowUserSkin = ((siteSettings.AllowUserSkins) || ((WebConfigSettings.AllowEditingSkins) && (WebUser.IsInRoles(siteSettings.RolesThatCanManageSkins)))); if (allowUserSkin) { this.divSkin.Visible = true; ScriptConfig.IncludeColorBox = true; } else { this.divSkin.Visible = false; SkinSetting.Visible = false; } if (siteSettings.UseLdapAuth && !siteSettings.AllowDbFallbackWithLdap) { this.lnkChangePassword.Visible = false; } divEditorPreference.Visible = siteSettings.AllowUserEditorPreference; timeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); divOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth; rpxApiKey = siteSettings.RpxNowApiKey; rpxApplicationName = siteSettings.RpxNowApplicationName; if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig) { if (WebConfigSettings.OpenIdRpxApiKey.Length > 0) { rpxApiKey = WebConfigSettings.OpenIdRpxApiKey; } if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0) { rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName; } } if (rpxApiKey.Length > 0) { lnkOpenIDUpdate.Visible = false; rpxLink.Visible = divOpenID.Visible; } if (!mojoSetup.RunningInFullTrust()) { divOpenID.Visible = false; } if ( (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) || (!siteSettings.AllowWindowsLiveMessengerForMembers) || ((siteSettings.WindowsLiveAppId.Length == 0) && (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] == null)) ) { divLiveMessenger.Visible = false; } int countOfNewsLetters = LetterInfo.GetCount(siteSettings.SiteGuid); liNewsletters.Visible = (WebConfigSettings.EnableNewsletter && (countOfNewsLetters > 0)); tabNewsletters.Visible = liNewsletters.Visible; newsLetterPrefs.Visible = liNewsletters.Visible; commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { liOrderHistory.Visible = false; tabOrderHistory.Visible = false; } if ((WebConfigSettings.UserNameValidationExpression.Length > 0) && (siteSettings.AllowUserFullNameChange)) { regexUserName.ValidationExpression = WebConfigSettings.UserNameValidationExpression; regexUserName.ErrorMessage = WebConfigSettings.UserNameValidationWarning; regexUserName.Enabled = true; } FailSafeUserNameValidator.ErrorMessage = Resource.UserNameHasInvalidCharsWarning; FailSafeUserNameValidator.ServerValidate += new ServerValidateEventHandler(FailSafeUserNameValidator_ServerValidate); AddClassToBody("userprofile"); }
private void LoadSettings() { commerceConfig = SiteUtils.GetCommerceConfig(); }
private void LoadSettings() { currentUser = SiteUtils.GetCurrentSiteUser(); isAdmin = WebUser.IsAdmin; pageID = WebUtils.ParseInt32FromQueryString("pageid", -1); userID = WebUtils.ParseInt32FromQueryString("userid", true, userID); TimeOffset = SiteUtils.GetUserTimeOffset(); userGuid = WebUtils.ParseGuidFromQueryString("u", Guid.Empty); switch (siteSettings.AvatarSystem) { case "gravatar": allowGravatars = true; disableAvatars = true; break; case "internal": allowGravatars = false; disableAvatars = false; lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + userID.ToInvariantString(); lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarAdminHeading) + "', this.href, GBCallback)"; break; case "none": default: allowGravatars = false; disableAvatars = true; break; } lnkUnsubscribeFromGroups.Visible = WebConfigSettings.ShowGroupUnsubscribeLinkInUserManagement; if (WebConfigSettings.MaskPasswordsInUserAdmin) { txtPassword.TextMode = TextBoxMode.Password; } regexEmail.ValidationExpression = SecurityHelper.RegexEmailValidationPattern; if (WebConfigSettings.UseRelatedSiteMode) { divTotalPosts.Visible = false; } commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { liOrderHistory.Visible = false; tabOrderHistory.Visible = false; } string wlAppId = siteSettings.WindowsLiveAppId; if (ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"] != null) { wlAppId = ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"]; if (wlAppId.Length == 0) { wlAppId = siteSettings.WindowsLiveAppId; } } if ( (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) || (!siteSettings.AllowWindowsLiveMessengerForMembers) || (wlAppId.Length == 0) ) { divLiveMessenger.Visible = false; } }
private void LoadSettings() { PageId = WebUtils.ParseInt32FromQueryString("pageid", -1); ModuleId = WebUtils.ParseInt32FromQueryString("mid", -1); payPalGetExpressCheckoutLogGuid = WebUtils.ParseGuidFromQueryString("plog", payPalGetExpressCheckoutLogGuid); if (payPalGetExpressCheckoutLogGuid == Guid.Empty) { Response.Redirect(SiteUtils.GetCurrentPageUrl()); } checkoutDetailsLog = new PayPalLog(payPalGetExpressCheckoutLogGuid); if (checkoutDetailsLog.RowGuid == Guid.Empty) { Response.Redirect(SiteUtils.GetCurrentPageUrl()); } cart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), checkoutDetailsLog.SerializedObject); if (cart == null) { Response.Redirect(SiteUtils.GetCurrentPageUrl()); } cart.DeSerializeCartOffers(); cart.RefreshTotals(); if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } siteUser = SiteUtils.GetCurrentSiteUser(); //if (siteUser == null) //{ // Response.Redirect(SiteUtils.GetCurrentPageUrl()); //} if ((siteUser != null) && (cart.UserGuid == Guid.Empty)) { // user wasn't logged in when express checkout was called cart.UserGuid = siteUser.UserGuid; cart.Save(); //if (checkoutDetailsLog.UserGuid == Guid.Empty) //{ // // we need to make sure we have the user in the log and serialized cart // checkoutDetailsLog.UserGuid = siteUser.UserGuid; // cart.SerializeCartOffers(); // checkoutDetailsLog.SerializedObject = SerializationHelper.SerializeToSoap(cart); // checkoutDetailsLog.Save(); //} } if ((siteUser != null) && (cart.UserGuid != siteUser.UserGuid)) { Response.Redirect(SiteUtils.GetCurrentPageUrl()); } if (ModuleId == -1) { ModuleId = StoreHelper.FindStoreModuleId(CurrentPage); } store = StoreHelper.GetStore(); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); if (siteUser != null) { pnlRequireLogin.Visible = false; } else { btnMakePayment.Visible = false; } AddClassToBody("webstore webstoreexpresscheckout"); }
private void LoadSettings() { store = StoreHelper.GetStore(); if (store == null) { return; } commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); storeCountry = new GeoCountry(siteSettings.DefaultCountryGuid); if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } if (StoreHelper.UserHasCartCookie(store.Guid)) { cart = StoreHelper.GetCart(); if (cart != null) { if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (siteUser != null) { if (cart.UserGuid == Guid.Empty) { // take ownership of anonymous cart cart.UserGuid = siteUser.UserGuid; cart.Save(); StoreHelper.InitializeOrderInfo(cart, siteUser); } else { // cart already has a user guid but // check if it matches the current user // cart cookie could have been left behind by a previous user // on shared computers // if cart user guid doesn't match reset billing shipping info // and any other identifiers // but leave items in cart if (cart.UserGuid != siteUser.UserGuid) { cart.ResetUserInfo(); cart.UserGuid = siteUser.UserGuid; cart.Save(); StoreHelper.InitializeOrderInfo(cart, siteUser); } } } if (WebStoreConfiguration.IsDemo) { LoadDemoCustomer(); } canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); // disable till I finish //canCheckoutWithoutAuthentication = false; } AddClassToBody("webstore webstoreconfirmorder"); } pnlRequireLogin.Visible = !Request.IsAuthenticated; if ((canCheckoutWithoutAuthentication) || (Request.IsAuthenticated)) { pnlOrderDetail.Visible = commerceConfig.CanProcessStandardCards || (commerceConfig.WorldPayInstallationId.Length > 0); pnlRequireLogin.Visible = true; pnlShippingTotal.Visible = false; pnlTaxTotal.Visible = false; pnlOrderTotal.Visible = false; } if ((cart != null) && (cart.SubTotal == 0) && (cart.CartOffers.Count > 0)) { // free checkout pnlOrderDetail.Visible = true; } if (pnlOrderDetail.Visible) { tblCountryList = GeoCountry.GetList(); } ConfigureCheckoutButtons(); //if (!Page.IsPostBack) //{ // if ((commerceConfig.PayPalIsEnabled) && (commerceConfig.PayPalUsePayPalStandard)) // { // if (Request.IsAuthenticated) // { // SetupPayPalStandardForm(); // } // else // { // // we need the user to be signed in before we send them to paypal if using PayPal Standard // // because we want to return them to their order summary and that requires login // // so we need to know who the user is before sending them to PayPal // litOr.Visible = false; // btnPayPal.Visible = false; // btnGoogleCheckout.Visible = false; // } // } //} //if (!Request.IsAuthenticated) //{ // pnlOrderDetail.Visible = false; // pnlRequireLogin.Visible = true; // pnlShippingTotal.Visible = false; // pnlTaxTotal.Visible = false; // pnlOrderTotal.Visible = false; // if (commerceConfig.GoogleCheckoutIsEnabled) // { // if ( // (!commerceConfig.Is503TaxExempt) // && ((cart != null) && (cart.HasDonations())) // ) // { // //btnGoogleCheckout.Visible = false; // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // PaymentAcceptanceMark mark = (PaymentAcceptanceMark)pam1; // mark.SuppressGoogleCheckout = true; // mark = (PaymentAcceptanceMark)PaymentAcceptanceMark1; // mark.SuppressGoogleCheckout = true; // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // } // } //} //else //{ // if ( // (!commerceConfig.Is503TaxExempt) // && ((cart != null)&& (cart.HasDonations())) // && (commerceConfig.GoogleCheckoutIsEnabled) // ) // { // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // } //} }
private void LoadSettings() { avatarPath = Page.ResolveUrl("~/Data/Sites/" + siteSettings.SiteId.ToInvariantString() + "/useravatars/"); //lnkAvatarUpload.Visible = false; switch (siteSettings.AvatarSystem) { case "gravatar": allowGravatars = true; disableAvatars = true; break; case "internal": allowGravatars = false; disableAvatars = false; if (siteUser != null) { lnkAvatarUpload.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + siteUser.UserId.ToInvariantString(); lnkAvatarUpload.ClientClick = "return GB_showPage('" + Page.Server.HtmlEncode(Resource.UploadAvatarHeading) + "', this.href, GBCallback)"; } if (WebConfigSettings.AvatarsCanOnlyBeUploadedByAdmin) { lnkAvatarUpload.Visible = false; //lblMaxAvatarSize.Visible = false; //avatarFile.Visible = false; // progressBar.Visible = false; //btnUploadAvatar.Visible = false; // regexAvatarFile.Visible = false; // regexAvatarFile.Enabled = false; avatarHelp.Visible = false; } break; case "none": default: allowGravatars = false; disableAvatars = true; break; } if (siteSettings.AllowUserSkins) { this.divSkin.Visible = true; } else { this.divSkin.Visible = false; } if (siteSettings.UseLdapAuth) { this.lnkChangePassword.Visible = false; } timeOffset = SiteUtils.GetUserTimeOffset(); divOpenID.Visible = WebConfigSettings.EnableOpenIdAuthentication && siteSettings.AllowOpenIdAuth; rpxApiKey = siteSettings.RpxNowApiKey; rpxApplicationName = siteSettings.RpxNowApplicationName; if (WebConfigSettings.UseOpenIdRpxSettingsFromWebConfig) { if (WebConfigSettings.OpenIdRpxApiKey.Length > 0) { rpxApiKey = WebConfigSettings.OpenIdRpxApiKey; } if (WebConfigSettings.OpenIdRpxApplicationName.Length > 0) { rpxApplicationName = WebConfigSettings.OpenIdRpxApplicationName; } } if (rpxApiKey.Length > 0) { lnkOpenIDUpdate.Visible = false; rpxLink.Visible = divOpenID.Visible; } if (WebConfigSettings.RunningInMediumTrust) { divOpenID.Visible = false; } if ( (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) || (!siteSettings.AllowWindowsLiveMessengerForMembers) || ((siteSettings.WindowsLiveAppId.Length == 0) && (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] == null)) ) { divLiveMessenger.Visible = false; } int countOfNewsLetters = LetterInfo.GetCount(siteSettings.SiteGuid); liNewsletters.Visible = (WebConfigSettings.EnableNewsletter && (countOfNewsLetters > 0)); tabNewsletters.Visible = liNewsletters.Visible; newsLetterPrefs.Visible = liNewsletters.Visible; commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { liOrderHistory.Visible = false; tabOrderHistory.Visible = false; } }
private void LoadSettings() { AddClassToBody($"webstore webstorecart {displaySettings.AdditionalBodyClass}"); SiteUtils.AddNoIndexMeta(Page); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); moduleSettings = ModuleSettings.GetModuleSettings(moduleId); if (moduleSettings != null) { config = new WebStoreConfiguration(moduleSettings); } litCartFooter.Text = config.CartPageFooter; if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } store = StoreHelper.GetStore(); if (store == null) { return; } if ( (StoreHelper.UserHasCartCookie(store.Guid)) || (Request.IsAuthenticated) ) { cart = StoreHelper.GetCart(); } //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page //and the order can be processed wtithout the user signing in or if the user is already signed in if ( ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0)) //&& ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) //moved login prompt to cart so we don't need to have a link to the confirmorder page ) { //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; } if (cart == null) { pnlDiscountCode.Visible = false; //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; return; } if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (store != null) { canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); } cartList.Store = store; cartList.ShoppingCart = cart; cartList.CurrencyCulture = currencyCulture; cartList.DisplaySettings = displaySettings; cartListAlt.Store = store; cartListAlt.ShoppingCart = cart; cartListAlt.CurrencyCulture = currencyCulture; if (displaySettings.UseAltCartList) { cartList.Visible = false; cartListAlt.Visible = true; } ConfigureCheckoutButtons(); int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid); pnlDiscountCode.Visible = (countOfDiscountCodes > 0); // don't show the discount code panel if the cart is empty if (cart.SubTotal == 0) { // allow checkout if cart has items (support checkout with free items) if (cart.CartOffers.Count == 0) { //lnkConfirmOrder.Visible = false; litConfirmOrder.Visible = false; } else { //cart has free items //lnkConfirmOrder.Visible = true; } //litOr.Visible = false; //btnPayPal.Visible = false; pnlDiscountCode.Visible = false; } // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses bool disableDiscounts = false; ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts); if (disableDiscounts) { pnlDiscountCode.Visible = false; } }
private void LoadSettings() { currentUser = SiteUtils.GetCurrentSiteUser(); isAdmin = WebUser.IsAdmin; pageID = WebUtils.ParseInt32FromQueryString("pageid", -1); userID = WebUtils.ParseInt32FromQueryString("userid", true, userID); TimeOffset = SiteUtils.GetUserTimeOffset(); timeZone = SiteUtils.GetUserTimeZone(); userGuid = WebUtils.ParseGuidFromQueryString("u", Guid.Empty); UserRolesControl.SiteRoot = SiteRoot; #if!MONO divTimeZone.Visible = true; #endif switch (siteSettings.AvatarSystem) { case "gravatar": allowGravatars = true; disableAvatars = false; break; case "internal": allowGravatars = false; disableAvatars = false; lnkAvatarUpld.NavigateUrl = SiteRoot + "/Dialog/AvatarUploadDialog.aspx?u=" + userID.ToInvariantString(); break; case "none": default: allowGravatars = false; disableAvatars = true; break; } if (displaySettings.OverrideAvatarLabel.Length > 0) { lblAvatar.ConfigKey = displaySettings.OverrideAvatarLabel; } lnkUnsubscribeFromForums.Visible = WebConfigSettings.ShowForumUnsubscribeLinkInUserManagement; // a way to block from purging user locations/ip address history // needed for the demo site btnPurgeUserLocations.Visible = WebConfigSettings.ShowPurgeUserLocationsInUserManagement; if (WebConfigSettings.MaskPasswordsInUserAdmin) { txtPassword.TextMode = TextBoxMode.Password; } if (WebConfigSettings.UseRelatedSiteMode) { divTotalPosts.Visible = false; } if (displaySettings.HidePostCount) { divTotalPosts.Visible = false; } commerceConfig = SiteUtils.GetCommerceConfig(); if (!commerceConfig.IsConfigured) { liOrderHistory.Visible = false; tabOrderHistory.Visible = false; } string wlAppId = siteSettings.WindowsLiveAppId; if (ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"] != null) { wlAppId = ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"]; if (wlAppId.Length == 0) { wlAppId = siteSettings.WindowsLiveAppId; } } if ( (WebConfigSettings.GloballyDisableMemberUseOfWindowsLiveMessenger) || (!siteSettings.AllowWindowsLiveMessengerForMembers) || (wlAppId.Length == 0) ) { divLiveMessenger.Visible = false; } divEditorPreference.Visible = siteSettings.AllowUserEditorPreference; if (userID == -1) { HideExtendedProfileControls(); } divReqPasswordChange.Visible = WebConfigSettings.AllowRequiringPasswordChange; // don't let an admin user lock himself out if ((userID == currentUser.UserId)&&(!currentUser.IsLockedOut)) { btnLockUser.Enabled = false; } AddClassToBody("administration"); AddClassToBody("manageusers"); }
public override void HandleOrderStateChangeNotification( string requestXml, OrderStateChangeNotification notification) { GoogleCheckoutLog gLog = new GoogleCheckoutLog(); Guid orderGuid = GoogleCheckoutLog.GetCartGuidFromOrderNumber(notification.googleordernumber); gLog.RawResponse = requestXml; gLog.NotificationType = "OrderStateChangeNotification"; gLog.ProviderName = "WebStoreGCheckoutNotificationHandlerProvider"; gLog.SerialNumber = notification.serialnumber; gLog.OrderNumber = notification.googleordernumber; gLog.FinanceState = notification.newfinancialorderstate.ToString(); gLog.FullfillState = notification.newfulfillmentorderstate.ToString(); gLog.GTimestamp = notification.timestamp; gLog.AvsResponse = notification.reason; gLog.CartGuid = orderGuid; gLog.Save(); if (orderGuid == Guid.Empty) { return; } Order order = new Order(orderGuid); if (order.OrderGuid != orderGuid) { return; } Store store = new Store(order.StoreGuid); if (store.Guid != order.StoreGuid) { return; } gLog.SiteGuid = store.SiteGuid; gLog.UserGuid = order.UserGuid; gLog.CartGuid = order.OrderGuid; gLog.StoreGuid = order.StoreGuid; gLog.Save(); if (notification.newfinancialorderstate == FinancialOrderState.CHARGED) { order.StatusGuid = OrderStatus.OrderStatusFulfillableGuid; order.Save(); if (!order.HasShippingProducts()) { // order only has download products so tell google the order is fulfilled try { CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig(); string gEvironment; if (commerceConfig.GoogleEnvironment == GCheckout.EnvironmentType.Sandbox) { gEvironment = "Sandbox"; } else { gEvironment = "Production"; } GCheckout.OrderProcessing.DeliverOrderRequest fulfillNotification = new GCheckout.OrderProcessing.DeliverOrderRequest( commerceConfig.GoogleMerchantID, commerceConfig.GoogleMerchantKey, gEvironment, notification.googleordernumber); fulfillNotification.Send(); StoreHelper.ConfirmOrder(store, order); PayPalLog.DeleteByCart(order.OrderGuid); log.Info("Sent DeliverOrderRequest to google api for google order " + notification.googleordernumber); } catch (Exception ex) { log.Error(ex); } } } }
private void LoadSettings() { AddClassToBody("webstore webstorecart"); SiteUtils.AddNoIndexMeta(Page); commerceConfig = SiteUtils.GetCommerceConfig(); currencyCulture = ResourceHelper.GetCurrencyCulture(siteSettings.GetCurrency().Code); moduleSettings = ModuleSettings.GetModuleSettings(moduleId); if (moduleSettings != null) { config = new WebStoreConfiguration(moduleSettings); } litCartFooter.Text = config.CartPageFooter; if (Request.IsAuthenticated) { siteUser = SiteUtils.GetCurrentSiteUser(); } store = StoreHelper.GetStore(); if (store == null) { return; } if ( (StoreHelper.UserHasCartCookie(store.Guid)) || (Request.IsAuthenticated) ) { cart = StoreHelper.GetCart(); } //if we can't process cards internally there is no reason (except a free order) to go to the ConfirmOrder.aspx page //and the order can be processed wtithout the user signing in or if the user is already signed in if ( ((!commerceConfig.CanProcessStandardCards) && (commerceConfig.WorldPayInstallationId.Length == 0)) && ((Request.IsAuthenticated) || (canCheckoutWithoutAuthentication)) ) { lnkCheckout.Visible = false; } if (cart == null) { pnlDiscountCode.Visible = false; lnkCheckout.Visible = false; return; } if ((cart.LastModified < DateTime.UtcNow.AddDays(-1)) && (cart.DiscountCodesCsv.Length > 0)) { StoreHelper.EnsureValidDiscounts(store, cart); } if (store != null) { canCheckoutWithoutAuthentication = store.CanCheckoutWithoutAuthentication(cart); } cartList.Store = store; cartList.ShoppingCart = cart; cartList.CurrencyCulture = currencyCulture; cartListAlt.Store = store; cartListAlt.ShoppingCart = cart; cartListAlt.CurrencyCulture = currencyCulture; if (displaySettings.UseAltCartList) { cartList.Visible = false; cartListAlt.Visible = true; } // disable till I finish //canCheckoutWithoutAuthentication = false; ConfigureCheckoutButtons(); int countOfDiscountCodes = Discount.GetCountOfActiveDiscountCodes(store.ModuleGuid); pnlDiscountCode.Visible = (countOfDiscountCodes > 0); // don't show the discount code panel if the cart is empty if (cart.SubTotal == 0) { // allow checkout if cart has items (support checkout with free items) if (cart.CartOffers.Count == 0) { lnkCheckout.Visible = false; } else { //cart has free items lnkCheckout.Visible = true; } //litOr.Visible = false; //btnPayPal.Visible = false; //btnGoogleCheckout.Visible = false; pnlDiscountCode.Visible = false; } // kill switch to disable discount codes (doesn't prevent use of ones already in the cart but prevents new uses bool disableDiscounts = false; ConfigHelper.GetBoolProperty("WebStoreDisabledDiscounts", disableDiscounts); if (disableDiscounts) { pnlDiscountCode.Visible = false; } //if (!Page.IsPostBack) //{ // if ((commerceConfig.PayPalIsEnabled) && (commerceConfig.PayPalUsePayPalStandard)) // { // if (Request.IsAuthenticated) // { // siteUser = SiteUtils.GetCurrentSiteUser(); // SetupPayPalStandardForm(); // } // else // { // //TODO: if the cart has no download items allow checkout without registration/sign in // // we need the user to be signed in before we send them to paypal if using PayPal Standard // // because we want to return them to their order summary and that requires login // // so we need to know who the user is before sending them to PayPal // litOr.Visible = false; // btnPayPal.Visible = false; // btnGoogleCheckout.Visible = false; // } // } //} //if (!Request.IsAuthenticated) //{ // if (commerceConfig.GoogleCheckoutIsEnabled) // { // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // ) // { // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // PaymentAcceptanceMark mark = (PaymentAcceptanceMark)pam1; // mark.SuppressGoogleCheckout = true; // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // } // } //} //else //{ // if ( // (!commerceConfig.Is503TaxExempt) // && (cart != null) // && (cart.HasDonations()) // && (commerceConfig.GoogleCheckoutIsEnabled) // ) // { // btnGoogleCheckout.Visible = true; // btnGoogleCheckout.Enabled = false; // lblGoogleMessage.Text = WebStoreResources.GoogleCheckoutDisabledForDonationsMessage; // lblGoogleMessage.Visible = true; // } //} }
private void HandleRequest() { // the handler will return html that worldpay will display on their own site so make sure this page doesn't write to the response Response.Clear(); Response.Buffer = true; log.Info("Received a post"); WorldPayPaymentResponse wpResponse = WorldPayPaymentResponse.ParseRequest(); if (wpResponse == null) { log.Info("wpResponse object was null"); SiteUtils.RedirectToAccessDeniedPage(this); return; } CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig(); if ( (commerceConfig.WorldPayResponsePassword.Length > 0) && (wpResponse.CallbackPW != commerceConfig.WorldPayResponsePassword) ) { log.Info("recieved post but the response password was not correct. so redirecting to access denied."); //TODO: should we log what was posted? SiteUtils.RedirectToAccessDeniedPage(this); return; } Guid logGuid = Guid.Empty; if (wpResponse.CartId.Length == 36) { log.Info("wpResponse.CartId was 36 chars"); logGuid = new Guid(wpResponse.CartId); } PayPalLog worldPayLog = new PayPalLog(logGuid); if (worldPayLog.RowGuid == Guid.Empty) { // log was not found log.Info("WorldPay/PayPal log not found "); SiteUtils.RedirectToAccessDeniedPage(this); return; } log.Info("Provider name is " + worldPayLog.ProviderName); WorldPayResponseHandlerProvider handler = WorldPayResponseHandlerProviderManager.Providers[worldPayLog.ProviderName]; if (handler == null) { //log the details of the request. string serializedResponse = SerializationHelper.SerializeToString(wpResponse); log.Info("failed to find a handler for worldpay postback, xml to follow"); log.Info(serializedResponse); SiteUtils.RedirectToAccessDeniedPage(this); return; } handler.HandleRequest(wpResponse, worldPayLog, this); }