---
displayed_sidebar: servicesSidebar
---
import ParameterTypes from "@site/src/components/ParameterTypes"
# CustomerService
Provides layer to manipulate customers.
## constructor
### Parameters
___
## Properties
`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"__moduleDeclaration__","type":"`Record`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="CustomerService"/>
___
## Accessors
### activeManager\_
#### Returns
___
## Methods
### withTransaction
#### Parameters
#### Returns
### shouldRetryTransaction\_
#### Parameters
` \\| `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="shouldRetryTransaction_"/>
#### Returns
### atomicPhase\_
Wraps some work within a transactional block. If the service already has
a transaction manager attached this will be reused, otherwise a new
transaction manager is created.
#### Type Parameters
#### Parameters
Promise<TResult>","description":"the transactional work to be done","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationOrErrorHandler","type":"`IsolationLevel` \\| (`error`: TError) => Promise<void \\| TResult>","description":"the isolation level to be used for the work.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"maybeErrorHandlerOrDontFail","type":"(`error`: TError) => Promise<void \\| TResult>","description":"Potential error handler","optional":true,"defaultValue":"","expandable":false,"children":[]}]} sectionTitle="atomicPhase_"/>
#### Returns
### generateResetPasswordToken
Generate a JSON Web token, that will be sent to a customer, that wishes to
reset password.
The token will be signed with the customer's current password hash as a
secret a long side a payload with userId and the expiry time for the token,
which is always 15 minutes.
#### Parameters
#### Returns
### list
#### Parameters
#### Returns
### listAndCount
#### Parameters
#### Returns
### count
Return the total number of documents in database
#### Returns
### retrieve\_
#### Parameters
#### Returns
### retrieveByEmail
Gets a registered customer by email.
#### Parameters
#### Returns
#### Deprecated
### retrieveUnregisteredByEmail
#### Parameters
#### Returns
### retrieveRegisteredByEmail
#### Parameters
#### Returns
### listByEmail
#### Parameters
#### Returns
### retrieveByPhone
Gets a customer by phone.
#### Parameters
#### Returns
### retrieve
Gets a customer by id.
#### Parameters
#### Returns
### hashPassword\_
Hashes a password
#### Parameters
#### Returns
### create
Creates a customer from an email - customers can have accounts associated,
e.g. to login and view order history, etc. If a password is provided the
customer will automatically get an account, otherwise the customer is just
used to hold details of customers.
#### Parameters
#### Returns
### update
Updates a customer.
#### Parameters
#### Returns
### updateBillingAddress\_
Updates the customers' billing address.
#### Parameters
#### Returns
### updateAddress
#### Parameters
#### Returns
### removeAddress
#### Parameters
#### Returns
### addAddress
#### Parameters
#### Returns
### delete
Deletes a customer from a given customer id.
#### Parameters
#### Returns