/// <summary> /// Add user tokens /// </summary> /// <param name="tokens">List of already added tokens</param> /// <param name="user">User</param> public virtual void AddUserTokens(IList <Token> tokens, User user) { tokens.Add(new Token("User.Email", user.Email)); tokens.Add(new Token("User.Username", user.Username)); tokens.Add(new Token("User.FullName", _userService.GetUserFullName(user))); tokens.Add(new Token("User.FirstName", _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.FirstNameAttribute))); tokens.Add(new Token("User.LastName", _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.LastNameAttribute))); tokens.Add(new Token("User.VatNumber", _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.VatNumberAttribute))); var customAttributesXml = _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.CustomUserAttributes); tokens.Add(new Token("User.CustomAttributes", _userAttributeFormatter.FormatAttributes(customAttributesXml), true)); //note: we do not use SEO friendly URLS for these links because we can get errors caused by having .(dot) in the URL (from the email address) var passwordRecoveryUrl = RouteUrl(routeName: "PasswordRecoveryConfirm", routeValues: new { token = _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.PasswordRecoveryTokenAttribute), email = user.Email }); var accountActivationUrl = RouteUrl(routeName: "AccountActivation", routeValues: new { token = _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.AccountActivationTokenAttribute), email = user.Email }); var emailRevalidationUrl = RouteUrl(routeName: "EmailRevalidation", routeValues: new { token = _genericAttributeService.GetAttribute <string>(user, NopUserDefaults.EmailRevalidationTokenAttribute), email = user.Email }); var wishlistUrl = RouteUrl(routeName: "Wishlist", routeValues: new { userGuid = user.UserGuid }); tokens.Add(new Token("User.PasswordRecoveryURL", passwordRecoveryUrl, true)); tokens.Add(new Token("User.AccountActivationURL", accountActivationUrl, true)); tokens.Add(new Token("User.EmailRevalidationURL", emailRevalidationUrl, true)); tokens.Add(new Token("Wishlist.URLForUser", wishlistUrl, true)); //event notification _eventPublisher.EntityTokensAdded(user, tokens); }
/// <summary> /// Add site tokens /// </summary> /// <param name="tokens">List of already added tokens</param> /// <param name="site">Site</param> /// <param name="emailAccount">Email account</param> public virtual void AddSiteTokens(IList <Token> tokens, Site site, EmailAccount emailAccount) { if (emailAccount == null) { throw new ArgumentNullException(nameof(emailAccount)); } tokens.Add(new Token("Site.Name", site.Name)); tokens.Add(new Token("Site.URL", site.Url, true)); tokens.Add(new Token("Site.Email", emailAccount.Email)); //event notification _eventPublisher.EntityTokensAdded(site, tokens); }
public void AddCustomerTokens(IList <Token> tokens, Customer customer) { tokens.Add(new Token("Customer.Email", customer.Email)); tokens.Add(new Token("Customer.Username", customer.Username)); tokens.Add(new Token("Customer.FullName", customer.GetFullName())); tokens.Add(new Token("Customer.FirstName", customer.GetAttribute <string>(SystemCustomerAttributeNames.FirstName))); tokens.Add(new Token("Customer.LastName", customer.GetAttribute <string>(SystemCustomerAttributeNames.LastName))); tokens.Add(new Token("Customer.VatNumber", customer.GetAttribute <string>(SystemCustomerAttributeNames.VatNumber))); //note: we do not use SEO friendly URLS because we can get errors caused by having .(dot) in the URL (from the email address) //TODO add a method for getting URL (use routing because it handles all SEO friendly URLs) var passwordRecoveryUrl = string.Format("{0}passwordrecovery/confirm?token={1}&email={2}", GetStoreUrl(), customer.GetAttribute <string>(SystemCustomerAttributeNames.PasswordRecoveryToken), HttpUtility.UrlEncode(customer.Email)); var accountActivationUrl = string.Format("{0}customer/activation?token={1}&email={2}", GetStoreUrl(), customer.GetAttribute <string>(SystemCustomerAttributeNames.AccountActivationToken), HttpUtility.UrlEncode(customer.Email)); var wishlistUrl = string.Format("{0}wishlist/{1}", GetStoreUrl(), customer.CustomerGuid); tokens.Add(new Token("Customer.PasswordRecoveryURL", passwordRecoveryUrl, true)); tokens.Add(new Token("Customer.AccountActivationURL", accountActivationUrl, true)); tokens.Add(new Token("Wishlist.URLForCustomer", wishlistUrl, true)); //event notification _eventPublisher.EntityTokensAdded(customer, tokens); }
/// <summary> /// Add application tokens /// </summary> /// <param name="tokens">List of already added tokens</param> /// <param name="application">Application</param> /// <param name="emailAccount">Email account</param> public virtual void AddApplicationTokens(IList <Token> tokens, Application application, EmailAccount emailAccount) { if (emailAccount == null) { throw new ArgumentNullException("emailAccount"); } tokens.Add(new Token("Application.Name", application.GetLocalized(x => x.Name))); tokens.Add(new Token("Application.URL", application.Url, true)); tokens.Add(new Token("Application.Email", emailAccount.Email)); tokens.Add(new Token("Application.CompanyName", application.CompanyName)); tokens.Add(new Token("Application.CompanyAddress", application.CompanyAddress)); tokens.Add(new Token("Application.CompanyPhoneNumber", application.CompanyPhoneNumber)); tokens.Add(new Token("Facebook.URL", _applicationInformationSettings.FacebookLink)); tokens.Add(new Token("Twitter.URL", _applicationInformationSettings.TwitterLink)); tokens.Add(new Token("YouTube.URL", _applicationInformationSettings.YoutubeLink)); tokens.Add(new Token("GooglePlus.URL", _applicationInformationSettings.GooglePlusLink)); //event notification _eventPublisher.EntityTokensAdded(application, tokens); }
/// <summary> /// Add store tokens /// </summary> /// <param name="tokens">List of already added tokens</param> /// <param name="store">Store</param> /// <param name="emailAccount">Email account</param> public virtual void AddStoreTokens(IList <Token> tokens, Store store, EmailAccount emailAccount) { if (emailAccount == null) { throw new ArgumentNullException(nameof(emailAccount)); } tokens.Add(new Token("Store.Name", _localizationService.GetLocalized(store, x => x.Name))); tokens.Add(new Token("Store.URL", store.Url, true)); tokens.Add(new Token("Store.Email", emailAccount.Email)); tokens.Add(new Token("Store.CompanyName", store.CompanyName)); tokens.Add(new Token("Store.CompanyAddress", store.CompanyAddress)); tokens.Add(new Token("Store.CompanyPhoneNumber", store.CompanyPhoneNumber)); tokens.Add(new Token("Store.CompanyVat", store.CompanyVat)); tokens.Add(new Token("Facebook.URL", _storeInformationSettings.FacebookLink)); tokens.Add(new Token("Twitter.URL", _storeInformationSettings.TwitterLink)); tokens.Add(new Token("YouTube.URL", _storeInformationSettings.YoutubeLink)); tokens.Add(new Token("GooglePlus.URL", _storeInformationSettings.GooglePlusLink)); //event notification _eventPublisher.EntityTokensAdded(store, tokens); }
/// <summary> /// Add user tokens /// </summary> /// <param name="tokens">List of already added tokens</param> /// <param name="user">User</param> public virtual void AddUserTokens(IList <Token> tokens, User user) { tokens.Add(new Token("WebSite.URL", _siteInformationSettings.SiteURL)); tokens.Add(new Token("WebSite.Name", _siteInformationSettings.SiteName)); tokens.Add(new Token("WebSite.Address", _siteInformationSettings.SiteAddress)); tokens.Add(new Token("WebSite.PhoneNumber", _siteInformationSettings.SitePhoneNumber)); tokens.Add(new Token("User.Email", user.Email)); tokens.Add(new Token("User.Username", user.UserName)); tokens.Add(new Token("User.FullName", _userService.GetUserFullName(user))); tokens.Add(new Token("User.FirstName", user.FirstName)); tokens.Add(new Token("User.LastName", user.LastName)); //string emailRevalidationUrl = GetURL(user, "EmailRevalidationToken", "EmailRevalidation"); string accountActivationUrl = GetURL(user, "AccountActivationToken", "User", "AccountActivation"); string passwordRecoveryUrl = GetURL(user, "PasswordRecoveryToken", "User", "PasswordRecoveryConfirm"); tokens.Add(new Token("User.AccountActivationURL", accountActivationUrl, true)); tokens.Add(new Token("User.PasswordRecoveryURL", passwordRecoveryUrl, true)); // tokens.Add(new Token("User.EmailRevalidationURL", emailRevalidationUrl, true)); //event notification _eventPublisher.EntityTokensAdded(user, tokens); }
public virtual void AddAccountUserTokens(IList <Token> tokens, AccountUser property) { tokens.Add(new Token("AccountUser.Username", property.UserName)); //tokens.Add(new Token("AccountUser.FullName", property.GetFullName())); //tokens.Add(new Token("AccountUser.FirstName", property.GetAttribute<string>(SystemAccountUserAttributeNames.FirstName))); //tokens.Add(new Token("AccountUser.LastName", property.GetAttribute<string>(SystemAccountUserAttributeNames.LastName))); //tokens.Add(new Token("AccountUser.VatNumber", property.GetAttribute<string>(SystemAccountUserAttributeNames.VatNumber))); //tokens.Add(new Token("AccountUser.VatNumberStatus", ((VatNumberStatus)property.GetAttribute<int>(SystemAccountUserAttributeNames.VatNumberStatusId)).ToString())); //note: we do not use SEO friendly URLS because we can get errors caused by having .(dot) in the URL (from the email address) //TODO add a method for getting URL (use routing because it handles all SEO friendly URLs) //string passwordRecoveryUrl = string.Format("{0}passwordrecovery/confirm?token={1}&email={2}", GetStoreUrl(), property.GetAttribute<string>(SystemAccountUserAttributeNames.PasswordRecoveryToken), HttpUtility.UrlEncode(property.Email)); //string accountActivationUrl = string.Format("{0}property/activation?token={1}&email={2}", GetStoreUrl(), property.GetAttribute<string>(SystemAccountUserAttributeNames.AccountActivationToken), HttpUtility.UrlEncode(property.Email)); //var wishlistUrl = string.Format("{0}wishlist/{1}", GetStoreUrl(), property.AccountUserGuid); //tokens.Add(new Token("AccountUser.PasswordRecoveryURL", passwordRecoveryUrl, true)); //tokens.Add(new Token("AccountUser.AccountActivationURL", accountActivationUrl, true)); //tokens.Add(new Token("Wishlist.URLForAccountUser", wishlistUrl, true)); //event notification _eventPublisher.EntityTokensAdded(property, tokens); }
public virtual void AddUserTokens(IList <Token> tokens, User user) { tokens.Add(new Token("User.Email", user.Email)); tokens.Add(new Token("User.Username", user.Username)); tokens.Add(new Token("User.FullName", user.GetFullName())); //note: we do not use SEO friendly URLS because we can get errors caused by having .(dot) in the URL (from the email address) //TODO add a method for getting URL (use routing because it handles all SEO friendly URLs) string passwordRecoveryUrl = string.Format("{0}passwordrecovery/confirm?token={1}&email={2}", _siteSettings.Url, user.GetAttribute <string>(SystemUserAttributeNames.PasswordRecoveryToken), HttpUtility.UrlEncode(user.Email)); string accountActivationUrl = string.Format("{0}user/activation?token={1}&email={2}", _siteSettings.Url, user.GetAttribute <string>(SystemUserAttributeNames.AccountActivationToken), HttpUtility.UrlEncode(user.Email)); tokens.Add(new Token("User.PasswordRecoveryURL", passwordRecoveryUrl, true)); tokens.Add(new Token("User.AccountActivationURL", accountActivationUrl, true)); //event notification _eventPublisher.EntityTokensAdded(user, tokens); }
public virtual void AddStoreTokens(IList <Token> tokens, Store store) { tokens.Add(new Token("Store.Name", store.Name)); tokens.Add(new Token("Store.URL", store.Url, true)); var defaultEmailAccount = _emailAccountService.GetEmailAccountById(_emailAccountSettings.DefaultEmailAccountId); if (defaultEmailAccount == null) { defaultEmailAccount = _emailAccountService.GetAllEmailAccounts().FirstOrDefault(); } tokens.Add(new Token("Store.Email", defaultEmailAccount.Email)); //event notification _eventPublisher.EntityTokensAdded(store, tokens); }
public virtual void AddOrderTokens(IList <Token> tokens, Order order, int languageId) { tokens.Add(new Token("Order.OrderNumber", order.Id.ToString())); tokens.Add(new Token("Order.CustomerFullName", string.Format("{0} {1}", order.BillingAddress.FirstName, order.BillingAddress.LastName))); tokens.Add(new Token("Order.CustomerEmail", order.BillingAddress.Email)); tokens.Add(new Token("Order.BillingFirstName", order.BillingAddress.FirstName)); tokens.Add(new Token("Order.BillingLastName", order.BillingAddress.LastName)); tokens.Add(new Token("Order.BillingPhoneNumber", order.BillingAddress.PhoneNumber)); tokens.Add(new Token("Order.BillingEmail", order.BillingAddress.Email)); tokens.Add(new Token("Order.BillingFaxNumber", order.BillingAddress.FaxNumber)); tokens.Add(new Token("Order.BillingCompany", order.BillingAddress.Company)); tokens.Add(new Token("Order.BillingAddress1", order.BillingAddress.Address1)); tokens.Add(new Token("Order.BillingAddress2", order.BillingAddress.Address2)); tokens.Add(new Token("Order.BillingCity", order.BillingAddress.City)); tokens.Add(new Token("Order.BillingStateProvince", order.BillingAddress.StateProvince != null ? order.BillingAddress.StateProvince.GetLocalized(x => x.Name) : "")); tokens.Add(new Token("Order.BillingZipPostalCode", order.BillingAddress.ZipPostalCode)); tokens.Add(new Token("Order.BillingCountry", order.BillingAddress.Country != null ? order.BillingAddress.Country.GetLocalized(x => x.Name) : "")); tokens.Add(new Token("Order.ShippingMethod", order.ShippingMethod)); tokens.Add(new Token("Order.ShippingFirstName", order.ShippingAddress != null ? order.ShippingAddress.FirstName : "")); tokens.Add(new Token("Order.ShippingLastName", order.ShippingAddress != null ? order.ShippingAddress.LastName : "")); tokens.Add(new Token("Order.ShippingPhoneNumber", order.ShippingAddress != null ? order.ShippingAddress.PhoneNumber : "")); tokens.Add(new Token("Order.ShippingEmail", order.ShippingAddress != null ? order.ShippingAddress.Email : "")); tokens.Add(new Token("Order.ShippingFaxNumber", order.ShippingAddress != null ? order.ShippingAddress.FaxNumber : "")); tokens.Add(new Token("Order.ShippingCompany", order.ShippingAddress != null ? order.ShippingAddress.Company : "")); tokens.Add(new Token("Order.ShippingAddress1", order.ShippingAddress != null ? order.ShippingAddress.Address1 : "")); tokens.Add(new Token("Order.ShippingAddress2", order.ShippingAddress != null ? order.ShippingAddress.Address2 : "")); tokens.Add(new Token("Order.ShippingCity", order.ShippingAddress != null ? order.ShippingAddress.City : "")); tokens.Add(new Token("Order.ShippingStateProvince", order.ShippingAddress != null && order.ShippingAddress.StateProvince != null ? order.ShippingAddress.StateProvince.GetLocalized(x => x.Name) : "")); tokens.Add(new Token("Order.ShippingZipPostalCode", order.ShippingAddress != null ? order.ShippingAddress.ZipPostalCode : "")); tokens.Add(new Token("Order.ShippingCountry", order.ShippingAddress != null && order.ShippingAddress.Country != null ? order.ShippingAddress.Country.GetLocalized(x => x.Name) : "")); var paymentMethod = _paymentService.LoadPaymentMethodBySystemName(order.PaymentMethodSystemName); var paymentMethodName = paymentMethod != null?paymentMethod.GetLocalizedFriendlyName(_localizationService, _workContext.WorkingLanguage.Id) : order.PaymentMethodSystemName; tokens.Add(new Token("Order.PaymentMethod", paymentMethodName)); tokens.Add(new Token("Order.VatNumber", order.VatNumber)); tokens.Add(new Token("Order.Product(s)", ProductListToHtmlTable(order, languageId), true)); var language = _languageService.GetLanguageById(languageId); if (language != null && !String.IsNullOrEmpty(language.LanguageCulture)) { DateTime createdOn = _dateTimeHelper.ConvertToUserTime(order.CreatedOnUtc, TimeZoneInfo.Utc, _dateTimeHelper.GetCustomerTimeZone(order.Customer)); tokens.Add(new Token("Order.CreatedOn", createdOn.ToString("D", new CultureInfo(language.LanguageCulture)))); } else { tokens.Add(new Token("Order.CreatedOn", order.CreatedOnUtc.ToString("D"))); } //TODO add a method for getting URL (use routing because it handles all SEO friendly URLs) tokens.Add(new Token("Order.OrderURLForCustomer", string.Format("{0}orderdetails/{1}", _webHelper.GetStoreLocation(false), order.Id), true)); //event notification _eventPublisher.EntityTokensAdded(order, tokens); }
public async Task AddStoreTokens(LiquidObject liquidObject, Store store, Language language, EmailAccount emailAccount) { var liquidStore = new LiquidStore(store, language, emailAccount); liquidStore.TwitterLink = _storeInformationSettings.TwitterLink; liquidStore.FacebookLink = _storeInformationSettings.FacebookLink; liquidStore.YoutubeLink = _storeInformationSettings.YoutubeLink; liquidStore.InstagramLink = _storeInformationSettings.InstagramLink; liquidStore.LinkedInLink = _storeInformationSettings.LinkedInLink; liquidStore.PinterestLink = _storeInformationSettings.PinterestLink; liquidObject.Store = liquidStore; await _eventPublisher.EntityTokensAdded(store, liquidStore, liquidObject); }
public void AddStoreTokens(LiquidObject liquidObject, Store store, EmailAccount emailAccount) { var liquidStore = new LiquidStore(store, emailAccount); liquidObject.Store = liquidStore; _eventPublisher.EntityTokensAdded(store, liquidStore, liquidObject); }
public virtual void AddStoreTokens(IList <Token> tokens, Store store, EmailAccount emailAccount) { if (emailAccount == null) { throw new ArgumentNullException("emailAccount"); } tokens.Add(new Token("Store.Name", store.GetLocalized(x => x.Name))); tokens.Add(new Token("Store.URL", store.Url, true)); tokens.Add(new Token("Store.Email", emailAccount.Email)); //event notification _eventPublisher.EntityTokensAdded(store, tokens); }