Generated the following references: - `pricing` - `product` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
1150 lines
23 KiB
Plaintext
1150 lines
23 KiB
Plaintext
---
|
|
displayed_sidebar: servicesSidebar
|
|
---
|
|
|
|
import ParameterTypes from "@site/src/components/ParameterTypes"
|
|
|
|
# CustomerService
|
|
|
|
Provides layer to manipulate customers.
|
|
|
|
## Constructors
|
|
|
|
### constructor
|
|
|
|
**new CustomerService**(`«destructured»`)
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "__namedParameters",
|
|
"type": "[`InjectedDependencies`](../types/InjectedDependencies-7.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
## Properties
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "__configModule__",
|
|
"type": "Record<`string`, `unknown`\\>",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "__container__",
|
|
"type": "`any`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "__moduleDeclaration__",
|
|
"type": "Record<`string`, `unknown`\\>",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "addressRepository_",
|
|
"type": "`Repository`<[`Address`](Address.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "customerRepository_",
|
|
"type": "`Repository`<[`Customer`](Customer.mdx)\\> & { `listAndCount`: Method listAndCount }",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "eventBusService_",
|
|
"type": "[`EventBusService`](EventBusService.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "manager_",
|
|
"type": "`EntityManager`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "transactionManager_",
|
|
"type": "`undefined` \\| `EntityManager`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "Events",
|
|
"type": "`object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "Events.CREATED",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "\"customer.created\"",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "Events.PASSWORD_RESET",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "\"customer.password_reset\"",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "Events.UPDATED",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "\"customer.updated\"",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
## Accessors
|
|
|
|
### activeManager\_
|
|
|
|
`Protected` `get` **activeManager_**(): `EntityManager`
|
|
|
|
#### Returns
|
|
|
|
`EntityManager`
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "EntityManager",
|
|
"type": "`EntityManager`",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
## Methods
|
|
|
|
### addAddress
|
|
|
|
**addAddress**(`customerId`, `address`): `Promise`<[`Customer`](Customer.mdx) \| [`Address`](Address.mdx)\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "address",
|
|
"type": "[`AddressCreatePayload`](AddressCreatePayload.mdx)",
|
|
"description": "Address fields used when creating an address.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx) \| [`Address`](Address.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx) \\| [`Address`](Address.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### atomicPhase\_
|
|
|
|
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
|
|
|
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.
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "TResult",
|
|
"type": "`object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "TError",
|
|
"type": "`object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "work",
|
|
"type": "(`transactionManager`: `EntityManager`) => `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": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`TResult`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`TResult`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the transactional work",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### count
|
|
|
|
**count**(): `Promise`<`number`\>
|
|
|
|
Return the total number of documents in database
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`number`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`number`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the count operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### create
|
|
|
|
**create**(`customer`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customer",
|
|
"type": "[`CreateCustomerInput`](../types/CreateCustomerInput.mdx)",
|
|
"description": "the customer to create",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of create",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### delete
|
|
|
|
**delete**(`customerId`): `Promise`<`void` \| [`Customer`](Customer.mdx)\>
|
|
|
|
Deletes a customer from a given customer id.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the id of the customer to delete. Must be castable as an ObjectId",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`void` \| [`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`void` \\| [`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the delete operation.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### generateResetPasswordToken
|
|
|
|
**generateResetPasswordToken**(`customerId`): `Promise`<`string`\>
|
|
|
|
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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the customer to reset the password for",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`string`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`string`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the generated JSON web token",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### hashPassword\_
|
|
|
|
**hashPassword_**(`password`): `Promise`<`string`\>
|
|
|
|
Hashes a password
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "password",
|
|
"type": "`string`",
|
|
"description": "the value to hash",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`string`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`string`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "hashed password",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### list
|
|
|
|
**list**(`selector?`, `config?`): `Promise`<[`Customer`](Customer.mdx)[]\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[`Selector`](../types/Selector.mdx)<[`Customer`](Customer.mdx)\\> & { `groups?`: `string`[] ; `q?`: `string` }",
|
|
"description": "the query object for find",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)[]\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)[]\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the find operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### listAndCount
|
|
|
|
**listAndCount**(`selector`, `config?`): `Promise`<[[`Customer`](Customer.mdx)[], `number`]\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[`Selector`](../types/Selector.mdx)<[`Customer`](Customer.mdx)\\> & { `groups?`: `string`[] ; `q?`: `string` }",
|
|
"description": "the query object for find",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[[`Customer`](Customer.mdx)[], `number`]\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[[`Customer`](Customer.mdx)[], `number`]\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the find operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### listByEmail
|
|
|
|
**listByEmail**(`email`, `config?`): `Promise`<[`Customer`](Customer.mdx)[]\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)[]\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)[]\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### removeAddress
|
|
|
|
**removeAddress**(`customerId`, `addressId`): `Promise`<`void`\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "addressId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`void`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`void`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieve
|
|
|
|
**retrieve**(`customerId`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
Gets a customer by id.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the id of the customer to get.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveByEmail
|
|
|
|
**retrieveByEmail**(`email`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
Gets a registered customer by email.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "the email of the customer to get.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Deprecated
|
|
|
|
___
|
|
|
|
### retrieveByPhone
|
|
|
|
**retrieveByPhone**(`phone`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
Gets a customer by phone.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "phone",
|
|
"type": "`string`",
|
|
"description": "the phone of the customer to get.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveRegisteredByEmail
|
|
|
|
**retrieveRegisteredByEmail**(`email`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveUnregisteredByEmail
|
|
|
|
**retrieveUnregisteredByEmail**(`email`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieve\_
|
|
|
|
`Private` **retrieve_**(`selector`, `config?`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[`Selector`](../types/Selector.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Customer`](Customer.mdx)\\>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### shouldRetryTransaction\_
|
|
|
|
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "err",
|
|
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`boolean`
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "boolean",
|
|
"type": "`boolean`",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### update
|
|
|
|
**update**(`customerId`, `update`): `Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
Updates a customer.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the id of the variant. Must be a string that can be casted to an ObjectId",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "update",
|
|
"type": "[`UpdateCustomerInput`](../types/UpdateCustomerInput.mdx)",
|
|
"description": "an object with the update values.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Customer`](Customer.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Customer`](Customer.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "resolves to the update result.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### updateAddress
|
|
|
|
**updateAddress**(`customerId`, `addressId`, `address`): `Promise`<[`Address`](Address.mdx)\>
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "addressId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "address",
|
|
"type": "[`StorePostCustomersCustomerAddressesAddressReq`](StorePostCustomersCustomerAddressesAddressReq.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<[`Address`](Address.mdx)\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<[`Address`](Address.mdx)\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### updateBillingAddress\_
|
|
|
|
**updateBillingAddress_**(`customer`, `addressOrId`): `Promise`<`void`\>
|
|
|
|
Updates the customers' billing address.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customer",
|
|
"type": "[`Customer`](Customer.mdx)",
|
|
"description": "the Customer to update",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "addressOrId",
|
|
"type": "`undefined` \\| `string` \\| `DeepPartial`<[`Address`](Address.mdx)\\>",
|
|
"description": "the value to set the billing address to",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
`Promise`<`void`\>
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "`Promise`<`void`\\>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the update operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### withTransaction
|
|
|
|
**withTransaction**(`transactionManager?`): [`CustomerService`](CustomerService.mdx)
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "transactionManager",
|
|
"type": "`EntityManager`",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
[`CustomerService`](CustomerService.mdx)
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "CustomerService",
|
|
"type": "[`CustomerService`](CustomerService.mdx)",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|