* adjusted configurations * enhancements to tool and configurations * change reference in docs * fixed issue in workflows reference * added project name * more optimizations * fix context error * added a types reference * resolved missing types * fix reference reflection types not having children * add an expand url parameter * added new option to the README * added details about new option
1062 lines
21 KiB
Plaintext
1062 lines
21 KiB
Plaintext
---
|
|
displayed_sidebar: servicesSidebar
|
|
---
|
|
|
|
import ParameterTypes from "@site/src/components/ParameterTypes"
|
|
|
|
# CustomerService
|
|
|
|
Provides layer to manipulate customers.
|
|
|
|
## constructor
|
|
|
|
### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "__namedParameters",
|
|
"type": "`InjectedDependencies`",
|
|
"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](../../entities/classes/entities.Address.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "customerRepository_",
|
|
"type": "Repository<[Customer](../../entities/classes/entities.Customer.mdx)> & `object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "eventBusService_",
|
|
"type": "[EventBusService](services.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\_
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "EntityManager",
|
|
"type": "`EntityManager`",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
## Methods
|
|
|
|
### addAddress
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "address",
|
|
"type": "[AddressCreatePayload](../../medusa/classes/medusa.AddressCreatePayload.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx) \\| [Address](../../entities/classes/entities.Address.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### 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
|
|
|
|
<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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<TResult>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the transactional work",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### count
|
|
|
|
Return the total number of documents in database
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<number>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the count operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### 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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customer",
|
|
"type": "`CreateCustomerInput`",
|
|
"description": "the customer to create",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of create",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### delete
|
|
|
|
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\n castable as an ObjectId",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<void \\| [Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the delete operation.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### 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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the customer to reset the password for",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<string>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the generated JSON web token",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### hashPassword\_
|
|
|
|
Hashes a password
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "password",
|
|
"type": "`string`",
|
|
"description": "the value to hash",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<string>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "hashed password",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### list
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[Selector](../../medusa/types/medusa.Selector.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)> & `object`",
|
|
"description": "the query object for find",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the find operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### listAndCount
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[Selector](../../medusa/types/medusa.Selector.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)> & `object`",
|
|
"description": "the query object for find",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[[Customer](../../entities/classes/entities.Customer.mdx)[], number]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the find operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### listByEmail
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)[]>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### removeAddress
|
|
|
|
#### 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
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<void>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieve
|
|
|
|
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](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveByEmail
|
|
|
|
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](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Deprecated
|
|
|
|
___
|
|
|
|
### retrieveByPhone
|
|
|
|
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](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "the config object containing query settings",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the customer document.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveRegisteredByEmail
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieveUnregisteredByEmail
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "email",
|
|
"type": "`string`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### retrieve\_
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "selector",
|
|
"type": "[Selector](../../medusa/types/medusa.Selector.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "config",
|
|
"type": "[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "{}",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### shouldRetryTransaction\_
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "err",
|
|
"type": "`Record<string, unknown>` \\| `object`",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "boolean",
|
|
"type": "`boolean`",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### update
|
|
|
|
Updates a customer.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customerId",
|
|
"type": "`string`",
|
|
"description": "the id of the variant. Must be a string that\n can be casted to an ObjectId",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "update",
|
|
"type": "`UpdateCustomerInput`",
|
|
"description": "an object with the update values.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Customer](../../entities/classes/entities.Customer.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "resolves to the update result.",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### updateAddress
|
|
|
|
#### 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](../../medusa/classes/medusa.StorePostCustomersCustomerAddressesAddressReq.mdx)",
|
|
"description": "",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<[Address](../../entities/classes/entities.Address.mdx)>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### updateBillingAddress\_
|
|
|
|
Updates the customers' billing address.
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "customer",
|
|
"type": "[Customer](../../entities/classes/entities.Customer.mdx)",
|
|
"description": "the Customer to update",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
},
|
|
{
|
|
"name": "addressOrId",
|
|
"type": "`undefined` \\| `string` \\| DeepPartial<[Address](../../entities/classes/entities.Address.mdx)>",
|
|
"description": "the value to set the billing address to",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "Promise",
|
|
"type": "Promise<void>",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"description": "the result of the update operation",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
___
|
|
|
|
### withTransaction
|
|
|
|
#### Parameters
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "transactionManager",
|
|
"type": "`EntityManager`",
|
|
"description": "",
|
|
"optional": true,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|
|
|
|
#### Returns
|
|
|
|
<ParameterTypes parameters={[
|
|
{
|
|
"name": "CustomerService",
|
|
"type": "`object`",
|
|
"description": "Provides layer to manipulate customers.",
|
|
"optional": false,
|
|
"defaultValue": "",
|
|
"expandable": false,
|
|
"children": []
|
|
}
|
|
]} />
|