chore: fixed commit branch on generate reference action (#1857)
* fixed commit branch * fixes after yarn upgrade
This commit is contained in:
1 parent
32b066d923
commit
e134f6d237
49 files changed
+13599
-11325
No files matched your search
@@ -44,3 +44,4 @@ jobs:
|
||||
commit_message: "docs: automatically Generated Services Reference"
|
||||
file_pattern: docs/content/*
|
||||
skip_dirty_check: false
|
||||
branch: master
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: AuthService
|
||||
|
||||
Can authenticate a user based on email password combination
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`AuthService`](AuthService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<AuthService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L25)
|
||||
[services/auth.ts:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L23)
|
||||
[services/auth.ts:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
@@ -70,7 +68,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:20](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L20)
|
||||
[services/auth.ts:20](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
@@ -84,7 +82,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:21](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L21)
|
||||
[services/auth.ts:21](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
@@ -94,7 +92,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L22)
|
||||
[services/auth.ts:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L22)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -102,10 +100,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -117,23 +111,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -141,27 +133,20 @@ ___
|
||||
|
||||
▸ **authenticate**(`email`, `password`): `Promise`<`AuthenticateResult`\>
|
||||
|
||||
Authenticates a given user based on an email, password combination. Uses
|
||||
scrypt to match password with hashed value.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `email` | `string` | the email of the user |
|
||||
| `password` | `string` | the password of the user |
|
||||
| `email` | `string` | |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
success: whether authentication succeeded
|
||||
user: the user document if authentication succeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:98](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L98)
|
||||
[services/auth.ts:98](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L98)
|
||||
|
||||
___
|
||||
|
||||
@@ -169,25 +154,19 @@ ___
|
||||
|
||||
▸ **authenticateAPIToken**(`token`): `Promise`<`AuthenticateResult`\>
|
||||
|
||||
Authenticates a given user with an API token
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `token` | `string` | the api_token of the user to authenticate |
|
||||
| `token` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
success: whether authentication succeeded
|
||||
user: the user document if authentication succeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:55](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L55)
|
||||
[services/auth.ts:55](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
@@ -195,27 +174,20 @@ ___
|
||||
|
||||
▸ **authenticateCustomer**(`email`, `password`): `Promise`<`AuthenticateResult`\>
|
||||
|
||||
Authenticates a customer based on an email, password combination. Uses
|
||||
scrypt to match password with hashed value.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `email` | `string` | the email of the user |
|
||||
| `password` | `string` | the password of the user |
|
||||
| `email` | `string` | |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
success: whether authentication succeeded
|
||||
user: the user document if authentication succeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:147](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L147)
|
||||
[services/auth.ts:147](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
@@ -223,24 +195,20 @@ ___
|
||||
|
||||
▸ `Protected` **comparePassword_**(`password`, `hash`): `Promise`<`boolean`\>
|
||||
|
||||
Verifies if a password is valid given the provided password hash
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `password` | `string` | the raw password to check |
|
||||
| `hash` | `string` | the hash to compare against |
|
||||
| `password` | `string` | |
|
||||
| `hash` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
the result of the comparison
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/auth.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/auth.ts#L39)
|
||||
[services/auth.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/auth.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -264,7 +232,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -288,4 +256,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -24,7 +24,7 @@ TransactionBaseService<BatchJobService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:93](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L93)
|
||||
[services/batch-job.ts:93](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L93)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -34,7 +34,7 @@ TransactionBaseService<BatchJobService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:41](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L41)
|
||||
[services/batch-job.ts:41](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
@@ -44,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L45)
|
||||
[services/batch-job.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -74,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L42)
|
||||
[services/batch-job.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,7 +88,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L38)
|
||||
[services/batch-job.ts:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
@@ -98,7 +98,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L43)
|
||||
[services/batch-job.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -112,7 +112,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L39)
|
||||
[services/batch-job.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -135,7 +135,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L27)
|
||||
[services/batch-job.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L27)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -143,10 +143,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -158,23 +154,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -194,7 +188,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:284](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L284)
|
||||
[services/batch-job.ts:284](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L284)
|
||||
|
||||
___
|
||||
|
||||
@@ -214,7 +208,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:266](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L266)
|
||||
[services/batch-job.ts:266](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L266)
|
||||
|
||||
___
|
||||
|
||||
@@ -234,7 +228,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:248](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L248)
|
||||
[services/batch-job.ts:248](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L248)
|
||||
|
||||
___
|
||||
|
||||
@@ -254,7 +248,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:153](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L153)
|
||||
[services/batch-job.ts:153](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L153)
|
||||
|
||||
___
|
||||
|
||||
@@ -275,7 +269,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:137](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L137)
|
||||
[services/batch-job.ts:137](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L137)
|
||||
|
||||
___
|
||||
|
||||
@@ -296,7 +290,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:380](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L380)
|
||||
[services/batch-job.ts:380](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L380)
|
||||
|
||||
___
|
||||
|
||||
@@ -317,7 +311,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:112](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L112)
|
||||
[services/batch-job.ts:112](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L112)
|
||||
|
||||
___
|
||||
|
||||
@@ -338,7 +332,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:354](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L354)
|
||||
[services/batch-job.ts:354](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L354)
|
||||
|
||||
___
|
||||
|
||||
@@ -358,7 +352,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:302](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L302)
|
||||
[services/batch-job.ts:302](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L302)
|
||||
|
||||
___
|
||||
|
||||
@@ -378,7 +372,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:334](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L334)
|
||||
[services/batch-job.ts:334](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L334)
|
||||
|
||||
___
|
||||
|
||||
@@ -402,7 +396,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -423,7 +417,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:172](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L172)
|
||||
[services/batch-job.ts:172](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L172)
|
||||
|
||||
___
|
||||
|
||||
@@ -444,7 +438,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/batch-job.ts:213](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/batch-job.ts#L213)
|
||||
[services/batch-job.ts:213](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/batch-job.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
@@ -468,4 +462,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -24,7 +24,7 @@ BaseService<ClaimItemService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L30)
|
||||
[services/claim-item.ts:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L30)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -34,7 +34,7 @@ BaseService<ClaimItemService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L25)
|
||||
[services/claim-item.ts:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
@@ -44,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L23)
|
||||
[services/claim-item.ts:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
@@ -54,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:24](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L24)
|
||||
[services/claim-item.ts:24](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
@@ -84,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L22)
|
||||
[services/claim-item.ts:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
@@ -94,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:21](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L21)
|
||||
[services/claim-item.ts:21](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
@@ -108,7 +108,7 @@ BaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L27)
|
||||
[services/claim-item.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -122,7 +122,7 @@ BaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L28)
|
||||
[services/claim-item.ts:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
@@ -140,7 +140,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L15)
|
||||
[services/claim-item.ts:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L15)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -148,10 +148,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -163,23 +159,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
BaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -199,7 +193,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L49)
|
||||
[services/claim-item.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
@@ -211,18 +205,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`ClaimItem`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | the config object for find |
|
||||
| `selector` | `Selector`<`ClaimItem`\> | |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:214](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L214)
|
||||
[services/claim-item.ts:214](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L214)
|
||||
|
||||
___
|
||||
|
||||
@@ -230,24 +222,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`ClaimItem`\>
|
||||
|
||||
Gets a claim item by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of ClaimItem to retrieve |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | configuration for the find operation |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`\>
|
||||
|
||||
the ClaimItem
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:233](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L233)
|
||||
[services/claim-item.ts:233](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L233)
|
||||
|
||||
___
|
||||
|
||||
@@ -271,7 +259,7 @@ BaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -292,7 +280,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim-item.ts:132](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim-item.ts#L132)
|
||||
[services/claim-item.ts:132](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim-item.ts#L132)
|
||||
|
||||
___
|
||||
|
||||
@@ -316,4 +304,4 @@ BaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -27,7 +27,7 @@ TransactionBaseService<
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:85](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L85)
|
||||
[services/claim.ts:85](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L85)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -37,7 +37,7 @@ TransactionBaseService<
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L68)
|
||||
[services/claim.ts:68](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
@@ -47,7 +47,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:72](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L72)
|
||||
[services/claim.ts:72](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
@@ -57,7 +57,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:69](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L69)
|
||||
[services/claim.ts:69](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L69)
|
||||
|
||||
___
|
||||
|
||||
@@ -87,7 +87,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:73](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L73)
|
||||
[services/claim.ts:73](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
@@ -97,7 +97,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:74](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L74)
|
||||
[services/claim.ts:74](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
@@ -107,7 +107,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:75](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L75)
|
||||
[services/claim.ts:75](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
@@ -117,7 +117,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:76](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L76)
|
||||
[services/claim.ts:76](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L76)
|
||||
|
||||
___
|
||||
|
||||
@@ -127,7 +127,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:71](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L71)
|
||||
[services/claim.ts:71](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
@@ -137,7 +137,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:77](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L77)
|
||||
[services/claim.ts:77](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L77)
|
||||
|
||||
___
|
||||
|
||||
@@ -151,7 +151,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:65](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L65)
|
||||
[services/claim.ts:65](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
@@ -161,7 +161,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:78](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L78)
|
||||
[services/claim.ts:78](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
@@ -171,7 +171,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:79](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L79)
|
||||
[services/claim.ts:79](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L79)
|
||||
|
||||
___
|
||||
|
||||
@@ -181,7 +181,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:80](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L80)
|
||||
[services/claim.ts:80](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
@@ -191,7 +191,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:70](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L70)
|
||||
[services/claim.ts:70](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
@@ -201,7 +201,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:81](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L81)
|
||||
[services/claim.ts:81](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
@@ -211,7 +211,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:82](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L82)
|
||||
[services/claim.ts:82](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
@@ -221,7 +221,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:83](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L83)
|
||||
[services/claim.ts:83](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L83)
|
||||
|
||||
___
|
||||
|
||||
@@ -235,7 +235,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:66](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L66)
|
||||
[services/claim.ts:66](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L66)
|
||||
|
||||
___
|
||||
|
||||
@@ -256,7 +256,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L56)
|
||||
[services/claim.ts:56](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L56)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -264,10 +264,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -279,23 +275,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -315,7 +309,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:753](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L753)
|
||||
[services/claim.ts:753](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L753)
|
||||
|
||||
___
|
||||
|
||||
@@ -335,7 +329,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:602](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L602)
|
||||
[services/claim.ts:602](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L602)
|
||||
|
||||
___
|
||||
|
||||
@@ -343,25 +337,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
Creates a Claim on an Order. Claims consists of items that are claimed and
|
||||
optionally items to be sent as replacement for the claimed items. The
|
||||
shipping address that the new items will be shipped to
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `CreateClaimInput` | the object containing all data required to create a claim |
|
||||
| `data` | `CreateClaimInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
created claim
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:217](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L217)
|
||||
[services/claim.ts:217](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L217)
|
||||
|
||||
___
|
||||
|
||||
@@ -373,20 +361,18 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the object containing all data required to create a claim |
|
||||
| `config` | `Object` | config object |
|
||||
| `config.metadata?` | `Record`<`string`, `unknown`\> | config metadata |
|
||||
| `config.no_notification?` | `boolean` | config no notification |
|
||||
| `id` | `string` | |
|
||||
| `config` | `Object` | |
|
||||
| `config.metadata?` | `Record`<`string`, `unknown`\> | |
|
||||
| `config.no_notification?` | `boolean` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
created claim
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:456](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L456)
|
||||
[services/claim.ts:456](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L456)
|
||||
|
||||
___
|
||||
|
||||
@@ -411,7 +397,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:674](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L674)
|
||||
[services/claim.ts:674](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L674)
|
||||
|
||||
___
|
||||
|
||||
@@ -423,18 +409,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | the config object containing query settings |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:809](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L809)
|
||||
[services/claim.ts:809](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L809)
|
||||
|
||||
___
|
||||
|
||||
@@ -454,7 +438,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:628](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L628)
|
||||
[services/claim.ts:628](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L628)
|
||||
|
||||
___
|
||||
|
||||
@@ -462,24 +446,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the claim order to retrieve |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | the config object containing query settings |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:834](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L834)
|
||||
[services/claim.ts:834](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L834)
|
||||
|
||||
___
|
||||
|
||||
@@ -503,7 +483,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -524,7 +504,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/claim.ts:127](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/claim.ts#L127)
|
||||
[services/claim.ts:127](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/claim.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
@@ -548,4 +528,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -24,7 +24,7 @@ TransactionBaseService<CustomShippingOptionService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:19](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L19)
|
||||
[services/custom-shipping-option.ts:19](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L19)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -54,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:17](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L17)
|
||||
[services/custom-shipping-option.ts:17](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
@@ -68,7 +68,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L15)
|
||||
[services/custom-shipping-option.ts:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
@@ -82,7 +82,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L16)
|
||||
[services/custom-shipping-option.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L16)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -90,10 +90,6 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -105,23 +101,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -129,23 +123,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`CustomShippingOption`\>
|
||||
|
||||
Creates a custom shipping option
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `CreateCustomShippingOptionInput` | the custom shipping option to create |
|
||||
| `data` | `CreateCustomShippingOptionInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomShippingOption`\>
|
||||
|
||||
resolves to the creation result
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:90](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L90)
|
||||
[services/custom-shipping-option.ts:90](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L90)
|
||||
|
||||
___
|
||||
|
||||
@@ -153,24 +143,20 @@ ___
|
||||
|
||||
▸ **list**(`selector`, `config?`): `Promise`<`CustomShippingOption`[]\>
|
||||
|
||||
Fetches all custom shipping options based on the given selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`CustomShippingOption`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `selector` | `Selector`<`CustomShippingOption`\> | |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomShippingOption`[]\>
|
||||
|
||||
custom shipping options matching the query
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:65](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L65)
|
||||
[services/custom-shipping-option.ts:65](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
@@ -178,24 +164,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`CustomShippingOption`\>
|
||||
|
||||
Retrieves a specific shipping option.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the custom shipping option to retrieve. |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | any options needed to query for the result. |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomShippingOption`\>
|
||||
|
||||
the requested custom shipping option.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/custom-shipping-option.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/custom-shipping-option.ts#L36)
|
||||
[services/custom-shipping-option.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/custom-shipping-option.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -219,7 +201,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -243,4 +225,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,9 +1,5 @@
|
||||
# Class: CustomerGroupService
|
||||
|
||||
Provides layer to manipulate discounts.
|
||||
|
||||
**`implements`** {BaseService}
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -28,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L31)
|
||||
[services/customer-group.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L31)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -38,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L27)
|
||||
[services/customer-group.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -48,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L29)
|
||||
[services/customer-group.ts:29](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
@@ -58,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L25)
|
||||
[services/customer-group.ts:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L25)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -66,24 +62,20 @@ ___
|
||||
|
||||
▸ **addCustomers**(`id`, `customerIds`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Add a batch of customers to a customer group at once
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the customer group to add customers to |
|
||||
| `customerIds` | `string` \| `string`[] | customer id's to add to the group |
|
||||
| `id` | `string` | |
|
||||
| `customerIds` | `string` \| `string`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
the customer group after insertion
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:113](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L113)
|
||||
[services/customer-group.ts:113](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
@@ -91,23 +83,27 @@ ___
|
||||
|
||||
▸ **create**(`group`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Creates a customer group with the provided data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `group` | `DeepPartial`<`CustomerGroup`\> | the customer group to create |
|
||||
| `group` | `Object` | |
|
||||
| `group.created_at?` | { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } | - |
|
||||
| `group.customers?` | (`undefined` \| { email?: string \| undefined; first\_name?: string \| undefined; last\_name?: string \| undefined; billing\_address\_id?: string \| null \| undefined; billing\_address?: { customer\_id?: string \| null \| undefined; ... 16 more ...; updated\_at?: { ...; } \| undefined; } \| undefined; ... 10 more ...; updated\_at?: { ...; } \| undef...)[] | - |
|
||||
| `group.deleted_at?` | ``null`` \| { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } | - |
|
||||
| `group.id?` | `string` | - |
|
||||
| `group.metadata?` | { [x: string]: unknown; } | - |
|
||||
| `group.name?` | `string` | - |
|
||||
| `group.price_lists?` | (`undefined` \| { name?: string \| undefined; description?: string \| undefined; type?: PriceListType \| undefined; status?: PriceListStatus \| undefined; starts\_at?: { ...; } \| ... 1 more ... \| undefined; ... 6 more ...; updated\_at?: { ...; } \| undefined; })[] | - |
|
||||
| `group.updated_at?` | { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:86](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L86)
|
||||
[services/customer-group.ts:86](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
@@ -115,23 +111,19 @@ ___
|
||||
|
||||
▸ **delete**(`groupId`): `Promise`<`void`\>
|
||||
|
||||
Remove customer group
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `groupId` | `string` | id of the customer group to delete |
|
||||
| `groupId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
a promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:194](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L194)
|
||||
[services/customer-group.ts:194](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L194)
|
||||
|
||||
___
|
||||
|
||||
@@ -139,24 +131,20 @@ ___
|
||||
|
||||
▸ **list**(`selector?`, `config`): `Promise`<`CustomerGroup`[]\>
|
||||
|
||||
List customer groups.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableCustomerGroupProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | the config to be used for find |
|
||||
| `selector` | `FilterableCustomerGroupProps` | |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:217](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L217)
|
||||
[services/customer-group.ts:217](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L217)
|
||||
|
||||
___
|
||||
|
||||
@@ -164,24 +152,20 @@ ___
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config`): `Promise`<[`CustomerGroup`[], `number`]\>
|
||||
|
||||
Retrieve a list of customer groups and total count of records that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableCustomerGroupProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | the config to be used for find |
|
||||
| `selector` | `FilterableCustomerGroupProps` | |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:236](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L236)
|
||||
[services/customer-group.ts:236](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L236)
|
||||
|
||||
___
|
||||
|
||||
@@ -189,24 +173,20 @@ ___
|
||||
|
||||
▸ **removeCustomer**(`id`, `customerIds`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Remove list of customers from a customergroup
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the customer group from which the customers are removed |
|
||||
| `customerIds` | `string` \| `string`[] | id's of the customer to remove from group |
|
||||
| `id` | `string` | |
|
||||
| `customerIds` | `string` \| `string`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
the customergroup with the provided id
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:271](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L271)
|
||||
[services/customer-group.ts:271](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L271)
|
||||
|
||||
___
|
||||
|
||||
@@ -227,7 +207,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L62)
|
||||
[services/customer-group.ts:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
@@ -235,24 +215,20 @@ ___
|
||||
|
||||
▸ **update**(`customerGroupId`, `update`): `Promise`<`CustomerGroup`[]\>
|
||||
|
||||
Update a customer group.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customerGroupId` | `string` | id of the customer group |
|
||||
| `update` | `CustomerGroupUpdate` | customer group partial data |
|
||||
| `customerGroupId` | `string` | |
|
||||
| `update` | `CustomerGroupUpdate` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`[]\>
|
||||
|
||||
resulting customer group
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:162](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L162)
|
||||
[services/customer-group.ts:162](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L162)
|
||||
|
||||
___
|
||||
|
||||
@@ -272,4 +248,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer-group.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer-group.ts#L46)
|
||||
[services/customer-group.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer-group.ts#L46)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: CustomerService
|
||||
|
||||
Provides layer to manipulate customers.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`CustomerService`](CustomerService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<CustomerService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L40)
|
||||
[services/customer.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L40)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ TransactionBaseService<CustomerService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L28)
|
||||
[services/customer.ts:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L27)
|
||||
[services/customer.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L29)
|
||||
[services/customer.ts:29](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
@@ -90,7 +88,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L31)
|
||||
[services/customer.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
@@ -104,7 +102,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L32)
|
||||
[services/customer.ts:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
@@ -122,13 +120,13 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L34)
|
||||
[services/customer.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L34)
|
||||
|
||||
## Methods
|
||||
|
||||
### addAddress
|
||||
|
||||
▸ **addAddress**(`customerId`, `address`): `Promise`<`Customer` \| `Address`\>
|
||||
▸ **addAddress**(`customerId`, `address`): `Promise`<`Address` \| `Customer`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
@@ -139,11 +137,11 @@ ___
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer` \| `Address`\>
|
||||
`Promise`<`Address` \| `Customer`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:471](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L471)
|
||||
[services/customer.ts:471](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L471)
|
||||
|
||||
___
|
||||
|
||||
@@ -151,10 +149,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -166,23 +160,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -190,17 +182,13 @@ ___
|
||||
|
||||
▸ **count**(): `Promise`<`number`\>
|
||||
|
||||
Return the total number of documents in database
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the result of the count operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:161](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L161)
|
||||
[services/customer.ts:161](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L161)
|
||||
|
||||
___
|
||||
|
||||
@@ -208,26 +196,19 @@ ___
|
||||
|
||||
▸ **create**(`customer`): `Promise`<`Customer`\>
|
||||
|
||||
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
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customer` | `CreateCustomerInput` | the customer to create |
|
||||
| `customer` | `CreateCustomerInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
the result of create
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:255](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L255)
|
||||
[services/customer.ts:255](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L255)
|
||||
|
||||
___
|
||||
|
||||
@@ -235,23 +216,19 @@ ___
|
||||
|
||||
▸ **delete**(`customerId`): `Promise`<`void` \| `Customer`\>
|
||||
|
||||
Deletes a customer from a given customer id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customerId` | `string` | the id of the customer to delete. Must be castable as an ObjectId |
|
||||
| `customerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `Customer`\>
|
||||
|
||||
the result of the delete operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:519](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L519)
|
||||
[services/customer.ts:519](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L519)
|
||||
|
||||
___
|
||||
|
||||
@@ -259,27 +236,19 @@ ___
|
||||
|
||||
▸ **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
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customerId` | `string` | the customer to reset the password for |
|
||||
| `customerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
the generated JSON web token
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:65](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L65)
|
||||
[services/customer.ts:65](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
@@ -287,23 +256,19 @@ ___
|
||||
|
||||
▸ **hashPassword_**(`password`): `Promise`<`string`\>
|
||||
|
||||
Hashes a password
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `password` | `string` | the value to hash |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
hashed password
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:242](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L242)
|
||||
[services/customer.ts:242](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L242)
|
||||
|
||||
___
|
||||
|
||||
@@ -315,18 +280,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`Customer`\> & { `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
| `selector` | `Selector`<`Customer`\> & { `q?`: `string` } | |
|
||||
| `config` | `FindConfig`<`Customer`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:108](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L108)
|
||||
[services/customer.ts:108](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L108)
|
||||
|
||||
___
|
||||
|
||||
@@ -338,18 +301,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`Customer`\> & { `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
| `selector` | `Selector`<`Customer`\> & { `q?`: `string` } | |
|
||||
| `config` | `FindConfig`<`Customer`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Customer`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:133](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L133)
|
||||
[services/customer.ts:133](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L133)
|
||||
|
||||
___
|
||||
|
||||
@@ -370,7 +331,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:454](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L454)
|
||||
[services/customer.ts:454](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L454)
|
||||
|
||||
___
|
||||
|
||||
@@ -378,24 +339,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`customerId`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a customer by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customerId` | `string` | the id of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
| `customerId` | `string` | |
|
||||
| `config` | `FindConfig`<`Customer`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
the customer document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:228](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L228)
|
||||
[services/customer.ts:228](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L228)
|
||||
|
||||
___
|
||||
|
||||
@@ -403,24 +360,20 @@ ___
|
||||
|
||||
▸ **retrieveByEmail**(`email`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a customer by email.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `email` | `string` | the email of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
| `email` | `string` | |
|
||||
| `config` | `FindConfig`<`Customer`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
the customer document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:198](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L198)
|
||||
[services/customer.ts:198](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L198)
|
||||
|
||||
___
|
||||
|
||||
@@ -428,24 +381,20 @@ ___
|
||||
|
||||
▸ **retrieveByPhone**(`phone`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a customer by phone.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `phone` | `string` | the phone of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
| `phone` | `string` | |
|
||||
| `config` | `FindConfig`<`Customer`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
the customer document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:213](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L213)
|
||||
[services/customer.ts:213](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L213)
|
||||
|
||||
___
|
||||
|
||||
@@ -466,7 +415,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:168](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L168)
|
||||
[services/customer.ts:168](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L168)
|
||||
|
||||
___
|
||||
|
||||
@@ -490,7 +439,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -498,24 +447,20 @@ ___
|
||||
|
||||
▸ **update**(`customerId`, `update`): `Promise`<`Customer`\>
|
||||
|
||||
Updates a customer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customerId` | `string` | the id of the variant. Must be a string that can be casted to an ObjectId |
|
||||
| `update` | `UpdateCustomerInput` | an object with the update values. |
|
||||
| `customerId` | `string` | |
|
||||
| `update` | `UpdateCustomerInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:310](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L310)
|
||||
[services/customer.ts:310](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L310)
|
||||
|
||||
___
|
||||
|
||||
@@ -537,7 +482,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:426](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L426)
|
||||
[services/customer.ts:426](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L426)
|
||||
|
||||
___
|
||||
|
||||
@@ -545,24 +490,20 @@ ___
|
||||
|
||||
▸ **updateBillingAddress_**(`customer`, `addressOrId`): `Promise`<`void`\>
|
||||
|
||||
Updates the customers' billing address.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `customer` | `Customer` | the Customer to update |
|
||||
| `addressOrId` | `undefined` \| `string` \| `DeepPartial`<`Address`\> | the value to set the billing address to |
|
||||
| `customer` | `Customer` | |
|
||||
| `addressOrId` | `undefined` \| `string` \| { `address_1?`: ``null`` \| `string` ; `address_2?`: ``null`` \| `string` ; `city?`: ``null`` \| `string` ; `company?`: ``null`` \| `string` ; `country?`: ``null`` \| { id?: number \| undefined; iso\_2?: string \| undefined; iso\_3?: string \| undefined; num\_code?: number \| undefined; name?: string \| undefined; display\_name?: string \| undefined; region\_id?: string \| ... 1 more ... \| undefined; region?: { ...; } \| undefined; } ; `country_code?`: ``null`` \| `string` ; `created_at?`: { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } ; `customer?`: ``null`` \| { email?: string \| undefined; first\_name?: string \| undefined; last\_name?: string \| undefined; billing\_address\_id?: string \| null \| undefined; billing\_address?: { customer\_id?: string \| null \| undefined; ... 16 more ...; updated\_at?: { ...; } \| undefined; } \| undefined; ... 10 more ...; updated\_at?: { ...; } \| undef... ; `customer_id?`: ``null`` \| `string` ; `deleted_at?`: ``null`` \| { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } ; `first_name?`: ``null`` \| `string` ; `id?`: `string` ; `last_name?`: ``null`` \| `string` ; `metadata?`: { [x: string]: unknown; } ; `phone?`: ``null`` \| `string` ; `postal_code?`: ``null`` \| `string` ; `province?`: ``null`` \| `string` ; `updated_at?`: { toString?: {} \| undefined; toDateString?: {} \| undefined; toTimeString?: {} \| undefined; toLocaleString?: {} \| undefined; toLocaleDateString?: {} \| undefined; toLocaleTimeString?: {} \| undefined; ... 37 more ...; [Symbol.toPrimitive]?: {} \| undefined; } } | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/customer.ts:374](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/customer.ts#L374)
|
||||
[services/customer.ts:374](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/customer.ts#L374)
|
||||
|
||||
___
|
||||
|
||||
@@ -586,4 +527,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,9 +1,5 @@
|
||||
# Class: DiscountService
|
||||
|
||||
Provides layer to manipulate discounts.
|
||||
|
||||
**`implements`** {BaseService}
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`DiscountService`](DiscountService.md)\>
|
||||
@@ -28,7 +24,7 @@ TransactionBaseService<DiscountService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L62)
|
||||
[services/discount.ts:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L62)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -58,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L52)
|
||||
[services/discount.ts:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
@@ -68,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:55](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L55)
|
||||
[services/discount.ts:55](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
@@ -78,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L56)
|
||||
[services/discount.ts:56](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:51](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L51)
|
||||
[services/discount.ts:51](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
@@ -98,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L53)
|
||||
[services/discount.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -108,7 +104,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:60](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L60)
|
||||
[services/discount.ts:60](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L60)
|
||||
|
||||
___
|
||||
|
||||
@@ -118,7 +114,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:54](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L54)
|
||||
[services/discount.ts:54](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
@@ -132,7 +128,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:48](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L48)
|
||||
[services/discount.ts:48](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
@@ -142,7 +138,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:58](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L58)
|
||||
[services/discount.ts:58](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
@@ -152,7 +148,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:59](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L59)
|
||||
[services/discount.ts:59](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
@@ -162,7 +158,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:57](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L57)
|
||||
[services/discount.ts:57](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
@@ -176,7 +172,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L49)
|
||||
[services/discount.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L49)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -184,24 +180,20 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ **addRegion**(`discountId`, `regionId`): `Promise`<`Discount`\>
|
||||
|
||||
Adds a region to the discount regions array.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | id of discount |
|
||||
| `regionId` | `string` | id of region to add |
|
||||
| `discountId` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:477](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L477)
|
||||
[services/discount.ts:477](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L477)
|
||||
|
||||
___
|
||||
|
||||
@@ -209,10 +201,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -224,23 +212,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -262,7 +248,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:576](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L576)
|
||||
[services/discount.ts:576](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L576)
|
||||
|
||||
___
|
||||
|
||||
@@ -283,7 +269,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:720](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L720)
|
||||
[services/discount.ts:720](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L720)
|
||||
|
||||
___
|
||||
|
||||
@@ -291,24 +277,19 @@ ___
|
||||
|
||||
▸ **create**(`discount`): `Promise`<`Discount`\>
|
||||
|
||||
Creates a discount with provided data given that the data is validated.
|
||||
Normalizes discount code to uppercase.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discount` | `CreateDiscountInput` | the discount data to create |
|
||||
| `discount` | `CreateDiscountInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:182](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L182)
|
||||
[services/discount.ts:182](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
@@ -316,24 +297,20 @@ ___
|
||||
|
||||
▸ **createDynamicCode**(`discountId`, `data`): `Promise`<`Discount`\>
|
||||
|
||||
Creates a dynamic code for a discount id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | the id of the discount to create a code for |
|
||||
| `data` | `CreateDynamicDiscountInput` | the object containing a code to identify the discount by |
|
||||
| `discountId` | `string` | |
|
||||
| `data` | `CreateDynamicDiscountInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the newly created dynamic code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:405](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L405)
|
||||
[services/discount.ts:405](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L405)
|
||||
|
||||
___
|
||||
|
||||
@@ -341,23 +318,19 @@ ___
|
||||
|
||||
▸ **delete**(`discountId`): `Promise`<`void`\>
|
||||
|
||||
Deletes a discount idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | id of discount to delete |
|
||||
| `discountId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:537](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L537)
|
||||
[services/discount.ts:537](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L537)
|
||||
|
||||
___
|
||||
|
||||
@@ -365,24 +338,20 @@ ___
|
||||
|
||||
▸ **deleteDynamicCode**(`discountId`, `code`): `Promise`<`void`\>
|
||||
|
||||
Deletes a dynamic code for a discount id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | the id of the discount to create a code for |
|
||||
| `code` | `string` | the code to identify the discount by |
|
||||
| `discountId` | `string` | |
|
||||
| `code` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
the newly created dynamic code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:456](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L456)
|
||||
[services/discount.ts:456](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L456)
|
||||
|
||||
___
|
||||
|
||||
@@ -402,7 +371,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:689](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L689)
|
||||
[services/discount.ts:689](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L689)
|
||||
|
||||
___
|
||||
|
||||
@@ -422,7 +391,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:685](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L685)
|
||||
[services/discount.ts:685](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L685)
|
||||
|
||||
___
|
||||
|
||||
@@ -442,7 +411,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:679](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L679)
|
||||
[services/discount.ts:679](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L679)
|
||||
|
||||
___
|
||||
|
||||
@@ -462,7 +431,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:697](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L697)
|
||||
[services/discount.ts:697](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L697)
|
||||
|
||||
___
|
||||
|
||||
@@ -483,7 +452,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:701](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L701)
|
||||
[services/discount.ts:701](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L701)
|
||||
|
||||
___
|
||||
|
||||
@@ -495,18 +464,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableDiscountProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
| `selector` | `FilterableDiscountProps` | |
|
||||
| `config` | `FindConfig`<`Discount`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L114)
|
||||
[services/discount.ts:114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L114)
|
||||
|
||||
___
|
||||
|
||||
@@ -518,18 +485,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableDiscountProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
| `selector` | `FilterableDiscountProps` | |
|
||||
| `config` | `FindConfig`<`Discount`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Discount`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:133](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L133)
|
||||
[services/discount.ts:133](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L133)
|
||||
|
||||
___
|
||||
|
||||
@@ -537,24 +502,20 @@ ___
|
||||
|
||||
▸ **removeRegion**(`discountId`, `regionId`): `Promise`<`Discount`\>
|
||||
|
||||
Removes a region from the discount regions array.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | id of discount |
|
||||
| `regionId` | `string` | id of region to remove |
|
||||
| `discountId` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:512](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L512)
|
||||
[services/discount.ts:512](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L512)
|
||||
|
||||
___
|
||||
|
||||
@@ -562,24 +523,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`discountId`, `config?`): `Promise`<`Discount`\>
|
||||
|
||||
Gets a discount by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | id of discount to retrieve |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
| `discountId` | `string` | |
|
||||
| `config` | `FindConfig`<`Discount`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the discount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:247](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L247)
|
||||
[services/discount.ts:247](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L247)
|
||||
|
||||
___
|
||||
|
||||
@@ -587,24 +544,20 @@ ___
|
||||
|
||||
▸ **retrieveByCode**(`discountCode`, `config?`): `Promise`<`Discount`\>
|
||||
|
||||
Gets a discount by discount code.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountCode` | `string` | discount code of discount to retrieve |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
| `discountCode` | `string` | |
|
||||
| `config` | `FindConfig`<`Discount`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the discount document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:276](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L276)
|
||||
[services/discount.ts:276](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L276)
|
||||
|
||||
___
|
||||
|
||||
@@ -628,7 +581,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -636,24 +589,20 @@ ___
|
||||
|
||||
▸ **update**(`discountId`, `update`): `Promise`<`Discount`\>
|
||||
|
||||
Updates a discount.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountId` | `string` | discount id of discount to update |
|
||||
| `update` | `UpdateDiscountInput` | the data to update the discount with |
|
||||
| `discountId` | `string` | |
|
||||
| `update` | `UpdateDiscountInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:310](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L310)
|
||||
[services/discount.ts:310](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L310)
|
||||
|
||||
___
|
||||
|
||||
@@ -674,7 +623,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:619](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L619)
|
||||
[services/discount.ts:619](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L619)
|
||||
|
||||
___
|
||||
|
||||
@@ -695,7 +644,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:551](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L551)
|
||||
[services/discount.ts:551](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L551)
|
||||
|
||||
___
|
||||
|
||||
@@ -703,8 +652,6 @@ ___
|
||||
|
||||
▸ **validateDiscountRule_**<`T`\>(`discountRule`): `T`
|
||||
|
||||
Creates a discount rule with provided data given that the data is validated.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name | Type |
|
||||
@@ -715,17 +662,15 @@ Creates a discount rule with provided data given that the data is validated.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discountRule` | `T` | the discount rule to create |
|
||||
| `discountRule` | `T` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/discount.ts:96](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/discount.ts#L96)
|
||||
[services/discount.ts:96](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/discount.ts#L96)
|
||||
|
||||
___
|
||||
|
||||
@@ -749,4 +694,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,9 +1,5 @@
|
||||
# Class: DraftOrderService
|
||||
|
||||
Handles draft orders
|
||||
|
||||
**`implements`** {BaseService}
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`DraftOrderService`](DraftOrderService.md)\>
|
||||
@@ -28,7 +24,7 @@ TransactionBaseService<DraftOrderService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:51](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L51)
|
||||
[services/draft-order.ts:51](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L51)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -38,7 +34,7 @@ TransactionBaseService<DraftOrderService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L46)
|
||||
[services/draft-order.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -68,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L42)
|
||||
[services/draft-order.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -78,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L45)
|
||||
[services/draft-order.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L47)
|
||||
[services/draft-order.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -102,7 +98,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L39)
|
||||
[services/draft-order.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -112,7 +108,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:44](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L44)
|
||||
[services/draft-order.ts:44](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
@@ -122,7 +118,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L43)
|
||||
[services/draft-order.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -132,7 +128,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:48](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L48)
|
||||
[services/draft-order.ts:48](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
@@ -142,7 +138,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L49)
|
||||
[services/draft-order.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
@@ -156,7 +152,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L40)
|
||||
[services/draft-order.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -173,7 +169,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L34)
|
||||
[services/draft-order.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L34)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -181,10 +177,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -196,23 +188,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -220,23 +210,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Creates a draft order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `AdminPostDraftOrdersReq` | data to create draft order from |
|
||||
| `data` | `AdminPostDraftOrdersReq` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
the created draft order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:257](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L257)
|
||||
[services/draft-order.ts:257](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L257)
|
||||
|
||||
___
|
||||
|
||||
@@ -244,23 +230,19 @@ ___
|
||||
|
||||
▸ **delete**(`draftOrderId`): `Promise`<`undefined` \| `DraftOrder`\>
|
||||
|
||||
Deletes draft order idempotently.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `draftOrderId` | `string` | id of draft order to delete |
|
||||
| `draftOrderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `DraftOrder`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:150](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L150)
|
||||
[services/draft-order.ts:150](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L150)
|
||||
|
||||
___
|
||||
|
||||
@@ -268,24 +250,20 @@ ___
|
||||
|
||||
▸ **list**(`selector`, `config?`): `Promise`<`DraftOrder`[]\>
|
||||
|
||||
Lists draft orders
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | query object for find |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | configurable attributes for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`[]\>
|
||||
|
||||
list of draft orders
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:231](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L231)
|
||||
[services/draft-order.ts:231](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L231)
|
||||
|
||||
___
|
||||
|
||||
@@ -293,24 +271,20 @@ ___
|
||||
|
||||
▸ **listAndCount**(`selector`, `config?`): `Promise`<[`DraftOrder`[], `number`]\>
|
||||
|
||||
Lists draft orders alongside the count
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | query selector to filter draft orders |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query config |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`[], `number`]\>
|
||||
|
||||
draft orders
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:174](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L174)
|
||||
[services/draft-order.ts:174](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L174)
|
||||
|
||||
___
|
||||
|
||||
@@ -318,24 +292,20 @@ ___
|
||||
|
||||
▸ **registerCartCompletion**(`draftOrderId`, `orderId`): `Promise`<`UpdateResult`\>
|
||||
|
||||
Registers a draft order as completed, when an order has been completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `draftOrderId` | `string` | id of draft order to complete |
|
||||
| `orderId` | `string` | id of order completed from draft order cart |
|
||||
| `draftOrderId` | `string` | |
|
||||
| `orderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`UpdateResult`\>
|
||||
|
||||
the created order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:363](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L363)
|
||||
[services/draft-order.ts:363](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L363)
|
||||
|
||||
___
|
||||
|
||||
@@ -343,24 +313,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Retrieves a draft order with the given id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the draft order to retrieve |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query object for findOne |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
the draft order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:91](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L91)
|
||||
[services/draft-order.ts:91](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L91)
|
||||
|
||||
___
|
||||
|
||||
@@ -368,24 +334,20 @@ ___
|
||||
|
||||
▸ **retrieveByCartId**(`cartId`, `config?`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Retrieves a draft order based on its associated cart id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartId` | `string` | cart id that the draft orders's cart has |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query object for findOne |
|
||||
| `cartId` | `string` | |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
the draft order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:121](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L121)
|
||||
[services/draft-order.ts:121](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
@@ -409,7 +371,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -417,25 +379,21 @@ ___
|
||||
|
||||
▸ **update**(`id`, `data`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Updates a draft order with the given data
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the draft order |
|
||||
| `data` | `Object` | values to update the order with |
|
||||
| `id` | `string` | |
|
||||
| `data` | `Object` | |
|
||||
| `data.no_notification_order` | `boolean` | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
the updated draft order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/draft-order.ts:392](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/draft-order.ts#L392)
|
||||
[services/draft-order.ts:392](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/draft-order.ts#L392)
|
||||
|
||||
___
|
||||
|
||||
@@ -459,4 +417,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,8 +1,5 @@
|
||||
# Class: EventBusService
|
||||
|
||||
Can keep track of multiple subscribers to different events and run the
|
||||
subscribers when events happen. Events will run asynchronously.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
@@ -19,7 +16,7 @@ subscribers when events happen. Events will run asynchronously.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L38)
|
||||
[services/event-bus.ts:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L38)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -29,7 +26,7 @@ subscribers when events happen. Events will run asynchronously.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:24](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L24)
|
||||
[services/event-bus.ts:24](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
@@ -39,7 +36,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L29)
|
||||
[services/event-bus.ts:29](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
@@ -49,7 +46,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L32)
|
||||
[services/event-bus.ts:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
@@ -59,7 +56,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L36)
|
||||
[services/event-bus.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -69,7 +66,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:26](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L26)
|
||||
[services/event-bus.ts:26](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
@@ -79,7 +76,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L25)
|
||||
[services/event-bus.ts:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
@@ -89,7 +86,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L28)
|
||||
[services/event-bus.ts:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
@@ -99,7 +96,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L33)
|
||||
[services/event-bus.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
@@ -109,7 +106,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L30)
|
||||
[services/event-bus.ts:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -119,7 +116,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L31)
|
||||
[services/event-bus.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
@@ -129,7 +126,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L34)
|
||||
[services/event-bus.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -139,7 +136,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L27)
|
||||
[services/event-bus.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -149,7 +146,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L35)
|
||||
[services/event-bus.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L35)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -157,8 +154,6 @@ ___
|
||||
|
||||
▸ **createCronJob**<`T`\>(`eventName`, `data`, `cron`, `handler`): `void`
|
||||
|
||||
Registers a cron job.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -169,20 +164,18 @@ Registers a cron job.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `eventName` | `string` | the name of the event |
|
||||
| `data` | `T` | the data to be sent with the event |
|
||||
| `cron` | `string` | the cron pattern |
|
||||
| `handler` | `Subscriber`<`unknown`\> | the handler to call on each cron job |
|
||||
| `eventName` | `string` | |
|
||||
| `data` | `T` | |
|
||||
| `cron` | `string` | |
|
||||
| `handler` | `Subscriber`<`unknown`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
void
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:308](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L308)
|
||||
[services/event-bus.ts:308](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L308)
|
||||
|
||||
___
|
||||
|
||||
@@ -190,8 +183,6 @@ ___
|
||||
|
||||
▸ **cronWorker_**<`T`\>(`job`): `Promise`<`unknown`[]\>
|
||||
|
||||
Handles incoming jobs.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -202,7 +193,7 @@ Handles incoming jobs.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `job` | `Object` | The job object |
|
||||
| `job` | `Object` | |
|
||||
| `job.data` | `Object` | - |
|
||||
| `job.data.data` | `T` | - |
|
||||
| `job.data.eventName` | `string` | - |
|
||||
@@ -211,11 +202,9 @@ Handles incoming jobs.
|
||||
|
||||
`Promise`<`unknown`[]\>
|
||||
|
||||
resolves to the results of the subscriber calls.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:281](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L281)
|
||||
[services/event-bus.ts:281](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L281)
|
||||
|
||||
___
|
||||
|
||||
@@ -223,8 +212,6 @@ ___
|
||||
|
||||
▸ **emit**<`T`\>(`eventName`, `data`, `options?`): `Promise`<`void` \| `StagedJob`\>
|
||||
|
||||
Calls all subscribers when an event occurs.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -235,20 +222,18 @@ Calls all subscribers when an event occurs.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `eventName` | `string` | the name of the event to be process. |
|
||||
| `data` | `T` | the data to send to the subscriber. |
|
||||
| `options` | `Object` | options to add the job with |
|
||||
| `eventName` | `string` | |
|
||||
| `data` | `T` | |
|
||||
| `options` | `Object` | |
|
||||
| `options.delay?` | `number` | - |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `StagedJob`\>
|
||||
|
||||
the job from our queue
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:179](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L179)
|
||||
[services/event-bus.ts:179](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L179)
|
||||
|
||||
___
|
||||
|
||||
@@ -262,7 +247,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:215](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L215)
|
||||
[services/event-bus.ts:215](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L215)
|
||||
|
||||
___
|
||||
|
||||
@@ -270,24 +255,20 @@ ___
|
||||
|
||||
▸ `Protected` **registerCronHandler_**(`event`, `subscriber`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
Adds a function to a list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `event` | `string` \| `symbol` | the event that the subscriber will listen for. |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | the function to be called when a certain event happens. Subscribers must return a Promise. |
|
||||
| `event` | `string` \| `symbol` | |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
this
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:158](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L158)
|
||||
[services/event-bus.ts:158](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L158)
|
||||
|
||||
___
|
||||
|
||||
@@ -301,7 +282,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:205](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L205)
|
||||
[services/event-bus.ts:205](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L205)
|
||||
|
||||
___
|
||||
|
||||
@@ -315,7 +296,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:210](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L210)
|
||||
[services/event-bus.ts:210](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L210)
|
||||
|
||||
___
|
||||
|
||||
@@ -323,24 +304,20 @@ ___
|
||||
|
||||
▸ **subscribe**(`event`, `subscriber`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
Adds a function to a list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `event` | `string` \| `symbol` | the event that the subscriber will listen for. |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | the function to be called when a certain event happens. Subscribers must return a Promise. |
|
||||
| `event` | `string` \| `symbol` | |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
this
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:118](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L118)
|
||||
[services/event-bus.ts:118](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L118)
|
||||
|
||||
___
|
||||
|
||||
@@ -348,24 +325,20 @@ ___
|
||||
|
||||
▸ **unsubscribe**(`event`, `subscriber`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
Adds a function to a list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `event` | `string` \| `symbol` | the event that the subscriber will listen for. |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | the function to be called when a certain event happens. Subscribers must return a Promise. |
|
||||
| `event` | `string` \| `symbol` | |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
this
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:136](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L136)
|
||||
[services/event-bus.ts:136](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L136)
|
||||
|
||||
___
|
||||
|
||||
@@ -385,7 +358,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:88](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L88)
|
||||
[services/event-bus.ts:88](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
@@ -393,8 +366,6 @@ ___
|
||||
|
||||
▸ **worker_**<`T`\>(`job`): `Promise`<`unknown`[]\>
|
||||
|
||||
Handles incoming jobs.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -405,7 +376,7 @@ Handles incoming jobs.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `job` | `Object` | The job object |
|
||||
| `job` | `Object` | |
|
||||
| `job.data` | `Object` | - |
|
||||
| `job.data.data` | `T` | - |
|
||||
| `job.data.eventName` | `string` | - |
|
||||
@@ -414,8 +385,6 @@ Handles incoming jobs.
|
||||
|
||||
`Promise`<`unknown`[]\>
|
||||
|
||||
resolves to the results of the subscriber calls.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/event-bus.ts:250](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/event-bus.ts#L250)
|
||||
[services/event-bus.ts:250](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/event-bus.ts#L250)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: FulfillmentProviderService
|
||||
|
||||
Helps retrive fulfillment providers
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
@@ -16,7 +14,7 @@ Helps retrive fulfillment providers
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:7](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L7)
|
||||
[services/fulfillment-provider.js:7](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L7)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -38,7 +36,7 @@ Helps retrive fulfillment providers
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:79](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L79)
|
||||
[services/fulfillment-provider.js:79](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L79)
|
||||
|
||||
___
|
||||
|
||||
@@ -58,7 +56,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:64](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L64)
|
||||
[services/fulfillment-provider.js:64](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L64)
|
||||
|
||||
___
|
||||
|
||||
@@ -78,7 +76,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:74](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L74)
|
||||
[services/fulfillment-provider.js:74](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L74)
|
||||
|
||||
___
|
||||
|
||||
@@ -101,7 +99,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:59](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L59)
|
||||
[services/fulfillment-provider.js:59](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L59)
|
||||
|
||||
___
|
||||
|
||||
@@ -121,7 +119,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:89](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L89)
|
||||
[services/fulfillment-provider.js:89](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L89)
|
||||
|
||||
___
|
||||
|
||||
@@ -135,7 +133,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L23)
|
||||
[services/fulfillment-provider.js:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L23)
|
||||
|
||||
___
|
||||
|
||||
@@ -155,7 +153,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L30)
|
||||
[services/fulfillment-provider.js:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -175,7 +173,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:12](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L12)
|
||||
[services/fulfillment-provider.js:12](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L12)
|
||||
|
||||
___
|
||||
|
||||
@@ -183,15 +181,13 @@ ___
|
||||
|
||||
▸ **retrieveDocuments**(`providerId`, `fulfillmentData`, `documentType`): `Promise`<`any`\>
|
||||
|
||||
Fetches documents from the fulfillment provider
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerId` | `string` | the id of the provider |
|
||||
| `fulfillmentData` | `any` | the data relating to the fulfillment |
|
||||
| `documentType` | ``"invoice"`` \| ``"label"`` | the typ of document to fetch |
|
||||
| `providerId` | `string` | |
|
||||
| `fulfillmentData` | `any` | |
|
||||
| `documentType` | ``"label"`` \| ``"invoice"`` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -199,7 +195,7 @@ Fetches documents from the fulfillment provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:102](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L102)
|
||||
[services/fulfillment-provider.js:102](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L102)
|
||||
|
||||
___
|
||||
|
||||
@@ -211,17 +207,15 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `provider_id` | `string` | the provider id |
|
||||
| `provider_id` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`FulfillmentService`
|
||||
|
||||
the payment fulfillment provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:48](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L48)
|
||||
[services/fulfillment-provider.js:48](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L48)
|
||||
|
||||
___
|
||||
|
||||
@@ -243,7 +237,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:69](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L69)
|
||||
[services/fulfillment-provider.js:69](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L69)
|
||||
|
||||
___
|
||||
|
||||
@@ -263,4 +257,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment-provider.js:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment-provider.js#L84)
|
||||
[services/fulfillment-provider.js:84](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment-provider.js#L84)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: FulfillmentService
|
||||
|
||||
Handles Fulfillments
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`FulfillmentService`](FulfillmentService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<FulfillmentService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L47)
|
||||
[services/fulfillment.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L47)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L42)
|
||||
[services/fulfillment.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L43)
|
||||
[services/fulfillment.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L45)
|
||||
[services/fulfillment.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -86,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L40)
|
||||
[services/fulfillment.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -100,7 +98,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L36)
|
||||
[services/fulfillment.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -110,7 +108,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:41](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L41)
|
||||
[services/fulfillment.ts:41](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
@@ -120,7 +118,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L39)
|
||||
[services/fulfillment.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -130,7 +128,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:44](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L44)
|
||||
[services/fulfillment.ts:44](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
@@ -144,7 +142,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L37)
|
||||
[services/fulfillment.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L37)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -152,10 +150,6 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -167,23 +161,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -191,25 +183,19 @@ ___
|
||||
|
||||
▸ **cancelFulfillment**(`fulfillmentOrId`): `Promise`<`Fulfillment`\>
|
||||
|
||||
Cancels a fulfillment with the fulfillment provider. Will decrement the
|
||||
fulfillment_quantity on the line items associated with the fulfillment.
|
||||
Throws if the fulfillment has already been shipped.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fulfillmentOrId` | `string` \| `Fulfillment` | the fulfillment object or id. |
|
||||
| `fulfillmentOrId` | `string` \| `Fulfillment` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
the result of the save operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:254](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L254)
|
||||
[services/fulfillment.ts:254](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L254)
|
||||
|
||||
___
|
||||
|
||||
@@ -217,28 +203,21 @@ ___
|
||||
|
||||
▸ **createFulfillment**(`order`, `itemsToFulfill`, `custom?`): `Promise`<`Fulfillment`[]\>
|
||||
|
||||
Creates an order fulfillment
|
||||
If items needs to be fulfilled by different provider, we make
|
||||
sure to partition those items, and create fulfillment for
|
||||
those partitions.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `CreateFulfillmentOrder` | order to create fulfillment for |
|
||||
| `itemsToFulfill` | `FulFillmentItemType`[] | the items in the order to fulfill |
|
||||
| `custom` | `Partial`<`Fulfillment`\> | potential custom values to add |
|
||||
| `order` | `CreateFulfillmentOrder` | |
|
||||
| `itemsToFulfill` | `FulFillmentItemType`[] | |
|
||||
| `custom` | `Partial`<`Fulfillment`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`[]\>
|
||||
|
||||
the created fulfillments
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:199](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L199)
|
||||
[services/fulfillment.ts:199](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L199)
|
||||
|
||||
___
|
||||
|
||||
@@ -246,26 +225,21 @@ ___
|
||||
|
||||
▸ **createShipment**(`fulfillmentId`, `trackingLinks`, `config?`): `Promise`<`Fulfillment`\>
|
||||
|
||||
Creates a shipment by marking a fulfillment as shipped. Adds
|
||||
tracking links and potentially more metadata.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fulfillmentId` | `string` | the fulfillment to ship |
|
||||
| `trackingLinks` | { `tracking_number`: `string` }[] | tracking links for the shipment |
|
||||
| `config` | `CreateShipmentConfig` | potential configuration settings, such as no_notification and metadata |
|
||||
| `fulfillmentId` | `string` | |
|
||||
| `trackingLinks` | { `tracking_number`: `string` }[] | |
|
||||
| `config` | `CreateShipmentConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
the shipped fulfillment
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:304](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L304)
|
||||
[services/fulfillment.ts:304](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L304)
|
||||
|
||||
___
|
||||
|
||||
@@ -273,24 +247,20 @@ ___
|
||||
|
||||
▸ **getFulfillmentItems_**(`order`, `items`): `Promise`<(``null`` \| `LineItem`)[]\>
|
||||
|
||||
Retrieves the order line items, given an array of items.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `CreateFulfillmentOrder` | the order to get line items from |
|
||||
| `items` | `FulFillmentItemType`[] | the items to get |
|
||||
| `order` | `CreateFulfillmentOrder` | |
|
||||
| `items` | `FulFillmentItemType`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(``null`` \| `LineItem`)[]\>
|
||||
|
||||
the line items generated by the transformer.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:109](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L109)
|
||||
[services/fulfillment.ts:109](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
@@ -311,7 +281,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:71](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L71)
|
||||
[services/fulfillment.ts:71](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
@@ -319,24 +289,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`Fulfillment`\>
|
||||
|
||||
Retrieves a fulfillment by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the fulfillment to retrieve |
|
||||
| `config` | `FindConfig`<`Fulfillment`\> | optional values to include with fulfillmentRepository query |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`Fulfillment`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
the fulfillment
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:166](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L166)
|
||||
[services/fulfillment.ts:166](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L166)
|
||||
|
||||
___
|
||||
|
||||
@@ -360,7 +326,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -368,28 +334,20 @@ ___
|
||||
|
||||
▸ **validateFulfillmentLineItem_**(`item`, `quantity`): ``null`` \| `LineItem`
|
||||
|
||||
Checks that a given quantity of a line item can be fulfilled. Fails if the
|
||||
fulfillable quantity is lower than the requested fulfillment quantity.
|
||||
Fulfillable quantity is calculated by subtracting the already fulfilled
|
||||
quantity from the quantity that was originally purchased.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `item` | `undefined` \| `LineItem` | the line item to check has sufficient fulfillable quantity. |
|
||||
| `quantity` | `number` | the quantity that is requested to be fulfilled. |
|
||||
| `item` | `undefined` \| `LineItem` | |
|
||||
| `quantity` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| `LineItem`
|
||||
|
||||
a line item that has the requested fulfillment quantity
|
||||
set.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/fulfillment.ts:134](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/fulfillment.ts#L134)
|
||||
[services/fulfillment.ts:134](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/fulfillment.ts#L134)
|
||||
|
||||
___
|
||||
|
||||
@@ -413,4 +371,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: GiftCardService
|
||||
|
||||
Provides layer to manipulate gift cards.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`GiftCardService`](GiftCardService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<GiftCardService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L46)
|
||||
[services/gift-card.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L46)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L37)
|
||||
[services/gift-card.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L34)
|
||||
[services/gift-card.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L35)
|
||||
[services/gift-card.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
@@ -90,7 +88,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L39)
|
||||
[services/gift-card.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -100,7 +98,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L36)
|
||||
[services/gift-card.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -114,7 +112,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L40)
|
||||
[services/gift-card.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -130,7 +128,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L42)
|
||||
[services/gift-card.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L42)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -138,10 +136,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -153,23 +147,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -177,23 +169,19 @@ ___
|
||||
|
||||
▸ **create**(`giftCard`): `Promise`<`GiftCard`\>
|
||||
|
||||
Creates a gift card with provided data given that the data is validated.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCard` | `CreateGiftCardInput` | the gift card data to create |
|
||||
| `giftCard` | `CreateGiftCardInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:155](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L155)
|
||||
[services/gift-card.ts:155](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L155)
|
||||
|
||||
___
|
||||
|
||||
@@ -213,7 +201,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:139](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L139)
|
||||
[services/gift-card.ts:139](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L139)
|
||||
|
||||
___
|
||||
|
||||
@@ -221,23 +209,19 @@ ___
|
||||
|
||||
▸ **delete**(`giftCardId`): `Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
Deletes a gift card idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCardId` | `string` | id of gift card to delete |
|
||||
| `giftCardId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:288](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L288)
|
||||
[services/gift-card.ts:288](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L288)
|
||||
|
||||
___
|
||||
|
||||
@@ -249,18 +233,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L114)
|
||||
[services/gift-card.ts:114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L114)
|
||||
|
||||
___
|
||||
|
||||
@@ -272,18 +254,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L84)
|
||||
[services/gift-card.ts:84](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
@@ -291,24 +271,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`giftCardId`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
Gets a gift card by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCardId` | `string` | id of gift card to retrieve |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | optional values to include with gift card query |
|
||||
| `giftCardId` | `string` | |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
the gift card
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:220](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L220)
|
||||
[services/gift-card.ts:220](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L220)
|
||||
|
||||
___
|
||||
|
||||
@@ -329,7 +305,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:229](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L229)
|
||||
[services/gift-card.ts:229](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L229)
|
||||
|
||||
___
|
||||
|
||||
@@ -350,7 +326,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:185](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L185)
|
||||
[services/gift-card.ts:185](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L185)
|
||||
|
||||
___
|
||||
|
||||
@@ -374,7 +350,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -382,24 +358,20 @@ ___
|
||||
|
||||
▸ **update**(`giftCardId`, `update`): `Promise`<`GiftCard`\>
|
||||
|
||||
Updates a giftCard.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `giftCardId` | `string` | giftCard id of giftCard to update |
|
||||
| `update` | `UpdateGiftCardInput` | the data to update the giftCard with |
|
||||
| `giftCardId` | `string` | |
|
||||
| `update` | `UpdateGiftCardInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:244](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L244)
|
||||
[services/gift-card.ts:244](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L244)
|
||||
|
||||
___
|
||||
|
||||
@@ -423,7 +395,7 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
@@ -431,14 +403,10 @@ ___
|
||||
|
||||
▸ `Static` **generateCode**(): `string`
|
||||
|
||||
Generates a 16 character gift card code
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the generated gift card code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/gift-card.ts:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/gift-card.ts#L68)
|
||||
[services/gift-card.ts:68](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/gift-card.ts#L68)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:8](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L8)
|
||||
[services/idempotency-key.js:8](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -32,25 +32,19 @@ BaseService.constructor
|
||||
|
||||
▸ **create**(`payload`): `Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
Creates an idempotency key for a request.
|
||||
If no idempotency key is provided in request, we will create a unique
|
||||
identifier.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `payload` | `any` | payload of request to create idempotency key for |
|
||||
| `payload` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
the created idempotency key
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L52)
|
||||
[services/idempotency-key.js:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L52)
|
||||
|
||||
___
|
||||
|
||||
@@ -58,26 +52,22 @@ ___
|
||||
|
||||
▸ **initializeRequest**(`headerKey`, `reqMethod`, `reqParams`, `reqPath`): `Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
Execute the initial steps in a idempotent request.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `headerKey` | `string` | potential idempotency key from header |
|
||||
| `reqMethod` | `string` | method of request |
|
||||
| `reqParams` | `string` | params of request |
|
||||
| `reqPath` | `string` | path of request |
|
||||
| `headerKey` | `string` | |
|
||||
| `reqMethod` | `string` | |
|
||||
| `reqParams` | `string` | |
|
||||
| `reqPath` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
the existing or created idempotency key
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:26](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L26)
|
||||
[services/idempotency-key.js:26](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L26)
|
||||
|
||||
___
|
||||
|
||||
@@ -85,23 +75,19 @@ ___
|
||||
|
||||
▸ **lock**(`idempotencyKey`): `Promise`<`any`\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `idempotencyKey` | `string` | key to lock |
|
||||
| `idempotencyKey` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:90](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L90)
|
||||
[services/idempotency-key.js:90](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L90)
|
||||
|
||||
___
|
||||
|
||||
@@ -109,23 +95,19 @@ ___
|
||||
|
||||
▸ **retrieve**(`idempotencyKey`): `Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
Retrieves an idempotency key
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `idempotencyKey` | `string` | key to retrieve |
|
||||
| `idempotencyKey` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKeyModel`\>
|
||||
|
||||
idempotency key
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:73](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L73)
|
||||
[services/idempotency-key.js:73](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L73)
|
||||
|
||||
___
|
||||
|
||||
@@ -133,24 +115,20 @@ ___
|
||||
|
||||
▸ **update**(`idempotencyKey`, `update`): `Promise`<`any`\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `idempotencyKey` | `string` | key to update |
|
||||
| `update` | `any` | update object |
|
||||
| `idempotencyKey` | `string` | |
|
||||
| `update` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:117](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L117)
|
||||
[services/idempotency-key.js:117](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L117)
|
||||
|
||||
___
|
||||
|
||||
@@ -158,25 +136,17 @@ ___
|
||||
|
||||
▸ **workStage**(`idempotencyKey`, `func`): `IdempotencyKeyModel`
|
||||
|
||||
Performs an atomic work stage.
|
||||
An atomic work stage contains some related functionality, that needs to be
|
||||
transactionally executed in isolation. An idempotent request will
|
||||
always consist of 2 or more of these phases. The required phases are
|
||||
"started" and "finished".
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `idempotencyKey` | `string` | current idempotency key |
|
||||
| `func` | `Function` | functionality to execute within the phase |
|
||||
| `idempotencyKey` | `string` | |
|
||||
| `func` | `Function` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`IdempotencyKeyModel`
|
||||
|
||||
new updated idempotency key
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/idempotency-key.js:144](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/idempotency-key.js#L144)
|
||||
[services/idempotency-key.js:144](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/idempotency-key.js#L144)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/inventory.js:5](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/inventory.js#L5)
|
||||
[services/inventory.js:5](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/inventory.js#L5)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -32,24 +32,20 @@ BaseService.constructor
|
||||
|
||||
▸ **adjustInventory**(`variantId`, `adjustment`): `Promise`<`any`\>
|
||||
|
||||
Updates the inventory of a variant based on a given adjustment.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to update |
|
||||
| `adjustment` | `number` | the number to adjust the inventory quantity by |
|
||||
| `variantId` | `string` | |
|
||||
| `adjustment` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/inventory.js:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/inventory.js#L36)
|
||||
[services/inventory.js:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/inventory.js#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -57,26 +53,20 @@ ___
|
||||
|
||||
▸ **confirmInventory**(`variantId`, `quantity`): `Promise`<`boolean`\>
|
||||
|
||||
Checks if the inventory of a variant can cover a given quantity. Will
|
||||
return true if the variant doesn't have managed inventory or if the variant
|
||||
allows backorders or if the inventory quantity is greater than `quantity`.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to check |
|
||||
| `quantity` | `number` | the number of units to check availability for |
|
||||
| `variantId` | `string` | |
|
||||
| `quantity` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
true if the inventory covers the quantity
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/inventory.js:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/inventory.js#L62)
|
||||
[services/inventory.js:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/inventory.js#L62)
|
||||
|
||||
___
|
||||
|
||||
@@ -96,4 +86,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/inventory.js:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/inventory.js#L15)
|
||||
[services/inventory.js:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/inventory.js#L15)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: LineItemService
|
||||
|
||||
Provides layer to manipulate line items.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:44](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L44)
|
||||
[services/line-item.ts:44](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L44)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L38)
|
||||
[services/line-item.ts:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L37)
|
||||
[services/line-item.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L42)
|
||||
[services/line-item.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L36)
|
||||
[services/line-item.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L35)
|
||||
[services/line-item.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
@@ -86,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L40)
|
||||
[services/line-item.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -96,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L39)
|
||||
[services/line-item.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
@@ -106,7 +104,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:41](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L41)
|
||||
[services/line-item.ts:41](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L41)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -114,23 +112,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`LineItem`\>
|
||||
|
||||
Create a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `Partial`<`LineItem`\> | the line item object to create |
|
||||
| `data` | `Partial`<`LineItem`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`\>
|
||||
|
||||
the created line item
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:270](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L270)
|
||||
[services/line-item.ts:270](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L270)
|
||||
|
||||
___
|
||||
|
||||
@@ -138,25 +132,20 @@ ___
|
||||
|
||||
▸ **createReturnLines**(`returnId`, `cartId`): `Promise`<`LineItem`[]\>
|
||||
|
||||
Creates return line items for a given cart based on the return items in a
|
||||
return.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `returnId` | `string` | the id to generate return items from. |
|
||||
| `cartId` | `string` | the cart to assign the return line items to. |
|
||||
| `returnId` | `string` | |
|
||||
| `cartId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
the created line items
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:142](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L142)
|
||||
[services/line-item.ts:142](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L142)
|
||||
|
||||
___
|
||||
|
||||
@@ -164,23 +153,19 @@ ___
|
||||
|
||||
▸ **delete**(`id`): `Promise`<`undefined` \| `LineItem`\>
|
||||
|
||||
Deletes a line item.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to delete |
|
||||
| `id` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `LineItem`\>
|
||||
|
||||
the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:318](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L318)
|
||||
[services/line-item.ts:318](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L318)
|
||||
|
||||
___
|
||||
|
||||
@@ -207,7 +192,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:195](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L195)
|
||||
[services/line-item.ts:195](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L195)
|
||||
|
||||
___
|
||||
|
||||
@@ -232,7 +217,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:90](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L90)
|
||||
[services/line-item.ts:90](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L90)
|
||||
|
||||
___
|
||||
|
||||
@@ -240,24 +225,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`LineItem`\>
|
||||
|
||||
Retrieves a line item by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to retrieve |
|
||||
| `config` | `Object` | the config to be used at query building |
|
||||
| `id` | `string` | |
|
||||
| `config` | `Object` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`\>
|
||||
|
||||
the line item
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:111](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L111)
|
||||
[services/line-item.ts:111](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
@@ -265,24 +246,20 @@ ___
|
||||
|
||||
▸ **update**(`id`, `data`): `Promise`<`LineItem`\>
|
||||
|
||||
Updates a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to update |
|
||||
| `data` | `Partial`<`LineItem`\> | the properties to update on line item |
|
||||
| `id` | `string` | |
|
||||
| `data` | `Partial`<`LineItem`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`\>
|
||||
|
||||
the update line item
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:289](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L289)
|
||||
[services/line-item.ts:289](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L289)
|
||||
|
||||
___
|
||||
|
||||
@@ -302,4 +279,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/line-item.ts:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/line-item.ts#L68)
|
||||
[services/line-item.ts:68](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/line-item.ts#L68)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: MiddlewareService
|
||||
|
||||
Orchestrates dynamic middleware registered through the Medusa Middleware API
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
@@ -16,7 +14,7 @@ Orchestrates dynamic middleware registered through the Medusa Middleware API
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:7](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L7)
|
||||
[services/middleware.js:7](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L7)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -26,7 +24,7 @@ Orchestrates dynamic middleware registered through the Medusa Middleware API
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:8](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L8)
|
||||
[services/middleware.js:8](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L8)
|
||||
|
||||
___
|
||||
|
||||
@@ -36,7 +34,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:9](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L9)
|
||||
[services/middleware.js:9](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L9)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:10](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L10)
|
||||
[services/middleware.js:10](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L10)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:11](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L11)
|
||||
[services/middleware.js:11](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L11)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -64,14 +62,12 @@ ___
|
||||
|
||||
▸ **addPostAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called after authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `middleware` | `Function` | the middleware function. Should return a middleware function. |
|
||||
| `options` | `any` | the arguments that will be passed to the middleware |
|
||||
| `middleware` | `Function` | |
|
||||
| `options` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -79,7 +75,7 @@ Adds a middleware function to be called after authentication is completed.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L45)
|
||||
[services/middleware.js:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -87,14 +83,12 @@ ___
|
||||
|
||||
▸ **addPreAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called before authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `middleware` | `Function` | the middleware function. Should return a middleware function. |
|
||||
| `options` | `any` | the arguments that will be passed to the middleware |
|
||||
| `middleware` | `Function` | |
|
||||
| `options` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -102,7 +96,7 @@ Adds a middleware function to be called before authentication is completed.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:61](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L61)
|
||||
[services/middleware.js:61](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L61)
|
||||
|
||||
___
|
||||
|
||||
@@ -110,13 +104,11 @@ ___
|
||||
|
||||
▸ **addPreCartCreation**(`middleware`): `void`
|
||||
|
||||
Adds a middleware function to be called before cart creation
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `middleware` | `Function` | the middleware function. Should return a middleware function. |
|
||||
| `middleware` | `Function` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -124,7 +116,7 @@ Adds a middleware function to be called before cart creation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:75](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L75)
|
||||
[services/middleware.js:75](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L75)
|
||||
|
||||
___
|
||||
|
||||
@@ -145,7 +137,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L14)
|
||||
[services/middleware.js:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -165,7 +157,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:19](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L19)
|
||||
[services/middleware.js:19](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L19)
|
||||
|
||||
___
|
||||
|
||||
@@ -173,13 +165,11 @@ ___
|
||||
|
||||
▸ **usePostAuthentication**(`app`): `void`
|
||||
|
||||
Adds post authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `app` | `ExpressApp` | the express app to add the middleware to |
|
||||
| `app` | `ExpressApp` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -187,7 +177,7 @@ Adds post authentication middleware to an express app.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:85](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L85)
|
||||
[services/middleware.js:85](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L85)
|
||||
|
||||
___
|
||||
|
||||
@@ -195,13 +185,11 @@ ___
|
||||
|
||||
▸ **usePreAuthentication**(`app`): `void`
|
||||
|
||||
Adds pre authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `app` | `ExpressApp` | the express app to add the middleware to |
|
||||
| `app` | `ExpressApp` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -209,7 +197,7 @@ Adds pre authentication middleware to an express app.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:96](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L96)
|
||||
[services/middleware.js:96](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L96)
|
||||
|
||||
___
|
||||
|
||||
@@ -223,7 +211,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:102](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L102)
|
||||
[services/middleware.js:102](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L102)
|
||||
|
||||
___
|
||||
|
||||
@@ -231,13 +219,11 @@ ___
|
||||
|
||||
▸ **validateMiddleware_**(`fn`): `void`
|
||||
|
||||
Validates a middleware function, throws if fn is not of type function.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fn` | `Function` | the middleware function to validate. |
|
||||
| `fn` | `Function` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -245,4 +231,4 @@ Validates a middleware function, throws if fn is not of type function.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/middleware.js:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/middleware.js#L28)
|
||||
[services/middleware.js:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/middleware.js#L28)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:12](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L12)
|
||||
[services/note.js:12](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L12)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -42,7 +42,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:6](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L6)
|
||||
[services/note.js:6](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L6)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -50,24 +50,20 @@ BaseService.constructor
|
||||
|
||||
▸ **create**(`data`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Creates a note associated with a given author
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `CreateNoteInput` | the note to create |
|
||||
| `config` | `any` | any configurations if needed, including meta data |
|
||||
| `data` | `CreateNoteInput` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the creation result
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:98](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L98)
|
||||
[services/note.js:98](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L98)
|
||||
|
||||
___
|
||||
|
||||
@@ -75,13 +71,11 @@ ___
|
||||
|
||||
▸ **delete**(`noteId`): `Promise`<`any`\>
|
||||
|
||||
Deletes a given note
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `noteId` | `any` | id of the note to delete |
|
||||
| `noteId` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -89,7 +83,7 @@ Deletes a given note
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:154](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L154)
|
||||
[services/note.js:154](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L154)
|
||||
|
||||
___
|
||||
|
||||
@@ -97,27 +91,23 @@ ___
|
||||
|
||||
▸ **list**(`selector`, `config?`): `Promise`<`Note`[]\>
|
||||
|
||||
Fetches all notes related to the given selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `Object` | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `config.relations` | `string`[] | Which relations to include in the resulting list of Notes. |
|
||||
| `config.skip` | `number` | How many Notes to skip in the resulting list of Notes. |
|
||||
| `config.take` | `number` | How many Notes to take in the resulting list of Notes. |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `Object` | |
|
||||
| `config.relations` | `string`[] | |
|
||||
| `config.skip` | `number` | |
|
||||
| `config.take` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Note`[]\>
|
||||
|
||||
notes related to the given search.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:77](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L77)
|
||||
[services/note.js:77](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L77)
|
||||
|
||||
___
|
||||
|
||||
@@ -125,24 +115,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`Note`\>
|
||||
|
||||
Retrieves a specific note.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the note to retrieve. |
|
||||
| `config` | `any` | any options needed to query for the result. |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Note`\>
|
||||
|
||||
which resolves to the requested note.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:51](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L51)
|
||||
[services/note.js:51](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L51)
|
||||
|
||||
___
|
||||
|
||||
@@ -150,24 +136,20 @@ ___
|
||||
|
||||
▸ **update**(`noteId`, `value`): `Promise`<`any`\>
|
||||
|
||||
Updates a given note with a new value
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `noteId` | `any` | the id of the note to update |
|
||||
| `value` | `any` | the new value |
|
||||
| `noteId` | `any` | |
|
||||
| `value` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the updated element
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:131](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L131)
|
||||
[services/note.js:131](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L131)
|
||||
|
||||
___
|
||||
|
||||
@@ -175,20 +157,16 @@ ___
|
||||
|
||||
▸ **withTransaction**(`transactionManager`): [`NoteService`](NoteService.md)
|
||||
|
||||
Sets the service's manager to a given transaction manager
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `transactionManager` | `EntityManager` | the manager to use |
|
||||
| `transactionManager` | `EntityManager` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`NoteService`](NoteService.md)
|
||||
|
||||
a cloned note service
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/note.js:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/note.js#L30)
|
||||
[services/note.js:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/note.js#L30)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: NotificationService
|
||||
|
||||
Provides layer to manipulate orchestrate notifications.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:9](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L9)
|
||||
[services/notification.js:9](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L9)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L30)
|
||||
[services/notification.js:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:19](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L19)
|
||||
[services/notification.js:19](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L19)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L23)
|
||||
[services/notification.js:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L23)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L27)
|
||||
[services/notification.js:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L29)
|
||||
[services/notification.js:29](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L29)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -84,26 +82,20 @@ ___
|
||||
|
||||
▸ **handleEvent**(`eventName`, `data`): `Promise`<`any`\>
|
||||
|
||||
Handles an event by relaying the event data to the subscribing providers.
|
||||
The result of the notification send will be persisted in the database in
|
||||
order to allow for resends. Will log any errors that are encountered.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `eventName` | `string` | the event to handle |
|
||||
| `data` | `any` | the data the event was sent with |
|
||||
| `eventName` | `string` | |
|
||||
| `data` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
- the result of notification subscribed
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:166](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L166)
|
||||
[services/notification.js:166](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L166)
|
||||
|
||||
___
|
||||
|
||||
@@ -111,24 +103,20 @@ ___
|
||||
|
||||
▸ **list**(`selector`, `config?`): `Notification`[]
|
||||
|
||||
Retrieves a list of notifications.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the params to select the notifications by. |
|
||||
| `config` | `any` | the configuration to apply to the query |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Notification`[]
|
||||
|
||||
the notifications that satisfy the query.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L84)
|
||||
[services/notification.js:84](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L84)
|
||||
|
||||
___
|
||||
|
||||
@@ -136,14 +124,11 @@ ___
|
||||
|
||||
▸ **registerAttachmentGenerator**(`service`): `void`
|
||||
|
||||
Registers an attachment generator to the service. The generator can be
|
||||
used to generate on demand invoices or other documents.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `service` | `any` |
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `service` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -151,7 +136,7 @@ used to generate on demand invoices or other documents.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L38)
|
||||
[services/notification.js:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L38)
|
||||
|
||||
___
|
||||
|
||||
@@ -159,13 +144,11 @@ ___
|
||||
|
||||
▸ **registerInstalledProviders**(`providers`): `Promise`<`void`\>
|
||||
|
||||
Takes a list of notification provider ids and persists them in the database.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providers` | `string`[] | a list of provider ids |
|
||||
| `providers` | `string`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -173,7 +156,7 @@ Takes a list of notification provider ids and persists them in the database.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L68)
|
||||
[services/notification.js:68](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L68)
|
||||
|
||||
___
|
||||
|
||||
@@ -181,25 +164,20 @@ ___
|
||||
|
||||
▸ **resend**(`id`, `config?`): `Notification`
|
||||
|
||||
Resends a notification by retrieving a prior notification and calling the
|
||||
underlying provider's resendNotification method.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the notification |
|
||||
| `config` | `any` | any configuration that might override the previous send |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Notification`
|
||||
|
||||
the newly created notification
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:237](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L237)
|
||||
[services/notification.js:237](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L237)
|
||||
|
||||
___
|
||||
|
||||
@@ -207,24 +185,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Notification`
|
||||
|
||||
Retrieves a notification with a given id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the notification |
|
||||
| `config` | `any` | the configuration to apply to the query |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Notification`
|
||||
|
||||
the notification
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:101](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L101)
|
||||
[services/notification.js:101](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L101)
|
||||
|
||||
___
|
||||
|
||||
@@ -232,24 +206,19 @@ ___
|
||||
|
||||
▸ **retrieveProvider_**(`id`): `NotificationProvider`
|
||||
|
||||
Finds a provider with a given id. Will throw a NOT_FOUND error if the
|
||||
resolution fails.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the provider |
|
||||
| `id` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`NotificationProvider`
|
||||
|
||||
the notification provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:147](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L147)
|
||||
[services/notification.js:147](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L147)
|
||||
|
||||
___
|
||||
|
||||
@@ -257,26 +226,21 @@ ___
|
||||
|
||||
▸ **send**(`event`, `eventData`, `providerId`): `Notification`
|
||||
|
||||
Sends a notification, by calling the given provider's sendNotification
|
||||
method. Persists the Notification in the database.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `event` | `string` | the name of the event |
|
||||
| `eventData` | `any` | the data the event was sent with |
|
||||
| `providerId` | `string` | the provider that should hande the event. |
|
||||
| `event` | `string` | |
|
||||
| `eventData` | `any` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Notification`
|
||||
|
||||
the created notification
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:195](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L195)
|
||||
[services/notification.js:195](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L195)
|
||||
|
||||
___
|
||||
|
||||
@@ -284,14 +248,12 @@ ___
|
||||
|
||||
▸ **subscribe**(`eventName`, `providerId`): `void`
|
||||
|
||||
Subscribes a given provider to an event.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `eventName` | `string` | the event to subscribe to |
|
||||
| `providerId` | `string` | the provider that the event will be sent to |
|
||||
| `eventName` | `string` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -299,7 +261,7 @@ Subscribes a given provider to an event.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:126](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L126)
|
||||
[services/notification.js:126](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L126)
|
||||
|
||||
___
|
||||
|
||||
@@ -307,20 +269,16 @@ ___
|
||||
|
||||
▸ **withTransaction**(`transactionManager`): [`NotificationService`](NotificationService.md)
|
||||
|
||||
Sets the service's manager to a given transaction manager.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `transactionManager` | `EntityManager` | the manager to use |
|
||||
| `transactionManager` | `EntityManager` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`NotificationService`](NotificationService.md)
|
||||
|
||||
a cloned notification service
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/notification.js:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/notification.js#L47)
|
||||
[services/notification.js:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/notification.js#L47)
|
||||
@@ -24,7 +24,7 @@ OauthService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:10](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L10)
|
||||
[services/oauth.js:10](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L10)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -34,7 +34,7 @@ OauthService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L15)
|
||||
[services/oauth.js:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L15)
|
||||
|
||||
___
|
||||
|
||||
@@ -44,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:17](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L17)
|
||||
[services/oauth.js:17](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L17)
|
||||
|
||||
___
|
||||
|
||||
@@ -54,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L14)
|
||||
[services/oauth.js:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -64,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L16)
|
||||
[services/oauth.js:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L16)
|
||||
|
||||
___
|
||||
|
||||
@@ -81,7 +81,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:5](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L5)
|
||||
[services/oauth.js:5](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L5)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -101,7 +101,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L32)
|
||||
[services/oauth.js:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L32)
|
||||
|
||||
___
|
||||
|
||||
@@ -123,7 +123,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:66](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L66)
|
||||
[services/oauth.js:66](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L66)
|
||||
|
||||
___
|
||||
|
||||
@@ -143,7 +143,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L27)
|
||||
[services/oauth.js:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L27)
|
||||
|
||||
___
|
||||
|
||||
@@ -163,7 +163,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:96](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L96)
|
||||
[services/oauth.js:96](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L96)
|
||||
|
||||
___
|
||||
|
||||
@@ -183,7 +183,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L56)
|
||||
[services/oauth.js:56](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L56)
|
||||
|
||||
___
|
||||
|
||||
@@ -203,7 +203,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:20](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L20)
|
||||
[services/oauth.js:20](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L20)
|
||||
|
||||
___
|
||||
|
||||
@@ -224,4 +224,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/oauth.js:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/oauth.js#L45)
|
||||
[services/oauth.js:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/oauth.js#L45)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L25)
|
||||
[services/order.js:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -55,7 +55,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:6](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L6)
|
||||
[services/order.js:6](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L6)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -78,7 +78,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:806](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L806)
|
||||
[services/order.js:806](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L806)
|
||||
|
||||
___
|
||||
|
||||
@@ -86,24 +86,19 @@ ___
|
||||
|
||||
▸ **archive**(`orderId`): `Promise`<`any`\>
|
||||
|
||||
Archives an order. It only alloved, if the order has been fulfilled
|
||||
and payment has been captured.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | the order to archive |
|
||||
| `orderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1301](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1301)
|
||||
[services/order.js:1302](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1302)
|
||||
|
||||
___
|
||||
|
||||
@@ -111,25 +106,19 @@ ___
|
||||
|
||||
▸ **cancel**(`orderId`): `Promise`<`any`\>
|
||||
|
||||
Cancels an order.
|
||||
Throws if fulfillment process has been initiated.
|
||||
Throws if payment process has been initiated.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of order to cancel. |
|
||||
| `orderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the update operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:952](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L952)
|
||||
[services/order.js:952](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L952)
|
||||
|
||||
___
|
||||
|
||||
@@ -137,23 +126,19 @@ ___
|
||||
|
||||
▸ **cancelFulfillment**(`fulfillmentId`): `Promise`<`any`\>
|
||||
|
||||
Cancels a fulfillment (if related to an order)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fulfillmentId` | `string` | the ID of the fulfillment to cancel |
|
||||
| `fulfillmentId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
updated order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1242](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1242)
|
||||
[services/order.js:1243](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1243)
|
||||
|
||||
___
|
||||
|
||||
@@ -161,23 +146,19 @@ ___
|
||||
|
||||
▸ **capturePayment**(`orderId`): `Promise`<`any`\>
|
||||
|
||||
Captures payment for an order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of order to capture payment for. |
|
||||
| `orderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the update operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1021](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1021)
|
||||
[services/order.js:1021](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1021)
|
||||
|
||||
___
|
||||
|
||||
@@ -189,17 +170,15 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of the order to complete |
|
||||
| `orderId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:429](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L429)
|
||||
[services/order.js:429](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L429)
|
||||
|
||||
___
|
||||
|
||||
@@ -207,23 +186,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`any`\>
|
||||
|
||||
Creates an order
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `any` | the data to create an order |
|
||||
| `data` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the creation result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:723](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L723)
|
||||
[services/order.js:723](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L723)
|
||||
|
||||
___
|
||||
|
||||
@@ -231,23 +206,19 @@ ___
|
||||
|
||||
▸ **createFromCart**(`cartId`): `Promise`<`any`\>
|
||||
|
||||
Creates an order from a cart
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartId` | `string` | id of the cart to create an order from |
|
||||
| `cartId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the creation result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:465](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L465)
|
||||
[services/order.js:465](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L465)
|
||||
|
||||
___
|
||||
|
||||
@@ -255,28 +226,21 @@ ___
|
||||
|
||||
▸ **createFulfillment**(`orderId`, `itemsToFulfill`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Creates fulfillments for an order.
|
||||
In a situation where the order has more than one shipping method,
|
||||
we need to partition the order items, such that they can be sent
|
||||
to their respective fulfillment provider.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of order to cancel. |
|
||||
| `itemsToFulfill` | `any` | items to fulfil. |
|
||||
| `config` | `any` | the config to cancel. |
|
||||
| `orderId` | `string` | |
|
||||
| `itemsToFulfill` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the update operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1121](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1121)
|
||||
[services/order.js:1121](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1121)
|
||||
|
||||
___
|
||||
|
||||
@@ -284,27 +248,23 @@ ___
|
||||
|
||||
▸ **createRefund**(`orderId`, `refundAmount`, `reason`, `note`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Refunds a given amount back to the customer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of the order to refund. |
|
||||
| `refundAmount` | `float` | the amount to refund. |
|
||||
| `reason` | `string` | the reason to refund. |
|
||||
| `note` | `undefined` \| `string` | note for refund. |
|
||||
| `config` | `any` | the config for refund. |
|
||||
| `orderId` | `string` | |
|
||||
| `refundAmount` | `float` | |
|
||||
| `reason` | `string` | |
|
||||
| `note` | `undefined` \| `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the refund operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1328](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1328)
|
||||
[services/order.js:1329](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1329)
|
||||
|
||||
___
|
||||
|
||||
@@ -312,28 +272,22 @@ ___
|
||||
|
||||
▸ **createShipment**(`orderId`, `fulfillmentId`, `trackingLinks`, `config?`): `order`
|
||||
|
||||
Adds a shipment to the order to indicate that an order has left the
|
||||
warehouse. Will ask the fulfillment provider for any documents that may
|
||||
have been created in regards to the shipment.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | the id of the order that has been shipped |
|
||||
| `fulfillmentId` | `string` | the fulfillment that has now been shipped |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | array of tracking numebers associated with the shipment |
|
||||
| `config` | `any` | the config of the order that has been shipped |
|
||||
| `orderId` | `string` | |
|
||||
| `fulfillmentId` | `string` | |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`order`
|
||||
|
||||
the resulting order following the update.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:643](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L643)
|
||||
[services/order.js:643](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L643)
|
||||
|
||||
___
|
||||
|
||||
@@ -354,7 +308,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1377](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1377)
|
||||
[services/order.js:1378](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1378)
|
||||
|
||||
___
|
||||
|
||||
@@ -362,24 +316,20 @@ ___
|
||||
|
||||
▸ **deleteMetadata**(`orderId`, `key`): `Promise`<`any`\>
|
||||
|
||||
Dedicated method to delete metadata for an order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | the order to delete metadata from. |
|
||||
| `key` | `string` | key for metadata field |
|
||||
| `orderId` | `string` | |
|
||||
| `key` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the updated result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1550](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1550)
|
||||
[services/order.js:1553](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1553)
|
||||
|
||||
___
|
||||
|
||||
@@ -387,23 +337,19 @@ ___
|
||||
|
||||
▸ **existsByCartId**(`cartId`): `Promise`<`Order`\>
|
||||
|
||||
Checks the existence of an order by cart id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartId` | `string` | cart id to find order |
|
||||
| `cartId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:417](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L417)
|
||||
[services/order.js:417](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L417)
|
||||
|
||||
___
|
||||
|
||||
@@ -411,27 +357,23 @@ ___
|
||||
|
||||
▸ **getFulfillmentItems_**(`order`, `items`, `transformer`): `Promise`<`LineItem`[]\>
|
||||
|
||||
Retrieves the order line items, given an array of items.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to get line items from |
|
||||
| `items` | `Object` | the items to get |
|
||||
| `order` | `Order` | |
|
||||
| `items` | `Object` | |
|
||||
| `items.item_id` | `string` | - |
|
||||
| `items.quantity` | `number` | - |
|
||||
| `transformer` | `Function` | a function to apply to each of the items retrieved from the order, should return a line item. If the transformer returns an undefined value the line item will be filtered from the returned array. |
|
||||
| `transformer` | `Function` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
the line items generated by the transformer.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1284](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1284)
|
||||
[services/order.js:1285](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1285)
|
||||
|
||||
___
|
||||
|
||||
@@ -443,18 +385,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the config to be used for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:148](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L148)
|
||||
[services/order.js:148](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L148)
|
||||
|
||||
___
|
||||
|
||||
@@ -479,7 +419,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:173](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L173)
|
||||
[services/order.js:173](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L173)
|
||||
|
||||
___
|
||||
|
||||
@@ -487,31 +427,21 @@ ___
|
||||
|
||||
▸ **registerReturnReceived**(`orderId`, `receivedReturn`, `customRefundAmount`): `Promise`<`any`\>
|
||||
|
||||
Handles receiving a return. This will create a
|
||||
refund to the customer. If the returned items don't match the requested
|
||||
items the return status will be updated to requires_action. This behaviour
|
||||
is useful in sitautions where a custom refund amount is requested, but the
|
||||
retuned items are not matching the requested items. Setting the
|
||||
allowMismatch argument to true, will process the return, ignoring any
|
||||
mismatches.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | the order to return. |
|
||||
| `receivedReturn` | `any` | the received return |
|
||||
| `customRefundAmount` | `float` | the custom refund amount return |
|
||||
| `orderId` | `string` | |
|
||||
| `receivedReturn` | `any` | |
|
||||
| `customRefundAmount` | `float` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1473](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1473)
|
||||
[services/order.js:1476](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1476)
|
||||
|
||||
___
|
||||
|
||||
@@ -519,24 +449,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`orderId`, `config?`): `Promise`<`Order`\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | id of order to retrieve |
|
||||
| `config` | `any` | config of order to retrieve |
|
||||
| `orderId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:305](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L305)
|
||||
[services/order.js:305](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L305)
|
||||
|
||||
___
|
||||
|
||||
@@ -544,24 +470,20 @@ ___
|
||||
|
||||
▸ **retrieveByCartId**(`cartId`, `config?`): `Promise`<`Order`\>
|
||||
|
||||
Gets an order by cart id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartId` | `string` | cart id to find order |
|
||||
| `config` | `any` | the config to be used to find order |
|
||||
| `cartId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:343](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L343)
|
||||
[services/order.js:343](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L343)
|
||||
|
||||
___
|
||||
|
||||
@@ -569,24 +491,20 @@ ___
|
||||
|
||||
▸ **retrieveByExternalId**(`externalId`, `config?`): `Promise`<`Order`\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `externalId` | `string` | id of order to retrieve |
|
||||
| `config` | `any` | query config to get order by |
|
||||
| `externalId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:380](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L380)
|
||||
[services/order.js:380](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L380)
|
||||
|
||||
___
|
||||
|
||||
@@ -606,7 +524,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:234](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L234)
|
||||
[services/order.js:234](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L234)
|
||||
|
||||
___
|
||||
|
||||
@@ -614,26 +532,20 @@ ___
|
||||
|
||||
▸ **update**(`orderId`, `update`): `Promise`<`any`\>
|
||||
|
||||
Updates an order. Metadata updates should
|
||||
use dedicated method, e.g. `setMetadata` etc. The function
|
||||
will throw errors if metadata updates are attempted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderId` | `string` | the id of the order. Must be a string that can be casted to an ObjectId |
|
||||
| `update` | `any` | an object with the update values. |
|
||||
| `orderId` | `string` | |
|
||||
| `update` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:864](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L864)
|
||||
[services/order.js:864](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L864)
|
||||
|
||||
___
|
||||
|
||||
@@ -641,24 +553,20 @@ ___
|
||||
|
||||
▸ **updateBillingAddress_**(`order`, `address`): `Promise`<`any`\>
|
||||
|
||||
Updates the order's billing address.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `any` | the order to update |
|
||||
| `address` | `any` | the value to set the billing address to |
|
||||
| `order` | `any` | |
|
||||
| `address` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:744](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L744)
|
||||
[services/order.js:744](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L744)
|
||||
|
||||
___
|
||||
|
||||
@@ -666,24 +574,20 @@ ___
|
||||
|
||||
▸ **updateShippingAddress_**(`order`, `address`): `Promise`<`any`\>
|
||||
|
||||
Updates the order's shipping address.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `any` | the order to update |
|
||||
| `address` | `any` | the value to set the shipping address to |
|
||||
| `order` | `any` | |
|
||||
| `address` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:779](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L779)
|
||||
[services/order.js:779](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L779)
|
||||
|
||||
___
|
||||
|
||||
@@ -691,28 +595,20 @@ ___
|
||||
|
||||
▸ **validateFulfillmentLineItem_**(`item`, `quantity`): `LineItem`
|
||||
|
||||
Checks that a given quantity of a line item can be fulfilled. Fails if the
|
||||
fulfillable quantity is lower than the requested fulfillment quantity.
|
||||
Fulfillable quantity is calculated by subtracting the already fulfilled
|
||||
quantity from the quantity that was originally purchased.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `item` | `LineItem` | the line item to check has sufficient fulfillable quantity. |
|
||||
| `quantity` | `number` | the quantity that is requested to be fulfilled. |
|
||||
| `item` | `LineItem` | |
|
||||
| `quantity` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineItem`
|
||||
|
||||
a line item that has the requested fulfillment quantity
|
||||
set.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:1091](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L1091)
|
||||
[services/order.js:1091](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L1091)
|
||||
|
||||
___
|
||||
|
||||
@@ -720,23 +616,19 @@ ___
|
||||
|
||||
▸ **validateId_**(`rawId`): `string`
|
||||
|
||||
Used to validate order ids. Throws an error if the cast fails
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `rawId` | `string` | the raw order id to validate. |
|
||||
| `rawId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the validated id
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:139](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L139)
|
||||
[services/order.js:139](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L139)
|
||||
|
||||
___
|
||||
|
||||
@@ -756,4 +648,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/order.js:102](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/order.js#L102)
|
||||
[services/order.js:102](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/order.js#L102)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: PaymentProviderService
|
||||
|
||||
Helps retrive payment providers
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:8](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L8)
|
||||
[services/payment-provider.js:8](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L8)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L14)
|
||||
[services/payment-provider.js:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:18](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L18)
|
||||
[services/payment-provider.js:18](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L18)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L16)
|
||||
[services/payment-provider.js:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L16)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:20](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L20)
|
||||
[services/payment-provider.js:20](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L20)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -87,7 +85,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:283](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L283)
|
||||
[services/payment-provider.js:283](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L283)
|
||||
|
||||
___
|
||||
|
||||
@@ -107,7 +105,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:324](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L324)
|
||||
[services/payment-provider.js:324](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L324)
|
||||
|
||||
___
|
||||
|
||||
@@ -127,7 +125,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:343](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L343)
|
||||
[services/payment-provider.js:343](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L343)
|
||||
|
||||
___
|
||||
|
||||
@@ -147,7 +145,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:246](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L246)
|
||||
[services/payment-provider.js:246](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L246)
|
||||
|
||||
___
|
||||
|
||||
@@ -155,24 +153,20 @@ ___
|
||||
|
||||
▸ **createSession**(`providerId`, `cart`): `Promise`<`any`\>
|
||||
|
||||
Creates a payment session with the given provider.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerId` | `string` | the id of the provider to create payment with |
|
||||
| `cart` | `Cart` | a cart object used to calculate the amount, etc. from |
|
||||
| `providerId` | `string` | |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the payment session
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:121](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L121)
|
||||
[services/payment-provider.js:121](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L121)
|
||||
|
||||
___
|
||||
|
||||
@@ -192,7 +186,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:202](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L202)
|
||||
[services/payment-provider.js:202](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L202)
|
||||
|
||||
___
|
||||
|
||||
@@ -212,7 +206,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:338](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L338)
|
||||
[services/payment-provider.js:338](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L338)
|
||||
|
||||
___
|
||||
|
||||
@@ -226,7 +220,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L47)
|
||||
[services/payment-provider.js:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -251,7 +245,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:80](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L80)
|
||||
[services/payment-provider.js:80](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L80)
|
||||
|
||||
___
|
||||
|
||||
@@ -259,25 +253,20 @@ ___
|
||||
|
||||
▸ **refreshSession**(`paymentSession`, `cart`): `Promise`<`any`\>
|
||||
|
||||
Refreshes a payment session with the given provider.
|
||||
This means, that we delete the current one and create a new.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `paymentSession` | `PaymentSession` | the payment session object to update |
|
||||
| `cart` | `Cart` | a cart object used to calculate the amount, etc. from |
|
||||
| `paymentSession` | `PaymentSession` | |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the payment session
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:152](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L152)
|
||||
[services/payment-provider.js:152](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L152)
|
||||
|
||||
___
|
||||
|
||||
@@ -300,7 +289,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:358](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L358)
|
||||
[services/payment-provider.js:358](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L358)
|
||||
|
||||
___
|
||||
|
||||
@@ -320,7 +309,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L35)
|
||||
[services/payment-provider.js:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L35)
|
||||
|
||||
___
|
||||
|
||||
@@ -341,7 +330,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:54](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L54)
|
||||
[services/payment-provider.js:54](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L54)
|
||||
|
||||
___
|
||||
|
||||
@@ -349,23 +338,19 @@ ___
|
||||
|
||||
▸ **retrieveProvider**(`providerId`): `PaymentService`
|
||||
|
||||
Finds a provider given an id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `providerId` | `string` | the id of the provider to get |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`PaymentService`
|
||||
|
||||
the payment provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:228](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L228)
|
||||
[services/payment-provider.js:228](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L228)
|
||||
|
||||
___
|
||||
|
||||
@@ -386,7 +371,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:422](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L422)
|
||||
[services/payment-provider.js:422](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L422)
|
||||
|
||||
___
|
||||
|
||||
@@ -407,7 +392,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:89](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L89)
|
||||
[services/payment-provider.js:89](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L89)
|
||||
|
||||
___
|
||||
|
||||
@@ -428,7 +413,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:266](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L266)
|
||||
[services/payment-provider.js:266](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L266)
|
||||
|
||||
___
|
||||
|
||||
@@ -436,24 +421,20 @@ ___
|
||||
|
||||
▸ **updateSession**(`paymentSession`, `cart`): `Promise`<`any`\>
|
||||
|
||||
Updates an existing payment session.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `paymentSession` | `PaymentSession` | the payment session object to update |
|
||||
| `cart` | `Cart` | the cart object to update for |
|
||||
| `paymentSession` | `PaymentSession` | |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the updated payment session
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:188](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L188)
|
||||
[services/payment-provider.js:188](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L188)
|
||||
|
||||
___
|
||||
|
||||
@@ -474,7 +455,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:308](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L308)
|
||||
[services/payment-provider.js:308](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L308)
|
||||
|
||||
___
|
||||
|
||||
@@ -494,4 +475,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/payment-provider.js:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/payment-provider.js#L23)
|
||||
[services/payment-provider.js:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/payment-provider.js#L23)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: PricingService
|
||||
|
||||
Allows retrieval of prices.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`PricingService`](PricingService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<PricingService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L40)
|
||||
[services/pricing.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L40)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -60,7 +58,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L33)
|
||||
[services/pricing.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
@@ -70,7 +68,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L37)
|
||||
[services/pricing.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
@@ -80,7 +78,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L38)
|
||||
[services/pricing.ts:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
@@ -90,7 +88,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L35)
|
||||
[services/pricing.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
@@ -100,7 +98,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L36)
|
||||
[services/pricing.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -114,7 +112,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L34)
|
||||
[services/pricing.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L34)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -122,10 +120,6 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -137,23 +131,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -161,24 +153,20 @@ ___
|
||||
|
||||
▸ **calculateTaxes**(`variantPricing`, `productRates`): `Promise`<`TaxedPricing`\>
|
||||
|
||||
Gets the prices for a product variant
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantPricing` | `ProductVariantPricing` | the prices retrieved from a variant |
|
||||
| `productRates` | `TaxServiceRate`[] | the tax rates that the product has applied |
|
||||
| `variantPricing` | `ProductVariantPricing` | |
|
||||
| `productRates` | `TaxServiceRate`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TaxedPricing`\>
|
||||
|
||||
The tax related variant prices.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:102](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L102)
|
||||
[services/pricing.ts:102](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L102)
|
||||
|
||||
___
|
||||
|
||||
@@ -186,24 +174,19 @@ ___
|
||||
|
||||
▸ **collectPricingContext**(`context`): `Promise`<`PricingContext`\>
|
||||
|
||||
Collects additional information neccessary for completing the price
|
||||
selection.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `context` | `PriceSelectionContext` | the price selection context to use |
|
||||
| `context` | `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PricingContext`\>
|
||||
|
||||
The pricing context
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:63](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L63)
|
||||
[services/pricing.ts:63](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
@@ -211,25 +194,20 @@ ___
|
||||
|
||||
▸ **getProductPricing**(`product`, `context`): `Promise`<`Record`<`string`, `ProductVariantPricing`\>\>
|
||||
|
||||
Gets all the variant prices for a product. All the product's variants will
|
||||
be fetched.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `product` | `Pick`<`Product`, ``"id"`` \| ``"variants"``\> | the product to get pricing for. |
|
||||
| `context` | `PriceSelectionContext` | the price selection context to use |
|
||||
| `product` | `Pick`<`Product`, ``"id"`` \| ``"variants"``\> | |
|
||||
| `context` | `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, `ProductVariantPricing`\>\>
|
||||
|
||||
A map of variant ids to their corresponding prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:292](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L292)
|
||||
[services/pricing.ts:292](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L292)
|
||||
|
||||
___
|
||||
|
||||
@@ -237,24 +215,20 @@ ___
|
||||
|
||||
▸ **getProductPricingById**(`productId`, `context`): `Promise`<`Record`<`string`, `ProductVariantPricing`\>\>
|
||||
|
||||
Gets all the variant prices for a product by the product id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the id of the product to get prices for |
|
||||
| `context` | `PriceSelectionContext` | the price selection context to use |
|
||||
| `productId` | `string` | |
|
||||
| `context` | `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Record`<`string`, `ProductVariantPricing`\>\>
|
||||
|
||||
A map of variant ids to their corresponding prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:310](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L310)
|
||||
[services/pricing.ts:310](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L310)
|
||||
|
||||
___
|
||||
|
||||
@@ -276,7 +250,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:254](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L254)
|
||||
[services/pricing.ts:254](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L254)
|
||||
|
||||
___
|
||||
|
||||
@@ -284,24 +258,20 @@ ___
|
||||
|
||||
▸ **getProductVariantPricing**(`variant`, `context`): `Promise`<`ProductVariantPricing`\>
|
||||
|
||||
Gets the prices for a product variant.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variant` | `Pick`<`ProductVariant`, ``"id"`` \| ``"product_id"``\> | the id of the variant to get prices for |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | the price selection context to use |
|
||||
| `variant` | `Pick`<`ProductVariant`, ``"id"`` \| ``"product_id"``\> | |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariantPricing`\>
|
||||
|
||||
The product variant prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:180](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L180)
|
||||
[services/pricing.ts:180](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L180)
|
||||
|
||||
___
|
||||
|
||||
@@ -309,24 +279,20 @@ ___
|
||||
|
||||
▸ **getProductVariantPricingById**(`variantId`, `context`): `Promise`<`ProductVariantPricing`\>
|
||||
|
||||
Gets the prices for a product variant by a variant id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to get prices for |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | the price selection context to use |
|
||||
| `variantId` | `string` | |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariantPricing`\>
|
||||
|
||||
The product variant prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:218](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L218)
|
||||
[services/pricing.ts:218](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L218)
|
||||
|
||||
___
|
||||
|
||||
@@ -348,7 +314,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:138](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L138)
|
||||
[services/pricing.ts:138](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L138)
|
||||
|
||||
___
|
||||
|
||||
@@ -356,24 +322,20 @@ ___
|
||||
|
||||
▸ **getShippingOptionPricing**(`shippingOption`, `context`): `Promise`<`PricedShippingOption`\>
|
||||
|
||||
Gets the prices for a shipping option.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingOption` | `ShippingOption` | the shipping option to get prices for |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | the price selection context to use |
|
||||
| `shippingOption` | `ShippingOption` | |
|
||||
| `context` | `PriceSelectionContext` \| `PricingContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PricedShippingOption`\>
|
||||
|
||||
The shipping option prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:396](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L396)
|
||||
[services/pricing.ts:396](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L396)
|
||||
|
||||
___
|
||||
|
||||
@@ -381,24 +343,20 @@ ___
|
||||
|
||||
▸ **setProductPrices**(`products`, `context?`): `Promise`<(`Product` \| `PricedProduct`)[]\>
|
||||
|
||||
Set additional prices on a list of products.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `products` | `Product`[] | list of products on which to set additional prices |
|
||||
| `context` | `PriceSelectionContext` | the price selection context to use |
|
||||
| `products` | `Product`[] | |
|
||||
| `context` | `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(`Product` \| `PricedProduct`)[]\>
|
||||
|
||||
A list of products with variants decorated with prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:353](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L353)
|
||||
[services/pricing.ts:353](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L353)
|
||||
|
||||
___
|
||||
|
||||
@@ -406,24 +364,20 @@ ___
|
||||
|
||||
▸ **setShippingOptionPrices**(`shippingOptions`, `context?`): `Promise`<`PricedShippingOption`[]\>
|
||||
|
||||
Set additional prices on a list of shipping options.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingOptions` | `ShippingOption`[] | list of shipping options on which to set additional prices |
|
||||
| `context` | `Omit`<`PriceSelectionContext`, ``"region_id"``\> | the price selection context to use |
|
||||
| `shippingOptions` | `ShippingOption`[] | |
|
||||
| `context` | `Omit`<`PriceSelectionContext`, ``"region_id"``\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PricedShippingOption`[]\>
|
||||
|
||||
A list of shipping options with prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:445](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L445)
|
||||
[services/pricing.ts:445](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L445)
|
||||
|
||||
___
|
||||
|
||||
@@ -431,24 +385,20 @@ ___
|
||||
|
||||
▸ **setVariantPrices**(`variants`, `context`): `Promise`<`PricedVariant`[]\>
|
||||
|
||||
Set additional prices on a list of product variants.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variants` | `ProductVariant`[] | list of variants on which to set additional prices |
|
||||
| `context` | `PriceSelectionContext` | the price selection context to use |
|
||||
| `variants` | `ProductVariant`[] | |
|
||||
| `context` | `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`PricedVariant`[]\>
|
||||
|
||||
A list of products with variants decorated with prices
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/pricing.ts:328](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/pricing.ts#L328)
|
||||
[services/pricing.ts:328](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/pricing.ts#L328)
|
||||
|
||||
___
|
||||
|
||||
@@ -472,7 +422,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -496,4 +446,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: ProductCollectionService
|
||||
|
||||
Provides layer to manipulate product collections.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:11](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L11)
|
||||
[services/product-collection.js:11](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L11)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -47,7 +45,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:170](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L170)
|
||||
[services/product-collection.js:170](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L170)
|
||||
|
||||
___
|
||||
|
||||
@@ -55,23 +53,19 @@ ___
|
||||
|
||||
▸ **create**(`collection`): `Promise`<`ProductCollection`\>
|
||||
|
||||
Creates a product collection
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `collection` | `any` | the collection to create |
|
||||
| `collection` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductCollection`\>
|
||||
|
||||
created collection
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:104](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L104)
|
||||
[services/product-collection.js:104](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L104)
|
||||
|
||||
___
|
||||
|
||||
@@ -79,23 +73,19 @@ ___
|
||||
|
||||
▸ **delete**(`collectionId`): `Promise`<`any`\>
|
||||
|
||||
Deletes a product collection idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `collectionId` | `string` | id of collection to delete |
|
||||
| `collectionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:152](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L152)
|
||||
[services/product-collection.js:152](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L152)
|
||||
|
||||
___
|
||||
|
||||
@@ -103,24 +93,20 @@ ___
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Lists product collections
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the config to be used for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:206](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L206)
|
||||
[services/product-collection.js:206](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L206)
|
||||
|
||||
___
|
||||
|
||||
@@ -128,24 +114,20 @@ ___
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Lists product collections and add count.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the config to be used for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:221](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L221)
|
||||
[services/product-collection.js:221](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L221)
|
||||
|
||||
___
|
||||
|
||||
@@ -166,7 +148,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:188](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L188)
|
||||
[services/product-collection.js:188](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L188)
|
||||
|
||||
___
|
||||
|
||||
@@ -174,24 +156,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`collectionId`, `config?`): `Promise`<`ProductCollection`\>
|
||||
|
||||
Retrieves a product collection by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `collectionId` | `string` | the id of the collection to retrieve. |
|
||||
| `config` | `any` | the config of the collection to retrieve. |
|
||||
| `collectionId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductCollection`\>
|
||||
|
||||
the collection.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:55](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L55)
|
||||
[services/product-collection.js:55](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L55)
|
||||
|
||||
___
|
||||
|
||||
@@ -199,24 +177,20 @@ ___
|
||||
|
||||
▸ **retrieveByHandle**(`collectionHandle`, `config?`): `Promise`<`ProductCollection`\>
|
||||
|
||||
Retrieves a product collection by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `collectionHandle` | `string` | the handle of the collection to retrieve. |
|
||||
| `config` | `any` | query config for request |
|
||||
| `collectionHandle` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductCollection`\>
|
||||
|
||||
the collection.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:81](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L81)
|
||||
[services/product-collection.js:81](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L81)
|
||||
|
||||
___
|
||||
|
||||
@@ -224,24 +198,20 @@ ___
|
||||
|
||||
▸ **update**(`collectionId`, `update`): `Promise`<`ProductCollection`\>
|
||||
|
||||
Updates a product collection
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `collectionId` | `string` | id of collection to update |
|
||||
| `update` | `any` | update object |
|
||||
| `collectionId` | `string` | |
|
||||
| `update` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductCollection`\>
|
||||
|
||||
update collection
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:125](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L125)
|
||||
[services/product-collection.js:125](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L125)
|
||||
|
||||
___
|
||||
|
||||
@@ -261,4 +231,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-collection.js:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-collection.js#L32)
|
||||
[services/product-collection.js:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-collection.js#L32)
|
||||
@@ -24,7 +24,7 @@ TransactionBaseService<ProductService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L62)
|
||||
[services/product.ts:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L62)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -54,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L53)
|
||||
[services/product.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -64,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:50](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L50)
|
||||
[services/product.ts:50](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
@@ -78,7 +78,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L42)
|
||||
[services/product.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,7 +88,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L45)
|
||||
[services/product.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -98,7 +98,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L46)
|
||||
[services/product.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -108,7 +108,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L49)
|
||||
[services/product.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
@@ -118,7 +118,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:48](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L48)
|
||||
[services/product.ts:48](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
@@ -128,7 +128,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L47)
|
||||
[services/product.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -138,7 +138,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:51](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L51)
|
||||
[services/product.ts:51](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
@@ -148,7 +148,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L52)
|
||||
[services/product.ts:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
@@ -162,7 +162,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L43)
|
||||
[services/product.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -180,7 +180,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L56)
|
||||
[services/product.ts:56](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
@@ -190,7 +190,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:55](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L55)
|
||||
[services/product.ts:55](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L55)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -198,26 +198,20 @@ ___
|
||||
|
||||
▸ **addOption**(`productId`, `optionTitle`): `Promise`<`Product`\>
|
||||
|
||||
Adds an option to a product. Options can, for example, be "Size", "Color",
|
||||
etc. Will update all the products variants with a dummy value for the newly
|
||||
created option. The same option cannot be added more than once.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product to apply the new option to |
|
||||
| `optionTitle` | `string` | the display title of the option, e.g. "Size" |
|
||||
| `productId` | `string` | |
|
||||
| `optionTitle` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the result of the model update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:552](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L552)
|
||||
[services/product.ts:552](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L552)
|
||||
|
||||
___
|
||||
|
||||
@@ -225,10 +219,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -240,23 +230,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -264,23 +252,19 @@ ___
|
||||
|
||||
▸ **count**(`selector?`): `Promise`<`number`\>
|
||||
|
||||
Return the total number of documents in database
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`Product`\> | the selector to choose products by |
|
||||
| `selector` | `Selector`<`Product`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the result of the count operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:175](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L175)
|
||||
[services/product.ts:175](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L175)
|
||||
|
||||
___
|
||||
|
||||
@@ -288,23 +272,19 @@ ___
|
||||
|
||||
▸ **create**(`productObject`): `Promise`<`Product`\>
|
||||
|
||||
Creates a product.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productObject` | `CreateProductInput` | the product to create |
|
||||
| `productObject` | `CreateProductInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
resolves to the creation result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:324](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L324)
|
||||
[services/product.ts:324](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L324)
|
||||
|
||||
___
|
||||
|
||||
@@ -312,24 +292,19 @@ ___
|
||||
|
||||
▸ **delete**(`productId`): `Promise`<`void`\>
|
||||
|
||||
Deletes a product from a given product id. The product's associated
|
||||
variants will also be deleted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the id of the product to delete. Must be castable as an ObjectId |
|
||||
| `productId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:518](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L518)
|
||||
[services/product.ts:518](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L518)
|
||||
|
||||
___
|
||||
|
||||
@@ -337,24 +312,20 @@ ___
|
||||
|
||||
▸ **deleteOption**(`productId`, `optionId`): `Promise`<`void` \| `Product`\>
|
||||
|
||||
Delete an option from a product.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product to delete an option from |
|
||||
| `optionId` | `string` | the option to delete |
|
||||
| `productId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `Product`\>
|
||||
|
||||
the updated product
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:693](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L693)
|
||||
[services/product.ts:693](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L693)
|
||||
|
||||
___
|
||||
|
||||
@@ -362,24 +333,20 @@ ___
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`Product`[]\>
|
||||
|
||||
Lists products based on the provided parameters.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductProps` \| `Selector`<`Product`\> | an object that defines rules to filter products by |
|
||||
| `config` | `FindProductConfig` | object that defines the scope for what should be returned |
|
||||
| `selector` | `Selector`<`Product`\> \| `FilterableProductProps` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:107](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L107)
|
||||
[services/product.ts:107](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
@@ -387,27 +354,20 @@ ___
|
||||
|
||||
▸ **listAndCount**(`selector`, `config?`): `Promise`<[`Product`[], `number`]\>
|
||||
|
||||
Lists products based on the provided parameters and includes the count of
|
||||
products that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductProps` \| `Selector`<`Product`\> | an object that defines rules to filter products by |
|
||||
| `config` | `FindProductConfig` | object that defines the scope for what should be returned |
|
||||
| `selector` | `Selector`<`Product`\> \| `FilterableProductProps` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Product`[], `number`]\>
|
||||
|
||||
an array containing the products as
|
||||
the first element and the total count of products that matches the query
|
||||
as the second element.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:144](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L144)
|
||||
[services/product.ts:144](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L144)
|
||||
|
||||
___
|
||||
|
||||
@@ -427,7 +387,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:309](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L309)
|
||||
[services/product.ts:309](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L309)
|
||||
|
||||
___
|
||||
|
||||
@@ -441,7 +401,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:299](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L299)
|
||||
[services/product.ts:299](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L299)
|
||||
|
||||
___
|
||||
|
||||
@@ -449,22 +409,17 @@ ___
|
||||
|
||||
▸ `Protected` **prepareListQuery_**(`selector`, `config`): `Object`
|
||||
|
||||
Creates a query object to be used for list queries.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductProps` \| `Selector`<`Product`\> | the selector to create the query from |
|
||||
| `config` | `FindProductConfig` | the config to use for the query |
|
||||
| `selector` | `Selector`<`Product`\> \| `FilterableProductProps` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
an object containing the query, relations and free-text
|
||||
search param.
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `q` | `string` |
|
||||
@@ -473,7 +428,7 @@ an object containing the query, relations and free-text
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:759](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L759)
|
||||
[services/product.ts:759](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L759)
|
||||
|
||||
___
|
||||
|
||||
@@ -494,7 +449,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:591](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L591)
|
||||
[services/product.ts:591](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L591)
|
||||
|
||||
___
|
||||
|
||||
@@ -502,25 +457,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`productId`, `config?`): `Promise`<`Product`\>
|
||||
|
||||
Gets a product by id.
|
||||
Throws in case of DB Error and if product was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | id of the product to get. |
|
||||
| `config` | `FindProductConfig` | object that defines what should be included in the query response |
|
||||
| `productId` | `string` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the result of the find one operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:191](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L191)
|
||||
[services/product.ts:191](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L191)
|
||||
|
||||
___
|
||||
|
||||
@@ -528,25 +478,20 @@ ___
|
||||
|
||||
▸ **retrieveByExternalId**(`externalId`, `config?`): `Promise`<`Product`\>
|
||||
|
||||
Gets a product by external id.
|
||||
Throws in case of DB Error and if product was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `externalId` | `string` | handle of the product to get. |
|
||||
| `config` | `FindProductConfig` | details about what to get from the product |
|
||||
| `externalId` | `string` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the result of the find one operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:225](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L225)
|
||||
[services/product.ts:225](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L225)
|
||||
|
||||
___
|
||||
|
||||
@@ -554,25 +499,20 @@ ___
|
||||
|
||||
▸ **retrieveByHandle**(`productHandle`, `config?`): `Promise`<`Product`\>
|
||||
|
||||
Gets a product by handle.
|
||||
Throws in case of DB Error and if product was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productHandle` | `string` | handle of the product to get. |
|
||||
| `config` | `FindProductConfig` | details about what to get from the product |
|
||||
| `productHandle` | `string` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the result of the find one operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:209](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L209)
|
||||
[services/product.ts:209](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L209)
|
||||
|
||||
___
|
||||
|
||||
@@ -580,24 +520,20 @@ ___
|
||||
|
||||
▸ **retrieveVariants**(`productId`, `config?`): `Promise`<`ProductVariant`[]\>
|
||||
|
||||
Gets all variants belonging to a product.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the id of the product to get variants from. |
|
||||
| `config` | `FindProductConfig` | The config to select and configure relations etc... |
|
||||
| `productId` | `string` | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`[]\>
|
||||
|
||||
an array of variants
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:279](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L279)
|
||||
[services/product.ts:279](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L279)
|
||||
|
||||
___
|
||||
|
||||
@@ -605,25 +541,20 @@ ___
|
||||
|
||||
▸ **retrieve_**(`selector`, `config?`): `Promise`<`Product`\>
|
||||
|
||||
Gets a product by selector.
|
||||
Throws in case of DB Error and if product was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`Product`\> | selector object |
|
||||
| `config` | `FindProductConfig` | object that defines what should be included in the query response |
|
||||
| `selector` | `Selector`<`Product`\> | |
|
||||
| `config` | `FindProductConfig` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the result of the find one operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:242](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L242)
|
||||
[services/product.ts:242](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L242)
|
||||
|
||||
___
|
||||
|
||||
@@ -647,7 +578,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -655,26 +586,20 @@ ___
|
||||
|
||||
▸ **update**(`productId`, `update`): `Promise`<`Product`\>
|
||||
|
||||
Updates a product. Product variant updates should use dedicated methods,
|
||||
e.g. `addVariant`, etc. The function will throw errors if metadata or
|
||||
product variant updates are attempted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the id of the product. Must be a string that can be casted to an ObjectId |
|
||||
| `update` | `UpdateProductInput` | an object with the update values. |
|
||||
| `productId` | `string` | |
|
||||
| `update` | `UpdateProductInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:399](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L399)
|
||||
[services/product.ts:399](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L399)
|
||||
|
||||
___
|
||||
|
||||
@@ -682,26 +607,21 @@ ___
|
||||
|
||||
▸ **updateOption**(`productId`, `optionId`, `data`): `Promise`<`Product`\>
|
||||
|
||||
Updates a product's option. Throws if the call tries to update an option
|
||||
not associated with the product. Throws if the updated title already exists.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product whose option we are updating |
|
||||
| `optionId` | `string` | the id of the option we are updating |
|
||||
| `data` | `ProductOptionInput` | the data to update the option with |
|
||||
| `productId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
| `data` | `ProductOptionInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the updated product
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product.ts:637](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product.ts#L637)
|
||||
[services/product.ts:637](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product.ts#L637)
|
||||
|
||||
___
|
||||
|
||||
@@ -725,4 +645,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: ProductTypeService
|
||||
|
||||
Provides layer to manipulate products.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L16)
|
||||
[services/product-type.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L16)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L14)
|
||||
[services/product-type.ts:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L15)
|
||||
[services/product-type.ts:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L15)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -54,24 +52,20 @@ ___
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`ProductType`[]\>
|
||||
|
||||
Lists product types
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductTypeProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`ProductType`\> | the config to be used for find |
|
||||
| `selector` | `FilterableProductTypeProps` | |
|
||||
| `config` | `FindConfig`<`ProductType`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductType`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:72](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L72)
|
||||
[services/product-type.ts:72](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
@@ -79,24 +73,20 @@ ___
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config?`): `Promise`<[`ProductType`[], `number`]\>
|
||||
|
||||
Lists product tags and adds count.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductTypeProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`ProductType`\> | the config to be used for find |
|
||||
| `selector` | `FilterableProductTypeProps` | |
|
||||
| `config` | `FindConfig`<`ProductType`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProductType`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:88](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L88)
|
||||
[services/product-type.ts:88](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
@@ -104,25 +94,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`ProductType`\>
|
||||
|
||||
Gets a product by id.
|
||||
Throws in case of DB Error and if product was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of the product to get. |
|
||||
| `config` | `FindConfig`<`ProductType`\> | object that defines what should be included in the query response |
|
||||
| `id` | `string` | |
|
||||
| `config` | `FindConfig`<`ProductType`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductType`\>
|
||||
|
||||
the result of the find one operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L47)
|
||||
[services/product-type.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -142,4 +127,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-type.ts:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-type.ts#L23)
|
||||
[services/product-type.ts:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-type.ts#L23)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: ProductVariantService
|
||||
|
||||
Provides layer to manipulate product variants.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L52)
|
||||
[services/product-variant.ts:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L52)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:50](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L50)
|
||||
[services/product-variant.ts:50](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L45)
|
||||
[services/product-variant.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L42)
|
||||
[services/product-variant.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:48](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L48)
|
||||
[services/product-variant.ts:48](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L47)
|
||||
[services/product-variant.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -86,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L49)
|
||||
[services/product-variant.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
@@ -96,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:44](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L44)
|
||||
[services/product-variant.ts:44](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
@@ -106,7 +104,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L43)
|
||||
[services/product-variant.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -116,7 +114,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L46)
|
||||
[services/product-variant.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -134,7 +132,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L36)
|
||||
[services/product-variant.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L36)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -142,29 +140,21 @@ ___
|
||||
|
||||
▸ **addOptionValue**(`variantId`, `optionId`, `optionValue`): `Promise`<`ProductOptionValue`\>
|
||||
|
||||
Adds option value to a varaint.
|
||||
Fails when product with variant does not exists or
|
||||
if that product does not have an option with the given
|
||||
option id. Fails if given variant is not found.
|
||||
Option value must be of type string or number.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the variant to decorate. |
|
||||
| `optionId` | `string` | the option from product. |
|
||||
| `optionValue` | `string` | option value to add. |
|
||||
| `variantId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
| `optionValue` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductOptionValue`\>
|
||||
|
||||
the result of the update operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:529](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L529)
|
||||
[services/product-variant.ts:529](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L529)
|
||||
|
||||
___
|
||||
|
||||
@@ -172,25 +162,20 @@ ___
|
||||
|
||||
▸ **create**(`productOrProductId`, `variant`): `Promise`<`ProductVariant`\>
|
||||
|
||||
Creates an unpublished product variant. Will validate against parent product
|
||||
to ensure that the variant can in fact be created.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productOrProductId` | `string` \| `Product` | the product the variant will be added to |
|
||||
| `variant` | `CreateProductVariantInput` | the variant to create |
|
||||
| `productOrProductId` | `string` \| `Product` | |
|
||||
| `variant` | `CreateProductVariantInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`\>
|
||||
|
||||
resolves to the creation result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:183](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L183)
|
||||
[services/product-variant.ts:183](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L183)
|
||||
|
||||
___
|
||||
|
||||
@@ -198,24 +183,19 @@ ___
|
||||
|
||||
▸ **delete**(`variantId`): `Promise`<`void`\>
|
||||
|
||||
Deletes variant.
|
||||
Will never fail due to delete being idempotent.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to delete. Must be castable as an ObjectId |
|
||||
| `variantId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:682](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L682)
|
||||
[services/product-variant.ts:682](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L682)
|
||||
|
||||
___
|
||||
|
||||
@@ -223,25 +203,20 @@ ___
|
||||
|
||||
▸ **deleteOptionValue**(`variantId`, `optionId`): `Promise`<`void`\>
|
||||
|
||||
Deletes option value from given variant.
|
||||
Will never fail due to delete being idempotent.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the variant to decorate. |
|
||||
| `optionId` | `string` | the option from product. |
|
||||
| `variantId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:556](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L556)
|
||||
[services/product-variant.ts:556](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L556)
|
||||
|
||||
___
|
||||
|
||||
@@ -249,27 +224,21 @@ ___
|
||||
|
||||
▸ **getFreeTextQueryBuilder_**(`variantRepo`, `query`, `q?`): `SelectQueryBuilder`<`ProductVariant`\>
|
||||
|
||||
Lists variants based on the provided parameters and includes the count of
|
||||
variants that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantRepo` | `ProductVariantRepository` | the variant repository |
|
||||
| `query` | `FindWithRelationsOptions` | object that defines the scope for what should be returned |
|
||||
| `q?` | `string` | free text query |
|
||||
| `variantRepo` | `ProductVariantRepository` | |
|
||||
| `query` | `FindWithRelationsOptions` | |
|
||||
| `q?` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`SelectQueryBuilder`<`ProductVariant`\>
|
||||
|
||||
an array containing the products as the first element and the total
|
||||
count of products that matches the query as the second element.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:788](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L788)
|
||||
[services/product-variant.ts:788](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L788)
|
||||
|
||||
___
|
||||
|
||||
@@ -277,26 +246,20 @@ ___
|
||||
|
||||
▸ **getRegionPrice**(`variantId`, `context`): `Promise`<`number`\>
|
||||
|
||||
Gets the price specific to a region. If no region specific money amount
|
||||
exists the function will try to use a currency price. If no default
|
||||
currency price exists the function will throw an error.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to get price from |
|
||||
| `context` | `GetRegionPriceContext` | context for getting region price |
|
||||
| `variantId` | `string` | |
|
||||
| `context` | `GetRegionPriceContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the price specific to the region
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:404](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L404)
|
||||
[services/product-variant.ts:404](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L404)
|
||||
|
||||
___
|
||||
|
||||
@@ -308,18 +271,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductVariantProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | query config object for variant retrieval |
|
||||
| `selector` | `FilterableProductVariantProps` | |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:624](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L624)
|
||||
[services/product-variant.ts:624](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L624)
|
||||
|
||||
___
|
||||
|
||||
@@ -331,18 +292,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductVariantProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | query config object for variant retrieval |
|
||||
| `selector` | `FilterableProductVariantProps` | |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ProductVariant`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:583](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L583)
|
||||
[services/product-variant.ts:583](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L583)
|
||||
|
||||
___
|
||||
|
||||
@@ -350,22 +309,17 @@ ___
|
||||
|
||||
▸ **prepareListQuery_**(`selector`, `config`): `Object`
|
||||
|
||||
Creates a query object to be used for list queries.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableProductVariantProps` | the selector to create the query from |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> | the config to use for the query |
|
||||
| `selector` | `FilterableProductVariantProps` | |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Object`
|
||||
|
||||
an object containing the query, relations and free-text
|
||||
search param.
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `q?` | `string` |
|
||||
@@ -374,7 +328,7 @@ an object containing the query, relations and free-text
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:749](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L749)
|
||||
[services/product-variant.ts:749](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L749)
|
||||
|
||||
___
|
||||
|
||||
@@ -382,24 +336,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`variantId`, `config?`): `Promise`<`ProductVariant`\>
|
||||
|
||||
Gets a product variant by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the product to get. |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | query config object for variant retrieval. |
|
||||
| `variantId` | `string` | |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`\>
|
||||
|
||||
the product document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:117](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L117)
|
||||
[services/product-variant.ts:117](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L117)
|
||||
|
||||
___
|
||||
|
||||
@@ -407,24 +357,20 @@ ___
|
||||
|
||||
▸ **retrieveBySKU**(`sku`, `config?`): `Promise`<`ProductVariant`\>
|
||||
|
||||
Gets a product variant by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `sku` | `string` | The unique stock keeping unit used to identify the product variant. |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | query config object for variant retrieval. |
|
||||
| `sku` | `string` | |
|
||||
| `config` | `FindConfig`<`ProductVariant`\> & `PriceSelectionContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`\>
|
||||
|
||||
the product document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:147](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L147)
|
||||
[services/product-variant.ts:147](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
@@ -432,24 +378,20 @@ ___
|
||||
|
||||
▸ **setCurrencyPrice**(`variantId`, `price`): `Promise`<`MoneyAmount`\>
|
||||
|
||||
Sets the default price for the given currency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to set prices for |
|
||||
| `price` | `ProductVariantPrice` | the price for the variant |
|
||||
| `variantId` | `string` | |
|
||||
| `price` | `ProductVariantPrice` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`MoneyAmount`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:470](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L470)
|
||||
[services/product-variant.ts:470](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L470)
|
||||
|
||||
___
|
||||
|
||||
@@ -457,24 +399,20 @@ ___
|
||||
|
||||
▸ **setMetadata_**(`variant`, `metadata`): `Record`<`string`, `unknown`\>
|
||||
|
||||
Dedicated method to set metadata for a variant.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variant` | `ProductVariant` | the variant to set metadata for. |
|
||||
| `metadata` | `object` | the metadata to set |
|
||||
| `variant` | `ProductVariant` | |
|
||||
| `metadata` | `object` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Record`<`string`, `unknown`\>
|
||||
|
||||
updated metadata object
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:717](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L717)
|
||||
[services/product-variant.ts:717](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L717)
|
||||
|
||||
___
|
||||
|
||||
@@ -482,24 +420,20 @@ ___
|
||||
|
||||
▸ **setRegionPrice**(`variantId`, `price`): `Promise`<`MoneyAmount`\>
|
||||
|
||||
Sets the default price of a specific region
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of the variant to update |
|
||||
| `price` | `ProductVariantPrice` | the price for the variant. |
|
||||
| `variantId` | `string` | |
|
||||
| `price` | `ProductVariantPrice` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`MoneyAmount`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:433](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L433)
|
||||
[services/product-variant.ts:433](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L433)
|
||||
|
||||
___
|
||||
|
||||
@@ -507,26 +441,20 @@ ___
|
||||
|
||||
▸ **update**(`variantOrVariantId`, `update`): `Promise`<`ProductVariant`\>
|
||||
|
||||
Updates a variant.
|
||||
Price updates should use dedicated methods.
|
||||
The function will throw, if price updates are attempted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantOrVariantId` | `string` \| `Partial`<`ProductVariant`\> | variant or id of a variant. |
|
||||
| `update` | `UpdateProductVariantInput` | an object with the update values. |
|
||||
| `variantOrVariantId` | `string` \| `Partial`<`ProductVariant`\> | |
|
||||
| `update` | `UpdateProductVariantInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductVariant`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:288](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L288)
|
||||
[services/product-variant.ts:288](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L288)
|
||||
|
||||
___
|
||||
|
||||
@@ -534,26 +462,21 @@ ___
|
||||
|
||||
▸ **updateOptionValue**(`variantId`, `optionId`, `optionValue`): `Promise`<`ProductOptionValue`\>
|
||||
|
||||
Updates variant's option value.
|
||||
Option value must be of type string or number.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the variant to decorate. |
|
||||
| `optionId` | `string` | the option from product. |
|
||||
| `optionValue` | `string` | option value to add. |
|
||||
| `variantId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
| `optionValue` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ProductOptionValue`\>
|
||||
|
||||
the result of the update operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:491](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L491)
|
||||
[services/product-variant.ts:491](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L491)
|
||||
|
||||
___
|
||||
|
||||
@@ -561,25 +484,20 @@ ___
|
||||
|
||||
▸ **updateVariantPrices**(`variantId`, `prices`): `Promise`<`void`\>
|
||||
|
||||
Updates a variant's prices.
|
||||
Deletes any prices that are not in the update object, and is not associated with a price list.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `variantId` | `string` | the id of variant variant |
|
||||
| `prices` | `ProductVariantPrice`[] | the update prices |
|
||||
| `variantId` | `string` | |
|
||||
| `prices` | `ProductVariantPrice`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
empty promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:366](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L366)
|
||||
[services/product-variant.ts:366](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L366)
|
||||
|
||||
___
|
||||
|
||||
@@ -599,4 +517,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/product-variant.ts:89](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/product-variant.ts#L89)
|
||||
[services/product-variant.ts:89](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/product-variant.ts#L89)
|
||||
@@ -34,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/query-builder.js:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/query-builder.js#L25)
|
||||
[services/query-builder.js:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/query-builder.js#L25)
|
||||
|
||||
___
|
||||
|
||||
@@ -55,7 +55,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/query-builder.js:5](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/query-builder.js#L5)
|
||||
[services/query-builder.js:5](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/query-builder.js#L5)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,4 +76,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/query-builder.js:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/query-builder.js#L39)
|
||||
[services/query-builder.js:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/query-builder.js#L39)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: RegionService
|
||||
|
||||
Provides layer to manipulate regions.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L16)
|
||||
[services/region.js:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L16)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -44,7 +42,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:10](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L10)
|
||||
[services/region.js:10](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L10)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -52,24 +50,20 @@ BaseService.constructor
|
||||
|
||||
▸ **addCountry**(`regionId`, `code`): `Promise`<`any`\>
|
||||
|
||||
Adds a country to the region.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to add a country to |
|
||||
| `code` | `string` | a 2 digit alphanumeric ISO country code. |
|
||||
| `regionId` | `string` | |
|
||||
| `code` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:462](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L462)
|
||||
[services/region.js:462](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L462)
|
||||
|
||||
___
|
||||
|
||||
@@ -77,25 +71,20 @@ ___
|
||||
|
||||
▸ **addFulfillmentProvider**(`regionId`, `providerId`): `Promise`<`any`\>
|
||||
|
||||
Adds a fulfillment provider that is available in the region. Fails if the
|
||||
provider doesn't exist.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to add the provider to |
|
||||
| `providerId` | `string` | the provider to add to the region |
|
||||
| `regionId` | `string` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:582](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L582)
|
||||
[services/region.js:582](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L582)
|
||||
|
||||
___
|
||||
|
||||
@@ -103,25 +92,20 @@ ___
|
||||
|
||||
▸ **addPaymentProvider**(`regionId`, `providerId`): `Promise`<`any`\>
|
||||
|
||||
Adds a payment provider that is available in the region. Fails if the
|
||||
provider doesn't exist.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to add the provider to |
|
||||
| `providerId` | `string` | the provider to add to the region |
|
||||
| `regionId` | `string` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:535](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L535)
|
||||
[services/region.js:535](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L535)
|
||||
|
||||
___
|
||||
|
||||
@@ -129,23 +113,19 @@ ___
|
||||
|
||||
▸ **create**(`regionObject`): `Region`
|
||||
|
||||
Creates a region.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionObject` | `Region` | the unvalidated region |
|
||||
| `regionObject` | `Region` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Region`
|
||||
|
||||
the newly created region
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:95](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L95)
|
||||
[services/region.js:95](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L95)
|
||||
|
||||
___
|
||||
|
||||
@@ -153,23 +133,19 @@ ___
|
||||
|
||||
▸ **delete**(`regionId`): `Promise`<`any`\>
|
||||
|
||||
Deletes a region.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to delete |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:432](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L432)
|
||||
[services/region.js:432](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L432)
|
||||
|
||||
___
|
||||
|
||||
@@ -177,24 +153,20 @@ ___
|
||||
|
||||
▸ **list**(`selector?`, `config?`): `Promise`<`any`\>
|
||||
|
||||
Lists all regions based on a query
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | query object for find |
|
||||
| `config` | `any` | configuration settings |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:420](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L420)
|
||||
[services/region.js:420](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L420)
|
||||
|
||||
___
|
||||
|
||||
@@ -202,24 +174,20 @@ ___
|
||||
|
||||
▸ **removeCountry**(`regionId`, `code`): `Promise`<`any`\>
|
||||
|
||||
Removes a country from a Region
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to remove from |
|
||||
| `code` | `string` | a 2 digit alphanumeric ISO country code to remove |
|
||||
| `regionId` | `string` | |
|
||||
| `code` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:499](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L499)
|
||||
[services/region.js:499](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L499)
|
||||
|
||||
___
|
||||
|
||||
@@ -227,24 +195,20 @@ ___
|
||||
|
||||
▸ **removeFulfillmentProvider**(`regionId`, `providerId`): `Promise`<`any`\>
|
||||
|
||||
Removes a fulfillment provider from a region. Is idempotent.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to remove the provider from |
|
||||
| `providerId` | `string` | the provider to remove from the region |
|
||||
| `regionId` | `string` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:660](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L660)
|
||||
[services/region.js:660](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L660)
|
||||
|
||||
___
|
||||
|
||||
@@ -252,24 +216,20 @@ ___
|
||||
|
||||
▸ **removePaymentProvider**(`regionId`, `providerId`): `Promise`<`any`\>
|
||||
|
||||
Removes a payment provider from a region. Is idempotent.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to remove the provider from |
|
||||
| `providerId` | `string` | the provider to remove from the region |
|
||||
| `regionId` | `string` | |
|
||||
| `providerId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:626](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L626)
|
||||
[services/region.js:626](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L626)
|
||||
|
||||
___
|
||||
|
||||
@@ -277,24 +237,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`regionId`, `config?`): `Region`
|
||||
|
||||
Retrieves a region by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the id of the region to retrieve |
|
||||
| `config` | `any` | configuration settings |
|
||||
| `regionId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Region`
|
||||
|
||||
the region
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:396](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L396)
|
||||
[services/region.js:396](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L396)
|
||||
|
||||
___
|
||||
|
||||
@@ -315,7 +271,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:362](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L362)
|
||||
[services/region.js:362](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L362)
|
||||
|
||||
___
|
||||
|
||||
@@ -323,24 +279,20 @@ ___
|
||||
|
||||
▸ **update**(`regionId`, `update`): `Promise`<`any`\>
|
||||
|
||||
Updates a region
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `regionId` | `string` | the region to update |
|
||||
| `update` | `any` | the data to update the region with |
|
||||
| `regionId` | `string` | |
|
||||
| `update` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:153](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L153)
|
||||
[services/region.js:153](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L153)
|
||||
|
||||
___
|
||||
|
||||
@@ -348,15 +300,12 @@ ___
|
||||
|
||||
▸ **validateCountry_**(`code`, `regionId`): `Promise`<`any`\>
|
||||
|
||||
Validates a country code. Will normalize the code before checking for
|
||||
existence.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `code` | `string` | a 2 digit alphanumeric ISO country code |
|
||||
| `regionId` | `string` | the id of the current region to check against |
|
||||
| `code` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -364,7 +313,7 @@ existence.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:323](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L323)
|
||||
[services/region.js:323](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L323)
|
||||
|
||||
___
|
||||
|
||||
@@ -372,13 +321,11 @@ ___
|
||||
|
||||
▸ **validateCurrency_**(`currencyCode`): `Promise`<`void`\>
|
||||
|
||||
Validates a currency code. Will throw if the currency code doesn't exist.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `currencyCode` | `string` | an ISO currency code |
|
||||
| `currencyCode` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -386,7 +333,7 @@ Validates a currency code. Will throw if the currency code doesn't exist.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:302](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L302)
|
||||
[services/region.js:302](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L302)
|
||||
|
||||
___
|
||||
|
||||
@@ -394,25 +341,20 @@ ___
|
||||
|
||||
▸ **validateFields_**(`region`, `id?`): `any`
|
||||
|
||||
Validates fields for creation and updates. If the region already exisits
|
||||
the id can be passed to check that country updates are allowed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `region` | `any` | `undefined` | the region data to validate |
|
||||
| `id` | ``null`` \| `string` | `undefined` | optional id of the region to check against |
|
||||
| `region` | `any` | `undefined` | |
|
||||
| `id` | ``null`` \| `string` | `undefined` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
the validated region data
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:213](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L213)
|
||||
[services/region.js:213](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L213)
|
||||
|
||||
___
|
||||
|
||||
@@ -420,13 +362,11 @@ ___
|
||||
|
||||
▸ **validateTaxRate_**(`taxRate`): `void`
|
||||
|
||||
Validates a tax rate. Will throw if the tax rate is not between 0 and 1.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `taxRate` | `number` | a number representing the tax rate of the region |
|
||||
| `taxRate` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -434,7 +374,7 @@ Validates a tax rate. Will throw if the tax rate is not between 0 and 1.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:289](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L289)
|
||||
[services/region.js:289](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L289)
|
||||
|
||||
___
|
||||
|
||||
@@ -454,4 +394,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/region.js:65](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/region.js#L65)
|
||||
[services/region.js:65](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/region.js#L65)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:5](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L5)
|
||||
[services/return-reason.js:5](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L5)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -44,7 +44,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L30)
|
||||
[services/return-reason.js:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -64,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L114)
|
||||
[services/return-reason.js:114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L114)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,18 +76,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | config object |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:82](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L82)
|
||||
[services/return-reason.js:82](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L82)
|
||||
|
||||
___
|
||||
|
||||
@@ -95,24 +93,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`Order`\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | id of order to retrieve |
|
||||
| `config` | `any` | config object |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the order document
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:97](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L97)
|
||||
[services/return-reason.js:97](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L97)
|
||||
|
||||
___
|
||||
|
||||
@@ -133,7 +127,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L52)
|
||||
[services/return-reason.js:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L52)
|
||||
|
||||
___
|
||||
|
||||
@@ -153,4 +147,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return-reason.js:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return-reason.js#L15)
|
||||
[services/return-reason.js:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return-reason.js#L15)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: ReturnService
|
||||
|
||||
Handles Returns
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:9](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L9)
|
||||
[services/return.js:9](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L9)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L49)
|
||||
[services/return.js:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L49)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L47)
|
||||
[services/return.js:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L39)
|
||||
[services/return.js:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L39)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -64,23 +62,19 @@ ___
|
||||
|
||||
▸ **cancel**(`returnId`): `Promise`<`Return`\>
|
||||
|
||||
Cancels a return if possible. Returns can be canceled if it has not been received.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `returnId` | `string` | the id of the return to cancel. |
|
||||
| `returnId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Return`\>
|
||||
|
||||
the updated Return
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:134](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L134)
|
||||
[services/return.js:134](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L134)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,25 +82,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`Return`\>
|
||||
|
||||
Creates a return request for an order, with given items, and a shipping
|
||||
method. If no refund amount is provided the refund amount is calculated from
|
||||
the return lines and the shipping cost.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `any` | data to use for the return e.g. shipping_method, items or refund_amount |
|
||||
| `data` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Return`\>
|
||||
|
||||
the created return
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:307](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L307)
|
||||
[services/return.js:307](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L307)
|
||||
|
||||
___
|
||||
|
||||
@@ -126,7 +114,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:450](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L450)
|
||||
[services/return.js:450](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L450)
|
||||
|
||||
___
|
||||
|
||||
@@ -134,27 +122,23 @@ ___
|
||||
|
||||
▸ **getFulfillmentItems_**(`order`, `items`, `transformer`): `Promise`<`LineItem`[]\>
|
||||
|
||||
Retrieves the order line items, given an array of items
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to get line items from |
|
||||
| `items` | `Object` | the items to get |
|
||||
| `order` | `Order` | |
|
||||
| `items` | `Object` | |
|
||||
| `items.item_id` | `string` | - |
|
||||
| `items.quantity` | `number` | - |
|
||||
| `transformer` | `Function` | a function to apply to each of the items retrieved from the order, should return a line item. If the transformer returns an undefined value the line item will be filtered from the returned array. |
|
||||
| `transformer` | `Function` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
the line items generated by the transformer.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:89](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L89)
|
||||
[services/return.js:89](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L89)
|
||||
|
||||
___
|
||||
|
||||
@@ -166,18 +150,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the config object for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:120](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L120)
|
||||
[services/return.js:120](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L120)
|
||||
|
||||
___
|
||||
|
||||
@@ -185,32 +167,22 @@ ___
|
||||
|
||||
▸ **receive**(`return_id`, `received_items`, `refund_amount`, `allow_mismatch?`): `Promise`<`any`\>
|
||||
|
||||
Registers a previously requested return as received. This will create a
|
||||
refund to the customer. If the returned items don't match the requested
|
||||
items the return status will be updated to requires_action. This behaviour
|
||||
is useful in sitautions where a custom refund amount is requested, but the
|
||||
retuned items are not matching the requested items. Setting the
|
||||
allowMismatch argument to true, will process the return, ignoring any
|
||||
mismatches.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `return_id` | `string` | `undefined` | the orderId to return to |
|
||||
| `received_items` | `Item`[] | `undefined` | the items received after return. |
|
||||
| `refund_amount` | `undefined` \| `number` | `undefined` | the amount to return |
|
||||
| `allow_mismatch` | `bool` | `false` | whether to ignore return/received product mismatch |
|
||||
| `return_id` | `string` | `undefined` | |
|
||||
| `received_items` | `Item`[] | `undefined` | |
|
||||
| `refund_amount` | `undefined` \| `number` | `undefined` | |
|
||||
| `allow_mismatch` | `bool` | `false` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:524](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L524)
|
||||
[services/return.js:524](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L524)
|
||||
|
||||
___
|
||||
|
||||
@@ -218,24 +190,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Return`
|
||||
|
||||
Retrieves a return by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the return to retrieve |
|
||||
| `config` | `any` | the config object |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Return`
|
||||
|
||||
the return
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:229](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L229)
|
||||
[services/return.js:229](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L229)
|
||||
|
||||
___
|
||||
|
||||
@@ -256,7 +224,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:248](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L248)
|
||||
[services/return.js:248](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L248)
|
||||
|
||||
___
|
||||
|
||||
@@ -277,7 +245,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:271](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L271)
|
||||
[services/return.js:271](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L271)
|
||||
|
||||
___
|
||||
|
||||
@@ -285,28 +253,21 @@ ___
|
||||
|
||||
▸ **validateReturnLineItem_**(`item`, `quantity`, `additional`): `LineItem`
|
||||
|
||||
Checks that a given quantity of a line item can be returned. Fails if the
|
||||
item is undefined or if the returnable quantity of the item is lower, than
|
||||
the quantity that is requested to be returned.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `item` | `any` | the line item to check has sufficient returnable quantity. |
|
||||
| `quantity` | `number` | the quantity that is requested to be returned. |
|
||||
| `additional` | `any` | the quantity that is requested to be returned. |
|
||||
| `item` | `any` | |
|
||||
| `quantity` | `number` | |
|
||||
| `additional` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineItem`
|
||||
|
||||
a line item where the quantity is set to the requested
|
||||
return quantity.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:191](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L191)
|
||||
[services/return.js:191](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L191)
|
||||
|
||||
___
|
||||
|
||||
@@ -314,17 +275,11 @@ ___
|
||||
|
||||
▸ **validateReturnStatuses_**(`order`): `void`
|
||||
|
||||
Checks that an order has the statuses necessary to complete a return.
|
||||
fulfillment_status cannot be not_fulfilled or returned.
|
||||
payment_status must be captured.
|
||||
|
||||
**`throws`** when statuses are not sufficient for returns.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to check statuses on |
|
||||
| `order` | `Order` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -332,7 +287,7 @@ payment_status must be captured.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:161](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L161)
|
||||
[services/return.js:161](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L161)
|
||||
|
||||
___
|
||||
|
||||
@@ -352,4 +307,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/return.js:55](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/return.js#L55)
|
||||
[services/return.js:55](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/return.js#L55)
|
||||
@@ -0,0 +1,321 @@
|
||||
# Class: SalesChannelService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`SalesChannelService`](SalesChannelService.md)\>
|
||||
|
||||
↳ **`SalesChannelService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
• **new SalesChannelService**(`__namedParameters`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `__namedParameters` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService<SalesChannelService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L37)
|
||||
|
||||
## Properties
|
||||
|
||||
### configModule
|
||||
|
||||
• `Protected` `Optional` `Readonly` **configModule**: `Record`<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.configModule
|
||||
|
||||
___
|
||||
|
||||
### container
|
||||
|
||||
• `Protected` `Readonly` **container**: `unknown`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.container
|
||||
|
||||
___
|
||||
|
||||
### eventBusService\_
|
||||
|
||||
• `Protected` `Readonly` **eventBusService\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
• `Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### salesChannelRepository\_
|
||||
|
||||
• `Protected` `Readonly` **salesChannelRepository\_**: typeof `SalesChannelRepository`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### storeService\_
|
||||
|
||||
• `Protected` `Readonly` **storeService\_**: [`StoreService`](StoreService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
• `Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
▪ `Static` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CREATED` | `string` |
|
||||
| `DELETED` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:24](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L24)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
▸ `Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` |
|
||||
| `TError` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
▸ **create**(`data`): `Promise`<`SalesChannel`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `data` | `CreateSalesChannelInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`SalesChannel`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:102](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L102)
|
||||
|
||||
___
|
||||
|
||||
### createDefault
|
||||
|
||||
▸ **createDefault**(): `Promise`<`SalesChannel`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`SalesChannel`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:182](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
▸ **delete**(`salesChannelId`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `salesChannelId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:154](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L154)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
▸ **listAndCount**(`selector?`, `config?`): `Promise`<[`SalesChannel`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`any`\> |
|
||||
| `config` | `FindConfig`<`any`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`SalesChannel`[], `number`]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:88](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
▸ **retrieve**(`salesChannelId`, `config?`): `Promise`<`SalesChannel`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `salesChannelId` | `string` |
|
||||
| `config` | `FindConfig`<`SalesChannel`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`SalesChannel`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:59](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
▸ `Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `err` | `Record`<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
▸ **update**(`salesChannelId`, `data`): `Promise`<`SalesChannel`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `salesChannelId` | `string` |
|
||||
| `data` | `Partial`<`CreateSalesChannelInput`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`SalesChannel`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/sales-channel.ts:119](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/sales-channel.ts#L119)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
▸ **withTransaction**(`transactionManager?`): [`SalesChannelService`](SalesChannelService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`SalesChannelService`](SalesChannelService.md)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: SearchService
|
||||
|
||||
Default class that implements SearchService but provides stuv implementation for all methods
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ SearchService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:8](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L8)
|
||||
[services/search.js:8](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L8)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ SearchService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:11](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L11)
|
||||
[services/search.js:11](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L11)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:13](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L13)
|
||||
[services/search.js:13](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L13)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -68,7 +66,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L28)
|
||||
[services/search.js:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L28)
|
||||
|
||||
___
|
||||
|
||||
@@ -89,7 +87,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L16)
|
||||
[services/search.js:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L16)
|
||||
|
||||
___
|
||||
|
||||
@@ -109,7 +107,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L46)
|
||||
[services/search.js:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -130,7 +128,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L40)
|
||||
[services/search.js:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -150,7 +148,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L22)
|
||||
[services/search.js:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L22)
|
||||
|
||||
___
|
||||
|
||||
@@ -172,7 +170,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L34)
|
||||
[services/search.js:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -198,7 +196,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:52](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L52)
|
||||
[services/search.js:52](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L52)
|
||||
|
||||
___
|
||||
|
||||
@@ -219,4 +217,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/search.js:59](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/search.js#L59)
|
||||
[services/search.js:59](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/search.js#L59)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: ShippingOptionService
|
||||
|
||||
Provides layer to manipulate profiles.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`ShippingOptionService`](ShippingOptionService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<ShippingOptionService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:39](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L39)
|
||||
[services/shipping-option.ts:39](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L39)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -60,7 +58,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:36](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L36)
|
||||
[services/shipping-option.ts:36](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
@@ -70,7 +68,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L34)
|
||||
[services/shipping-option.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -80,7 +78,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L33)
|
||||
[services/shipping-option.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
@@ -90,7 +88,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L30)
|
||||
[services/shipping-option.ts:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -100,7 +98,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L31)
|
||||
[services/shipping-option.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
@@ -110,7 +108,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L32)
|
||||
[services/shipping-option.ts:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
@@ -124,7 +122,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L37)
|
||||
[services/shipping-option.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L37)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -132,25 +130,20 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ **addRequirement**(`optionId`, `requirement`): `Promise`<`ShippingOption`\>
|
||||
|
||||
Adds a requirement to a shipping option. Only 1 requirement of each type
|
||||
is allowed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `string` | the option to add the requirement to. |
|
||||
| `requirement` | `ShippingOptionRequirement` | the requirement for the option. |
|
||||
| `optionId` | `string` | |
|
||||
| `requirement` | `ShippingOptionRequirement` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOption`\>
|
||||
|
||||
the result of update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:627](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L627)
|
||||
[services/shipping-option.ts:627](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L627)
|
||||
|
||||
___
|
||||
|
||||
@@ -158,10 +151,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -173,23 +162,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -197,25 +184,19 @@ ___
|
||||
|
||||
▸ **create**(`data`): `Promise`<`ShippingOption`\>
|
||||
|
||||
Creates a new shipping option. Used both for outbound and inbound shipping
|
||||
options. The difference is registered by the `is_return` field which
|
||||
defaults to false.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `CreateShippingOptionInput` | the data to create shipping options |
|
||||
| `data` | `CreateShippingOptionInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOption`\>
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:384](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L384)
|
||||
[services/shipping-option.ts:384](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L384)
|
||||
|
||||
___
|
||||
|
||||
@@ -223,25 +204,21 @@ ___
|
||||
|
||||
▸ **createShippingMethod**(`optionId`, `data`, `config`): `Promise`<`ShippingMethod`\>
|
||||
|
||||
Creates a shipping method for a given cart.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `string` | the id of the option to use for the method. |
|
||||
| `data` | `object` | the optional provider data to use. |
|
||||
| `config` | `CreateShippingMethodDto` | the cart to create the shipping method for. |
|
||||
| `optionId` | `string` | |
|
||||
| `data` | `object` | |
|
||||
| `config` | `CreateShippingMethodDto` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethod`\>
|
||||
|
||||
the resulting shipping method.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:259](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L259)
|
||||
[services/shipping-option.ts:259](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L259)
|
||||
|
||||
___
|
||||
|
||||
@@ -249,23 +226,19 @@ ___
|
||||
|
||||
▸ **delete**(`optionId`): `Promise`<`void` \| `ShippingOption`\>
|
||||
|
||||
Deletes a profile with a given profile id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `string` | the id of the profile to delete. Must be castable as an ObjectId |
|
||||
| `optionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `ShippingOption`\>
|
||||
|
||||
the result of the delete operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:605](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L605)
|
||||
[services/shipping-option.ts:605](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L605)
|
||||
|
||||
___
|
||||
|
||||
@@ -273,23 +246,19 @@ ___
|
||||
|
||||
▸ **deleteShippingMethods**(`shippingMethods`): `Promise`<`ShippingMethod`[]\>
|
||||
|
||||
Removes a given shipping method
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingMethods` | `ShippingMethod` \| `ShippingMethod`[] | the shipping method to remove |
|
||||
| `shippingMethods` | `ShippingMethod` \| `ShippingMethod`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethod`[]\>
|
||||
|
||||
removed shipping methods
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:239](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L239)
|
||||
[services/shipping-option.ts:239](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L239)
|
||||
|
||||
___
|
||||
|
||||
@@ -297,27 +266,21 @@ ___
|
||||
|
||||
▸ **getPrice_**(`option`, `data`, `cart`): `Promise`<`number`\>
|
||||
|
||||
Returns the amount to be paid for a shipping method. Will ask the
|
||||
fulfillment provider to calculate the price if the shipping option has the
|
||||
price type "calculated".
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `option` | `ShippingOption` | the shipping option to retrieve the price for. |
|
||||
| `data` | `object` | the shipping data to retrieve the price. |
|
||||
| `cart` | `undefined` \| `Cart` \| `Order` | the context in which the price should be retrieved. |
|
||||
| `option` | `ShippingOption` | |
|
||||
| `data` | `object` | |
|
||||
| `cart` | `undefined` \| `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the price of the shipping option.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:686](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L686)
|
||||
[services/shipping-option.ts:686](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L686)
|
||||
|
||||
___
|
||||
|
||||
@@ -329,18 +292,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`ShippingMethod`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`ShippingOption`\> | config object |
|
||||
| `selector` | `Selector`<`ShippingMethod`\> | |
|
||||
| `config` | `FindConfig`<`ShippingOption`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOption`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:130](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L130)
|
||||
[services/shipping-option.ts:130](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L130)
|
||||
|
||||
___
|
||||
|
||||
@@ -352,18 +313,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `Selector`<`ShippingMethod`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`ShippingOption`\> | config object |
|
||||
| `selector` | `Selector`<`ShippingMethod`\> | |
|
||||
| `config` | `FindConfig`<`ShippingOption`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ShippingOption`[], `number`]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:149](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L149)
|
||||
[services/shipping-option.ts:149](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L149)
|
||||
|
||||
___
|
||||
|
||||
@@ -371,23 +330,19 @@ ___
|
||||
|
||||
▸ **removeRequirement**(`requirementId`): `Promise`<`void` \| `ShippingOptionRequirement`\>
|
||||
|
||||
Removes a requirement from a shipping option
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `requirementId` | `any` | the id of the requirement to remove |
|
||||
| `requirementId` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `ShippingOptionRequirement`\>
|
||||
|
||||
the result of update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:656](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L656)
|
||||
[services/shipping-option.ts:656](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L656)
|
||||
|
||||
___
|
||||
|
||||
@@ -395,15 +350,12 @@ ___
|
||||
|
||||
▸ **retrieve**(`optionId`, `options?`): `Promise`<`ShippingOption`\>
|
||||
|
||||
Gets a profile by id.
|
||||
Throws in case of DB Error and if profile was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `any` | the id of the profile to get. |
|
||||
| `options` | `Object` | the options to get a profile |
|
||||
| `optionId` | `any` | |
|
||||
| `options` | `Object` | |
|
||||
| `options.relations?` | `string`[] | - |
|
||||
| `options.select?` | keyof `ShippingOption`[] | - |
|
||||
|
||||
@@ -411,11 +363,9 @@ Throws in case of DB Error and if profile was not found.
|
||||
|
||||
`Promise`<`ShippingOption`\>
|
||||
|
||||
the profile document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:170](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L170)
|
||||
[services/shipping-option.ts:170](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L170)
|
||||
|
||||
___
|
||||
|
||||
@@ -439,7 +389,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -447,26 +397,20 @@ ___
|
||||
|
||||
▸ **update**(`optionId`, `update`): `Promise`<`ShippingOption`\>
|
||||
|
||||
Updates a profile. Metadata updates and product updates should use
|
||||
dedicated methods, e.g. `setMetadata`, etc. The function
|
||||
will throw errors if metadata or product updates are attempted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `string` | the id of the option. Must be a string that can be casted to an ObjectId |
|
||||
| `update` | `UpdateShippingOptionInput` | an object with the update values. |
|
||||
| `optionId` | `string` | |
|
||||
| `update` | `UpdateShippingOptionInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOption`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:498](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L498)
|
||||
[services/shipping-option.ts:498](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L498)
|
||||
|
||||
___
|
||||
|
||||
@@ -474,25 +418,20 @@ ___
|
||||
|
||||
▸ **updateShippingMethod**(`id`, `update`): `Promise`<`undefined` \| `ShippingMethod`\>
|
||||
|
||||
Updates a shipping method's associations. Useful when a cart is completed
|
||||
and its methods should be copied to an order/swap entity.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the shipping method to update |
|
||||
| `update` | `ShippingMethodUpdate` | the values to update the method with |
|
||||
| `id` | `string` | |
|
||||
| `update` | `ShippingMethodUpdate` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `ShippingMethod`\>
|
||||
|
||||
the resulting shipping method
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:210](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L210)
|
||||
[services/shipping-option.ts:210](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L210)
|
||||
|
||||
___
|
||||
|
||||
@@ -500,26 +439,20 @@ ___
|
||||
|
||||
▸ **validateCartOption**(`option`, `cart`): ``null`` \| `ShippingOption`
|
||||
|
||||
Checks if a given option id is a valid option for a cart. If it is the
|
||||
option is returned with the correct price. Throws when region_ids do not
|
||||
match, or when the shipping option requirements are not satisfied.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `option` | `ShippingOption` | the option object to check |
|
||||
| `cart` | `Cart` | the cart object to check against |
|
||||
| `option` | `ShippingOption` | |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| `ShippingOption`
|
||||
|
||||
the validated shipping option
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:337](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L337)
|
||||
[services/shipping-option.ts:337](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L337)
|
||||
|
||||
___
|
||||
|
||||
@@ -527,24 +460,20 @@ ___
|
||||
|
||||
▸ **validatePriceType_**(`priceType`, `option`): `Promise`<`ShippingOptionPriceType`\>
|
||||
|
||||
Validates a shipping option price
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `priceType` | `ShippingOptionPriceType` | the price to validate |
|
||||
| `option` | `ShippingOption` | the option to validate against |
|
||||
| `priceType` | `ShippingOptionPriceType` | |
|
||||
| `option` | `ShippingOption` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOptionPriceType`\>
|
||||
|
||||
the validated price
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:462](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L462)
|
||||
[services/shipping-option.ts:462](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L462)
|
||||
|
||||
___
|
||||
|
||||
@@ -552,24 +481,20 @@ ___
|
||||
|
||||
▸ **validateRequirement_**(`requirement`, `optionId?`): `Promise`<`ShippingOptionRequirement`\>
|
||||
|
||||
Validates a requirement
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `requirement` | `ShippingOptionRequirement` | `undefined` | the requirement to validate |
|
||||
| `optionId` | `undefined` \| `string` | `undefined` | the id to validate the requirement |
|
||||
| `requirement` | `ShippingOptionRequirement` | `undefined` | |
|
||||
| `optionId` | `undefined` \| `string` | `undefined` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingOptionRequirement`\>
|
||||
|
||||
a validated shipping requirement
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-option.ts:64](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-option.ts#L64)
|
||||
[services/shipping-option.ts:64](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-option.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
@@ -593,4 +518,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,9 +1,5 @@
|
||||
# Class: ShippingProfileService
|
||||
|
||||
Provides layer to manipulate profiles.
|
||||
|
||||
**`implements`** {BaseService}
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -28,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:12](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L12)
|
||||
[services/shipping-profile.js:12](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L12)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -36,25 +32,20 @@ BaseService.constructor
|
||||
|
||||
▸ **addProduct**(`profileId`, `productId`): `Promise`<`any`\>
|
||||
|
||||
Adds a product to a profile. The method is idempotent, so multiple calls
|
||||
with the same product variant will have the same result.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profileId` | `string` | the profile to add the product to. |
|
||||
| `productId` | `string` | the product to add. |
|
||||
| `profileId` | `string` | |
|
||||
| `productId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:343](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L343)
|
||||
[services/shipping-profile.js:343](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L343)
|
||||
|
||||
___
|
||||
|
||||
@@ -62,25 +53,20 @@ ___
|
||||
|
||||
▸ **addShippingOption**(`profileId`, `optionId`): `Promise`<`any`\>
|
||||
|
||||
Adds a shipping option to the profile. The shipping option can be used to
|
||||
fulfill the products in the products field.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profileId` | `string` | the profile to apply the shipping option to |
|
||||
| `optionId` | `string` | the option to add to the profile |
|
||||
| `profileId` | `string` | |
|
||||
| `optionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the model update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:361](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L361)
|
||||
[services/shipping-profile.js:361](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L361)
|
||||
|
||||
___
|
||||
|
||||
@@ -88,23 +74,19 @@ ___
|
||||
|
||||
▸ **create**(`profile`): `Promise`<`any`\>
|
||||
|
||||
Creates a new shipping profile.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profile` | `ShippingProfile` | the shipping profile to create from |
|
||||
| `profile` | `ShippingProfile` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the create operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:235](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L235)
|
||||
[services/shipping-profile.js:235](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L235)
|
||||
|
||||
___
|
||||
|
||||
@@ -112,17 +94,13 @@ ___
|
||||
|
||||
▸ **createDefault**(): `Promise`<`ShippingProfile`\>
|
||||
|
||||
Creates a default shipping profile, if this does not already exist.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingProfile`\>
|
||||
|
||||
the shipping profile
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:167](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L167)
|
||||
[services/shipping-profile.js:167](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L167)
|
||||
|
||||
___
|
||||
|
||||
@@ -130,18 +108,13 @@ ___
|
||||
|
||||
▸ **createGiftCardDefault**(): `Promise`<`ShippingProfile`\>
|
||||
|
||||
Creates a default shipping profile, for gift cards if unless it already
|
||||
exists.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingProfile`\>
|
||||
|
||||
the shipping profile
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:209](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L209)
|
||||
[services/shipping-profile.js:209](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L209)
|
||||
|
||||
___
|
||||
|
||||
@@ -149,25 +122,21 @@ ___
|
||||
|
||||
▸ **decorate**(`profile`, `fields`, `expandFields?`): `Profile`
|
||||
|
||||
Decorates a profile.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `profile` | `Profile` | `undefined` | the profile to decorate. |
|
||||
| `fields` | `string`[] | `undefined` | the fields to include. |
|
||||
| `expandFields` | `string`[] | `[]` | fields to expand. |
|
||||
| `profile` | `Profile` | `undefined` | |
|
||||
| `fields` | `string`[] | `undefined` | |
|
||||
| `expandFields` | `string`[] | `[]` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Profile`
|
||||
|
||||
return the decorated profile.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:379](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L379)
|
||||
[services/shipping-profile.js:379](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L379)
|
||||
|
||||
___
|
||||
|
||||
@@ -175,23 +144,19 @@ ___
|
||||
|
||||
▸ **delete**(`profileId`): `Promise`<`any`\>
|
||||
|
||||
Deletes a profile with a given profile id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profileId` | `string` | the id of the profile to delete. Must be castable as an ObjectId |
|
||||
| `profileId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the delete operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:317](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L317)
|
||||
[services/shipping-profile.js:317](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L317)
|
||||
|
||||
___
|
||||
|
||||
@@ -199,24 +164,19 @@ ___
|
||||
|
||||
▸ **fetchCartOptions**(`cart`): `Promise`<[`ShippingOption`]\>
|
||||
|
||||
Finds all the shipping profiles that cover the products in a cart, and
|
||||
validates all options that are available for the cart.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cart` | `Cart` | the cart object to find shipping options for |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ShippingOption`]\>
|
||||
|
||||
a list of the available shipping options
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:425](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L425)
|
||||
[services/shipping-profile.js:425](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L425)
|
||||
|
||||
___
|
||||
|
||||
@@ -237,7 +197,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:73](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L73)
|
||||
[services/shipping-profile.js:73](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L73)
|
||||
|
||||
___
|
||||
|
||||
@@ -245,23 +205,19 @@ ___
|
||||
|
||||
▸ **getProfilesInCart_**(`cart`): [`string`]
|
||||
|
||||
Returns a list of all the productIds in the cart.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cart` | `Cart` | the cart to extract products from |
|
||||
| `cart` | `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`string`]
|
||||
|
||||
a list of product ids
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:406](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L406)
|
||||
[services/shipping-profile.js:406](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L406)
|
||||
|
||||
___
|
||||
|
||||
@@ -273,18 +229,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the config object for find |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:64](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L64)
|
||||
[services/shipping-profile.js:64](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L64)
|
||||
|
||||
___
|
||||
|
||||
@@ -292,25 +246,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`profileId`, `options?`): `Promise`<`Product`\>
|
||||
|
||||
Gets a profile by id.
|
||||
Throws in case of DB Error and if profile was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profileId` | `string` | the id of the profile to get. |
|
||||
| `options` | `any` | options opf the query. |
|
||||
| `profileId` | `string` | |
|
||||
| `options` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Product`\>
|
||||
|
||||
the profile document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:121](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L121)
|
||||
[services/shipping-profile.js:121](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L121)
|
||||
|
||||
___
|
||||
|
||||
@@ -324,7 +273,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:151](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L151)
|
||||
[services/shipping-profile.js:151](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L151)
|
||||
|
||||
___
|
||||
|
||||
@@ -332,17 +281,13 @@ ___
|
||||
|
||||
▸ **retrieveGiftCardDefault**(): `any`
|
||||
|
||||
Retrieves the default gift card profile
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
the shipping profile for gift cards
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:192](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L192)
|
||||
[services/shipping-profile.js:192](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L192)
|
||||
|
||||
___
|
||||
|
||||
@@ -350,26 +295,20 @@ ___
|
||||
|
||||
▸ **update**(`profileId`, `update`): `Promise`<`any`\>
|
||||
|
||||
Updates a profile. Metadata updates and product updates should use
|
||||
dedicated methods, e.g. `setMetadata`, `addProduct`, etc. The function
|
||||
will throw errors if metadata or product updates are attempted.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `profileId` | `string` | the id of the profile. Must be a string that can be casted to an ObjectId |
|
||||
| `update` | `any` | an object with the update values. |
|
||||
| `profileId` | `string` | |
|
||||
| `update` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:263](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L263)
|
||||
[services/shipping-profile.js:263](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L263)
|
||||
|
||||
___
|
||||
|
||||
@@ -389,4 +328,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/shipping-profile.js:41](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/shipping-profile.js#L41)
|
||||
[services/shipping-profile.js:41](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/shipping-profile.js#L41)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: StoreService
|
||||
|
||||
Provides layer to manipulate store settings.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`StoreService`](StoreService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<StoreService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L33)
|
||||
[services/store.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L33)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L30)
|
||||
[services/store.ts:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:31](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L31)
|
||||
[services/store.ts:31](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
@@ -80,7 +78,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:26](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L26)
|
||||
[services/store.ts:26](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
@@ -90,7 +88,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:29](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L29)
|
||||
[services/store.ts:29](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
@@ -104,7 +102,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L27)
|
||||
[services/store.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L27)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -112,23 +110,19 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ **addCurrency**(`code`): `Promise`<`Store`\>
|
||||
|
||||
Add a currency to the store
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `code` | `string` | 3 character ISO currency code |
|
||||
| `code` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Store`\>
|
||||
|
||||
result after update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:219](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L219)
|
||||
[services/store.ts:219](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L219)
|
||||
|
||||
___
|
||||
|
||||
@@ -136,10 +130,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -151,23 +141,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -175,17 +163,13 @@ ___
|
||||
|
||||
▸ **create**(): `Promise`<`Store`\>
|
||||
|
||||
Creates a store if it doesn't already exist.
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Store`\>
|
||||
|
||||
The store.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:56](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L56)
|
||||
[services/store.ts:56](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
@@ -205,7 +189,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:113](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L113)
|
||||
[services/store.ts:113](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L113)
|
||||
|
||||
___
|
||||
|
||||
@@ -213,23 +197,19 @@ ___
|
||||
|
||||
▸ **removeCurrency**(`code`): `Promise`<`any`\>
|
||||
|
||||
Removes a currency from the store
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `code` | `string` | 3 character ISO currency code |
|
||||
| `code` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
result after update
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:263](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L263)
|
||||
[services/store.ts:263](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L263)
|
||||
|
||||
___
|
||||
|
||||
@@ -237,23 +217,19 @@ ___
|
||||
|
||||
▸ **retrieve**(`config?`): `Promise`<`Store`\>
|
||||
|
||||
Retrieve the store settings. There is always a maximum of one store.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `config` | `FindConfig`<`Store`\> | The config object from which the query will be built |
|
||||
| `config` | `FindConfig`<`Store`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Store`\>
|
||||
|
||||
the store
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:92](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L92)
|
||||
[services/store.ts:92](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L92)
|
||||
|
||||
___
|
||||
|
||||
@@ -277,7 +253,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -285,23 +261,19 @@ ___
|
||||
|
||||
▸ **update**(`data`): `Promise`<`Store`\>
|
||||
|
||||
Updates a store
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `data` | `UpdateStoreInput` | an object with the update values. |
|
||||
| `data` | `UpdateStoreInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Store`\>
|
||||
|
||||
resolves to the update result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/store.ts:129](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/store.ts#L129)
|
||||
[services/store.ts:129](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/store.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
@@ -325,4 +297,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -27,7 +27,7 @@ TransactionBaseService<
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/strategy-resolver.ts:17](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/strategy-resolver.ts#L17)
|
||||
[services/strategy-resolver.ts:17](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/strategy-resolver.ts#L17)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -61,7 +61,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/strategy-resolver.ts:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/strategy-resolver.ts#L14)
|
||||
[services/strategy-resolver.ts:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/strategy-resolver.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -75,7 +75,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/strategy-resolver.ts:15](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/strategy-resolver.ts#L15)
|
||||
[services/strategy-resolver.ts:15](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/strategy-resolver.ts#L15)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -83,10 +83,6 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -98,23 +94,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -140,7 +134,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/strategy-resolver.ts:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/strategy-resolver.ts#L22)
|
||||
[services/strategy-resolver.ts:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/strategy-resolver.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
@@ -164,7 +158,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -188,4 +182,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: SwapService
|
||||
|
||||
Handles swaps
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:21](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L21)
|
||||
[services/swap.js:21](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L21)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -50,7 +48,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:9](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L9)
|
||||
[services/swap.js:9](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L9)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -58,25 +56,19 @@ BaseService.constructor
|
||||
|
||||
▸ **cancel**(`swapId`): `Promise`<`Swap`\>
|
||||
|
||||
Cancels a given swap if possible. A swap can only be canceled if all
|
||||
related returns, fulfillments, and payments have been canceled. If a swap
|
||||
is associated with a refund, it cannot be canceled.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | the id of the swap to cancel. |
|
||||
| `swapId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the canceled swap.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:790](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L790)
|
||||
[services/swap.js:790](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L790)
|
||||
|
||||
___
|
||||
|
||||
@@ -84,23 +76,19 @@ ___
|
||||
|
||||
▸ **cancelFulfillment**(`fulfillmentId`): `Swap`
|
||||
|
||||
Cancels a fulfillment (if related to a swap)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `fulfillmentId` | `string` | the ID of the fulfillment to cancel |
|
||||
| `fulfillmentId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Swap`
|
||||
|
||||
updated swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:983](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L983)
|
||||
[services/swap.js:983](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L983)
|
||||
|
||||
___
|
||||
|
||||
@@ -108,28 +96,23 @@ ___
|
||||
|
||||
▸ **create**(`order`, `returnItems`, `additionalItems`, `returnShipping`, `custom?`): `Promise`<`Swap`\>
|
||||
|
||||
Creates a swap from an order, with given return items, additional items
|
||||
and an optional return shipping method.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to base the swap off. |
|
||||
| `returnItems` | `ReturnItem`[] | the items to return in the swap. |
|
||||
| `additionalItems` | `undefined` \| `PreliminaryLineItem`[] | the items to send to the customer. |
|
||||
| `returnShipping` | `any` | an optional shipping method for returning the returnItems. |
|
||||
| `custom` | `any` | contains relevant custom information. This object may include no_notification which will disable sending notification when creating swap. If set, it overrules the attribute inherited from the order. |
|
||||
| `order` | `Order` | |
|
||||
| `returnItems` | `ReturnItem`[] | |
|
||||
| `additionalItems` | `undefined` \| `PreliminaryLineItem`[] | |
|
||||
| `returnShipping` | `any` | |
|
||||
| `custom` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the newly created swap.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:313](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L313)
|
||||
[services/swap.js:313](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L313)
|
||||
|
||||
___
|
||||
|
||||
@@ -137,28 +120,20 @@ ___
|
||||
|
||||
▸ **createCart**(`swapId`, `customShippingOptions?`): `Promise`<`Swap`\>
|
||||
|
||||
Creates a cart from the given swap and order. The cart can be used to pay
|
||||
for differences associated with the swap. The swap represented by the
|
||||
swapId must belong to the order. Fails if there is already a cart on the
|
||||
swap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `swapId` | `string` | `undefined` | the id of the swap to create the cart from |
|
||||
| `customShippingOptions` | `any`[] | `[]` | the shipping options |
|
||||
| `swapId` | `string` | `undefined` | |
|
||||
| `customShippingOptions` | `any`[] | `[]` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap with its cart_id prop set to the id of
|
||||
the new cart.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:544](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L544)
|
||||
[services/swap.js:544](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L544)
|
||||
|
||||
___
|
||||
|
||||
@@ -166,25 +141,20 @@ ___
|
||||
|
||||
▸ **createFulfillment**(`swapId`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Fulfills the addtional items associated with the swap. Will call the
|
||||
fulfillment providers associated with the shipping methods.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | the id of the swap to fulfill, |
|
||||
| `config` | `any` | optional configurations, includes optional metadata to attach to the shipment, and a no_notification flag. |
|
||||
| `swapId` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the updated swap with new status and fulfillments.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:848](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L848)
|
||||
[services/swap.js:848](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L848)
|
||||
|
||||
___
|
||||
|
||||
@@ -192,26 +162,22 @@ ___
|
||||
|
||||
▸ **createShipment**(`swapId`, `fulfillmentId`, `trackingLinks`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Marks a fulfillment as shipped and attaches tracking numbers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | the id of the swap that has been shipped. |
|
||||
| `fulfillmentId` | `string` | the id of the specific fulfillment that has been shipped |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | the tracking numbers associated with the shipment |
|
||||
| `config` | `any` | optional configurations, includes optional metadata to attach to the shipment, and a noNotification flag. |
|
||||
| `swapId` | `string` | |
|
||||
| `fulfillmentId` | `string` | |
|
||||
| `trackingLinks` | `undefined` \| `TrackingLink`[] | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the updated swap with new fulfillments and status.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1016](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L1016)
|
||||
[services/swap.js:1016](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1016)
|
||||
|
||||
___
|
||||
|
||||
@@ -219,24 +185,20 @@ ___
|
||||
|
||||
▸ **deleteMetadata**(`swapId`, `key`): `Promise`<`any`\>
|
||||
|
||||
Dedicated method to delete metadata for a swap.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | the order to delete metadata from. |
|
||||
| `key` | `string` | key for metadata field |
|
||||
| `swapId` | `string` | |
|
||||
| `key` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
resolves to the updated result.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1089](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L1089)
|
||||
[services/swap.js:1089](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1089)
|
||||
|
||||
___
|
||||
|
||||
@@ -248,18 +210,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `any` | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
| `selector` | `any` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:238](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L238)
|
||||
[services/swap.js:238](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L238)
|
||||
|
||||
___
|
||||
|
||||
@@ -279,7 +239,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:395](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L395)
|
||||
[services/swap.js:395](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L395)
|
||||
|
||||
___
|
||||
|
||||
@@ -291,7 +251,7 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `swapId` | `string` | The id of the swap |
|
||||
| `swapId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -299,7 +259,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:659](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L659)
|
||||
[services/swap.js:659](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L659)
|
||||
|
||||
___
|
||||
|
||||
@@ -307,24 +267,19 @@ ___
|
||||
|
||||
▸ **registerReceived**(`id`): `Promise`<`Order`\>
|
||||
|
||||
Registers the swap return items as received so that they cannot be used
|
||||
as a part of other swaps/returns.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the order with the swap. |
|
||||
| `id` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Order`\>
|
||||
|
||||
the resulting order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:1114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L1114)
|
||||
[services/swap.js:1114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L1114)
|
||||
|
||||
___
|
||||
|
||||
@@ -332,24 +287,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`id`, `config?`): `Promise`<`Swap`\>
|
||||
|
||||
Retrieves a swap with the given id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `id` | `string` | the id of the swap to retrieve |
|
||||
| `config` | `any` | the configuration to retrieve the swap |
|
||||
| `id` | `string` | |
|
||||
| `config` | `any` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:181](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L181)
|
||||
[services/swap.js:181](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L181)
|
||||
|
||||
___
|
||||
|
||||
@@ -357,24 +308,20 @@ ___
|
||||
|
||||
▸ **retrieveByCartId**(`cartId`, `relations?`): `Promise`<`Swap`\>
|
||||
|
||||
Retrieves a swap based on its associated cart id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `cartId` | `string` | `undefined` | the cart id that the swap's cart has |
|
||||
| `relations` | `string`[] | `[]` | the relations to retrieve swap |
|
||||
| `cartId` | `string` | `undefined` | |
|
||||
| `relations` | `string`[] | `[]` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Swap`\>
|
||||
|
||||
the swap
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:216](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L216)
|
||||
[services/swap.js:216](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L216)
|
||||
|
||||
___
|
||||
|
||||
@@ -394,7 +341,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:114](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L114)
|
||||
[services/swap.js:114](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L114)
|
||||
|
||||
___
|
||||
|
||||
@@ -415,7 +362,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:511](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L511)
|
||||
[services/swap.js:511](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L511)
|
||||
|
||||
___
|
||||
|
||||
@@ -423,26 +370,20 @@ ___
|
||||
|
||||
▸ **validateReturnItems_**(`order`, `returnItems`): `ReturnItems`[]
|
||||
|
||||
Goes through a list of return items to ensure that they exist on the
|
||||
original order. If the item exists it is verified that the quantity to
|
||||
return is not higher than the original quantity ordered.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `OrderLike` | the order to return from |
|
||||
| `returnItems` | `ReturnItem`[] | the items to return |
|
||||
| `order` | `OrderLike` | |
|
||||
| `returnItems` | `ReturnItem`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`ReturnItems`[]
|
||||
|
||||
the validated returnItems
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:269](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L269)
|
||||
[services/swap.js:269](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L269)
|
||||
|
||||
___
|
||||
|
||||
@@ -462,4 +403,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/swap.js:86](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/swap.js#L86)
|
||||
[services/swap.js:86](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/swap.js#L86)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:6](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L6)
|
||||
[services/system-payment-provider.js:6](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L6)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -34,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:4](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L4)
|
||||
[services/system-payment-provider.js:4](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L4)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -54,7 +54,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L22)
|
||||
[services/system-payment-provider.js:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L22)
|
||||
|
||||
___
|
||||
|
||||
@@ -74,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L46)
|
||||
[services/system-payment-provider.js:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -94,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:38](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L38)
|
||||
[services/system-payment-provider.js:38](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L38)
|
||||
|
||||
___
|
||||
|
||||
@@ -114,7 +114,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:10](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L10)
|
||||
[services/system-payment-provider.js:10](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L10)
|
||||
|
||||
___
|
||||
|
||||
@@ -134,7 +134,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L34)
|
||||
[services/system-payment-provider.js:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -154,7 +154,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:18](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L18)
|
||||
[services/system-payment-provider.js:18](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L18)
|
||||
|
||||
___
|
||||
|
||||
@@ -174,7 +174,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:14](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L14)
|
||||
[services/system-payment-provider.js:14](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L14)
|
||||
|
||||
___
|
||||
|
||||
@@ -194,7 +194,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L42)
|
||||
[services/system-payment-provider.js:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L42)
|
||||
|
||||
___
|
||||
|
||||
@@ -214,7 +214,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:30](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L30)
|
||||
[services/system-payment-provider.js:30](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L30)
|
||||
|
||||
___
|
||||
|
||||
@@ -234,4 +234,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/system-payment-provider.js:26](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/system-payment-provider.js#L26)
|
||||
[services/system-payment-provider.js:26](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/system-payment-provider.js#L26)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: TaxProviderService
|
||||
|
||||
Finds tax providers and assists in tax related operations.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -26,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:49](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L49)
|
||||
[services/tax-provider.ts:49](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L49)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -36,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:40](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L40)
|
||||
[services/tax-provider.ts:40](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
@@ -46,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:41](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L41)
|
||||
[services/tax-provider.ts:41](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:47](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L47)
|
||||
[services/tax-provider.ts:47](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
@@ -66,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:45](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L45)
|
||||
[services/tax-provider.ts:45](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
@@ -76,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:44](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L44)
|
||||
[services/tax-provider.ts:44](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L44)
|
||||
|
||||
___
|
||||
|
||||
@@ -86,7 +84,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:46](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L46)
|
||||
[services/tax-provider.ts:46](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
@@ -96,7 +94,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L43)
|
||||
[services/tax-provider.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
@@ -106,7 +104,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:42](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L42)
|
||||
[services/tax-provider.ts:42](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L42)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -126,58 +124,49 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:103](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L103)
|
||||
[services/tax-provider.ts:103](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L103)
|
||||
|
||||
___
|
||||
|
||||
### createShippingTaxLines
|
||||
|
||||
▸ **createShippingTaxLines**(`shippingMethod`, `calculationContext`): `Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
Persists the tax lines relevant for a shipping method to the database. Used
|
||||
for return shipping methods.
|
||||
▸ **createShippingTaxLines**(`shippingMethod`, `calculationContext`): `Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingMethod` | `ShippingMethod` | the shipping method to create tax lines for |
|
||||
| `calculationContext` | `TaxCalculationContext` | the calculation context to get tax lines by |
|
||||
| `shippingMethod` | `ShippingMethod` | |
|
||||
| `calculationContext` | `TaxCalculationContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
the newly created tax lines
|
||||
`Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:171](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L171)
|
||||
[services/tax-provider.ts:171](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L171)
|
||||
|
||||
___
|
||||
|
||||
### createTaxLines
|
||||
|
||||
▸ **createTaxLines**(`cartOrLineItems`, `calculationContext`): `Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
Persists the tax lines relevant for an order to the database.
|
||||
▸ **createTaxLines**(`cartOrLineItems`, `calculationContext`): `Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrLineItems` | `Cart` \| `LineItem`[] | the cart or line items to create tax lines for |
|
||||
| `calculationContext` | `TaxCalculationContext` | the calculation context to get tax lines by |
|
||||
| `cartOrLineItems` | `Cart` \| `LineItem`[] | |
|
||||
| `calculationContext` | `TaxCalculationContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
the newly created tax lines
|
||||
`Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:121](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L121)
|
||||
[services/tax-provider.ts:121](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L121)
|
||||
|
||||
___
|
||||
|
||||
@@ -185,24 +174,20 @@ ___
|
||||
|
||||
▸ `Private` **getCacheEntry**(`productId`, `regionId`): `Promise`<``null`` \| `TaxServiceRate`[]\>
|
||||
|
||||
Gets the cache results for a set of ids
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product id to cache |
|
||||
| `regionId` | `string` | the region id to cache |
|
||||
| `productId` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<``null`` \| `TaxServiceRate`[]\>
|
||||
|
||||
the cached result or null
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:454](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L454)
|
||||
[services/tax-provider.ts:454](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L454)
|
||||
|
||||
___
|
||||
|
||||
@@ -210,24 +195,20 @@ ___
|
||||
|
||||
▸ `Private` **getCacheKey**(`productId`, `regionId`): `string`
|
||||
|
||||
The cache key to get cache hits by.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product id to cache |
|
||||
| `regionId` | `string` | the region id to cache |
|
||||
| `productId` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the cache key to use for the id set
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:423](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L423)
|
||||
[services/tax-provider.ts:423](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L423)
|
||||
|
||||
___
|
||||
|
||||
@@ -235,25 +216,20 @@ ___
|
||||
|
||||
▸ **getRegionRatesForProduct**(`productId`, `region`): `Promise`<`TaxServiceRate`[]\>
|
||||
|
||||
Gets the tax rates configured for a product. The rates are cached between
|
||||
calls.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product id to get rates for |
|
||||
| `region` | `RegionDetails` | the region to get configured rates for. |
|
||||
| `productId` | `string` | |
|
||||
| `region` | `RegionDetails` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TaxServiceRate`[]\>
|
||||
|
||||
the tax rates configured for the shipping option.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:378](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L378)
|
||||
[services/tax-provider.ts:378](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L378)
|
||||
|
||||
___
|
||||
|
||||
@@ -261,25 +237,20 @@ ___
|
||||
|
||||
▸ **getRegionRatesForShipping**(`optionId`, `regionDetails`): `Promise`<`TaxServiceRate`[]\>
|
||||
|
||||
Gets the tax rates configured for a shipping option. The rates are cached
|
||||
between calls.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `optionId` | `string` | the option id of the shipping method. |
|
||||
| `regionDetails` | `RegionDetails` | the region to get configured rates for. |
|
||||
| `optionId` | `string` | |
|
||||
| `regionDetails` | `RegionDetails` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TaxServiceRate`[]\>
|
||||
|
||||
the tax rates configured for the shipping option.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:332](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L332)
|
||||
[services/tax-provider.ts:332](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L332)
|
||||
|
||||
___
|
||||
|
||||
@@ -287,55 +258,41 @@ ___
|
||||
|
||||
▸ **getShippingTaxLines**(`shippingMethod`, `calculationContext`): `Promise`<`ShippingMethodTaxLine`[]\>
|
||||
|
||||
Gets the relevant tax lines for a shipping method. Note: this method
|
||||
doesn't persist the tax lines. Use createShippingTaxLines if you wish to
|
||||
persist the tax lines to the DB layer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingMethod` | `ShippingMethod` | the shipping method to get tax lines for |
|
||||
| `calculationContext` | `TaxCalculationContext` | the calculation context to get tax lines by |
|
||||
| `shippingMethod` | `ShippingMethod` | |
|
||||
| `calculationContext` | `TaxCalculationContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethodTaxLine`[]\>
|
||||
|
||||
the computed tax lines
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:190](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L190)
|
||||
[services/tax-provider.ts:190](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L190)
|
||||
|
||||
___
|
||||
|
||||
### getTaxLines
|
||||
|
||||
▸ **getTaxLines**(`lineItems`, `calculationContext`): `Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
Gets the relevant tax lines for an order or cart. If an order is provided
|
||||
the order's tax lines will be returned. If a cart is provided the tax lines
|
||||
will be computed from the tax rules and potentially a 3rd party tax plugin.
|
||||
Note: this method doesn't persist the tax lines. Use createTaxLines if you
|
||||
wish to persist the tax lines to the DB layer.
|
||||
▸ **getTaxLines**(`lineItems`, `calculationContext`): `Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `lineItems` | `LineItem`[] | the cart or order to get tax lines for |
|
||||
| `calculationContext` | `TaxCalculationContext` | the calculation context to get tax lines by |
|
||||
| `lineItems` | `LineItem`[] | |
|
||||
| `calculationContext` | `TaxCalculationContext` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(`ShippingMethodTaxLine` \| `LineItemTaxLine`)[]\>
|
||||
|
||||
the computed tax lines
|
||||
`Promise`<(`LineItemTaxLine` \| `ShippingMethodTaxLine`)[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:242](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L242)
|
||||
[services/tax-provider.ts:242](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L242)
|
||||
|
||||
___
|
||||
|
||||
@@ -349,7 +306,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:75](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L75)
|
||||
[services/tax-provider.ts:75](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
@@ -369,7 +326,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:475](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L475)
|
||||
[services/tax-provider.ts:475](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L475)
|
||||
|
||||
___
|
||||
|
||||
@@ -377,23 +334,19 @@ ___
|
||||
|
||||
▸ **retrieveProvider**(`region`): `ITaxService`
|
||||
|
||||
Retrieves the relevant tax provider for the given region.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `region` | `Region` | the region to get tax provider for. |
|
||||
| `region` | `Region` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`ITaxService`
|
||||
|
||||
the region specific tax provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:85](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L85)
|
||||
[services/tax-provider.ts:85](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L85)
|
||||
|
||||
___
|
||||
|
||||
@@ -401,25 +354,21 @@ ___
|
||||
|
||||
▸ `Private` **setCache**(`productId`, `regionId`, `value`): `Promise`<`void`\>
|
||||
|
||||
Sets the cache results for a set of ids
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `productId` | `string` | the product id to cache |
|
||||
| `regionId` | `string` | the region id to cache |
|
||||
| `value` | `TaxServiceRate`[] | tax rates to cache |
|
||||
| `productId` | `string` | |
|
||||
| `regionId` | `string` | |
|
||||
| `value` | `TaxServiceRate`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
promise that resolves after the cache has been set
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:434](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L434)
|
||||
[services/tax-provider.ts:434](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L434)
|
||||
|
||||
___
|
||||
|
||||
@@ -439,4 +388,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-provider.ts:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-provider.ts#L62)
|
||||
[services/tax-provider.ts:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-provider.ts#L62)
|
||||
@@ -24,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:27](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L27)
|
||||
[services/tax-rate.ts:27](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L27)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -34,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:21](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L21)
|
||||
[services/tax-rate.ts:21](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
@@ -44,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:22](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L22)
|
||||
[services/tax-rate.ts:22](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
@@ -54,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:23](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L23)
|
||||
[services/tax-rate.ts:23](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
@@ -64,7 +64,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:24](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L24)
|
||||
[services/tax-rate.ts:24](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
@@ -74,7 +74,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:25](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L25)
|
||||
[services/tax-rate.ts:25](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L25)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -96,7 +96,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:197](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L197)
|
||||
[services/tax-rate.ts:197](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L197)
|
||||
|
||||
___
|
||||
|
||||
@@ -118,7 +118,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:233](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L233)
|
||||
[services/tax-rate.ts:233](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L233)
|
||||
|
||||
___
|
||||
|
||||
@@ -140,7 +140,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:273](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L273)
|
||||
[services/tax-rate.ts:273](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L273)
|
||||
|
||||
___
|
||||
|
||||
@@ -160,7 +160,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:104](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L104)
|
||||
[services/tax-rate.ts:104](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
@@ -180,7 +180,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:135](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L135)
|
||||
[services/tax-rate.ts:135](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L135)
|
||||
|
||||
___
|
||||
|
||||
@@ -201,7 +201,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:62](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L62)
|
||||
[services/tax-rate.ts:62](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
@@ -222,7 +222,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:73](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L73)
|
||||
[services/tax-rate.ts:73](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
@@ -243,7 +243,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:321](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L321)
|
||||
[services/tax-rate.ts:321](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L321)
|
||||
|
||||
___
|
||||
|
||||
@@ -263,7 +263,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:332](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L332)
|
||||
[services/tax-rate.ts:332](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L332)
|
||||
|
||||
___
|
||||
|
||||
@@ -284,7 +284,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:143](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L143)
|
||||
[services/tax-rate.ts:143](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
@@ -305,7 +305,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:161](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L161)
|
||||
[services/tax-rate.ts:161](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L161)
|
||||
|
||||
___
|
||||
|
||||
@@ -326,7 +326,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:179](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L179)
|
||||
[services/tax-rate.ts:179](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L179)
|
||||
|
||||
___
|
||||
|
||||
@@ -347,7 +347,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L84)
|
||||
[services/tax-rate.ts:84](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
@@ -368,7 +368,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:120](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L120)
|
||||
[services/tax-rate.ts:120](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L120)
|
||||
|
||||
___
|
||||
|
||||
@@ -388,4 +388,4 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/tax-rate.ts:43](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/tax-rate.ts#L43)
|
||||
[services/tax-rate.ts:43](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/tax-rate.ts#L43)
|
||||
@@ -1,9 +1,5 @@
|
||||
# Class: TotalsService
|
||||
|
||||
A service that calculates total and subtotals for orders, carts etc..
|
||||
|
||||
**`implements`** {BaseService}
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `"medusa-interfaces"`
|
||||
@@ -28,7 +24,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:90](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L90)
|
||||
[services/totals.ts:90](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L90)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -38,7 +34,7 @@ BaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:88](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L88)
|
||||
[services/totals.ts:88](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L88)
|
||||
|
||||
___
|
||||
|
||||
@@ -48,7 +44,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:87](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L87)
|
||||
[services/totals.ts:87](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L87)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -56,27 +52,23 @@ ___
|
||||
|
||||
▸ **calculateDiscount_**(`lineItem`, `variant`, `variantPrice`, `value`, `discountType`): `LineDiscount`
|
||||
|
||||
Calculates either fixed or percentage discount of a variant
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `lineItem` | `LineItem` | id of line item |
|
||||
| `variant` | `string` | id of variant in line item |
|
||||
| `variantPrice` | `number` | price of the variant based on region |
|
||||
| `value` | `number` | discount value |
|
||||
| `discountType` | `DiscountRuleType` | the type of discount (fixed or percentage) |
|
||||
| `lineItem` | `LineItem` | |
|
||||
| `variant` | `string` | |
|
||||
| `variantPrice` | `number` | |
|
||||
| `value` | `number` | |
|
||||
| `discountType` | `DiscountRuleType` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineDiscount`
|
||||
|
||||
triples of lineitem, variant and applied discount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:545](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L545)
|
||||
[services/totals.ts:553](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L553)
|
||||
|
||||
___
|
||||
|
||||
@@ -84,28 +76,20 @@ ___
|
||||
|
||||
▸ **getAllocationItemDiscounts**(`discount`, `cart`): `LineDiscount`[]
|
||||
|
||||
If the rule of a discount has allocation="item", then we need
|
||||
to calculate discount on each item in the cart. Furthermore, we need to
|
||||
make sure to only apply the discount on valid variants. And finally we
|
||||
return ether an array of percentages discounts or fixed discounts
|
||||
alongside the variant on which the discount was applied.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `discount` | `Discount` | the discount to which we do the calculation |
|
||||
| `cart` | `Cart` \| `Order` | the cart to calculate discounts for |
|
||||
| `discount` | `Discount` | |
|
||||
| `cart` | `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineDiscount`[]
|
||||
|
||||
array of triples of lineitem, variant and applied discount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:587](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L587)
|
||||
[services/totals.ts:595](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L595)
|
||||
|
||||
___
|
||||
|
||||
@@ -113,26 +97,20 @@ ___
|
||||
|
||||
▸ **getAllocationMap**(`orderOrCart`, `options?`): `LineAllocationsMap`
|
||||
|
||||
Gets a map of discounts and gift cards that apply to line items in an
|
||||
order. The function calculates the amount of a discount or gift card that
|
||||
applies to a specific line item.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `orderOrCart` | `Cart` \| `Order` | the order or cart to get an allocation map for |
|
||||
| `options` | `AllocationMapOptions` | controls what should be included in allocation map |
|
||||
| `orderOrCart` | `Order` \| `Cart` | |
|
||||
| `options` | `AllocationMapOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineAllocationsMap`
|
||||
|
||||
the allocation map for the line items in the cart or order.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:368](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L368)
|
||||
[services/totals.ts:376](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L376)
|
||||
|
||||
___
|
||||
|
||||
@@ -140,24 +118,20 @@ ___
|
||||
|
||||
▸ **getCalculationContext**(`cartOrOrder`, `options?`): `TaxCalculationContext`
|
||||
|
||||
Prepares the calculation context for a tax total calculation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to get the calculation context for |
|
||||
| `options` | `CalculationContextOptions` | options to gather context by |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `options` | `CalculationContextOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`TaxCalculationContext`
|
||||
|
||||
the tax calculation context
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:891](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L891)
|
||||
[services/totals.ts:959](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L959)
|
||||
|
||||
___
|
||||
|
||||
@@ -165,48 +139,64 @@ ___
|
||||
|
||||
▸ **getDiscountTotal**(`cartOrOrder`): `number`
|
||||
|
||||
Calculates the total discount amount for each of the different supported
|
||||
discount types. If discounts aren't present or invalid returns 0.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to calculate discounts for |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the total discounts amount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:857](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L857)
|
||||
[services/totals.ts:925](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L925)
|
||||
|
||||
___
|
||||
|
||||
### getGiftCardTotal
|
||||
|
||||
▸ **getGiftCardTotal**(`cartOrOrder`): `number`
|
||||
|
||||
Gets the gift card amount on a cart or order.
|
||||
▸ **getGiftCardTotal**(`cartOrOrder`): `Object`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to get gift card amount for |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
`Object`
|
||||
|
||||
the gift card amount applied to the cart or order
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `tax_total` | `number` |
|
||||
| `total` | `number` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:829](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L829)
|
||||
[services/totals.ts:853](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L853)
|
||||
|
||||
___
|
||||
|
||||
### getGiftCardableAmount
|
||||
|
||||
▸ **getGiftCardableAmount**(`cartOrOrder`): `Promise`<`number`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:838](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L838)
|
||||
|
||||
___
|
||||
|
||||
@@ -214,25 +204,20 @@ ___
|
||||
|
||||
▸ **getLineDiscounts**(`cartOrOrder`, `discount`): `LineDiscountAmount`[]
|
||||
|
||||
Returns the discount amount allocated to the line items of an order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to get line discount allocations for |
|
||||
| `discount` | `Discount` | the discount to use as context for the calculation |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `discount` | `Discount` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineDiscountAmount`[]
|
||||
|
||||
the allocations that the discount has on the items in the cart or
|
||||
order
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:638](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L638)
|
||||
[services/totals.ts:646](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L646)
|
||||
|
||||
___
|
||||
|
||||
@@ -244,7 +229,7 @@ ___
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` |
|
||||
| `cartOrOrder` | `Order` \| `Cart` |
|
||||
|
||||
#### Returns
|
||||
|
||||
@@ -252,7 +237,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:615](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L615)
|
||||
[services/totals.ts:623](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L623)
|
||||
|
||||
___
|
||||
|
||||
@@ -273,7 +258,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:600](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L600)
|
||||
[services/totals.ts:608](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L608)
|
||||
|
||||
___
|
||||
|
||||
@@ -281,24 +266,20 @@ ___
|
||||
|
||||
▸ **getLineItemRefund**(`order`, `lineItem`): `number`
|
||||
|
||||
The amount that can be refunded for a given line item.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | order to use as context for the calculation |
|
||||
| `lineItem` | `LineItem` | the line item to calculate the refund amount for. |
|
||||
| `order` | `Order` | |
|
||||
| `lineItem` | `LineItem` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the line item refund amount.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:460](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L460)
|
||||
[services/totals.ts:468](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L468)
|
||||
|
||||
___
|
||||
|
||||
@@ -306,26 +287,21 @@ ___
|
||||
|
||||
▸ **getLineItemTotal**(`lineItem`, `cartOrOrder`, `options?`): `Promise`<`number`\>
|
||||
|
||||
Gets a total for a line item. The total can take gift cards, discounts and
|
||||
taxes into account. This can be controlled through the options.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `lineItem` | `LineItem` | the line item to calculate a total for |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to use as context for the calculation |
|
||||
| `options` | `GetLineItemTotalOptions` | the options to use for the calculation |
|
||||
| `lineItem` | `LineItem` | |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `options` | `GetLineItemTotalOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the line item total
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:799](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L799)
|
||||
[services/totals.ts:807](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L807)
|
||||
|
||||
___
|
||||
|
||||
@@ -333,27 +309,21 @@ ___
|
||||
|
||||
▸ **getLineItemTotals**(`lineItem`, `cartOrOrder`, `options?`): `Promise`<`LineItemTotals`\>
|
||||
|
||||
Breaks down the totals related to a line item; these are the subtotal, the
|
||||
amount of discount applied to the line item, the amount of a gift card
|
||||
applied to a line item and the amount of tax applied to a line item.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `lineItem` | `LineItem` | the line item to calculate totals for |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to use as context for the calculation |
|
||||
| `options` | `LineItemTotalsOptions` | the options to evaluate the line item totals for |
|
||||
| `lineItem` | `LineItem` | |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `options` | `LineItemTotalsOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemTotals`\>
|
||||
|
||||
the breakdown of the line item totals
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:684](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L684)
|
||||
[services/totals.ts:692](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L692)
|
||||
|
||||
___
|
||||
|
||||
@@ -361,23 +331,19 @@ ___
|
||||
|
||||
▸ **getPaidTotal**(`order`): `number`
|
||||
|
||||
Gets the total payments made on an order
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to calculate paid amount for |
|
||||
| `order` | `Order` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the total paid amount
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:125](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L125)
|
||||
[services/totals.ts:129](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L129)
|
||||
|
||||
___
|
||||
|
||||
@@ -385,26 +351,20 @@ ___
|
||||
|
||||
▸ **getRefundTotal**(`order`, `lineItems`): `number`
|
||||
|
||||
Calculates refund total of line items.
|
||||
If any of the items to return have been discounted, we need to
|
||||
apply the discount again before refunding them.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | cart or order to calculate subtotal for |
|
||||
| `lineItems` | `LineItem`[] | the line items to calculate refund total for |
|
||||
| `order` | `Order` | |
|
||||
| `lineItems` | `LineItem`[] | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the calculated subtotal
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:504](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L504)
|
||||
[services/totals.ts:512](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L512)
|
||||
|
||||
___
|
||||
|
||||
@@ -412,23 +372,19 @@ ___
|
||||
|
||||
▸ **getRefundedTotal**(`order`): `number`
|
||||
|
||||
Gets the total refund amount for an order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to get total refund amount for. |
|
||||
| `order` | `Order` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the total refunded amount for an order.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:445](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L445)
|
||||
[services/totals.ts:453](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L453)
|
||||
|
||||
___
|
||||
|
||||
@@ -436,26 +392,21 @@ ___
|
||||
|
||||
▸ **getShippingMethodTotals**(`shippingMethod`, `cartOrOrder`, `opts?`): `Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
Gets the totals breakdown for a shipping method. Fetches tax lines if not
|
||||
already provided.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `shippingMethod` | `ShippingMethod` | the shipping method to get totals breakdown for. |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | the cart or order to use as context for the breakdown |
|
||||
| `opts` | `GetShippingMethodTotalsOptions` | options for what should be included |
|
||||
| `shippingMethod` | `ShippingMethod` | |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `opts` | `GetShippingMethodTotalsOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
An object that breaks down the totals for the shipping method
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:159](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L159)
|
||||
[services/totals.ts:163](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L163)
|
||||
|
||||
___
|
||||
|
||||
@@ -463,23 +414,19 @@ ___
|
||||
|
||||
▸ **getShippingTotal**(`cartOrOrder`): `number`
|
||||
|
||||
Calculates shipping total
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | cart or order to calculate subtotal for |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
shipping total
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:267](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L267)
|
||||
[services/totals.ts:271](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L271)
|
||||
|
||||
___
|
||||
|
||||
@@ -487,24 +434,20 @@ ___
|
||||
|
||||
▸ **getSubtotal**(`cartOrOrder`, `opts?`): `number`
|
||||
|
||||
Calculates subtotal of a given cart or order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | cart or order to calculate subtotal for |
|
||||
| `opts` | `SubtotalOptions` | options |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `opts` | `SubtotalOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the calculated subtotal
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:243](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L243)
|
||||
[services/totals.ts:247](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L247)
|
||||
|
||||
___
|
||||
|
||||
@@ -512,24 +455,19 @@ ___
|
||||
|
||||
▸ **getSwapTotal**(`order`): `number`
|
||||
|
||||
The total paid for swaps. May be negative in case of negative swap
|
||||
difference.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `order` | `Order` | the order to calculate swap total for |
|
||||
| `order` | `Order` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the swap total
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:140](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L140)
|
||||
[services/totals.ts:144](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L144)
|
||||
|
||||
___
|
||||
|
||||
@@ -537,25 +475,20 @@ ___
|
||||
|
||||
▸ **getTaxTotal**(`cartOrOrder`, `forceTaxes?`): `Promise`<``null`` \| `number`\>
|
||||
|
||||
Calculates tax total
|
||||
Currently based on the Danish tax system
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | `undefined` | cart or order to calculate tax total for |
|
||||
| `forceTaxes` | `boolean` | `false` | whether taxes should be calculated regardless of region settings |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | `undefined` | |
|
||||
| `forceTaxes` | `boolean` | `false` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<``null`` \| `number`\>
|
||||
|
||||
tax total
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:282](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L282)
|
||||
[services/totals.ts:286](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L286)
|
||||
|
||||
___
|
||||
|
||||
@@ -563,24 +496,20 @@ ___
|
||||
|
||||
▸ **getTotal**(`cartOrOrder`, `options?`): `Promise`<`number`\>
|
||||
|
||||
Calculates subtotal of a given cart or order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `cartOrOrder` | `Cart` \| `Order` | object to calculate total for |
|
||||
| `options` | `GetTotalsOptions` | options to calculate by |
|
||||
| `cartOrOrder` | `Order` \| `Cart` | |
|
||||
| `options` | `GetTotalsOptions` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
the calculated subtotal
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:106](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L106)
|
||||
[services/totals.ts:106](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L106)
|
||||
|
||||
___
|
||||
|
||||
@@ -588,20 +517,16 @@ ___
|
||||
|
||||
▸ **rounded**(`value`): `number`
|
||||
|
||||
Rounds a number using Math.round.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `value` | `number` | the value to round |
|
||||
| `value` | `number` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
the rounded value
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/totals.ts:921](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/totals.ts#L921)
|
||||
[services/totals.ts:989](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/totals.ts#L989)
|
||||
@@ -1,7 +1,5 @@
|
||||
# Class: UserService
|
||||
|
||||
Provides layer to manipulate users.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`<[`UserService`](UserService.md)\>
|
||||
@@ -26,7 +24,7 @@ TransactionBaseService<UserService\>.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:37](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L37)
|
||||
[services/user.ts:37](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L37)
|
||||
|
||||
## Properties
|
||||
|
||||
@@ -56,7 +54,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:35](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L35)
|
||||
[services/user.ts:35](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
@@ -70,7 +68,7 @@ TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:32](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L32)
|
||||
[services/user.ts:32](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
@@ -84,7 +82,7 @@ TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:33](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L33)
|
||||
[services/user.ts:33](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
@@ -94,7 +92,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L34)
|
||||
[services/user.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -110,7 +108,7 @@ ___
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:28](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L28)
|
||||
[services/user.ts:28](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L28)
|
||||
|
||||
## Methods
|
||||
|
||||
@@ -118,10 +116,6 @@ ___
|
||||
|
||||
▸ `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.
|
||||
|
||||
#### Type parameters
|
||||
|
||||
| Name |
|
||||
@@ -133,23 +127,21 @@ transaction manager is created.
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | the transactional work to be done |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | the isolation level to be used for the work. |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | Potential error handler |
|
||||
| `work` | (`transactionManager`: `EntityManager`) => `Promise`<`TResult`\> | |
|
||||
| `isolationOrErrorHandler?` | `IsolationLevel` \| (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
| `maybeErrorHandlerOrDontFail?` | (`error`: `TError`) => `Promise`<`void` \| `TResult`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
[interfaces/transaction-base-service.ts:53](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
@@ -157,25 +149,20 @@ ___
|
||||
|
||||
▸ **create**(`user`, `password`): `Promise`<`User`\>
|
||||
|
||||
Creates a user with username being validated.
|
||||
Fails if email is not a valid format.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `user` | `CreateUserInput` | the user to create |
|
||||
| `password` | `string` | user's password to hash |
|
||||
| `user` | `CreateUserInput` | |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the result of create
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:183](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L183)
|
||||
[services/user.ts:183](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L183)
|
||||
|
||||
___
|
||||
|
||||
@@ -183,23 +170,19 @@ ___
|
||||
|
||||
▸ **delete**(`userId`): `Promise`<`void`\>
|
||||
|
||||
Deletes a user from a given user id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userId` | `string` | the id of the user to delete. Must be castable as an ObjectId |
|
||||
| `userId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
the result of the delete operation.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:251](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L251)
|
||||
[services/user.ts:251](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L251)
|
||||
|
||||
___
|
||||
|
||||
@@ -207,27 +190,19 @@ ___
|
||||
|
||||
▸ **generateResetPasswordToken**(`userId`): `Promise`<`string`\>
|
||||
|
||||
Generate a JSON Web token, that will be sent to a user, that wishes to
|
||||
reset password.
|
||||
The token will be signed with the users 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
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userId` | `string` | the id of the user to reset password for |
|
||||
| `userId` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
the generated JSON web token
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:305](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L305)
|
||||
[services/user.ts:305](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L305)
|
||||
|
||||
___
|
||||
|
||||
@@ -235,23 +210,19 @@ ___
|
||||
|
||||
▸ **hashPassword_**(`password`): `Promise`<`string`\>
|
||||
|
||||
Hashes a password
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `password` | `string` | the value to hash |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
hashed password
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:171](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L171)
|
||||
[services/user.ts:171](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L171)
|
||||
|
||||
___
|
||||
|
||||
@@ -263,18 +234,16 @@ ___
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `selector` | `FilterableUserProps` | the query object for find |
|
||||
| `config` | `Object` | the configuration object for the query |
|
||||
| `selector` | `FilterableUserProps` | |
|
||||
| `config` | `Object` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`[]\>
|
||||
|
||||
the result of the find operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:68](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L68)
|
||||
[services/user.ts:68](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
@@ -282,25 +251,20 @@ ___
|
||||
|
||||
▸ **retrieve**(`userId`, `config?`): `Promise`<`User`\>
|
||||
|
||||
Gets a user by id.
|
||||
Throws in case of DB Error and if user was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userId` | `string` | the id of the user to get. |
|
||||
| `config` | `FindConfig`<`User`\> | query configs |
|
||||
| `userId` | `string` | |
|
||||
| `config` | `FindConfig`<`User`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the user document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:84](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L84)
|
||||
[services/user.ts:84](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
@@ -308,25 +272,20 @@ ___
|
||||
|
||||
▸ **retrieveByApiToken**(`apiToken`, `relations?`): `Promise`<`User`\>
|
||||
|
||||
Gets a user by api token.
|
||||
Throws in case of DB Error and if user was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| :------ | :------ | :------ | :------ |
|
||||
| `apiToken` | `string` | `undefined` | the token of the user to get. |
|
||||
| `relations` | `string`[] | `[]` | relations to include with the user |
|
||||
| `apiToken` | `string` | `undefined` | |
|
||||
| `relations` | `string`[] | `[]` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the user document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:111](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L111)
|
||||
[services/user.ts:111](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
@@ -334,25 +293,20 @@ ___
|
||||
|
||||
▸ **retrieveByEmail**(`email`, `config?`): `Promise`<`User`\>
|
||||
|
||||
Gets a user by email.
|
||||
Throws in case of DB Error and if user was not found.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `email` | `string` | the email of the user to get. |
|
||||
| `config` | `FindConfig`<`User`\> | query config |
|
||||
| `email` | `string` | |
|
||||
| `config` | `FindConfig`<`User`\> | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the user document.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:143](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L143)
|
||||
[services/user.ts:143](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
@@ -360,26 +314,20 @@ ___
|
||||
|
||||
▸ **setPassword_**(`userId`, `password`): `Promise`<`User`\>
|
||||
|
||||
Sets a password for a user
|
||||
Fails if no user exists with userId and if the hashing of the new
|
||||
password does not work.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userId` | `string` | the userId to set password for |
|
||||
| `password` | `string` | the old password to set |
|
||||
| `userId` | `string` | |
|
||||
| `password` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:276](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L276)
|
||||
[services/user.ts:276](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L276)
|
||||
|
||||
___
|
||||
|
||||
@@ -403,7 +351,7 @@ TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
[interfaces/transaction-base-service.ts:34](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
@@ -411,24 +359,20 @@ ___
|
||||
|
||||
▸ **update**(`userId`, `update`): `Promise`<`User`\>
|
||||
|
||||
Updates a user.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `userId` | `string` | id of the user to update |
|
||||
| `update` | `UpdateUserInput` | the values to be updated on the user |
|
||||
| `userId` | `string` | |
|
||||
| `update` | `UpdateUserInput` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`User`\>
|
||||
|
||||
the result of create
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:211](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L211)
|
||||
[services/user.ts:211](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L211)
|
||||
|
||||
___
|
||||
|
||||
@@ -436,23 +380,19 @@ ___
|
||||
|
||||
▸ **validateEmail_**(`email`): `string`
|
||||
|
||||
Used to validate user email.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
| :------ | :------ | :------ |
|
||||
| `email` | `string` | email to validate |
|
||||
| `email` | `string` | |
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
the validated email
|
||||
|
||||
#### Defined in
|
||||
|
||||
[services/user.ts:50](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/services/user.ts#L50)
|
||||
[services/user.ts:50](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/services/user.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
@@ -476,4 +416,4 @@ TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/ae5c88b89/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
[interfaces/transaction-base-service.ts:16](https://github.com/medusajs/medusa/blob/32b066d92/packages/medusa/src/interfaces/transaction-base-service.ts#L16)
|
||||
@@ -34,6 +34,7 @@
|
||||
- [RegionService](classes/RegionService.md)
|
||||
- [ReturnReasonService](classes/ReturnReasonService.md)
|
||||
- [ReturnService](classes/ReturnService.md)
|
||||
- [SalesChannelService](classes/SalesChannelService.md)
|
||||
- [SearchService](classes/SearchService.md)
|
||||
- [ShippingOptionService](classes/ShippingOptionService.md)
|
||||
- [ShippingProfileService](classes/ShippingProfileService.md)
|
||||
|
||||
@@ -18,3 +18,4 @@
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.yarn
|
||||
@@ -6,9 +6,9 @@
|
||||
"docusaurus": "docusaurus",
|
||||
"clean-node-modules": "rm -rf ../../node_modules",
|
||||
"prestart": "yarn clean-node-modules",
|
||||
"start": "docusaurus clear && docusaurus start",
|
||||
"start": "yarn prestart && docusaurus clear && docusaurus start",
|
||||
"prebuild": "yarn clean-node-modules",
|
||||
"build": "docusaurus build",
|
||||
"build": "yarn prestart && docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
|
||||
+11765
-8252
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user