Webiant Logo Webiant Logo
  1. No results found.

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

ICustomerService.cs

using Nop.Core;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;
using Nop.Core.Domain.Tax;

namespace Nop.Services.Customers;

/// 
/// Customer service interface
/// 
public partial interface ICustomerService
{
    #region Customers

    /// 
    /// Gets all customers
    /// 
    /// Created date from (UTC); null to load all records
    /// Created date to (UTC); null to load all records
    /// Last activity date from (UTC); null to load all records
    /// Last activity date to (UTC); null to load all records
    /// Affiliate identifier
    /// Vendor identifier
    /// A list of customer role identifiers to filter by (at least one match); pass null or empty list in order to load all customers; 
    /// Email; null to load all customers
    /// Username; null to load all customers
    /// First name; null to load all customers
    /// Last name; null to load all customers
    /// Day of birth; 0 to load all customers
    /// Month of birth; 0 to load all customers
    /// Company; null to load all customers
    /// Phone; null to load all customers
    /// Phone; null to load all customers
    /// IP address; null to load all customers
    /// Page index
    /// Page size
    /// A value in indicating whether you want to load only total number of records. Set to "true" if you don't want to load data from database
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customers
    /// 
    Task> GetAllCustomersAsync(DateTime? createdFromUtc = null, DateTime? createdToUtc = null,
        DateTime? lastActivityFromUtc = null, DateTime? lastActivityToUtc = null,
        int affiliateId = 0, int vendorId = 0, int[] customerRoleIds = null,
        string email = null, string username = null, string firstName = null, string lastName = null,
        int dayOfBirth = 0, int monthOfBirth = 0,
        string company = null, string phone = null, string zipPostalCode = null, string ipAddress = null,
        int pageIndex = 0, int pageSize = int.MaxValue, bool getOnlyTotalCount = false);

    /// 
    /// Gets online customers
    /// 
    /// Customer last activity date (from)
    /// A list of customer role identifiers to filter by (at least one match); pass null or empty list in order to load all customers; 
    /// Page index
    /// Page size
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customers
    /// 
    Task> GetOnlineCustomersAsync(DateTime lastActivityFromUtc,
        int[] customerRoleIds, int pageIndex = 0, int pageSize = int.MaxValue);

    /// 
    /// Gets customers with shopping carts
    /// 
    /// Shopping cart type; pass null to load all records
    /// Store identifier; pass 0 to load all records
    /// Product identifier; pass null to load all records
    /// Created date from (UTC); pass null to load all records
    /// Created date to (UTC); pass null to load all records
    /// Billing country identifier; pass null to load all records
    /// Page index
    /// Page size
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customers
    /// 
    Task> GetCustomersWithShoppingCartsAsync(ShoppingCartType? shoppingCartType = null,
        int storeId = 0, int? productId = null,
        DateTime? createdFromUtc = null, DateTime? createdToUtc = null, int? countryId = null,
        int pageIndex = 0, int pageSize = int.MaxValue);

    /// 
    /// Gets customer for shopping cart
    /// 
    /// Shopping cart
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task GetShoppingCartCustomerAsync(IList shoppingCart);

    /// 
    /// Delete a customer
    /// 
    /// Customer
    /// A task that represents the asynchronous operation
    Task DeleteCustomerAsync(Customer customer);

    /// 
    /// Gets built-in system record used for background tasks
    /// 
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains a customer object
    /// 
    Task GetOrCreateBackgroundTaskUserAsync();

    /// 
    /// Gets built-in system guest record used for requests from search engines
    /// 
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains a customer object
    /// 
    Task GetOrCreateSearchEngineUserAsync();

    /// 
    /// Gets a customer
    /// 
    /// Customer identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains a customer
    /// 
    Task GetCustomerByIdAsync(int customerId);

    /// 
    /// Get customers by identifiers
    /// 
    /// Customer identifiers
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customers
    /// 
    Task> GetCustomersByIdsAsync(int[] customerIds);

    /// 
    /// Get customers by guids
    /// 
    /// Customer guids
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customers
    /// 
    Task> GetCustomersByGuidsAsync(Guid[] customerGuids);

    /// 
    /// Gets a customer by GUID
    /// 
    /// Customer GUID
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains a customer
    /// 
    Task GetCustomerByGuidAsync(Guid customerGuid);

    /// 
    /// Get customer by email
    /// 
    /// Email
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer
    /// 
    Task GetCustomerByEmailAsync(string email);

    /// 
    /// Get customer by system role
    /// 
    /// System name
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer
    /// 
    Task GetCustomerBySystemNameAsync(string systemName);

    /// 
    /// Get customer by username
    /// 
    /// Username
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer
    /// 
    Task GetCustomerByUsernameAsync(string username);

    /// 
    /// Insert a guest customer
    /// 
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer
    /// 
    Task InsertGuestCustomerAsync();

    /// 
    /// Insert a customer
    /// 
    /// Customer
    /// A task that represents the asynchronous operation
    Task InsertCustomerAsync(Customer customer);

    /// 
    /// Updates the customer
    /// 
    /// Customer
    /// A task that represents the asynchronous operation
    Task UpdateCustomerAsync(Customer customer);

    /// 
    /// Reset data required for checkout
    /// 
    /// Customer
    /// Store identifier
    /// A value indicating whether to clear coupon code
    /// A value indicating whether to clear selected checkout attributes
    /// A value indicating whether to clear "Use reward points" flag
    /// A value indicating whether to clear selected shipping method
    /// A value indicating whether to clear selected payment method
    /// A task that represents the asynchronous operation
    Task ResetCheckoutDataAsync(Customer customer, int storeId,
        bool clearCouponCodes = false, bool clearCheckoutAttributes = false,
        bool clearRewardPoints = true, bool clearShippingMethod = true,
        bool clearPaymentMethod = true);

    /// 
    /// Delete guest customer records
    /// 
    /// Created date from (UTC); null to load all records
    /// Created date to (UTC); null to load all records
    /// A value indicating whether to delete customers only without shopping cart
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the number of deleted customers
    /// 
    Task DeleteGuestCustomersAsync(DateTime? createdFromUtc, DateTime? createdToUtc, bool onlyWithoutShoppingCart);

    /// 
    /// Gets a tax display type for the customer
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the tax display type
    /// 
    Task GetCustomerTaxDisplayTypeAsync(Customer customer);

    /// 
    /// Gets a default tax display type (if configured)
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task GetCustomerDefaultTaxDisplayTypeAsync(Customer customer);

    /// 
    /// Get full name
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer full name
    /// 
    Task GetCustomerFullNameAsync(Customer customer);

    /// 
    /// Formats the customer name
    /// 
    /// Source
    /// Strip too long customer name
    /// Maximum customer name length
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the formatted text
    /// 
    Task FormatUsernameAsync(Customer customer, bool stripTooLong = false, int maxLength = 0);

    /// 
    /// Gets coupon codes
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the coupon codes
    /// 
    Task ParseAppliedDiscountCouponCodesAsync(Customer customer);

    /// 
    /// Adds a coupon code
    /// 
    /// Customer
    /// Coupon code
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the new coupon codes document
    /// 
    Task ApplyDiscountCouponCodeAsync(Customer customer, string couponCode);

    /// 
    /// Removes a coupon code
    /// 
    /// Customer
    /// Coupon code to remove
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the new coupon codes document
    /// 
    Task RemoveDiscountCouponCodeAsync(Customer customer, string couponCode);

    /// 
    /// Gets coupon codes
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the coupon codes
    /// 
    Task ParseAppliedGiftCardCouponCodesAsync(Customer customer);

    /// 
    /// Adds a coupon code
    /// 
    /// Customer
    /// Coupon code
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the new coupon codes document
    /// 
    Task ApplyGiftCardCouponCodeAsync(Customer customer, string couponCode);

    /// 
    /// Removes a coupon code
    /// 
    /// Customer
    /// Coupon code to remove
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the new coupon codes document
    /// 
    Task RemoveGiftCardCouponCodeAsync(Customer customer, string couponCode);

    /// 
    /// Returns a list of guids of not existing customers
    /// 
    /// The guids of the customers to check
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the list of guids not existing customers
    /// 
    Task GetNotExistingCustomersAsync(Guid[] guids);

    #endregion

    #region Customer roles

    /// 
    /// Add a customer-customer role mapping
    /// 
    /// Customer-customer role mapping
    /// A task that represents the asynchronous operation
    Task AddCustomerRoleMappingAsync(CustomerCustomerRoleMapping roleMapping);

    /// 
    /// Remove a customer-customer role mapping
    /// 
    /// Customer
    /// Customer role
    /// A task that represents the asynchronous operation
    Task RemoveCustomerRoleMappingAsync(Customer customer, CustomerRole role);

    /// 
    /// Delete a customer role
    /// 
    /// Customer role
    /// A task that represents the asynchronous operation
    Task DeleteCustomerRoleAsync(CustomerRole customerRole);

    /// 
    /// Gets a customer role
    /// 
    /// Customer role identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer role
    /// 
    Task GetCustomerRoleByIdAsync(int customerRoleId);

    /// 
    /// Gets a customer role
    /// 
    /// Customer role system name
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer role
    /// 
    Task GetCustomerRoleBySystemNameAsync(string systemName);

    /// 
    /// Get customer role identifiers
    /// 
    /// Customer
    /// A value indicating whether to load hidden records
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer role identifiers
    /// 
    Task GetCustomerRoleIdsAsync(Customer customer, bool showHidden = false);

    /// 
    /// Gets list of customer roles
    /// 
    /// Customer
    /// A value indicating whether to load hidden records
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task> GetCustomerRolesAsync(Customer customer, bool showHidden = false);

    /// 
    /// Gets all customer roles
    /// 
    /// A value indicating whether to show hidden records
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer roles
    /// 
    Task> GetAllCustomerRolesAsync(bool showHidden = false);

    /// 
    /// Inserts a customer role
    /// 
    /// Customer role
    /// A task that represents the asynchronous operation
    Task InsertCustomerRoleAsync(CustomerRole customerRole);

    /// 
    /// Gets a value indicating whether customer is in a certain customer role
    /// 
    /// Customer
    /// Customer role system name
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsInCustomerRoleAsync(Customer customer, string customerRoleSystemName, bool onlyActiveCustomerRoles = true);

    /// 
    /// Gets a value indicating whether customer is administrator
    /// 
    /// Customer
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsAdminAsync(Customer customer, bool onlyActiveCustomerRoles = true);

    /// 
    /// Gets a value indicating whether customer is a forum moderator
    /// 
    /// Customer
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsForumModeratorAsync(Customer customer, bool onlyActiveCustomerRoles = true);

    /// 
    /// Gets a value indicating whether customer is registered
    /// 
    /// Customer
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsRegisteredAsync(Customer customer, bool onlyActiveCustomerRoles = true);

    /// 
    /// Gets a value indicating whether customer is guest
    /// 
    /// Customer
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsGuestAsync(Customer customer, bool onlyActiveCustomerRoles = true);

    /// 
    /// Gets a value indicating whether customer is vendor
    /// 
    /// Customer
    /// A value indicating whether we should look only in active customer roles
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsVendorAsync(Customer customer, bool onlyActiveCustomerRoles = true);

    /// 
    /// Updates the customer role
    /// 
    /// Customer role
    /// A task that represents the asynchronous operation
    Task UpdateCustomerRoleAsync(CustomerRole customerRole);

    #endregion

    #region Customer passwords

    /// 
    /// Gets customer passwords
    /// 
    /// Customer identifier; pass null to load all records
    /// Password format; pass null to load all records
    /// Number of returning passwords; pass null to load all records
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the list of customer passwords
    /// 
    Task> GetCustomerPasswordsAsync(int? customerId = null,
        PasswordFormat? passwordFormat = null, int? passwordsToReturn = null);

    /// 
    /// Get current customer password
    /// 
    /// Customer identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the customer password
    /// 
    Task GetCurrentPasswordAsync(int customerId);

    /// 
    /// Insert a customer password
    /// 
    /// Customer password
    /// A task that represents the asynchronous operation
    Task InsertCustomerPasswordAsync(CustomerPassword customerPassword);

    /// 
    /// Update a customer password
    /// 
    /// Customer password
    /// A task that represents the asynchronous operation
    Task UpdateCustomerPasswordAsync(CustomerPassword customerPassword);

    /// 
    /// Check whether password recovery token is valid
    /// 
    /// Customer
    /// Token to validate
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsPasswordRecoveryTokenValidAsync(Customer customer, string token);

    /// 
    /// Check whether password recovery link is expired
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task IsPasswordRecoveryLinkExpiredAsync(Customer customer);

    /// 
    /// Check whether customer password is expired 
    /// 
    /// Customer
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains true if password is expired; otherwise false
    /// 
    Task IsPasswordExpiredAsync(Customer customer);

    #endregion

    #region Customer address mapping

    /// 
    /// Gets a list of addresses mapped to customer
    /// 
    /// Customer identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the 
    /// 
    Task> GetAddressesByCustomerIdAsync(int customerId);

    /// 
    /// Gets a address mapped to customer
    /// 
    /// Customer identifier
    /// Address identifier
    /// 
    /// A task that represents the asynchronous operation
    /// The task result contains the result
    /// 
    Task
GetCustomerAddressAsync(int customerId, int addressId); /// /// Gets a customer billing address /// /// Customer identifier /// /// A task that represents the asynchronous operation /// The task result contains the result /// Task
GetCustomerBillingAddressAsync(Customer customer); /// /// Gets a customer shipping address /// /// Customer /// /// A task that represents the asynchronous operation /// The task result contains the result /// Task
GetCustomerShippingAddressAsync(Customer customer); /// /// Remove a customer-address mapping record /// /// Customer /// Address /// A task that represents the asynchronous operation Task RemoveCustomerAddressAsync(Customer customer, Address address); /// /// Inserts a customer-address mapping record /// /// Customer /// Address /// A task that represents the asynchronous operation Task InsertCustomerAddressAsync(Customer customer, Address address); #endregion }