Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

OmnisendDefaults.cs

using Nop.Core;

namespace Nop.Plugin.Misc.Omnisend;

/// 
/// Represents plugin constants
/// 
public class OmnisendDefaults
{
    #region Tokens

    public static string ProductId => "{ProductId}";

    /// 
    /// Gets a token to place brand identifier in the tracking script
    /// 
    public static string BrandId => "{BrandId}";

    public static string Sku => "{SKU}";

    public static string Currency => "{Currency}";

    public static string Price => "{Price}";

    public static string Title => "{Title}";

    public static string ImageUrl => "{ImageUrl}";

    public static string ProductUrl => "{ProductUrl}";

    public static string Email => "{Email}";

    #endregion

    /// 
    /// Gets a plugin system name
    /// 
    public static string SystemName => "Misc.Omnisend";

    /// 
    /// Gets an identify contact attribute name
    /// 
    public static string IdentifyContactAttribute => "Omnisend.IdentifyContact";

    /// 
    /// Gets a customer email attribute name
    /// 
    public static string CustomerEmailAttribute => "Omnisend.CustomerEmail";

    /// 
    /// Gets a customer shopping cart id attribute name
    /// 
    public static string CurrentCustomerShoppingCartIdAttribute => "Omnisend.ShoppingCartId";

    /// 
    /// Gets a customer shopping cart id attribute name
    /// 
    public static string StoredCustomerShoppingCartIdAttribute => "Omnisend.ShoppingCartId.Stored";

    /// 
    /// Gets a user agent used to request third-party services
    /// 
    public static string UserAgent => $"nopCommerce-{NopVersion.CURRENT_VERSION}";

    /// 
    /// Gets a header of the API key authorization: key
    /// 
    public static string ApiKeyHeader => "X-API-KEY";

    /// 
    /// Gets the configuration route name
    /// 
    public static string ConfigurationRouteName => "Plugin.Misc.Omnisend.Configure";

    /// 
    /// Gets the configuration route name
    /// 
    public static string AbandonedCheckoutRouteName => "Plugin.Misc.Omnisend.AbandonedCheckout";

    /// 
    /// Gets a period (in seconds) before the request times out
    /// 
    public static int RequestTimeout => 30;
        
    /// 
    /// Gets the integration origin
    /// 
    public static string IntegrationOrigin => "nopCommerce";
        
    /// 
    /// Version of the integration
    /// 
    public static string IntegrationVersion => "1.0";

    /// 
    /// Default contact tags
    /// 
    public static List ContactTags => new() {$"source: nopCommerce {NopVersion.FULL_VERSION}" };

    /// 
    /// ContactId query parameter name
    /// 
    public static string ContactIdQueryParamName => "omnisendContactID";

    #region Batch

    /// 
    /// Minimal count of entities to use batch functionality
    /// 
    public static int MinCountToUseBatch => 1;

    /// 
    /// The batch page size
    ///
    /// The max size is 1000
    /// 
    public static int PageSize => 800;

    /// 
    /// Batch finished status
    /// 
    public static string BatchFinishedStatus => "finished";

    #endregion
        
    #region Endpoints and URLs

    /// 
    /// Gets a base API URL
    /// 
    public static string BaseApiUrl => "https://api.omnisend.com/v3";

    /// 
    /// Get a batches API URL
    /// 
    public static string BatchesApiUrl => BaseApiUrl + "/batches";

    /// 
    /// Get an accounts API URL
    /// 
    public static string AccountsApiUrl => BaseApiUrl + "/accounts";

    /// 
    /// Get a contacts endpoint
    /// 
    public static string ContactsEndpoint => "contacts";

    /// 
    /// Get a contacts API URL
    /// 
    public static string ContactsApiUrl => BaseApiUrl + $"/{ContactsEndpoint}";
        
    /// 
    /// Get an orders endpoint
    /// 
    public static string OrdersEndpoint => "orders";

    /// 
    /// Get an orders API URL
    /// 
    public static string OrdersApiUrl => BaseApiUrl + $"/{OrdersEndpoint}";

    /// 
    /// Get a carts endpoint
    /// 
    public static string CartsEndpoint => "carts";

    /// 
    /// Get a carts API URL
    /// 
    public static string CartsApiUrl => BaseApiUrl + $"/{CartsEndpoint}";

    /// 
    /// Get a products endpoint
    /// 
    public static string ProductsEndpoint => "products";

    /// 
    /// Get a products API URL
    /// 
    public static string ProductsApiUrl => BaseApiUrl + $"/{ProductsEndpoint}";

    /// 
    /// Get a categories endpoint
    /// 
    public static string CategoriesEndpoint => "categories";

    /// 
    /// Get a categories API URL
    /// 
    public static string CategoriesApiUrl => BaseApiUrl + $"/{CategoriesEndpoint}";

    /// 
    /// Get a customer-events endpoint
    /// 
    public static string CustomerEventsEndpoint => "customer-events";

    /// 
    /// Get a customer-events API URL
    /// 
    public static string CustomerEventsApiUrl => BaseApiUrl + $"/{CustomerEventsEndpoint}";

    #endregion
}