chore(docs): Generated References (#5602)
Generated the following references: - `pricing` - `product` Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com> Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
2110 files changed
+148777
-4448445
No files matched your search
@@ -0,0 +1,557 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractBatchJobStrategy
|
||||
|
||||
## Implements
|
||||
|
||||
- [`IBatchJobStrategy`](../interfaces/IBatchJobStrategy.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
`Protected` **new AbstractBatchJobStrategy**(`__container__`, `__configModule__?`, `__moduleDeclaration__?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "batchJobService_",
|
||||
"type": "[`BatchJobService`](BatchJobService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "batchType",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "identifier",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### buildTemplate
|
||||
|
||||
`Abstract` **buildTemplate**(): `Promise`<`string`\>
|
||||
|
||||
Builds and returns a template file that can be downloaded and filled in
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`string`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### handleProcessingError
|
||||
|
||||
`Protected` **handleProcessingError**<`T`\>(`batchJobId`, `err`, `result`): `Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "err",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "result",
|
||||
"type": "`T`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### preProcessBatchJob
|
||||
|
||||
**preProcessBatchJob**(`batchJobId`): `Promise`<`void`\>
|
||||
|
||||
Method for pre-processing a batch job
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### prepareBatchJobForProcessing
|
||||
|
||||
**prepareBatchJobForProcessing**(`batchJob`, `req`): `Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
|
||||
|
||||
Method for preparing a batch job for processing
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJob",
|
||||
"type": "[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "req",
|
||||
"type": "`Request`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### processJob
|
||||
|
||||
`Abstract` **processJob**(`batchJobId`): `Promise`<`void`\>
|
||||
|
||||
Method does the actual processing of the job. Should report back on the progress of the operation.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryOnProcessingError
|
||||
|
||||
`Protected` **shouldRetryOnProcessingError**(`batchJob`, `err`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJob",
|
||||
"type": "[`BatchJob`](BatchJob.mdx)",
|
||||
"description": "A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "err",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`boolean`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AbstractBatchJobStrategy`](AbstractBatchJobStrategy.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbstractBatchJobStrategy`](AbstractBatchJobStrategy.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AbstractBatchJobStrategy",
|
||||
"type": "[`AbstractBatchJobStrategy`](AbstractBatchJobStrategy.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,334 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractEventBusModuleService
|
||||
|
||||
## Implements
|
||||
|
||||
- [`IEventBusModuleService`](../interfaces/IEventBusModuleService.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AbstractEventBusModuleService**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "eventToSubscribersMap_",
|
||||
"type": "`Map`<`string` \\| `symbol`, [`SubscriberDescriptor`](../types/SubscriberDescriptor.mdx)[]\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### eventToSubscribersMap
|
||||
|
||||
`get` **eventToSubscribersMap**(): `Map`<`string` \| `symbol`, [`SubscriberDescriptor`](../types/SubscriberDescriptor.mdx)[]\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Map`<`string` \| `symbol`, [`SubscriberDescriptor`](../types/SubscriberDescriptor.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Map",
|
||||
"type": "`Map`<`string` \\| `symbol`, [`SubscriberDescriptor`](../types/SubscriberDescriptor.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### emit
|
||||
|
||||
`Abstract` **emit**<`T`\>(`eventName`, `data`, `options`): `Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "eventName",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`T`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
`Abstract` **emit**<`T`\>(`data`): `Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`EmitData`](../types/EmitData.mdx)<`T`\\>[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### storeSubscribers
|
||||
|
||||
`Protected` **storeSubscribers**(`«destructured»`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__namedParameters.event",
|
||||
"type": "`string` \\| `symbol`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__namedParameters.subscriber",
|
||||
"type": "[`Subscriber`](../types/Subscriber.mdx)<`unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__namedParameters.subscriberId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### subscribe
|
||||
|
||||
**subscribe**(`eventName`, `subscriber`, `context?`): [`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "eventName",
|
||||
"type": "`string` \\| `symbol`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subscriber",
|
||||
"type": "[`Subscriber`](../types/Subscriber.mdx)<`unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`SubscriberContext`](../types/SubscriberContext.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AbstractEventBusModuleService",
|
||||
"type": "[`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### unsubscribe
|
||||
|
||||
**unsubscribe**(`eventName`, `subscriber`, `context`): [`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "eventName",
|
||||
"type": "`string` \\| `symbol`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subscriber",
|
||||
"type": "[`Subscriber`](../types/Subscriber.mdx)<`unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`SubscriberContext`](../types/SubscriberContext.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AbstractEventBusModuleService",
|
||||
"type": "[`AbstractEventBusModuleService`](AbstractEventBusModuleService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,411 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractNotificationService
|
||||
|
||||
## Implements
|
||||
|
||||
- [`INotificationService`](../interfaces/INotificationService.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
`Protected` **new AbstractNotificationService**(`__container__`, `__configModule__?`, `__moduleDeclaration__?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "identifier",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getIdentifier
|
||||
|
||||
**getIdentifier**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "string",
|
||||
"type": "`string`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### resendNotification
|
||||
|
||||
`Abstract` **resendNotification**(`notification`, `config`, `attachmentGenerator`): `Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "notification",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "attachmentGenerator",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### sendNotification
|
||||
|
||||
`Abstract` **sendNotification**(`event`, `data`, `attachmentGenerator`): `Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "event",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "attachmentGenerator",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ReturnedData`](../types/ReturnedData.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AbstractNotificationService`](AbstractNotificationService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbstractNotificationService`](AbstractNotificationService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AbstractNotificationService",
|
||||
"type": "[`AbstractNotificationService`](AbstractNotificationService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,505 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractPaymentProcessor
|
||||
|
||||
Payment processor in charge of creating , managing and processing a payment
|
||||
|
||||
## Implements
|
||||
|
||||
- [`PaymentProcessor`](../interfaces/PaymentProcessor.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
`Protected` **new AbstractPaymentProcessor**(`container`, `config?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "container",
|
||||
"type": "[`MedusaContainer`](../types/MedusaContainer-1.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "config",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "container",
|
||||
"type": "[`MedusaContainer`](../types/MedusaContainer-1.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "identifier",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### authorizePayment
|
||||
|
||||
`Abstract` **authorizePayment**(`paymentSessionData`, `context`): `Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| { `data`: Record<`string`, `unknown`\> ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\>
|
||||
|
||||
Authorize an existing session if it is not already authorized
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| { `data`: Record<`string`, `unknown`\> ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \\| { `data`: Record<`string`, `unknown`\\> ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancelPayment
|
||||
|
||||
`Abstract` **cancelPayment**(`paymentSessionData`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Cancel an existing session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### capturePayment
|
||||
|
||||
`Abstract` **capturePayment**(`paymentSessionData`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Capture an existing session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### deletePayment
|
||||
|
||||
`Abstract` **deletePayment**(`paymentSessionData`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Delete an existing session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getIdentifier
|
||||
|
||||
**getIdentifier**(): `string`
|
||||
|
||||
Return a unique identifier to retrieve the payment plugin provider
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "string",
|
||||
"type": "`string`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getPaymentStatus
|
||||
|
||||
`Abstract` **getPaymentStatus**(`paymentSessionData`): `Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\>
|
||||
|
||||
Return the status of the session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### initiatePayment
|
||||
|
||||
`Abstract` **initiatePayment**(`context`): `Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\>
|
||||
|
||||
Initiate a payment session with the external provider
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`PaymentProcessorContext`](../types/PaymentProcessorContext.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \\| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### refundPayment
|
||||
|
||||
`Abstract` **refundPayment**(`paymentSessionData`, `refundAmount`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Refund an existing session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refundAmount",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrievePayment
|
||||
|
||||
`Abstract` **retrievePayment**(`paymentSessionData`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Retrieve an existing session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### updatePayment
|
||||
|
||||
`Abstract` **updatePayment**(`context`): `Promise`<`void` \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\>
|
||||
|
||||
Update an existing payment session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`PaymentProcessorContext`](../types/PaymentProcessorContext.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void` \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx) \\| [`PaymentProcessorSessionResponse`](../types/PaymentProcessorSessionResponse.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### updatePaymentData
|
||||
|
||||
`Abstract` **updatePaymentData**(`sessionId`, `data`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
Update the session data for a payment session
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "sessionId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentProcessorError`](../interfaces/PaymentProcessorError.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,897 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractPaymentService
|
||||
|
||||
This will be
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future use the AbstractPaymentProcessor instead
|
||||
|
||||
## Implements
|
||||
|
||||
- [`"medusa-interfaces"`](../modules/medusa_interfaces_.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
`Protected` **new AbstractPaymentService**(`container`, `config?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "container",
|
||||
"type": "`unknown`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "identifier",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### authorizePayment
|
||||
|
||||
`Abstract` **authorizePayment**(`paymentSession`, `context`): `Promise`<{ `data`: [`Data`](../types/Data.mdx) ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSession",
|
||||
"type": "[`PaymentSession`](PaymentSession.mdx)",
|
||||
"description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `data`: [`Data`](../types/Data.mdx) ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<{ `data`: [`Data`](../types/Data.mdx) ; `status`: [`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx) }\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
___
|
||||
|
||||
### cancelPayment
|
||||
|
||||
`Abstract` **cancelPayment**(`payment`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "payment",
|
||||
"type": "[`Payment`](Payment.mdx)",
|
||||
"description": "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### capturePayment
|
||||
|
||||
`Abstract` **capturePayment**(`payment`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "payment",
|
||||
"type": "[`Payment`](Payment.mdx)",
|
||||
"description": "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### createPayment
|
||||
|
||||
`Abstract` **createPayment**(`context`): `Promise`<[`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`Cart`](Cart.mdx) & [`PaymentContext`](../types/PaymentContext.mdx)",
|
||||
"description": "The type of this argument is meant to be temporary and once the previous method signature will be removed, the type will only be PaymentContext instead of Cart & PaymentContext",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
`Abstract` **createPayment**(`cart`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future use `createPayment(context: Cart & PaymentContext): Promise<PaymentSessionResponse>` instead
|
||||
|
||||
___
|
||||
|
||||
### deletePayment
|
||||
|
||||
`Abstract` **deletePayment**(`paymentSession`): `Promise`<`void`\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSession",
|
||||
"type": "[`PaymentSession`](PaymentSession.mdx)",
|
||||
"description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### getIdentifier
|
||||
|
||||
**getIdentifier**(): `string`
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "string",
|
||||
"type": "`string`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getPaymentData
|
||||
|
||||
`Abstract` **getPaymentData**(`paymentSession`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSession",
|
||||
"type": "[`PaymentSession`](PaymentSession.mdx)",
|
||||
"description": "A Payment Session is created when a Customer initilizes the checkout flow, and can be used to hold the state of a payment flow. Each Payment Session is controlled by a Payment Provider, which is responsible for the communication with external payment services. Authorized Payment Sessions will eventually get promoted to Payments to indicate that they are authorized for payment processing such as capture or refund. Payment sessions can also be used as part of payment collections.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
___
|
||||
|
||||
### getStatus
|
||||
|
||||
`Abstract` **getStatus**(`data`): `Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`PaymentSessionStatus`](../enums/PaymentSessionStatus.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### refundPayment
|
||||
|
||||
`Abstract` **refundPayment**(`payment`, `refundAmount`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "payment",
|
||||
"type": "[`Payment`](Payment.mdx)",
|
||||
"description": "A payment is originally created from a payment session. Once a payment session is authorized, the payment is created to represent the authorized amount with a given payment method. Payments can be captured, canceled or refunded. Payments can be made towards orders, swaps, order edits, or other resources.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refundAmount",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### retrievePayment
|
||||
|
||||
`Abstract` **retrievePayment**(`paymentData`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentData",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
___
|
||||
|
||||
### retrieveSavedMethods
|
||||
|
||||
**retrieveSavedMethods**(`customer`): `Promise`<[`Data`](../types/Data.mdx)[]\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "customer",
|
||||
"type": "[`Customer`](Customer.mdx)",
|
||||
"description": "A customer can make purchases in your store and manage their profile.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### updatePayment
|
||||
|
||||
`Abstract` **updatePayment**(`paymentSessionData`, `context`): `Promise`<Record<`string`, `unknown`\> \| [`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`Cart`](Cart.mdx) & [`PaymentContext`](../types/PaymentContext.mdx)",
|
||||
"description": "The type of this argument is meant to be temporary and once the previous method signature will be removed, the type will only be PaymentContext instead of Cart & PaymentContext",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\> \| [`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\> \\| [`PaymentSessionResponse`](../types/PaymentSessionResponse.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "it return either a PaymentSessionResponse or PaymentSessionResponse[\"session_data\"] to maintain backward compatibility",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
`Abstract` **updatePayment**(`paymentSessionData`, `cart`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
This will be
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
in the near future use `updatePayment(paymentSessionData: PaymentSessionData, context: Cart & PaymentContext): Promise<PaymentSessionResponse>` instead
|
||||
|
||||
___
|
||||
|
||||
### updatePaymentData
|
||||
|
||||
`Abstract` **updatePaymentData**(`paymentSessionData`, `data`): `Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "paymentSessionData",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Data`](../types/Data.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Data`](../types/Data.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Data`](../types/Data.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Deprecated
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AbstractPaymentService`](AbstractPaymentService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AbstractPaymentService`](AbstractPaymentService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AbstractPaymentService",
|
||||
"type": "[`AbstractPaymentService`](AbstractPaymentService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,470 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AbstractSearchService
|
||||
|
||||
## Implements
|
||||
|
||||
- [`ISearchService`](../interfaces/ISearchService.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
`Protected` **new AbstractSearchService**(`container`, `options`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "container",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "isDefault",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options_",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### options
|
||||
|
||||
`get` **options**(): Record<`string`, `unknown`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
Record<`string`, `unknown`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Record",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### addDocuments
|
||||
|
||||
`Abstract` **addDocuments**(`indexName`, `documents`, `type`): `unknown`
|
||||
|
||||
Used to index documents by the search engine provider
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "documents",
|
||||
"type": "`unknown`",
|
||||
"description": "documents array to be indexed",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "`string`",
|
||||
"description": "of documents to be added (e.g: products, regions, orders, etc)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createIndex
|
||||
|
||||
`Abstract` **createIndex**(`indexName`, `options`): `unknown`
|
||||
|
||||
Used to create an index
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "`unknown`",
|
||||
"description": "the options",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### deleteAllDocuments
|
||||
|
||||
`Abstract` **deleteAllDocuments**(`indexName`): `unknown`
|
||||
|
||||
Used to delete all documents
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### deleteDocument
|
||||
|
||||
`Abstract` **deleteDocument**(`indexName`, `document_id`): `unknown`
|
||||
|
||||
Used to delete document
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "document_id",
|
||||
"type": "`string` \\| `number`",
|
||||
"description": "the id of the document",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getIndex
|
||||
|
||||
`Abstract` **getIndex**(`indexName`): `unknown`
|
||||
|
||||
Used to get an index
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### replaceDocuments
|
||||
|
||||
`Abstract` **replaceDocuments**(`indexName`, `documents`, `type`): `unknown`
|
||||
|
||||
Used to replace documents
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "documents",
|
||||
"type": "`unknown`",
|
||||
"description": "array of document objects that will replace existing documents",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "`string`",
|
||||
"description": "type of documents to be replaced (e.g: products, regions, orders, etc)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### search
|
||||
|
||||
`Abstract` **search**(`indexName`, `query`, `options`): `unknown`
|
||||
|
||||
Used to search for a document in an index
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "query",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "the search query",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "`unknown`",
|
||||
"description": "any options passed to the request object other than the query and indexName - additionalOptions contain any provider specific options",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### updateSettings
|
||||
|
||||
`Abstract` **updateSettings**(`indexName`, `settings`): `unknown`
|
||||
|
||||
Used to update the settings of an index
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "indexName",
|
||||
"type": "`string`",
|
||||
"description": "the index name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "settings",
|
||||
"type": "`unknown`",
|
||||
"description": "settings object",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`unknown`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "unknown",
|
||||
"type": "`unknown`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "returns response from search engine provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,206 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Address
|
||||
|
||||
An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Address**()
|
||||
|
||||
An address is used across the Medusa backend within other schemas and object types. For example, a customer's billing and shipping addresses both use the Address entity.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "address_1",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Address line 1",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_2",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Address line 2",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "City",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "company",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Company name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "country",
|
||||
"type": "``null`` \\| [`Country`](Country.mdx)",
|
||||
"description": "A country object.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "country_code",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The 2 character ISO code of the country in lower case",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer",
|
||||
"type": "``null`` \\| [`Customer`](Customer.mdx)",
|
||||
"description": "Available if the relation `customer` is expanded.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "ID of the customer this address belongs to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "first_name",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "First name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "ID of the address",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "last_name",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Last name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Phone Number",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "postal_code",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Postal Code",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Province",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AddressCreatePayload
|
||||
|
||||
Address fields used when creating an address.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AddressCreatePayload**()
|
||||
|
||||
Address fields used when creating an address.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "address_1",
|
||||
"type": "`string`",
|
||||
"description": "Address line 1",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_2",
|
||||
"type": "`string`",
|
||||
"description": "Address line 2",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "`string`",
|
||||
"description": "City",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "company",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "country_code",
|
||||
"type": "`string`",
|
||||
"description": "The 2 character ISO code of the country in lower case",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "first_name",
|
||||
"type": "`string`",
|
||||
"description": "First name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "last_name",
|
||||
"type": "`string`",
|
||||
"description": "Last name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`object`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"type": "`string`",
|
||||
"description": "Phone Number",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "postal_code",
|
||||
"type": "`string`",
|
||||
"description": "Postal Code",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "`string`",
|
||||
"description": "Province",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AddressPayload
|
||||
|
||||
Address fields used when creating/updating an address.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AddressPayload**()
|
||||
|
||||
Address fields used when creating/updating an address.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "address_1",
|
||||
"type": "`string`",
|
||||
"description": "Address line 1",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "address_2",
|
||||
"type": "`string`",
|
||||
"description": "Address line 2",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "city",
|
||||
"type": "`string`",
|
||||
"description": "City",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "company",
|
||||
"type": "`string`",
|
||||
"description": "Company",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "country_code",
|
||||
"type": "`string`",
|
||||
"description": "The 2 character ISO code of the country in lower case",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "first_name",
|
||||
"type": "`string`",
|
||||
"description": "First name",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "last_name",
|
||||
"type": "`string`",
|
||||
"description": "Last name",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"type": "`string`",
|
||||
"description": "Phone Number",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "postal_code",
|
||||
"type": "`string`",
|
||||
"description": "Postal Code",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "province",
|
||||
"type": "`string`",
|
||||
"description": "Province",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AdminGetDiscountsDiscountRuleParams
|
||||
|
||||
Filters to apply on discounts' rules.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AdminGetDiscountsDiscountRuleParams**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "allocation",
|
||||
"type": "[`AllocationType`](../enums/AllocationType.mdx)",
|
||||
"description": "Allocation to filter discount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`DiscountRuleType`](../enums/DiscountRuleType.mdx)",
|
||||
"description": "Type to filter discount rules by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AdminPriceListPricesCreateReq
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AdminPriceListPricesCreateReq**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,81 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AdminPriceListPricesUpdateReq
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AdminPriceListPricesUpdateReq**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "`number`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,105 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AnalyticsConfig
|
||||
|
||||
Base abstract entity for all entities
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AnalyticsConfig**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "anonymize",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "opt_out",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "user_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,325 +0,0 @@
|
||||
# AnalyticsConfigService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`AnalyticsConfigService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AnalyticsConfigService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:21](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L21)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### analyticsConfigRepository\_
|
||||
|
||||
`Protected` `Readonly` **analyticsConfigRepository\_**: `Repository`<`AnalyticsConfig`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:18](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### userService\_
|
||||
|
||||
`Protected` `Readonly` **userService\_**: [`UserService`](UserService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:19](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L19)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`userId`, `data`): `Promise`<`AnalyticsConfig`\>
|
||||
|
||||
Creates an analytics config.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `userId` | `string` |
|
||||
| `data` | `CreateAnalyticsConfig` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AnalyticsConfig`\>
|
||||
|
||||
-`Promise`:
|
||||
-`AnalyticsConfig`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:50](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`userId`): `Promise`<`void`\>
|
||||
|
||||
Deletes an analytics config.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `userId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:94](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L94)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`userId`): `Promise`<`AnalyticsConfig`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `userId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AnalyticsConfig`\>
|
||||
|
||||
-`Promise`:
|
||||
-`AnalyticsConfig`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:28](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`userId`, `update`): `Promise`<`AnalyticsConfig`\>
|
||||
|
||||
Updates an analytics config. If the config does not exist, it will be created instead.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `userId` | `string` |
|
||||
| `update` | `UpdateAnalyticsConfig` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AnalyticsConfig`\>
|
||||
|
||||
-`Promise`:
|
||||
-`AnalyticsConfig`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/analytics-config.ts:65](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/analytics-config.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AnalyticsConfigService`](AnalyticsConfigService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AnalyticsConfigService`](AnalyticsConfigService.md)
|
||||
|
||||
-`AnalyticsConfigService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,436 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AnalyticsConfigService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AnalyticsConfigService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "analyticsConfigRepository_",
|
||||
"type": "`Repository`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "userService_",
|
||||
"type": "[`UserService`](UserService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`userId`, `data`): `Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
Creates an analytics config.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "userId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateAnalyticsConfig`](../types/CreateAnalyticsConfig.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`userId`): `Promise`<`void`\>
|
||||
|
||||
Deletes an analytics config.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "userId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`userId`): `Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "userId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`userId`, `update`): `Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
Updates an analytics config. If the config does not exist, it will be created instead.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "userId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"type": "[`UpdateAnalyticsConfig`](../types/UpdateAnalyticsConfig.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AnalyticsConfig`](AnalyticsConfig.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AnalyticsConfigService`](AnalyticsConfigService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AnalyticsConfigService`](AnalyticsConfigService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AnalyticsConfigService",
|
||||
"type": "[`AnalyticsConfigService`](AnalyticsConfigService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,336 +0,0 @@
|
||||
# AuthService
|
||||
|
||||
Can authenticate a user based on email password combination
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`AuthService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AuthService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:22](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L22)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### customerService\_
|
||||
|
||||
`Protected` `Readonly` **customerService\_**: [`CustomerService`](CustomerService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### userService\_
|
||||
|
||||
`Protected` `Readonly` **userService\_**: [`UserService`](UserService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:19](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L19)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### authenticate
|
||||
|
||||
**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 | Description |
|
||||
| :------ | :------ |
|
||||
| `email` | `string` | the email of the user |
|
||||
| `password` | `string` | the password of the user |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
-`Promise`: success: whether authentication succeeded
|
||||
user: the user document if authentication succeeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:81](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
### authenticateAPIToken
|
||||
|
||||
**authenticateAPIToken**(`token`): `Promise`<`AuthenticateResult`\>
|
||||
|
||||
Authenticates a given user with an API token
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `token` | `string` | the api_token of the user to authenticate |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
-`Promise`: success: whether authentication succeeded
|
||||
user: the user document if authentication succeeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:52](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### authenticateCustomer
|
||||
|
||||
**authenticateCustomer**(`email`, `password`): `Promise`<`AuthenticateResult`\>
|
||||
|
||||
Authenticates a customer based on an email, password combination. Uses
|
||||
scrypt to match password with hashed value.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `email` | `string` | the email of the user |
|
||||
| `password` | `string` | the password of the user |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`AuthenticateResult`\>
|
||||
|
||||
-`Promise`: success: whether authentication succeeded
|
||||
customer: the customer document if authentication succeded
|
||||
error: a string with the error message
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:130](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L130)
|
||||
|
||||
___
|
||||
|
||||
### comparePassword\_
|
||||
|
||||
`Protected` **comparePassword_**(`password`, `hash`): `Promise`<`boolean`\>
|
||||
|
||||
Verifies if a password is valid given the provided password hash
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `password` | `string` | the raw password to check |
|
||||
| `hash` | `string` | the hash to compare against |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`: the result of the comparison
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/auth.ts:36](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/auth.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AuthService`](AuthService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AuthService`](AuthService.md)
|
||||
|
||||
-`AuthService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,451 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# AuthService
|
||||
|
||||
Can authenticate a user based on email password combination
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new AuthService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-1.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customerService_",
|
||||
"type": "[`CustomerService`](CustomerService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "userService_",
|
||||
"type": "[`UserService`](UserService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### authenticate
|
||||
|
||||
**authenticate**(`email`, `password`): `Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
Authenticates a given user based on an email, password combination. Uses
|
||||
scrypt to match password with hashed value.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "email",
|
||||
"type": "`string`",
|
||||
"description": "the email of the user",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "`string`",
|
||||
"description": "the password of the user",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "success: whether authentication succeeded\n user: the user document if authentication succeeded\n error: a string with the error message",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### authenticateAPIToken
|
||||
|
||||
**authenticateAPIToken**(`token`): `Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
Authenticates a given user with an API token
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "token",
|
||||
"type": "`string`",
|
||||
"description": "the api_token of the user to authenticate",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "success: whether authentication succeeded\n user: the user document if authentication succeeded\n error: a string with the error message",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### authenticateCustomer
|
||||
|
||||
**authenticateCustomer**(`email`, `password`): `Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
Authenticates a customer based on an email, password combination. Uses
|
||||
scrypt to match password with hashed value.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "email",
|
||||
"type": "`string`",
|
||||
"description": "the email of the user",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "`string`",
|
||||
"description": "the password of the user",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`AuthenticateResult`](../types/AuthenticateResult.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "success: whether authentication succeeded\n customer: the customer document if authentication succeded\n error: a string with the error message",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### comparePassword\_
|
||||
|
||||
`Protected` **comparePassword_**(`password`, `hash`): `Promise`<`boolean`\>
|
||||
|
||||
Verifies if a password is valid given the provided password hash
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "password",
|
||||
"type": "`string`",
|
||||
"description": "the raw password to check",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hash",
|
||||
"type": "`string`",
|
||||
"description": "the hash to compare against",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`boolean`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the comparison",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`AuthService`](AuthService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`AuthService`](AuthService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "AuthService",
|
||||
"type": "[`AuthService`](AuthService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# BaseEntity
|
||||
|
||||
Base abstract entity for all entities
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new BaseEntity**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,243 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# BatchJob
|
||||
|
||||
A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new BatchJob**()
|
||||
|
||||
A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "canceled_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date of the concellation.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "completed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date of the completion.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "confirmed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date when the confirmation has been done.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "The context of the batch job, the type of the batch job determines what the context should contain.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The unique identifier of the user that created the batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by_user",
|
||||
"type": "[`User`](User.mdx)",
|
||||
"description": "The details of the user that created the batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "dry_run",
|
||||
"type": "`boolean`",
|
||||
"description": "Specify if the job must apply the modifications or not.",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "failed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date when the job failed.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The unique identifier for the batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "pre_processed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date from which the job has been pre-processed.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "processing_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date the job is processing at.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "result",
|
||||
"type": "{ `advancement_count?`: `number` ; `count?`: `number` ; `errors?`: (`string` \\| [`BatchJobResultError`](../types/BatchJobResultError.mdx))[] ; `file_key?`: `string` ; `file_size?`: `number` ; `progress?`: `number` ; `stat_descriptors?`: [`BatchJobResultStatDescriptor`](../types/BatchJobResultStatDescriptor.mdx)[] } & Record<`string`, `unknown`\\>",
|
||||
"description": "The result of the batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`BatchJobStatus`](../enums/BatchJobStatus.mdx)",
|
||||
"description": "The status of the batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "created",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "`string`",
|
||||
"description": "The type of batch job.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was last updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### loadStatus
|
||||
|
||||
**loadStatus**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### toJSON
|
||||
|
||||
**toJSON**(): [`BatchJob`](BatchJob.mdx)
|
||||
|
||||
A Batch Job indicates an asynchronus task stored in the Medusa backend. Its status determines whether it has been executed or not.
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BatchJob`](BatchJob.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "BatchJob",
|
||||
"type": "[`BatchJob`](BatchJob.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,551 +0,0 @@
|
||||
# BatchJobService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`BatchJobService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new BatchJobService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:91](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L91)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### batchJobRepository\_
|
||||
|
||||
`Protected` `Readonly` **batchJobRepository\_**: `Repository`<`BatchJob`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:39](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### batchJobStatusMapToProps
|
||||
|
||||
`Protected` **batchJobStatusMapToProps**: `Map`<`BatchJobStatus`, { `entityColumnName`: `string` ; `eventType`: `string` }\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:43](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:40](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### strategyResolver\_
|
||||
|
||||
`Protected` `Readonly` **strategyResolver\_**: [`StrategyResolverService`](StrategyResolverService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:41](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` `Readonly` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CANCELED` | `string` |
|
||||
| `COMPLETED` | `string` |
|
||||
| `CONFIRMED` | `string` |
|
||||
| `CREATED` | `string` |
|
||||
| `FAILED` | `string` |
|
||||
| `PRE_PROCESSED` | `string` |
|
||||
| `PROCESSING` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:28](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L28)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### cancel
|
||||
|
||||
**cancel**(`batchJobOrId`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:270](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L270)
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
**complete**(`batchJobOrId`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:252](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L252)
|
||||
|
||||
___
|
||||
|
||||
### confirm
|
||||
|
||||
**confirm**(`batchJobOrId`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:234](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L234)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `BatchJobCreateProps` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:144](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L144)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config?`): `Promise`<[`BatchJob`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `selector` | `FilterableBatchJobProps` |
|
||||
| `config` | `FindConfig`<`BatchJob`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`[], `number`]\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:132](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L132)
|
||||
|
||||
___
|
||||
|
||||
### prepareBatchJobForProcessing
|
||||
|
||||
**prepareBatchJobForProcessing**(`data`, `req`): `Promise`<`CreateBatchJobInput`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `CreateBatchJobInput` |
|
||||
| `req` | `Request`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CreateBatchJobInput`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:367](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L367)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`batchJobId`, `config?`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobId` | `string` |
|
||||
| `config` | `FindConfig`<`BatchJob`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:104](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### setFailed
|
||||
|
||||
**setFailed**(`batchJobOrId`, `error?`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
| `error?` | `string` \| `BatchJobResultError` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:341](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L341)
|
||||
|
||||
___
|
||||
|
||||
### setPreProcessingDone
|
||||
|
||||
**setPreProcessingDone**(`batchJobOrId`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:288](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L288)
|
||||
|
||||
___
|
||||
|
||||
### setProcessing
|
||||
|
||||
**setProcessing**(`batchJobOrId`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:321](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L321)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`batchJobOrId`, `data`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
| `data` | `Partial`<`Pick`<`BatchJob`, ``"context"`` \| ``"result"``\>\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:161](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L161)
|
||||
|
||||
___
|
||||
|
||||
### updateStatus
|
||||
|
||||
`Protected` **updateStatus**(`batchJobOrId`, `status`): `Promise`<`BatchJob`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `batchJobOrId` | `string` \| `BatchJob` |
|
||||
| `status` | `BatchJobStatus` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`BatchJob`\>
|
||||
|
||||
-`Promise`:
|
||||
-`BatchJob`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/batch-job.ts:200](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/batch-job.ts#L200)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`BatchJobService`](BatchJobService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BatchJobService`](BatchJobService.md)
|
||||
|
||||
-`BatchJobService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,853 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# BatchJobService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new BatchJobService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-2.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "batchJobRepository_",
|
||||
"type": "`Repository`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "batchJobStatusMapToProps",
|
||||
"type": "`Map`<[`BatchJobStatus`](../enums/BatchJobStatus.mdx), { `entityColumnName`: `string` ; `eventType`: `string` }\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "strategyResolver_",
|
||||
"type": "[`StrategyResolverService`](StrategyResolverService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CANCELED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.canceled\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.COMPLETED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.completed\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CONFIRMED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.confirmed\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.FAILED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.failed\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.PRE_PROCESSED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.pre_processed\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.PROCESSING",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.processing\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.UPDATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"batch.updated\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancel
|
||||
|
||||
**cancel**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### complete
|
||||
|
||||
**complete**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### confirm
|
||||
|
||||
**confirm**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`BatchJobCreateProps`](../types/BatchJobCreateProps.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config?`): `Promise`<[[`BatchJob`](BatchJob.mdx)[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`FilterableBatchJobProps`](FilterableBatchJobProps.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[[`BatchJob`](BatchJob.mdx)[], `number`]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[[`BatchJob`](BatchJob.mdx)[], `number`]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### prepareBatchJobForProcessing
|
||||
|
||||
**prepareBatchJobForProcessing**(`data`, `req`): `Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "req",
|
||||
"type": "`Request`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\\>\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CreateBatchJobInput`](../types/CreateBatchJobInput.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`batchJobId`, `config?`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### setFailed
|
||||
|
||||
**setFailed**(`batchJobOrId`, `error?`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"type": "`string` \\| [`BatchJobResultError`](../types/BatchJobResultError.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### setPreProcessingDone
|
||||
|
||||
**setPreProcessingDone**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### setProcessing
|
||||
|
||||
**setProcessing**(`batchJobOrId`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`batchJobOrId`, `data`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Partial`](../types/Partial.mdx)<[`Pick`](../types/Pick.mdx)<[`BatchJob`](BatchJob.mdx), ``\"context\"`` \\| ``\"result\"``\\>\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### updateStatus
|
||||
|
||||
`Protected` **updateStatus**(`batchJobOrId`, `status`): `Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "batchJobOrId",
|
||||
"type": "`string` \\| [`BatchJob`](BatchJob.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`BatchJobStatus`](../enums/BatchJobStatus.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`BatchJob`](BatchJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`BatchJob`](BatchJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`BatchJobService`](BatchJobService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`BatchJobService`](BatchJobService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "BatchJobService",
|
||||
"type": "[`BatchJobService`](BatchJobService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,444 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Cart
|
||||
|
||||
A cart represents a virtual shopping bag. It can be used to complete an order, a swap, or a claim.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Cart**()
|
||||
|
||||
A cart represents a virtual shopping bag. It can be used to complete an order, a swap, or a claim.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "billing_address",
|
||||
"type": "[`Address`](Address.mdx)",
|
||||
"description": "The details of the billing address associated with the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "billing_address_id",
|
||||
"type": "`string`",
|
||||
"description": "The billing address's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "completed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the cart was completed.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "The context of the cart which can include info like IP or user agent.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer",
|
||||
"type": "[`Customer`](Customer.mdx)",
|
||||
"description": "The details of the customer the cart belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_id",
|
||||
"type": "`string`",
|
||||
"description": "The customer's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_total",
|
||||
"type": "`number`",
|
||||
"description": "The total of discount rounded",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discounts",
|
||||
"type": "[`Discount`](Discount.mdx)[]",
|
||||
"description": "An array of details of all discounts applied to the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "`string`",
|
||||
"description": "The email associated with the cart",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_card_tax_total",
|
||||
"type": "`number`",
|
||||
"description": "The total of gift cards with taxes",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_card_total",
|
||||
"type": "`number`",
|
||||
"description": "The total of gift cards",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_cards",
|
||||
"type": "[`GiftCard`](GiftCard.mdx)[]",
|
||||
"description": "An array of details of all gift cards applied to the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The cart's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotency_key",
|
||||
"type": "`string`",
|
||||
"description": "Randomly generated key used to continue the completion of a cart in case of failure.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_tax_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of items with taxes",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"type": "[`LineItem`](LineItem.mdx)[]",
|
||||
"description": "The line items added to the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "object",
|
||||
"type": "``\"cart\"``",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"cart\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment",
|
||||
"type": "[`Payment`](Payment.mdx)",
|
||||
"description": "The details of the payment associated with the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment_authorized_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the payment was authorized.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment_id",
|
||||
"type": "`string`",
|
||||
"description": "The payment's ID if available",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment_session",
|
||||
"type": "``null`` \\| [`PaymentSession`](PaymentSession.mdx)",
|
||||
"description": "The details of the selected payment session in the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment_sessions",
|
||||
"type": "[`PaymentSession`](PaymentSession.mdx)[]",
|
||||
"description": "The details of all payment sessions created on the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "raw_discount_total",
|
||||
"type": "`number`",
|
||||
"description": "The total of discount",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refundable_amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount that can be refunded",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refunded_total",
|
||||
"type": "`number`",
|
||||
"description": "The total amount refunded if the order associated with this cart is returned.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region",
|
||||
"type": "[`Region`](Region.mdx)",
|
||||
"description": "The details of the region associated with the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "`string`",
|
||||
"description": "The region's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sales_channel",
|
||||
"type": "[`SalesChannel`](SalesChannel.mdx)",
|
||||
"description": "The details of the sales channel associated with the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sales_channel_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The sales channel ID the cart is associated with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_address",
|
||||
"type": "``null`` \\| [`Address`](Address.mdx)",
|
||||
"description": "The details of the shipping address associated with the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_address_id",
|
||||
"type": "`string`",
|
||||
"description": "The shipping address's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_methods",
|
||||
"type": "[`ShippingMethod`](ShippingMethod.mdx)[]",
|
||||
"description": "The details of the shipping methods added to the cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_tax_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of shipping with taxes",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_total",
|
||||
"type": "`number`",
|
||||
"description": "The total of shipping",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subtotal",
|
||||
"type": "`number`",
|
||||
"description": "The subtotal of the cart",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tax_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of tax",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "total",
|
||||
"type": "`number`",
|
||||
"description": "The total amount of the cart",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`CartType`](../enums/CartType.mdx)",
|
||||
"description": "The cart's type.",
|
||||
"optional": false,
|
||||
"defaultValue": "default",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### afterLoad
|
||||
|
||||
`Private` **afterLoad**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,116 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimImage
|
||||
|
||||
The details of an image attached to a claim.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimImage**()
|
||||
|
||||
The details of an image attached to a claim.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "claim_item",
|
||||
"type": "[`ClaimItem`](ClaimItem.mdx)",
|
||||
"description": "The details of the claim item this image is associated with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the claim item associated with the image",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The claim image's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "`string`",
|
||||
"description": "The URL of the image",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,188 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimItem
|
||||
|
||||
A claim item is an item created as part of a claim. It references an item in the order that should be exchanged or refunded.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimItem**()
|
||||
|
||||
A claim item is an item created as part of a claim. It references an item in the order that should be exchanged or refunded.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "claim_order",
|
||||
"type": "[`ClaimOrder`](ClaimOrder.mdx)",
|
||||
"description": "The details of the claim this item belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the claim this item is associated with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The claim item's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "[`ClaimImage`](ClaimImage.mdx)[]",
|
||||
"description": "The claim images that are attached to the claim item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "The details of the line item in the original order that this claim item refers to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the line item that the claim item refers to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "note",
|
||||
"type": "`string`",
|
||||
"description": "An optional note about the claim, for additional information",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The quantity of the item that is being claimed; must be less than or equal to the amount purchased in the original order.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reason",
|
||||
"type": "[`ClaimReason`](../enums/ClaimReason.mdx)",
|
||||
"description": "The reason for the claim",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "[`ClaimTag`](ClaimTag.mdx)[]",
|
||||
"description": "User defined tags for easy filtering and grouping.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant",
|
||||
"type": "[`ProductVariant`](ProductVariant.mdx)",
|
||||
"description": "The details of the product variant to potentially replace the item in the original order.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the product variant that is claimed.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,372 +0,0 @@
|
||||
# ClaimItemService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`ClaimItemService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimItemService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `Object` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:26](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L26)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### claimImageRepository\_
|
||||
|
||||
`Protected` `Readonly` **claimImageRepository\_**: `Repository`<`ClaimImage`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:24](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L24)
|
||||
|
||||
___
|
||||
|
||||
### claimItemRepository\_
|
||||
|
||||
`Protected` `Readonly` **claimItemRepository\_**: `Repository`<`ClaimItem`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:22](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### claimTagRepository\_
|
||||
|
||||
`Protected` `Readonly` **claimTagRepository\_**: `Repository`<`ClaimTag`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:23](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:21](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### lineItemService\_
|
||||
|
||||
`Protected` `Readonly` **lineItemService\_**: [`LineItemService`](LineItemService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CANCELED` | `string` |
|
||||
| `CREATED` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L14)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<`ClaimItem`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `CreateClaimItemInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:43](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<`ClaimItem`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`ClaimItem`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | the config object for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`ClaimItem[]`:
|
||||
-`ClaimItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:205](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L205)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`claimItemId`, `config?`): `Promise`<`ClaimItem`\>
|
||||
|
||||
Gets a claim item by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `claimItemId` | `string` | id of ClaimItem to retrieve |
|
||||
| `config` | `FindConfig`<`ClaimItem`\> | configuration for the find operation |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`\>
|
||||
|
||||
-`Promise`: the ClaimItem
|
||||
-`ClaimItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:224](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L224)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<`ClaimItem`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `id` | `any` |
|
||||
| `data` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimItem`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim-item.ts:127](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim-item.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`ClaimItemService`](ClaimItemService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClaimItemService`](ClaimItemService.md)
|
||||
|
||||
-`ClaimItemService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,504 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimItemService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimItemService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "`Object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimImageRepository_",
|
||||
"type": "`Repository`<[`ClaimImage`](ClaimImage.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimItemRepository_",
|
||||
"type": "`Repository`<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimTagRepository_",
|
||||
"type": "`Repository`<[`ClaimTag`](ClaimTag.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemService_",
|
||||
"type": "[`LineItemService`](LineItemService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CANCELED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim_item.canceled\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim_item.created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.UPDATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim_item.updated\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateClaimItemInput`](../types/CreateClaimItemInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<[`ClaimItem`](ClaimItem.mdx)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"description": "the config object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimItem`](ClaimItem.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimItem`](ClaimItem.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`claimItemId`, `config?`): `Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
Gets a claim item by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "claimItemId",
|
||||
"type": "`string`",
|
||||
"description": "id of ClaimItem to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"description": "configuration for the find operation",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the ClaimItem",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimItem`](ClaimItem.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimItem`](ClaimItem.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`ClaimItemService`](ClaimItemService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClaimItemService`](ClaimItemService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "ClaimItemService",
|
||||
"type": "[`ClaimItemService`](ClaimItemService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimOrder
|
||||
|
||||
A Claim represents a group of faulty or missing items. It consists of claim items that refer to items in the original order that should be replaced or refunded. It also includes details related to shipping and fulfillment.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimOrder**()
|
||||
|
||||
A Claim represents a group of faulty or missing items. It consists of claim items that refer to items in the original order that should be replaced or refunded. It also includes details related to shipping and fulfillment.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "additional_items",
|
||||
"type": "[`LineItem`](LineItem.mdx)[]",
|
||||
"description": "The details of the new items to be shipped when the claim's type is `replace`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "canceled_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the claim was canceled.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_items",
|
||||
"type": "[`ClaimItem`](ClaimItem.mdx)[]",
|
||||
"description": "The details of the items that should be replaced or refunded.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillment_status",
|
||||
"type": "[`ClaimFulfillmentStatus`](../enums/ClaimFulfillmentStatus.mdx)",
|
||||
"description": "The claim's fulfillment status",
|
||||
"optional": false,
|
||||
"defaultValue": "not_fulfilled",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillments",
|
||||
"type": "[`Fulfillment`](Fulfillment.mdx)[]",
|
||||
"description": "The fulfillments of the new items to be shipped",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The claim's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotency_key",
|
||||
"type": "`string`",
|
||||
"description": "Randomly generated key used to continue the completion of the cart associated with the claim in case of failure.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "no_notification",
|
||||
"type": "`boolean`",
|
||||
"description": "Flag for describing whether or not notifications related to this should be send.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order that this claim was created for.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the order that the claim comes from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "payment_status",
|
||||
"type": "[`ClaimPaymentStatus`](../enums/ClaimPaymentStatus.mdx)",
|
||||
"description": "The status of the claim's payment",
|
||||
"optional": false,
|
||||
"defaultValue": "na",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refund_amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount that will be refunded in conjunction with the claim",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "return_order",
|
||||
"type": "[`Return`](Return.mdx)",
|
||||
"description": "The details of the return associated with the claim if the claim's type is `replace`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_address",
|
||||
"type": "[`Address`](Address.mdx)",
|
||||
"description": "The details of the address that new items should be shipped to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_address_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the address that the new items should be shipped to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_methods",
|
||||
"type": "[`ShippingMethod`](ShippingMethod.mdx)[]",
|
||||
"description": "The details of the shipping methods that the claim order will be shipped with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`ClaimType`](../enums/ClaimType.mdx)",
|
||||
"description": "The claim's type",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,666 +0,0 @@
|
||||
# ClaimService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`ClaimService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:86](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L86)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### addressRepository\_
|
||||
|
||||
`Protected` `Readonly` **addressRepository\_**: `Repository`<`Address`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:68](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### claimItemService\_
|
||||
|
||||
`Protected` `Readonly` **claimItemService\_**: [`ClaimItemService`](ClaimItemService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:72](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L72)
|
||||
|
||||
___
|
||||
|
||||
### claimRepository\_
|
||||
|
||||
`Protected` `Readonly` **claimRepository\_**: `Repository`<`ClaimOrder`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:69](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L69)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:73](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L73)
|
||||
|
||||
___
|
||||
|
||||
### fulfillmentProviderService\_
|
||||
|
||||
`Protected` `Readonly` **fulfillmentProviderService\_**: [`FulfillmentProviderService`](FulfillmentProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:74](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### fulfillmentService\_
|
||||
|
||||
`Protected` `Readonly` **fulfillmentService\_**: [`FulfillmentService`](FulfillmentService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:75](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### lineItemRepository\_
|
||||
|
||||
`Protected` `Readonly` **lineItemRepository\_**: `Repository`<`LineItem`\> & { `findByReturn`: Method findByReturn }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:71](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L71)
|
||||
|
||||
___
|
||||
|
||||
### lineItemService\_
|
||||
|
||||
`Protected` `Readonly` **lineItemService\_**: [`LineItemService`](LineItemService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:76](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L76)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### paymentProviderService\_
|
||||
|
||||
`Protected` `Readonly` **paymentProviderService\_**: [`PaymentProviderService`](PaymentProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:77](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L77)
|
||||
|
||||
___
|
||||
|
||||
### productVariantInventoryService\_
|
||||
|
||||
`Protected` `Readonly` **productVariantInventoryService\_**: [`ProductVariantInventoryService`](ProductVariantInventoryService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:84](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
`Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:78](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
### returnService\_
|
||||
|
||||
`Protected` `Readonly` **returnService\_**: [`ReturnService`](ReturnService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:79](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L79)
|
||||
|
||||
___
|
||||
|
||||
### shippingMethodRepository\_
|
||||
|
||||
`Protected` `Readonly` **shippingMethodRepository\_**: `Repository`<`ShippingMethod`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:70](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### shippingOptionService\_
|
||||
|
||||
`Protected` `Readonly` **shippingOptionService\_**: [`ShippingOptionService`](ShippingOptionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:80](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### taxProviderService\_
|
||||
|
||||
`Protected` `Readonly` **taxProviderService\_**: [`TaxProviderService`](TaxProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:81](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L81)
|
||||
|
||||
___
|
||||
|
||||
### totalsService\_
|
||||
|
||||
`Protected` `Readonly` **totalsService\_**: [`TotalsService`](TotalsService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:82](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L82)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` `Readonly` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CANCELED` | `string` |
|
||||
| `CREATED` | `string` |
|
||||
| `FULFILLMENT_CREATED` | `string` |
|
||||
| `REFUND_PROCESSED` | `string` |
|
||||
| `SHIPMENT_CREATED` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:59](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L59)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### cancel
|
||||
|
||||
**cancel**(`id`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `id` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:814](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L814)
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**cancelFulfillment**(`fulfillmentId`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `fulfillmentId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:662](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L662)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**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 | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `CreateClaimInput` | the object containing all data required to create a claim |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`: created claim
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:331](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L331)
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**createFulfillment**(`id`, `config?`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the object containing all data required to create a claim |
|
||||
| `config` | `object` | config object |
|
||||
| `config.location_id?` | `string` |
|
||||
| `config.metadata?` | Record<`string`, `unknown`\> | config metadata |
|
||||
| `config.no_notification?` | `boolean` | config no notification |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`: created claim
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:512](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L512)
|
||||
|
||||
___
|
||||
|
||||
### createShipment
|
||||
|
||||
**createShipment**(`id`, `fulfillmentId`, `trackingLinks?`, `config?`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Default value |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` |
|
||||
| `fulfillmentId` | `string` |
|
||||
| `trackingLinks` | { `tracking_number`: `string` }[] | `[]` |
|
||||
| `config` | `object` |
|
||||
| `config.metadata` | `object` |
|
||||
| `config.no_notification` | `undefined` | `undefined` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:734](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L734)
|
||||
|
||||
___
|
||||
|
||||
### getRefundTotalForClaimLinesOnOrder
|
||||
|
||||
`Protected` **getRefundTotalForClaimLinesOnOrder**(`order`, `claimItems`): `Promise`<`number`\>
|
||||
|
||||
Finds claim line items on an order and calculates the refund amount.
|
||||
There are three places too look:
|
||||
- Order items
|
||||
- Swap items
|
||||
- Claim items (from previous claims)
|
||||
Note, it will attempt to return early from each of these places to avoid having to iterate over all items every time.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `order` | `Order` | the order to find claim lines on |
|
||||
| `claimItems` | `CreateClaimItemInput`[] | the claim items to match against |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
-`Promise`: the refund amount
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:273](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L273)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<`ClaimOrder`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `any` | the query object for find |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`ClaimOrder[]`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:870](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L870)
|
||||
|
||||
___
|
||||
|
||||
### processRefund
|
||||
|
||||
**processRefund**(`id`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `id` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:688](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L688)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`claimId`, `config?`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `claimId` | `string` | id of the claim order to retrieve |
|
||||
| `config` | `FindConfig`<`ClaimOrder`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`: the order document
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:889](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L889)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<`ClaimOrder`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `id` | `string` |
|
||||
| `data` | `UpdateClaimInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ClaimOrder`\>
|
||||
|
||||
-`Promise`:
|
||||
-`ClaimOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:125](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### validateCreateClaimInput
|
||||
|
||||
`Protected` **validateCreateClaimInput**(`data`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `CreateClaimInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/claim.ts:206](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/claim.ts#L206)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`ClaimService`](ClaimService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClaimService`](ClaimService.md)
|
||||
|
||||
-`default`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,983 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-4.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "addressRepository_",
|
||||
"type": "`Repository`<[`Address`](Address.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimItemService_",
|
||||
"type": "[`ClaimItemService`](ClaimItemService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimRepository_",
|
||||
"type": "`Repository`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentProviderService_",
|
||||
"type": "[`FulfillmentProviderService`](FulfillmentProviderService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentService_",
|
||||
"type": "[`FulfillmentService`](FulfillmentService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemRepository_",
|
||||
"type": "`Repository`<[`LineItem`](LineItem.mdx)\\> & { `findByReturn`: Method findByReturn }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemService_",
|
||||
"type": "[`LineItemService`](LineItemService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "paymentProviderService_",
|
||||
"type": "[`PaymentProviderService`](PaymentProviderService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "productVariantInventoryService_",
|
||||
"type": "[`ProductVariantInventoryService`](ProductVariantInventoryService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "regionService_",
|
||||
"type": "[`RegionService`](RegionService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "returnService_",
|
||||
"type": "[`ReturnService`](ReturnService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shippingMethodRepository_",
|
||||
"type": "`Repository`<[`ShippingMethod`](ShippingMethod.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shippingOptionService_",
|
||||
"type": "[`ShippingOptionService`](ShippingOptionService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "taxProviderService_",
|
||||
"type": "[`TaxProviderService`](TaxProviderService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "totalsService_",
|
||||
"type": "[`TotalsService`](TotalsService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CANCELED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.canceled\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.FULFILLMENT_CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.fulfillment_created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.REFUND_PROCESSED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.refund_processed\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.SHIPMENT_CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.shipment_created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.UPDATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"claim.updated\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancel
|
||||
|
||||
**cancel**(`id`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**cancelFulfillment**(`fulfillmentId`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillmentId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
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
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateClaimInput`](../types/CreateClaimInput.mdx)",
|
||||
"description": "the object containing all data required to create a claim",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "created claim",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**createFulfillment**(`id`, `config?`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "the object containing all data required to create a claim",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "`object`",
|
||||
"description": "config object",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config.location_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config.metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "config metadata",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config.no_notification",
|
||||
"type": "`boolean`",
|
||||
"description": "config no notification",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "created claim",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createShipment
|
||||
|
||||
**createShipment**(`id`, `fulfillmentId`, `trackingLinks?`, `config?`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "trackingLinks",
|
||||
"type": "{ `tracking_number`: `string` }[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "[]",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config.metadata",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config.no_notification",
|
||||
"type": "`undefined`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "undefined",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getRefundTotalForClaimLinesOnOrder
|
||||
|
||||
`Protected` **getRefundTotalForClaimLinesOnOrder**(`order`, `claimItems`): `Promise`<`number`\>
|
||||
|
||||
Finds claim line items on an order and calculates the refund amount.
|
||||
There are three places too look:
|
||||
- Order items
|
||||
- Swap items
|
||||
- Claim items (from previous claims)
|
||||
Note, it will attempt to return early from each of these places to avoid having to iterate over all items every time.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "the order to find claim lines on",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claimItems",
|
||||
"type": "[`CreateClaimItemInput`](../types/CreateClaimItemInput.mdx)[]",
|
||||
"description": "the claim items to match against",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`number`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the refund amount",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "`any`",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"description": "the config object containing query settings",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### processRefund
|
||||
|
||||
**processRefund**(`id`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`claimId`, `config?`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
Gets an order by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "claimId",
|
||||
"type": "`string`",
|
||||
"description": "id of the claim order to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"description": "the config object containing query settings",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the order document",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`UpdateClaimInput`](../types/UpdateClaimInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`ClaimOrder`](ClaimOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### validateCreateClaimInput
|
||||
|
||||
`Protected` **validateCreateClaimInput**(`data`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateClaimInput`](../types/CreateClaimInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`ClaimService`](ClaimService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`ClaimService`](ClaimService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "default",
|
||||
"type": "[`ClaimService`](ClaimService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# ClaimTag
|
||||
|
||||
Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new ClaimTag**()
|
||||
|
||||
Claim Tags are user defined tags that can be assigned to claim items for easy filtering and grouping.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The claim tag's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`string`",
|
||||
"description": "The value that the claim tag holds",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Country
|
||||
|
||||
Country details
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Country**()
|
||||
|
||||
Country details
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "display_name",
|
||||
"type": "`string`",
|
||||
"description": "The country name appropriate for display.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`number`",
|
||||
"description": "The country's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "iso_2",
|
||||
"type": "`string`",
|
||||
"description": "The 2 character ISO code of the country in lower case",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "iso_3",
|
||||
"type": "`string`",
|
||||
"description": "The 2 character ISO code of the country in lower case",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The normalized country name in upper case.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "num_code",
|
||||
"type": "`number`",
|
||||
"description": "The numerical ISO code for the country.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region",
|
||||
"type": "[`Region`](Region.mdx)",
|
||||
"description": "The details of the region the country is associated with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The region ID this country is associated with.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Currency
|
||||
|
||||
Currency
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Currency**()
|
||||
|
||||
Currency
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The 3 character ISO code for the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "includes_tax",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the currency prices include tax",
|
||||
"optional": true,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"featureFlag": "tax_inclusive_pricing",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The written name of the currency",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "`string`",
|
||||
"description": "The symbol used to indicate the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "symbol_native",
|
||||
"type": "`string`",
|
||||
"description": "The native symbol used to indicate the currency.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,333 +0,0 @@
|
||||
# CurrencyService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`CurrencyService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CurrencyService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:29](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L29)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### currencyRepository\_
|
||||
|
||||
`Protected` `Readonly` **currencyRepository\_**: `Repository`<`Currency`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:25](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L25)
|
||||
|
||||
___
|
||||
|
||||
### eventBusService\_
|
||||
|
||||
`Protected` `Readonly` **eventBusService\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:26](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L26)
|
||||
|
||||
___
|
||||
|
||||
### featureFlagRouter\_
|
||||
|
||||
`Protected` `Readonly` **featureFlagRouter\_**: `FlagRouter`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:27](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` `Readonly` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:21](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L21)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector`, `config?`): `Promise`<[`Currency`[], `number`]\>
|
||||
|
||||
Lists currencies based on the provided parameters and includes the count of
|
||||
currencies that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`Currency`\> | an object that defines rules to filter currencies by |
|
||||
| `config` | `FindConfig`<`Currency`\> | object that defines the scope for what should be returned |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Currency`[], `number`]\>
|
||||
|
||||
-`Promise`: an array containing the currencies as
|
||||
the first element and the total count of products that matches the query
|
||||
as the second element.
|
||||
-`Currency[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:78](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L78)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
**retrieveByCode**(`code`): `Promise`<`Currency`\>
|
||||
|
||||
Return the currency
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `code` | `string` | The code of the currency that must be retrieve |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Currency`\>
|
||||
|
||||
-`Promise`: The currency
|
||||
-`Currency`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:47](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`code`, `data`): `Promise`<`undefined` \| `Currency`\>
|
||||
|
||||
Update a currency
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `code` | `string` | The code of the currency to update |
|
||||
| `data` | `UpdateCurrencyInput` | The data that must be updated on the currency |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `Currency`\>
|
||||
|
||||
-`Promise`: The updated currency
|
||||
-`undefined \| Currency`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/currency.ts:100](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/currency.ts#L100)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CurrencyService`](CurrencyService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CurrencyService`](CurrencyService.md)
|
||||
|
||||
-`default`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,428 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CurrencyService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CurrencyService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-5.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currencyRepository_",
|
||||
"type": "`Repository`<[`Currency`](Currency.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBusService_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "featureFlagRouter_",
|
||||
"type": "[`FlagRouter`](FlagRouter.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.UPDATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"currency.updated\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector`, `config?`): `Promise`<[[`Currency`](Currency.mdx)[], `number`]\>
|
||||
|
||||
Lists currencies based on the provided parameters and includes the count of
|
||||
currencies that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`Currency`](Currency.mdx)\\>",
|
||||
"description": "an object that defines rules to filter currencies by",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Currency`](Currency.mdx)\\>",
|
||||
"description": "object that defines the scope for what should be returned",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[[`Currency`](Currency.mdx)[], `number`]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[[`Currency`](Currency.mdx)[], `number`]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "an array containing the currencies as\n the first element and the total count of products that matches the query\n as the second element.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
**retrieveByCode**(`code`): `Promise`<[`Currency`](Currency.mdx)\>
|
||||
|
||||
Return the currency
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency that must be retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Currency`](Currency.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Currency`](Currency.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The currency",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`code`, `data`): `Promise`<`undefined` \| [`Currency`](Currency.mdx)\>
|
||||
|
||||
Update a currency
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The code of the currency to update",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`UpdateCurrencyInput`](../types/UpdateCurrencyInput.mdx)",
|
||||
"description": "The data that must be updated on the currency",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| [`Currency`](Currency.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`undefined` \\| [`Currency`](Currency.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated currency",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CurrencyService`](CurrencyService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CurrencyService`](CurrencyService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "default",
|
||||
"type": "[`CurrencyService`](CurrencyService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CustomShippingOption
|
||||
|
||||
Custom Shipping Options are overridden Shipping Options. Admins can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomShippingOption**()
|
||||
|
||||
Custom Shipping Options are overridden Shipping Options. Admins can attach a Custom Shipping Option to a cart in order to set a custom price for a particular Shipping Option.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "The details of the cart this shipping option belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Cart that the custom shipping option is attached to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The custom shipping option's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price",
|
||||
"type": "`number`",
|
||||
"description": "The custom price set that will override the shipping option's original price",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_option",
|
||||
"type": "[`ShippingOption`](ShippingOption.mdx)",
|
||||
"description": "The details of the overridden shipping options.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_option_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Shipping Option that the custom shipping option overrides",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,298 +0,0 @@
|
||||
# CustomShippingOptionService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`CustomShippingOptionService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomShippingOptionService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/custom-shipping-option.ts:18](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/custom-shipping-option.ts#L18)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### customShippingOptionRepository\_
|
||||
|
||||
`Protected` **customShippingOptionRepository\_**: `Repository`<`CustomShippingOption`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/custom-shipping-option.ts:16](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/custom-shipping-option.ts#L16)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**<`T`, `TResult`\>(`data`): `Promise`<`TResult`\>
|
||||
|
||||
Creates a custom shipping option
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `object` |
|
||||
| `TResult` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `T` | the custom shipping option to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: resolves to the creation result
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/custom-shipping-option.ts:80](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/custom-shipping-option.ts#L80)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<`CustomShippingOption`[]\>
|
||||
|
||||
Fetches all custom shipping options based on the given selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`CustomShippingOption`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomShippingOption`[]\>
|
||||
|
||||
-`Promise`: custom shipping options matching the query
|
||||
-`CustomShippingOption[]`:
|
||||
-`CustomShippingOption`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/custom-shipping-option.ts:58](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/custom-shipping-option.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`id`, `config?`): `Promise`<`CustomShippingOption`\>
|
||||
|
||||
Retrieves a specific shipping option.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the id of the custom shipping option to retrieve. |
|
||||
| `config` | `FindConfig`<`CustomShippingOption`\> | any options needed to query for the result. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomShippingOption`\>
|
||||
|
||||
-`Promise`: the requested custom shipping option.
|
||||
-`CustomShippingOption`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/custom-shipping-option.ts:31](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/custom-shipping-option.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CustomShippingOptionService`](CustomShippingOptionService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CustomShippingOptionService`](CustomShippingOptionService.md)
|
||||
|
||||
-`CustomShippingOptionService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,412 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CustomShippingOptionService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomShippingOptionService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-6.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customShippingOptionRepository_",
|
||||
"type": "`Repository`<[`CustomShippingOption`](CustomShippingOption.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**<`T`, `TResult`\>(`data`): `Promise`<`TResult`\>
|
||||
|
||||
Creates a custom shipping option
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`T`",
|
||||
"description": "the custom shipping option to create",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "resolves to the creation result",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)[]\>
|
||||
|
||||
Fetches all custom shipping options based on the given selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`CustomShippingOption`](CustomShippingOption.mdx)\\>",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`CustomShippingOption`](CustomShippingOption.mdx)\\>",
|
||||
"description": "the configuration used to find the objects. contains relations, skip, and take.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "custom shipping options matching the query",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`id`, `config?`): `Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)\>
|
||||
|
||||
Retrieves a specific shipping option.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "the id of the custom shipping option to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`CustomShippingOption`](CustomShippingOption.mdx)\\>",
|
||||
"description": "any options needed to query for the result.",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomShippingOption`](CustomShippingOption.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the requested custom shipping option.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CustomShippingOptionService`](CustomShippingOptionService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CustomShippingOptionService`](CustomShippingOptionService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "CustomShippingOptionService",
|
||||
"type": "[`CustomShippingOptionService`](CustomShippingOptionService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,188 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Customer
|
||||
|
||||
A customer can make purchases in your store and manage their profile.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Customer**()
|
||||
|
||||
A customer can make purchases in your store and manage their profile.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "billing_address",
|
||||
"type": "[`Address`](Address.mdx)",
|
||||
"description": "The details of the billing address associated with the customer.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "billing_address_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The customer's billing address ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "`string`",
|
||||
"description": "The customer's email",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "first_name",
|
||||
"type": "`string`",
|
||||
"description": "The customer's first name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "groups",
|
||||
"type": "[`CustomerGroup`](CustomerGroup.mdx)[]",
|
||||
"description": "The customer groups the customer belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "has_account",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the customer has an account or not",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The customer's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "last_name",
|
||||
"type": "`string`",
|
||||
"description": "The customer's last name",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "orders",
|
||||
"type": "[`Order`](Order.mdx)[]",
|
||||
"description": "The details of the orders this customer placed.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "password_hash",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "phone",
|
||||
"type": "`string`",
|
||||
"description": "The customer's phone number",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipping_addresses",
|
||||
"type": "[`Address`](Address.mdx)[]",
|
||||
"description": "The details of the shipping addresses associated with the customer.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,116 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CustomerGroup
|
||||
|
||||
A customer group that can be used to organize customers into groups of similar traits.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomerGroup**()
|
||||
|
||||
A customer group that can be used to organize customers into groups of similar traits.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customers",
|
||||
"type": "[`Customer`](Customer.mdx)[]",
|
||||
"description": "The details of the customers that belong to the customer group.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The customer group's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "The name of the customer group",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_lists",
|
||||
"type": "[`PriceList`](PriceList.mdx)[]",
|
||||
"description": "The price lists that are associated with the customer group.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,456 +0,0 @@
|
||||
# CustomerGroupService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`CustomerGroupService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomerGroupService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `CustomerGroupConstructorProps` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:24](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L24)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### customerGroupRepository\_
|
||||
|
||||
`Protected` `Readonly` **customerGroupRepository\_**: `Repository`<`CustomerGroup`\> & { `addCustomers`: Method addCustomers ; `findWithRelationsAndCount`: Method findWithRelationsAndCount ; `removeCustomers`: Method removeCustomers }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:21](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L21)
|
||||
|
||||
___
|
||||
|
||||
### customerService\_
|
||||
|
||||
`Protected` `Readonly` **customerService\_**: [`CustomerService`](CustomerService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:22](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L22)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### addCustomers
|
||||
|
||||
**addCustomers**(`id`, `customerIds`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Add a batch of customers to a customer group at once
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | id of the customer group to add customers to |
|
||||
| `customerIds` | `string` \| `string`[] | customer id's to add to the group |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
-`Promise`: the customer group after insertion
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:89](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L89)
|
||||
|
||||
___
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`group`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Creates a customer group with the provided data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `group` | `DeepPartial`<`CustomerGroup`\> | the customer group to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
-`Promise`: the result of the create operation
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:65](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`groupId`): `Promise`<`void`\>
|
||||
|
||||
Remove customer group
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `groupId` | `string` | id of the customer group to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`: a promise
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:153](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L153)
|
||||
|
||||
___
|
||||
|
||||
### handleCreationFail
|
||||
|
||||
`Private` **handleCreationFail**(`id`, `ids`, `error`): `Promise`<`never`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `id` | `string` |
|
||||
| `ids` | `string`[] |
|
||||
| `error` | `any` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`never`\>
|
||||
|
||||
-`Promise`:
|
||||
-`never`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:257](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L257)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config`): `Promise`<`CustomerGroup`[]\>
|
||||
|
||||
List customer groups.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`CustomerGroup`\> & { `discount_condition_id?`: `string` ; `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | the config to be used for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`CustomerGroup[]`:
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:176](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L176)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config`): `Promise`<[`CustomerGroup`[], `number`]\>
|
||||
|
||||
Retrieve a list of customer groups and total count of records that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`CustomerGroup`\> & { `discount_condition_id?`: `string` ; `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`CustomerGroup`\> | the config to be used for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`[], `number`]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`CustomerGroup[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:194](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L194)
|
||||
|
||||
___
|
||||
|
||||
### removeCustomer
|
||||
|
||||
**removeCustomer**(`id`, `customerIds`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Remove list of customers from a customergroup
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
-`Promise`: the customergroup with the provided id
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:236](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L236)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`customerGroupId`, `config?`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `customerGroupId` | `string` |
|
||||
| `config` | `object` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
-`Promise`:
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:35](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L35)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`customerGroupId`, `update`): `Promise`<`CustomerGroup`\>
|
||||
|
||||
Update a customer group.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `customerGroupId` | `string` | id of the customer group |
|
||||
| `update` | `CustomerGroupUpdate` | customer group partial data |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`CustomerGroup`\>
|
||||
|
||||
-`Promise`: resulting customer group
|
||||
-`CustomerGroup`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer-group.ts:120](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer-group.ts#L120)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CustomerGroupService`](CustomerGroupService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CustomerGroupService`](CustomerGroupService.md)
|
||||
|
||||
-`CustomerGroupService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,678 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CustomerGroupService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomerGroupService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`CustomerGroupConstructorProps`](../types/CustomerGroupConstructorProps.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customerGroupRepository_",
|
||||
"type": "`Repository`<[`CustomerGroup`](CustomerGroup.mdx)\\> & { `addCustomers`: Method addCustomers ; `findWithRelationsAndCount`: Method findWithRelationsAndCount ; `removeCustomers`: Method removeCustomers }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customerService_",
|
||||
"type": "[`CustomerService`](CustomerService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### addCustomers
|
||||
|
||||
**addCustomers**(`id`, `customerIds`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
Add a batch of customers to a customer group at once
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "id of the customer group to add customers to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customerIds",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "customer id's to add to the group",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the customer group after insertion",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`group`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
Creates a customer group with the provided data.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "group",
|
||||
"type": "`DeepPartial`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"description": "the customer group to create",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the create operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`groupId`): `Promise`<`void`\>
|
||||
|
||||
Remove customer group
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "groupId",
|
||||
"type": "`string`",
|
||||
"description": "id of the customer group to delete",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "a promise",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### handleCreationFail
|
||||
|
||||
`Private` **handleCreationFail**(`id`, `ids`, `error`): `Promise`<`never`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ids",
|
||||
"type": "`string`[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "error",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`never`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`never`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)[]\>
|
||||
|
||||
List customer groups.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`CustomerGroup`](CustomerGroup.mdx)\\> & { `discount_condition_id?`: `string` ; `q?`: `string` }",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"description": "the config to be used for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config`): `Promise`<[[`CustomerGroup`](CustomerGroup.mdx)[], `number`]\>
|
||||
|
||||
Retrieve a list of customer groups and total count of records that match the query.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`CustomerGroup`](CustomerGroup.mdx)\\> & { `discount_condition_id?`: `string` ; `q?`: `string` }",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"description": "the config to be used for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[[`CustomerGroup`](CustomerGroup.mdx)[], `number`]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[[`CustomerGroup`](CustomerGroup.mdx)[], `number`]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### removeCustomer
|
||||
|
||||
**removeCustomer**(`id`, `customerIds`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
Remove list of customers from a customergroup
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "id of the customer group from which the customers are removed",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customerIds",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "id's of the customer to remove from group",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the customergroup with the provided id",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`customerGroupId`, `config?`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "customerGroupId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`customerGroupId`, `update`): `Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
Update a customer group.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "customerGroupId",
|
||||
"type": "`string`",
|
||||
"description": "id of the customer group",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"type": "[`CustomerGroupUpdate`](CustomerGroupUpdate.mdx)",
|
||||
"description": "customer group partial data",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`CustomerGroup`](CustomerGroup.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "resulting customer group",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CustomerGroupService`](CustomerGroupService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CustomerGroupService`](CustomerGroupService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "CustomerGroupService",
|
||||
"type": "[`CustomerGroupService`](CustomerGroupService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# CustomerGroupUpdate
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomerGroupUpdate**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,732 +0,0 @@
|
||||
# CustomerService
|
||||
|
||||
Provides layer to manipulate customers.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`CustomerService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new CustomerService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:46](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L46)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### addressRepository\_
|
||||
|
||||
`Protected` `Readonly` **addressRepository\_**: `Repository`<`Address`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### customerRepository\_
|
||||
|
||||
`Protected` `Readonly` **customerRepository\_**: `Repository`<`Customer`\> & { `listAndCount`: Method listAndCount }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:36](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L36)
|
||||
|
||||
___
|
||||
|
||||
### eventBusService\_
|
||||
|
||||
`Protected` `Readonly` **eventBusService\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:38](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CREATED` | `string` |
|
||||
| `PASSWORD_RESET` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:40](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L40)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### addAddress
|
||||
|
||||
**addAddress**(`customerId`, `address`): `Promise`<`Customer` \| `Address`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `customerId` | `string` |
|
||||
| `address` | `AddressCreatePayload` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer` \| `Address`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Customer \| Address`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:519](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L519)
|
||||
|
||||
___
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### count
|
||||
|
||||
**count**(): `Promise`<`number`\>
|
||||
|
||||
Return the total number of documents in database
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
-`Promise`: the result of the count operation
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:178](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L178)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**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 | Description |
|
||||
| :------ | :------ |
|
||||
| `customer` | `CreateCustomerInput` | the customer to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`: the result of create
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:306](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L306)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`customerId`): `Promise`<`void` \| `Customer`\>
|
||||
|
||||
Deletes a customer from a given customer id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `customerId` | `string` | the id of the customer to delete. Must be castable as an ObjectId |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `Customer`\>
|
||||
|
||||
-`Promise`: the result of the delete operation.
|
||||
-`void \| Customer`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:565](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L565)
|
||||
|
||||
___
|
||||
|
||||
### generateResetPasswordToken
|
||||
|
||||
**generateResetPasswordToken**(`customerId`): `Promise`<`string`\>
|
||||
|
||||
Generate a JSON Web token, that will be sent to a customer, that wishes to
|
||||
reset password.
|
||||
The token will be signed with the customer's current password hash as a
|
||||
secret a long side a payload with userId and the expiry time for the token,
|
||||
which is always 15 minutes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `customerId` | `string` | the customer to reset the password for |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
-`Promise`: the generated JSON web token
|
||||
-`string`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:68](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### hashPassword\_
|
||||
|
||||
**hashPassword_**(`password`): `Promise`<`string`\>
|
||||
|
||||
Hashes a password
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `password` | `string` | the value to hash |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
-`Promise`: hashed password
|
||||
-`string`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:293](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L293)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<`Customer`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`Customer`\> & { `groups?`: `string`[] ; `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`Customer[]`:
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:111](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector`, `config?`): `Promise`<[`Customer`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `Selector`<`Customer`\> & { `groups?`: `string`[] ; `q?`: `string` } | the query object for find |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Customer`[], `number`]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`Customer[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:143](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L143)
|
||||
|
||||
___
|
||||
|
||||
### listByEmail
|
||||
|
||||
**listByEmail**(`email`, `config?`): `Promise`<`Customer`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `email` | `string` |
|
||||
| `config` | `FindConfig`<`Customer`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`Customer[]`:
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:249](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L249)
|
||||
|
||||
___
|
||||
|
||||
### removeAddress
|
||||
|
||||
**removeAddress**(`customerId`, `addressId`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `customerId` | `string` |
|
||||
| `addressId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:502](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L502)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`customerId`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a customer by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `customerId` | `string` | the id of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`: the customer document.
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:274](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L274)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByEmail
|
||||
|
||||
**retrieveByEmail**(`email`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a registered customer by email.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `email` | `string` | the email of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`: the customer document.
|
||||
-`Customer`:
|
||||
|
||||
**Deprecated**
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:216](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L216)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByPhone
|
||||
|
||||
**retrieveByPhone**(`phone`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
Gets a customer by phone.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `phone` | `string` | the phone of the customer to get. |
|
||||
| `config` | `FindConfig`<`Customer`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`: the customer document.
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:261](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L261)
|
||||
|
||||
___
|
||||
|
||||
### retrieveRegisteredByEmail
|
||||
|
||||
**retrieveRegisteredByEmail**(`email`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `email` | `string` |
|
||||
| `config` | `FindConfig`<`Customer`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:239](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L239)
|
||||
|
||||
___
|
||||
|
||||
### retrieveUnregisteredByEmail
|
||||
|
||||
**retrieveUnregisteredByEmail**(`email`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `email` | `string` |
|
||||
| `config` | `FindConfig`<`Customer`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:230](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L230)
|
||||
|
||||
___
|
||||
|
||||
### retrieve\_
|
||||
|
||||
`Private` **retrieve_**(`selector`, `config?`): `Promise`<`Customer`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `selector` | `Selector`<`Customer`\> |
|
||||
| `config` | `FindConfig`<`Customer`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:185](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L185)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`customerId`, `update`): `Promise`<`Customer`\>
|
||||
|
||||
Updates a customer.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Customer`\>
|
||||
|
||||
-`Promise`: resolves to the update result.
|
||||
-`Customer`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:362](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L362)
|
||||
|
||||
___
|
||||
|
||||
### updateAddress
|
||||
|
||||
**updateAddress**(`customerId`, `addressId`, `address`): `Promise`<`Address`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `customerId` | `string` |
|
||||
| `addressId` | `string` |
|
||||
| `address` | `StorePostCustomersCustomerAddressesAddressReq` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Address`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Address`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:474](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L474)
|
||||
|
||||
___
|
||||
|
||||
### updateBillingAddress\_
|
||||
|
||||
**updateBillingAddress_**(`customer`, `addressOrId`): `Promise`<`void`\>
|
||||
|
||||
Updates the customers' billing address.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `customer` | `Customer` | the Customer to update |
|
||||
| `addressOrId` | `undefined` \| `string` \| `DeepPartial`<`Address`\> | the value to set the billing address to |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`: the result of the update operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/customer.ts:422](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/customer.ts#L422)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`CustomerService`](CustomerService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`CustomerService`](CustomerService.md)
|
||||
|
||||
-`CustomerService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,56 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DateComparisonOperator
|
||||
|
||||
Fields used to apply flexible filters on dates.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DateComparisonOperator**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "gt",
|
||||
"type": "`Date`",
|
||||
"description": "The filtered date must be greater than this value.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gte",
|
||||
"type": "`Date`",
|
||||
"description": "The filtered date must be greater than or equal to this value.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lt",
|
||||
"type": "`Date`",
|
||||
"description": "The filtered date must be less than this value.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lte",
|
||||
"type": "`Date`",
|
||||
"description": "The filtered date must be less than or equal to this value.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Discount
|
||||
|
||||
A discount can be applied to a cart for promotional purposes.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Discount**()
|
||||
|
||||
A discount can be applied to a cart for promotional purposes.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "A unique code for the discount - this will be used by the customer to apply the discount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,206 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Discount
|
||||
|
||||
A discount can be applied to a cart for promotional purposes.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Discount**()
|
||||
|
||||
A discount can be applied to a cart for promotional purposes.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "A unique code for the discount - this will be used by the customer to apply the discount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The time at which the discount can no longer be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The discount's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_disabled",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the Discount has been disabled. Disabled discounts cannot be applied to carts",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_dynamic",
|
||||
"type": "`boolean`",
|
||||
"description": "A flag to indicate if multiple instances of the discount can be generated. I.e. for newsletter discounts",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "parent_discount",
|
||||
"type": "[`Discount`](Discount.mdx)",
|
||||
"description": "The details of the parent discount that this discount was created from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "parent_discount_id",
|
||||
"type": "`string`",
|
||||
"description": "The Discount that the discount was created from. This will always be a dynamic discount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "regions",
|
||||
"type": "[`Region`](Region.mdx)[]",
|
||||
"description": "The details of the regions in which the Discount can be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"type": "[`DiscountRule`](DiscountRule.mdx)",
|
||||
"description": "The details of the discount rule that defines how the discount will be applied to a cart..",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the discount rule that defines how the discount will be applied to a cart.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "starts_at",
|
||||
"type": "`Date`",
|
||||
"description": "The time at which the discount can be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "usage_count",
|
||||
"type": "`number`",
|
||||
"description": "The number of times a discount has been used.",
|
||||
"optional": false,
|
||||
"defaultValue": "0",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "usage_limit",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The maximum number of times that a discount can be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "valid_duration",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "Duration the discount runs between",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### upperCaseCodeAndTrim
|
||||
|
||||
`Private` **upperCaseCodeAndTrim**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,170 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountCondition
|
||||
|
||||
Holds rule conditions for when a discount is applicable
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountCondition**()
|
||||
|
||||
Holds rule conditions for when a discount is applicable
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_groups",
|
||||
"type": "[`CustomerGroup`](CustomerGroup.mdx)[]",
|
||||
"description": "Customer groups associated with this condition if `type` is `customer_groups`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_rule",
|
||||
"type": "[`DiscountRule`](DiscountRule.mdx)",
|
||||
"description": "The details of the discount rule associated with the condition.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_rule_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the discount rule associated with the condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The discount condition's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "operator",
|
||||
"type": "[`DiscountConditionOperator`](../enums/DiscountConditionOperator.mdx)",
|
||||
"description": "The operator of the condition. `in` indicates that discountable resources are within the specified resources. `not_in` indicates that discountable resources are everything but the specified resources.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_collections",
|
||||
"type": "[`ProductCollection`](ProductCollection.mdx)[]",
|
||||
"description": "Product collections associated with this condition if `type` is `product_collections`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_tags",
|
||||
"type": "[`ProductTag`](ProductTag.mdx)[]",
|
||||
"description": "Product tags associated with this condition if `type` is `product_tags`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_types",
|
||||
"type": "[`ProductType`](ProductType.mdx)[]",
|
||||
"description": "Product types associated with this condition if `type` is `product_types`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "products",
|
||||
"type": "[`Product`](Product.mdx)[]",
|
||||
"description": "products associated with this condition if `type` is `products`.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`DiscountConditionType`](../enums/DiscountConditionType.mdx)",
|
||||
"description": "The type of the condition. The type affects the available resources associated with the condition. For example, if the type is `products`, that means the `products` relation will hold the products associated with this condition and other relations will be empty.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionCustomerGroup
|
||||
|
||||
Associates a discount condition with a customer group
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionCustomerGroup**()
|
||||
|
||||
Associates a discount condition with a customer group
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "condition_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Discount Condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_group",
|
||||
"type": "[`CustomerGroup`](CustomerGroup.mdx)",
|
||||
"description": "Available if the relation `customer_group` is expanded.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_group_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Tag",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)",
|
||||
"description": "Available if the relation `discount_condition` is expanded.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionProduct
|
||||
|
||||
This represents the association between a discount condition and a product
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionProduct**()
|
||||
|
||||
This represents the association between a discount condition and a product
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "condition_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Discount Condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)",
|
||||
"description": "The details of the discount condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product",
|
||||
"type": "[`Product`](Product.mdx)",
|
||||
"description": "The details of the product.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Tag",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionProductCollection
|
||||
|
||||
This represents the association between a discount condition and a product collection
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionProductCollection**()
|
||||
|
||||
This represents the association between a discount condition and a product collection
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "condition_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Discount Condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)",
|
||||
"description": "The details of the discount condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_collection",
|
||||
"type": "[`ProductCollection`](ProductCollection.mdx)",
|
||||
"description": "The details of the product collection.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_collection_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Collection",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionProductTag
|
||||
|
||||
This represents the association between a discount condition and a product tag
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionProductTag**()
|
||||
|
||||
This represents the association between a discount condition and a product tag
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "condition_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Discount Condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)",
|
||||
"description": "The details of the discount condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_tag",
|
||||
"type": "[`ProductTag`](ProductTag.mdx)",
|
||||
"description": "The details of the product tag.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_tag_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Tag",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionProductType
|
||||
|
||||
This represents the association between a discount condition and a product type
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionProductType**()
|
||||
|
||||
This represents the association between a discount condition and a product type
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "condition_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Discount Condition",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)",
|
||||
"description": "The details of the discount condition.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_type",
|
||||
"type": "[`ProductType`](ProductType.mdx)",
|
||||
"description": "The details of the product type.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_type_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Tag",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,346 +0,0 @@
|
||||
# DiscountConditionService
|
||||
|
||||
Provides layer to manipulate discount conditions.
|
||||
|
||||
**Implements**
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`DiscountConditionService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:34](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L34)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### discountConditionRepository\_
|
||||
|
||||
`Protected` `Readonly` **discountConditionRepository\_**: `Repository`<`DiscountCondition`\> & { `addConditionResources`: Method addConditionResources ; `canApplyForCustomer`: Method canApplyForCustomer ; `findOneWithDiscount`: Method findOneWithDiscount ; `getJoinTableResourceIdentifiers`: Method getJoinTableResourceIdentifiers ; `isValidForProduct`: Method isValidForProduct ; `queryConditionTable`: Method queryConditionTable ; `removeConditionResources`: Method removeConditionResources }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:31](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:32](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`discountConditionId`): `Promise`<`void` \| `DiscountCondition`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discountConditionId` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `DiscountCondition`\>
|
||||
|
||||
-`Promise`:
|
||||
-`void \| DiscountCondition`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:217](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L217)
|
||||
|
||||
___
|
||||
|
||||
### removeResources
|
||||
|
||||
**removeResources**(`data`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `Omit`<`DiscountConditionInput`, ``"id"``\> & { `id`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:184](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L184)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`conditionId`, `config?`): `Promise`<`DiscountCondition`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `conditionId` | `string` |
|
||||
| `config?` | `FindConfig`<`DiscountCondition`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DiscountCondition`\>
|
||||
|
||||
-`Promise`:
|
||||
-`DiscountCondition`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:45](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### upsertCondition
|
||||
|
||||
**upsertCondition**(`data`, `overrideExisting?`): `Promise`<(`DiscountConditionProduct` \| `DiscountConditionProductType` \| `DiscountConditionProductCollection` \| `DiscountConditionProductTag` \| `DiscountConditionCustomerGroup`)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Default value |
|
||||
| :------ | :------ |
|
||||
| `data` | `DiscountConditionInput` |
|
||||
| `overrideExisting` | `boolean` | `true` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(`DiscountConditionProduct` \| `DiscountConditionProductType` \| `DiscountConditionProductCollection` \| `DiscountConditionProductTag` \| `DiscountConditionCustomerGroup`)[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`(DiscountConditionProduct \| DiscountConditionProductType \| DiscountConditionProductCollection \| DiscountConditionProductTag \| DiscountConditionCustomerGroup)[]`:
|
||||
-`DiscountConditionProduct \| DiscountConditionProductType \| DiscountConditionProductCollection \| DiscountConditionProductTag \| DiscountConditionCustomerGroup`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:111](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L111)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`DiscountConditionService`](DiscountConditionService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DiscountConditionService`](DiscountConditionService.md)
|
||||
|
||||
-`DiscountConditionService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### resolveConditionType\_
|
||||
|
||||
`Static` `Protected` **resolveConditionType_**(`data`): `undefined` \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: `DiscountConditionType` }
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `DiscountConditionInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: `DiscountConditionType` }
|
||||
|
||||
-`undefined \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: `DiscountConditionType` }`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount-condition.ts:74](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount-condition.ts#L74)
|
||||
@@ -0,0 +1,470 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountConditionService
|
||||
|
||||
Provides layer to manipulate discount conditions.
|
||||
|
||||
#### Implements
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountConditionService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-8.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discountConditionRepository_",
|
||||
"type": "`Repository`<[`DiscountCondition`](DiscountCondition.mdx)\\> & { `addConditionResources`: Method addConditionResources ; `canApplyForCustomer`: Method canApplyForCustomer ; `findOneWithDiscount`: Method findOneWithDiscount ; `getJoinTableResourceIdentifiers`: Method getJoinTableResourceIdentifiers ; `isValidForProduct`: Method isValidForProduct ; `queryConditionTable`: Method queryConditionTable ; `removeConditionResources`: Method removeConditionResources }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`discountConditionId`): `Promise`<`void` \| [`DiscountCondition`](DiscountCondition.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "discountConditionId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| [`DiscountCondition`](DiscountCondition.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void` \\| [`DiscountCondition`](DiscountCondition.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### removeResources
|
||||
|
||||
**removeResources**(`data`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Omit`](../types/Omit.mdx)<[`DiscountConditionInput`](../types/DiscountConditionInput.mdx), ``\"id\"``\\> & { `id`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`conditionId`, `config?`): `Promise`<[`DiscountCondition`](DiscountCondition.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "conditionId",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`DiscountCondition`](DiscountCondition.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DiscountCondition`](DiscountCondition.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DiscountCondition`](DiscountCondition.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### upsertCondition
|
||||
|
||||
**upsertCondition**(`data`, `overrideExisting?`): `Promise`<([`DiscountConditionProduct`](DiscountConditionProduct.mdx) \| [`DiscountConditionProductType`](DiscountConditionProductType.mdx) \| [`DiscountConditionProductCollection`](DiscountConditionProductCollection.mdx) \| [`DiscountConditionProductTag`](DiscountConditionProductTag.mdx) \| [`DiscountConditionCustomerGroup`](DiscountConditionCustomerGroup.mdx))[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`DiscountConditionInput`](../types/DiscountConditionInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "overrideExisting",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "true",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<([`DiscountConditionProduct`](DiscountConditionProduct.mdx) \| [`DiscountConditionProductType`](DiscountConditionProductType.mdx) \| [`DiscountConditionProductCollection`](DiscountConditionProductCollection.mdx) \| [`DiscountConditionProductTag`](DiscountConditionProductTag.mdx) \| [`DiscountConditionCustomerGroup`](DiscountConditionCustomerGroup.mdx))[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<([`DiscountConditionProduct`](DiscountConditionProduct.mdx) \\| [`DiscountConditionProductType`](DiscountConditionProductType.mdx) \\| [`DiscountConditionProductCollection`](DiscountConditionProductCollection.mdx) \\| [`DiscountConditionProductTag`](DiscountConditionProductTag.mdx) \\| [`DiscountConditionCustomerGroup`](DiscountConditionCustomerGroup.mdx))[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`DiscountConditionService`](DiscountConditionService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DiscountConditionService`](DiscountConditionService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "DiscountConditionService",
|
||||
"type": "[`DiscountConditionService`](DiscountConditionService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### resolveConditionType\_
|
||||
|
||||
`Static` `Protected` **resolveConditionType_**(`data`): `undefined` \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: [`DiscountConditionType`](../enums/DiscountConditionType.mdx) }
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`DiscountConditionInput`](../types/DiscountConditionInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| { `resource_ids`: (`string` \| { `id`: `string` })[] ; `type`: [`DiscountConditionType`](../enums/DiscountConditionType.mdx) }
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "undefined \\| { `resource_ids`: (`string` \\| { `id`: `string` })[] ; `type`: [`DiscountConditionType`](../enums/DiscountConditionType.mdx) }",
|
||||
"type": "`undefined` \\| { `resource_ids`: (`string` \\| { `id`: `string` })[] ; `type`: [`DiscountConditionType`](../enums/DiscountConditionType.mdx) }",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DiscountRule
|
||||
|
||||
A discount rule defines how a Discount is calculated when applied to a Cart.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountRule**()
|
||||
|
||||
A discount rule defines how a Discount is calculated when applied to a Cart.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "allocation",
|
||||
"type": "[`AllocationType`](../enums/AllocationType.mdx)",
|
||||
"description": "The scope that the discount should apply to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "conditions",
|
||||
"type": "[`DiscountCondition`](DiscountCondition.mdx)[]",
|
||||
"description": "The details of the discount conditions associated with the rule. They can be used to limit when the discount can be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "A short description of the discount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The discount rule's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`DiscountRuleType`](../enums/DiscountRuleType.mdx)",
|
||||
"description": "The type of the Discount, can be `fixed` for discounts that reduce the price by a fixed amount, `percentage` for percentage reductions or `free_shipping` for shipping vouchers.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`number`",
|
||||
"description": "The value that the discount represents; this will depend on the type of the discount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,894 +0,0 @@
|
||||
# DiscountService
|
||||
|
||||
Provides layer to manipulate discounts.
|
||||
|
||||
**Implements**
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`DiscountService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DiscountService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `Object` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:71](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L71)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### customerService\_
|
||||
|
||||
`Protected` `Readonly` **customerService\_**: [`CustomerService`](CustomerService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:58](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### discountConditionRepository\_
|
||||
|
||||
`Protected` `Readonly` **discountConditionRepository\_**: `Repository`<`DiscountCondition`\> & { `addConditionResources`: Method addConditionResources ; `canApplyForCustomer`: Method canApplyForCustomer ; `findOneWithDiscount`: Method findOneWithDiscount ; `getJoinTableResourceIdentifiers`: Method getJoinTableResourceIdentifiers ; `isValidForProduct`: Method isValidForProduct ; `queryConditionTable`: Method queryConditionTable ; `removeConditionResources`: Method removeConditionResources }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:62](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
### discountConditionService\_
|
||||
|
||||
`Protected` `Readonly` **discountConditionService\_**: [`DiscountConditionService`](DiscountConditionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:63](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### discountRepository\_
|
||||
|
||||
`Protected` `Readonly` **discountRepository\_**: `Repository`<`Discount`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:57](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### discountRuleRepository\_
|
||||
|
||||
`Protected` `Readonly` **discountRuleRepository\_**: `Repository`<`DiscountRule`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:59](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:68](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### featureFlagRouter\_
|
||||
|
||||
`Protected` `Readonly` **featureFlagRouter\_**: `FlagRouter`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:69](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L69)
|
||||
|
||||
___
|
||||
|
||||
### giftCardRepository\_
|
||||
|
||||
`Protected` `Readonly` **giftCardRepository\_**: `Repository`<`GiftCard`\> & { `listGiftCardsAndCount`: Method listGiftCardsAndCount }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:60](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L60)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### newTotalsService\_
|
||||
|
||||
`Protected` `Readonly` **newTotalsService\_**: [`NewTotalsService`](NewTotalsService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:65](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### productService\_
|
||||
|
||||
`Protected` `Readonly` **productService\_**: [`ProductService`](ProductService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:66](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L66)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
`Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:67](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L67)
|
||||
|
||||
___
|
||||
|
||||
### totalsService\_
|
||||
|
||||
`Protected` `Readonly` **totalsService\_**: [`TotalsService`](TotalsService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:64](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### addRegion
|
||||
|
||||
**addRegion**(`discountId`, `regionId`): `Promise`<`Discount`\>
|
||||
|
||||
Adds a region to the discount regions array.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | id of discount |
|
||||
| `regionId` | `string` | id of region to add |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the result of the update operation
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:503](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L503)
|
||||
|
||||
___
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### calculateDiscountForLineItem
|
||||
|
||||
**calculateDiscountForLineItem**(`discountId`, `lineItem`, `calculationContextData`): `Promise`<`number`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discountId` | `string` |
|
||||
| `lineItem` | `LineItem` |
|
||||
| `calculationContextData` | `CalculationContextData` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
-`Promise`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:599](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L599)
|
||||
|
||||
___
|
||||
|
||||
### canApplyForCustomer
|
||||
|
||||
**canApplyForCustomer**(`discountRuleId`, `customerId`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discountRuleId` | `string` |
|
||||
| `customerId` | `undefined` \| `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`:
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:791](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L791)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`discount`): `Promise`<`Discount`\>
|
||||
|
||||
Creates a discount with provided data given that the data is validated.
|
||||
Normalizes discount code to uppercase.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discount` | `CreateDiscountInput` | the discount data to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the result of the create operation
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:178](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L178)
|
||||
|
||||
___
|
||||
|
||||
### createDynamicCode
|
||||
|
||||
**createDynamicCode**(`discountId`, `data`): `Promise`<`Discount`\>
|
||||
|
||||
Creates a dynamic code for a discount id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the newly created dynamic code
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:431](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L431)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`discountId`): `Promise`<`void`\>
|
||||
|
||||
Deletes a discount idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | id of discount to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`: the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:563](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L563)
|
||||
|
||||
___
|
||||
|
||||
### deleteDynamicCode
|
||||
|
||||
**deleteDynamicCode**(`discountId`, `code`): `Promise`<`void`\>
|
||||
|
||||
Deletes a dynamic code for a discount id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | the id of the discount to create a code for |
|
||||
| `code` | `string` | the code to identify the discount by |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`: the newly created dynamic code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:482](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L482)
|
||||
|
||||
___
|
||||
|
||||
### hasCustomersGroupCondition
|
||||
|
||||
**hasCustomersGroupCondition**(`discount`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:744](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L744)
|
||||
|
||||
___
|
||||
|
||||
### hasExpired
|
||||
|
||||
**hasExpired**(`discount`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:760](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L760)
|
||||
|
||||
___
|
||||
|
||||
### hasNotStarted
|
||||
|
||||
**hasNotStarted**(`discount`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:756](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L756)
|
||||
|
||||
___
|
||||
|
||||
### hasReachedLimit
|
||||
|
||||
**hasReachedLimit**(`discount`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:750](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L750)
|
||||
|
||||
___
|
||||
|
||||
### isDisabled
|
||||
|
||||
**isDisabled**(`discount`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:768](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L768)
|
||||
|
||||
___
|
||||
|
||||
### isValidForRegion
|
||||
|
||||
**isValidForRegion**(`discount`, `region_id`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discount` | `Discount` |
|
||||
| `region_id` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`:
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:772](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L772)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<`Discount`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `FilterableDiscountProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`Discount[]`:
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:125](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L125)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config?`): `Promise`<[`Discount`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `FilterableDiscountProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Discount`[], `number`]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`Discount[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:142](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L142)
|
||||
|
||||
___
|
||||
|
||||
### listByCodes
|
||||
|
||||
**listByCodes**(`discountCodes`, `config?`): `Promise`<`Discount`[]\>
|
||||
|
||||
List all the discounts corresponding to the given codes
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountCodes` | `string`[] | discount codes of discounts to retrieve |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`[]\>
|
||||
|
||||
-`Promise`: the discounts
|
||||
-`Discount[]`:
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:307](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L307)
|
||||
|
||||
___
|
||||
|
||||
### removeRegion
|
||||
|
||||
**removeRegion**(`discountId`, `regionId`): `Promise`<`Discount`\>
|
||||
|
||||
Removes a region from the discount regions array.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | id of discount |
|
||||
| `regionId` | `string` | id of region to remove |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the result of the update operation
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:538](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L538)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`discountId`, `config?`): `Promise`<`Discount`\>
|
||||
|
||||
Gets a discount by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | id of discount to retrieve |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the discount
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:244](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L244)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
**retrieveByCode**(`discountCode`, `config?`): `Promise`<`Discount`\>
|
||||
|
||||
Gets the discount by discount code.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountCode` | `string` | discount code of discount to retrieve |
|
||||
| `config` | `FindConfig`<`Discount`\> | the config object containing query settings |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the discount
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:278](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L278)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`discountId`, `update`): `Promise`<`Discount`\>
|
||||
|
||||
Updates a discount.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountId` | `string` | discount id of discount to update |
|
||||
| `update` | `UpdateDiscountInput` | the data to update the discount with |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Discount`\>
|
||||
|
||||
-`Promise`: the result of the update operation
|
||||
-`Discount`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:338](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L338)
|
||||
|
||||
___
|
||||
|
||||
### validateDiscountForCartOrThrow
|
||||
|
||||
**validateDiscountForCartOrThrow**(`cart`, `discount`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `cart` | `Cart` |
|
||||
| `discount` | `Discount` \| `Discount`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:672](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L672)
|
||||
|
||||
___
|
||||
|
||||
### validateDiscountForProduct
|
||||
|
||||
**validateDiscountForProduct**(`discountRuleId`, `productId?`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `discountRuleId` | `string` |
|
||||
| `productId?` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`:
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:577](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L577)
|
||||
|
||||
___
|
||||
|
||||
### validateDiscountRule\_
|
||||
|
||||
**validateDiscountRule_**<`T`\>(`discountRule`): `T`
|
||||
|
||||
Creates a discount rule with provided data given that the data is validated.
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `discountRule` | `T` | the discount rule to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`T`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/discount.ts:107](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/discount.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`DiscountService`](DiscountService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DiscountService`](DiscountService.md)
|
||||
|
||||
-`DiscountService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,170 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DraftOrder
|
||||
|
||||
A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DraftOrder**()
|
||||
|
||||
A draft order is created by an admin without direct involvement of the customer. Once its payment is marked as captured, it is transformed into an order.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "canceled_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date the draft order was canceled at.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "The details of the cart associated with the draft order.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the cart associated with the draft order.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "completed_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date the draft order was completed at.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "display_id",
|
||||
"type": "`number`",
|
||||
"description": "The draft order's display ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The draft order's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotency_key",
|
||||
"type": "`string`",
|
||||
"description": "Randomly generated key used to continue the completion of the cart associated with the draft order in case of failure.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "no_notification_order",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether to send the customer notifications regarding order updates.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order created from the draft order when its payment is captured.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the order created from the draft order when its payment is captured.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`DraftOrderStatus`](../enums/DraftOrderStatus.mdx)",
|
||||
"description": "The status of the draft order. It's changed to `completed` when it's transformed to an order.",
|
||||
"optional": false,
|
||||
"defaultValue": "open",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `Promise`<`void`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,526 +0,0 @@
|
||||
# DraftOrderService
|
||||
|
||||
Handles draft orders
|
||||
|
||||
**Implements**
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`DraftOrderService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DraftOrderService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:67](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L67)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### cartService\_
|
||||
|
||||
`Protected` `Readonly` **cartService\_**: [`CartService`](CartService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:61](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L61)
|
||||
|
||||
___
|
||||
|
||||
### customShippingOptionService\_
|
||||
|
||||
`Protected` `Readonly` **customShippingOptionService\_**: [`CustomShippingOptionService`](CustomShippingOptionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:65](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### draftOrderRepository\_
|
||||
|
||||
`Protected` `Readonly` **draftOrderRepository\_**: `Repository`<`DraftOrder`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:57](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L57)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:60](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L60)
|
||||
|
||||
___
|
||||
|
||||
### lineItemService\_
|
||||
|
||||
`Protected` `Readonly` **lineItemService\_**: [`LineItemService`](LineItemService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:62](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L62)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### orderRepository\_
|
||||
|
||||
`Protected` `Readonly` **orderRepository\_**: `Repository`<`Order`\> & { `findOneWithRelations`: Method findOneWithRelations ; `findWithRelations`: Method findWithRelations }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:59](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L59)
|
||||
|
||||
___
|
||||
|
||||
### paymentRepository\_
|
||||
|
||||
`Protected` `Readonly` **paymentRepository\_**: `Repository`<`Payment`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:58](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### productVariantService\_
|
||||
|
||||
`Protected` `Readonly` **productVariantService\_**: [`ProductVariantService`](ProductVariantService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:63](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### shippingOptionService\_
|
||||
|
||||
`Protected` `Readonly` **shippingOptionService\_**: [`ShippingOptionService`](ShippingOptionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:64](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` `Readonly` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CREATED` | `string` |
|
||||
| `UPDATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:52](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L52)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Creates a draft order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `DraftOrderCreateProps` | data to create draft order from |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
-`Promise`: the created draft order
|
||||
-`DraftOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:260](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L260)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`draftOrderId`): `Promise`<`undefined` \| `DraftOrder`\>
|
||||
|
||||
Deletes draft order idempotently.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `draftOrderId` | `string` | id of draft order to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| `DraftOrder`\>
|
||||
|
||||
-`Promise`: empty promise
|
||||
-`undefined \| DraftOrder`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:156](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L156)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<`DraftOrder`[]\>
|
||||
|
||||
Lists draft orders
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `any` | query object for find |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | configurable attributes for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`[]\>
|
||||
|
||||
-`Promise`: list of draft orders
|
||||
-`DraftOrder[]`:
|
||||
-`DraftOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:238](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L238)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector`, `config?`): `Promise`<[`DraftOrder`[], `number`]\>
|
||||
|
||||
Lists draft orders alongside the count
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `any` | query selector to filter draft orders |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query config |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`[], `number`]\>
|
||||
|
||||
-`Promise`: draft orders
|
||||
-`DraftOrder[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:180](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L180)
|
||||
|
||||
___
|
||||
|
||||
### registerCartCompletion
|
||||
|
||||
**registerCartCompletion**(`draftOrderId`, `orderId`): `Promise`<`UpdateResult`\>
|
||||
|
||||
Registers a draft order as completed, when an order has been completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `draftOrderId` | `string` | id of draft order to complete |
|
||||
| `orderId` | `string` | id of order completed from draft order cart |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`UpdateResult`\>
|
||||
|
||||
-`Promise`: the created order
|
||||
-`UpdateResult`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:420](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L420)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`draftOrderId`, `config?`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Retrieves a draft order with the given id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `draftOrderId` | `string` | id of the draft order to retrieve |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query object for findOne |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
-`Promise`: the draft order
|
||||
-`DraftOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:98](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L98)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCartId
|
||||
|
||||
**retrieveByCartId**(`cartId`, `config?`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Retrieves a draft order based on its associated cart id
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `cartId` | `string` | cart id that the draft orders's cart has |
|
||||
| `config` | `FindConfig`<`DraftOrder`\> | query object for findOne |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
-`Promise`: the draft order
|
||||
-`DraftOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:131](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<`DraftOrder`\>
|
||||
|
||||
Updates a draft order with the given data
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | id of the draft order |
|
||||
| `data` | `object` | values to update the order with |
|
||||
| `data.no_notification_order` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`DraftOrder`\>
|
||||
|
||||
-`Promise`: the updated draft order
|
||||
-`DraftOrder`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/draft-order.ts:449](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/draft-order.ts#L449)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`DraftOrderService`](DraftOrderService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DraftOrderService`](DraftOrderService.md)
|
||||
|
||||
-`DraftOrderService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,729 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# DraftOrderService
|
||||
|
||||
Handles draft orders
|
||||
|
||||
#### Implements
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new DraftOrderService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-9.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cartService_",
|
||||
"type": "[`CartService`](CartService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customShippingOptionService_",
|
||||
"type": "[`CustomShippingOptionService`](CustomShippingOptionService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "draftOrderRepository_",
|
||||
"type": "`Repository`<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemService_",
|
||||
"type": "[`LineItemService`](LineItemService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "orderRepository_",
|
||||
"type": "`Repository`<[`Order`](Order.mdx)\\> & { `findOneWithRelations`: Method findOneWithRelations ; `findWithRelations`: Method findWithRelations }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "paymentRepository_",
|
||||
"type": "`Repository`<[`Payment`](Payment.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "productVariantService_",
|
||||
"type": "[`ProductVariantService`](ProductVariantService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shippingOptionService_",
|
||||
"type": "[`ShippingOptionService`](ShippingOptionService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"draft_order.created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.UPDATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"draft_order.updated\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
Creates a draft order.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`DraftOrderCreateProps`](../types/DraftOrderCreateProps.mdx)",
|
||||
"description": "data to create draft order from",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the created draft order",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`draftOrderId`): `Promise`<`undefined` \| [`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
Deletes draft order idempotently.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "draftOrderId",
|
||||
"type": "`string`",
|
||||
"description": "id of draft order to delete",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| [`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`undefined` \\| [`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "empty promise",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<[`DraftOrder`](DraftOrder.mdx)[]\>
|
||||
|
||||
Lists draft orders
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "`any`",
|
||||
"description": "query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"description": "configurable attributes for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`](DraftOrder.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DraftOrder`](DraftOrder.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "list of draft orders",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector`, `config?`): `Promise`<[[`DraftOrder`](DraftOrder.mdx)[], `number`]\>
|
||||
|
||||
Lists draft orders alongside the count
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "`any`",
|
||||
"description": "query selector to filter draft orders",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"description": "query config",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[[`DraftOrder`](DraftOrder.mdx)[], `number`]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[[`DraftOrder`](DraftOrder.mdx)[], `number`]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "draft orders",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### registerCartCompletion
|
||||
|
||||
**registerCartCompletion**(`draftOrderId`, `orderId`): `Promise`<`UpdateResult`\>
|
||||
|
||||
Registers a draft order as completed, when an order has been completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "draftOrderId",
|
||||
"type": "`string`",
|
||||
"description": "id of draft order to complete",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "orderId",
|
||||
"type": "`string`",
|
||||
"description": "id of order completed from draft order cart",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`UpdateResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`UpdateResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the created order",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`draftOrderId`, `config?`): `Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
Retrieves a draft order with the given id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "draftOrderId",
|
||||
"type": "`string`",
|
||||
"description": "id of the draft order to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"description": "query object for findOne",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the draft order",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCartId
|
||||
|
||||
**retrieveByCartId**(`cartId`, `config?`): `Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
Retrieves a draft order based on its associated cart id
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "cartId",
|
||||
"type": "`string`",
|
||||
"description": "cart id that the draft orders's cart has",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"description": "query object for findOne",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the draft order",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
Updates a draft order with the given data
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "id of the draft order",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`object`",
|
||||
"description": "values to update the order with",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data.no_notification_order",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`DraftOrder`](DraftOrder.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`DraftOrder`](DraftOrder.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the updated draft order",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`DraftOrderService`](DraftOrderService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`DraftOrderService`](DraftOrderService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "DraftOrderService",
|
||||
"type": "[`DraftOrderService`](DraftOrderService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,474 +0,0 @@
|
||||
# EventBusService
|
||||
|
||||
Can keep track of multiple subscribers to different events and run the
|
||||
subscribers when events happen. Events will run asynchronously.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`EventBusService`**
|
||||
|
||||
## Implements
|
||||
|
||||
- `IEventBusService`
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new EventBusService**(`«destructured»`, `config`, `isSingleton?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Default value |
|
||||
| :------ | :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
| `config` | `any` |
|
||||
| `isSingleton` | `boolean` | `true` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:36](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L36)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### config\_
|
||||
|
||||
`Protected` `Readonly` **config\_**: `ConfigModule`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:27](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L27)
|
||||
|
||||
___
|
||||
|
||||
### enqueue\_
|
||||
|
||||
`Protected` **enqueue\_**: `Promise`<`void`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:34](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### eventBusModuleService\_
|
||||
|
||||
`Protected` `Readonly` **eventBusModuleService\_**: `IEventBusModuleService`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:30](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L30)
|
||||
|
||||
___
|
||||
|
||||
### logger\_
|
||||
|
||||
`Protected` `Readonly` **logger\_**: `Logger`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:31](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### shouldEnqueuerRun
|
||||
|
||||
`Protected` **shouldEnqueuerRun**: `boolean`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:33](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### stagedJobService\_
|
||||
|
||||
`Protected` `Readonly` **stagedJobService\_**: [`StagedJobService`](StagedJobService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:28](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L28)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### emit
|
||||
|
||||
**emit**<`T`\>(`data`): `Promise`<`void` \| `StagedJob`[]\>
|
||||
|
||||
Calls all subscribers when an event occurs.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `EmitData`<`T`\>[] | The data to use to process the events |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `StagedJob`[]\>
|
||||
|
||||
-`Promise`: the jobs from our queue
|
||||
-`void \| StagedJob[]`: (optional)
|
||||
|
||||
#### Implementation of
|
||||
|
||||
EventBusTypes.IEventBusService.emit
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:117](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L117)
|
||||
|
||||
**emit**<`T`\>(`eventName`, `data`, `options?`): `Promise`<`void` \| `StagedJob`\>
|
||||
|
||||
Calls all subscribers when an event occurs.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `T` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `eventName` | `string` | the name of the event to be process. |
|
||||
| `data` | `T` | the data to send to the subscriber. |
|
||||
| `options?` | Record<`string`, `unknown`\> | options to add the job with |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `StagedJob`\>
|
||||
|
||||
-`Promise`: the job from our queue
|
||||
-`void \| StagedJob`: (optional)
|
||||
|
||||
#### Implementation of
|
||||
|
||||
EventBusTypes.IEventBusService.emit
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:126](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L126)
|
||||
|
||||
___
|
||||
|
||||
### enqueuer\_
|
||||
|
||||
**enqueuer_**(): `Promise`<`void`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:190](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L190)
|
||||
|
||||
___
|
||||
|
||||
### listJobs
|
||||
|
||||
`Protected` **listJobs**(`listConfig`): `Promise`<`never`[] \| `StagedJob`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `listConfig` | `FindConfig`<`StagedJob`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`never`[] \| `StagedJob`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`never[] \| StagedJob[]`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:220](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L220)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### startEnqueuer
|
||||
|
||||
**startEnqueuer**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:180](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L180)
|
||||
|
||||
___
|
||||
|
||||
### stopEnqueuer
|
||||
|
||||
**stopEnqueuer**(): `Promise`<`void`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:185](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L185)
|
||||
|
||||
___
|
||||
|
||||
### subscribe
|
||||
|
||||
**subscribe**(`event`, `subscriber`, `context?`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
Adds a function to a list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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. |
|
||||
| `context?` | `SubscriberContext` | subscriber context |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
-`default`: this
|
||||
|
||||
#### Implementation of
|
||||
|
||||
EventBusTypes.IEventBusService.subscribe
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:83](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L83)
|
||||
|
||||
___
|
||||
|
||||
### unsubscribe
|
||||
|
||||
**unsubscribe**(`event`, `subscriber`, `context`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
Removes function from the list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `event` | `string` \| `symbol` | the event of the subcriber. |
|
||||
| `subscriber` | `Subscriber`<`unknown`\> | the function to be removed |
|
||||
| `context` | `SubscriberContext` | subscriber context |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
-`default`: this
|
||||
|
||||
#### Implementation of
|
||||
|
||||
EventBusTypes.IEventBusService.unsubscribe
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:103](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L103)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.md)
|
||||
|
||||
-`default`:
|
||||
|
||||
#### Implementation of
|
||||
|
||||
EventBusTypes.IEventBusService.withTransaction
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/event-bus.ts:54](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/event-bus.ts#L54)
|
||||
@@ -0,0 +1,670 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# EventBusService
|
||||
|
||||
Can keep track of multiple subscribers to different events and run the
|
||||
subscribers when events happen. Events will run asynchronously.
|
||||
|
||||
## Implements
|
||||
|
||||
- [`IEventBusService`](../interfaces/IEventBusService.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new EventBusService**(`«destructured»`, `config`, `isSingleton?`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-10.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isSingleton",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "true",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config_",
|
||||
"type": "[`ConfigModule`](../types/ConfigModule.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "enqueue_",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "logger_",
|
||||
"type": "[`Logger`](../interfaces/Logger.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shouldEnqueuerRun",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stagedJobService_",
|
||||
"type": "[`StagedJobService`](StagedJobService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### eventBusModuleService\_
|
||||
|
||||
`Protected` `get` **eventBusModuleService_**(): [`IEventBusModuleService`](../interfaces/IEventBusModuleService.mdx)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`IEventBusModuleService`](../interfaces/IEventBusModuleService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "IEventBusModuleService",
|
||||
"type": "[`IEventBusModuleService`](../interfaces/IEventBusModuleService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### emit
|
||||
|
||||
**emit**<`T`\>(`data`): `Promise`<`void` \| [`StagedJob`](StagedJob.mdx)[]\>
|
||||
|
||||
Calls all subscribers when an event occurs.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`EmitData`](../types/EmitData.mdx)<`T`\\>[]",
|
||||
"description": "The data to use to process the events",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| [`StagedJob`](StagedJob.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void` \\| [`StagedJob`](StagedJob.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the jobs from our queue",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
**emit**<`T`\>(`eventName`, `data`, `options?`): `Promise`<`void` \| [`StagedJob`](StagedJob.mdx)\>
|
||||
|
||||
Calls all subscribers when an event occurs.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "T",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "eventName",
|
||||
"type": "`string`",
|
||||
"description": "the name of the event to be process.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "`T`",
|
||||
"description": "the data to send to the subscriber.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "options to add the job with",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| [`StagedJob`](StagedJob.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void` \\| [`StagedJob`](StagedJob.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the job from our queue",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### enqueuer\_
|
||||
|
||||
**enqueuer_**(): `Promise`<`void`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listJobs
|
||||
|
||||
`Protected` **listJobs**(`listConfig`): `Promise`<`never`[] \| [`StagedJob`](StagedJob.mdx)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "listConfig",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`StagedJob`](StagedJob.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`never`[] \| [`StagedJob`](StagedJob.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`never`[] \\| [`StagedJob`](StagedJob.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### startEnqueuer
|
||||
|
||||
**startEnqueuer**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### stopEnqueuer
|
||||
|
||||
**stopEnqueuer**(): `Promise`<`void`\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### subscribe
|
||||
|
||||
**subscribe**(`event`, `subscriber`, `context?`): [`EventBusService`](EventBusService.mdx)
|
||||
|
||||
Adds a function to a list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "event",
|
||||
"type": "`string` \\| `symbol`",
|
||||
"description": "the event that the subscriber will listen for.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subscriber",
|
||||
"type": "[`Subscriber`](../types/Subscriber.mdx)<`unknown`\\>",
|
||||
"description": "the function to be called when a certain event happens. Subscribers must return a Promise.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`SubscriberContext`](../types/SubscriberContext.mdx)",
|
||||
"description": "subscriber context",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "default",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "this",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### unsubscribe
|
||||
|
||||
**unsubscribe**(`event`, `subscriber`, `context`): [`EventBusService`](EventBusService.mdx)
|
||||
|
||||
Removes function from the list of event subscribers.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "event",
|
||||
"type": "`string` \\| `symbol`",
|
||||
"description": "the event of the subcriber.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subscriber",
|
||||
"type": "[`Subscriber`](../types/Subscriber.mdx)<`unknown`\\>",
|
||||
"description": "the function to be removed",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`SubscriberContext`](../types/SubscriberContext.mdx)",
|
||||
"description": "subscriber context",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "default",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "this",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`EventBusService`](EventBusService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`EventBusService`](EventBusService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "default",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableBatchJobProps
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableBatchJobProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`BatchJobStatus`](../enums/BatchJobStatus.mdx)[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "`string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableCartProps
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableCartProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[] \\| [`StringComparisonOperator`](StringComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableDiscountProps
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableDiscountProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_disabled",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_dynamic",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "q",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rule",
|
||||
"type": "[`AdminGetDiscountsDiscountRuleParams`](AdminGetDiscountsDiscountRuleParams.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableLineItemAdjustmentProps
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableLineItemAdjustmentProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[] \\| [`StringComparisonOperator`](StringComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "resource_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,110 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterablePriceListProps
|
||||
|
||||
Filters to apply on the retrieved price lists.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterablePriceListProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the price lists' `created_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "customer_groups",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter price lists by their associated customer groups.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the price lists' `deleted_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "Description to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "IDs to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "Name to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "q",
|
||||
"type": "`string`",
|
||||
"description": "Search terms to search price lists' description, name, and customer group's name.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`PriceListStatus`](../enums/PriceListStatus.mdx)[]",
|
||||
"description": "Statuses to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
"type": "[`PriceListType`](../enums/PriceListType.mdx)[]",
|
||||
"description": "Types to filter price lists by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the price lists' `updated_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,183 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableProductProps
|
||||
|
||||
Filters to apply on retrieved products.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableProductProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "category_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated product category's ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "collection_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated product collection's ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the products' `created_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the products' `deleted_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "Description to filter products by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_condition_id",
|
||||
"type": "`string`",
|
||||
"description": "Filter products by their associated discount condition's ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "handle",
|
||||
"type": "`string`",
|
||||
"description": "Handle to filter products by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "IDs to filter products by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "include_category_children",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether to include product category children in the response.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"featureFlag": "product_categories",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_giftcard",
|
||||
"type": "`boolean`",
|
||||
"description": "Filter products by whether they're gift cards.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated price lists' ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "q",
|
||||
"type": "`string`",
|
||||
"description": "Search term to search products' title, description, variants' title and sku, and collections' title.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sales_channel_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated sales channels' ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "status",
|
||||
"type": "[`ProductStatus`](../enums/ProductStatus.mdx)[]",
|
||||
"description": "Statuses to filter products by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tags",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated tags' value.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "Title to filter products by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "type_id",
|
||||
"type": "`string`[]",
|
||||
"description": "Filter products by their associated product type's ID.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "Date filters to apply on the products' `updated_at` date.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,207 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FilterableProductVariantProps
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FilterableProductVariantProps**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "allow_backorder",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "barcode",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ean",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`number` \\| [`NumericalComparisonOperator`](NumericalComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[] \\| [`StringComparisonOperator`](StringComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_quantity",
|
||||
"type": "`number` \\| [`NumericalComparisonOperator`](NumericalComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`number` \\| [`NumericalComparisonOperator`](NumericalComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manage_inventory",
|
||||
"type": "`boolean`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "q",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "upc",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "[`DateComparisonOperator`](DateComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`number` \\| [`NumericalComparisonOperator`](NumericalComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`number` \\| [`NumericalComparisonOperator`](NumericalComparisonOperator.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,162 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FlagRouter
|
||||
|
||||
## Implements
|
||||
|
||||
- [`IFlagRouter`](../interfaces/IFlagRouter.mdx)
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FlagRouter**(`flags`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "flags",
|
||||
"type": "Record<`string`, `boolean` \\| Record<`string`, `boolean`\\>\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "flags",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### isFeatureEnabled
|
||||
|
||||
**isFeatureEnabled**(`flag`): `boolean`
|
||||
|
||||
Check if a feature flag is enabled.
|
||||
There are two ways of using this method:
|
||||
1. `isFeatureEnabled("myFeatureFlag")`
|
||||
2. `isFeatureEnabled({ myNestedFeatureFlag: "someNestedFlag" })`
|
||||
We use 1. for top-level feature flags and 2. for nested feature flags. Almost all flags are top-level.
|
||||
An example of a nested flag is workflows. To use it, you would do:
|
||||
`isFeatureEnabled({ workflows: Workflows.CreateCart })`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "flag",
|
||||
"type": "`string` \\| Record<`string`, `string`\\>",
|
||||
"description": "The flag to check",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "- Whether the flag is enabled or not",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listFlags
|
||||
|
||||
**listFlags**(): [`FeatureFlagsResponse`](../types/FeatureFlagsResponse.mdx)
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FeatureFlagsResponse`](../types/FeatureFlagsResponse.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "FeatureFlagsResponse",
|
||||
"type": "{ `key`: `string` ; `value`: `boolean` \\| Record<`string`, `boolean`\\> }[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### setFlag
|
||||
|
||||
**setFlag**(`key`, `value`): `void`
|
||||
|
||||
Sets a feature flag.
|
||||
Flags take two shapes:
|
||||
setFlag("myFeatureFlag", true)
|
||||
setFlag("myFeatureFlag", { nestedFlag: true })
|
||||
These shapes are used for top-level and nested flags respectively, as explained in isFeatureEnabled.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "key",
|
||||
"type": "`string`",
|
||||
"description": "The key of the flag to set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`boolean` \\| { `[key: string]`: `boolean`; }",
|
||||
"description": "The value of the flag to set.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "- void",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,233 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Fulfillment
|
||||
|
||||
A Fulfillment is created once an admin can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a fulfillment provider, which typically integrates a third-party shipping service. Fulfillments can be associated with orders, claims, swaps, and returns.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Fulfillment**()
|
||||
|
||||
A Fulfillment is created once an admin can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a fulfillment provider, which typically integrates a third-party shipping service. Fulfillments can be associated with orders, claims, swaps, and returns.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "canceled_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the Fulfillment was canceled.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_order",
|
||||
"type": "[`ClaimOrder`](ClaimOrder.mdx)",
|
||||
"description": "The details of the claim that the fulfillment may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Claim that the Fulfillment belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "This contains all the data necessary for the Fulfillment provider to handle the fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The fulfillment's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotency_key",
|
||||
"type": "`string`",
|
||||
"description": "Randomly generated key used to continue the completion of the fulfillment in case of failure.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"type": "[`FulfillmentItem`](FulfillmentItem.mdx)[]",
|
||||
"description": "The Fulfillment Items in the Fulfillment. These hold information about how many of each Line Item has been fulfilled.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The ID of the stock location the fulfillment will be shipped from",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "no_notification",
|
||||
"type": "`boolean`",
|
||||
"description": "Flag for describing whether or not notifications related to this should be sent.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order that the fulfillment may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Order that the Fulfillment belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "provider",
|
||||
"type": "[`FulfillmentProvider`](FulfillmentProvider.mdx)",
|
||||
"description": "The details of the fulfillment provider responsible for handling the fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "provider_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Fulfillment Provider responsible for handling the fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipped_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the Fulfillment was shipped.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "swap",
|
||||
"type": "[`Swap`](Swap.mdx)",
|
||||
"description": "The details of the swap that the fulfillment may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "swap_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Swap that the Fulfillment belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tracking_links",
|
||||
"type": "[`TrackingLink`](TrackingLink.mdx)[]",
|
||||
"description": "The Tracking Links that can be used to track the status of the Fulfillment. These will usually be provided by the Fulfillment Provider.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tracking_numbers",
|
||||
"type": "`string`[]",
|
||||
"description": "The tracking numbers that can be used to track the status of the fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,67 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FulfillmentItem
|
||||
|
||||
This represents the association between a Line Item and a Fulfillment.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentItem**()
|
||||
|
||||
This represents the association between a Line Item and a Fulfillment.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillment",
|
||||
"type": "[`Fulfillment`](Fulfillment.mdx)",
|
||||
"description": "The details of the fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillment_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Fulfillment that the Fulfillment Item belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "The details of the line item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Line Item that the Fulfillment Item references.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The quantity of the Line Item that is included in the Fulfillment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FulfillmentProvider
|
||||
|
||||
A fulfillment provider represents a fulfillment service installed in the Medusa backend, either through a plugin or backend customizations. It holds the fulfillment service's installation status.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentProvider**()
|
||||
|
||||
A fulfillment provider represents a fulfillment service installed in the Medusa backend, either through a plugin or backend customizations. It holds the fulfillment service's installation status.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the fulfillment provider as given by the fulfillment service.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_installed",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the fulfillment service is installed in the current version. If a fulfillment service is no longer installed, the `is_installed` attribute is set to `false`.",
|
||||
"optional": false,
|
||||
"defaultValue": "true",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,514 +0,0 @@
|
||||
# FulfillmentProviderService
|
||||
|
||||
Helps retrieve fulfillment providers
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`FulfillmentProviderService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentProviderService**(`container`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `container` | `FulfillmentProviderContainer` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:44](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L44)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### container\_
|
||||
|
||||
`Protected` `Readonly` **container\_**: `FulfillmentProviderContainer`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:40](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### fulfillmentProviderRepository\_
|
||||
|
||||
`Protected` `Readonly` **fulfillmentProviderRepository\_**: `Repository`<`FulfillmentProvider`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:42](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### calculatePrice
|
||||
|
||||
**calculatePrice**(`option`, `data`, `cart?`): `Promise`<`number`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `option` | `ShippingOption` |
|
||||
| `data` | Record<`string`, `unknown`\> |
|
||||
| `cart?` | `Order` \| `Cart` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
-`Promise`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:147](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### canCalculate
|
||||
|
||||
**canCalculate**(`option`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `option` | `CalculateOptionPriceInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`:
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:122](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**cancelFulfillment**(`fulfillment`): `Promise`<`Fulfillment`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `fulfillment` | `Fulfillment` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
-`Promise`:
|
||||
-`Fulfillment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:140](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L140)
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**createFulfillment**(`method`, `items`, `order`, `fulfillment`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `method` | `ShippingMethod` |
|
||||
| `items` | `LineItem`[] |
|
||||
| `order` | `CreateFulfillmentOrder` |
|
||||
| `fulfillment` | `Omit`<`Fulfillment`, ``"beforeInsert"``\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
-`Promise`:
|
||||
-`Record`:
|
||||
-`string`: (optional)
|
||||
-`unknown`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:107](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L107)
|
||||
|
||||
___
|
||||
|
||||
### createReturn
|
||||
|
||||
**createReturn**(`returnOrder`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `returnOrder` | `CreateReturnType` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
-`Promise`:
|
||||
-`Record`:
|
||||
-`string`: (optional)
|
||||
-`unknown`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:165](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L165)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(): `Promise`<`FulfillmentProvider`[]\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`FulfillmentProvider`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`FulfillmentProvider[]`:
|
||||
-`FulfillmentProvider`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:67](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L67)
|
||||
|
||||
___
|
||||
|
||||
### listFulfillmentOptions
|
||||
|
||||
**listFulfillmentOptions**(`providerIds`): `Promise`<`FulfillmentOptions`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `providerIds` | `string`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`FulfillmentOptions`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`FulfillmentOptions[]`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:75](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L75)
|
||||
|
||||
___
|
||||
|
||||
### registerInstalledProviders
|
||||
|
||||
**registerInstalledProviders**(`providers`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `providers` | `string`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:53](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### retrieveDocuments
|
||||
|
||||
**retrieveDocuments**(`providerId`, `fulfillmentData`, `documentType`): `Promise`<`any`\>
|
||||
|
||||
Fetches documents from the fulfillment provider
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `providerId` | `string` | the id of the provider |
|
||||
| `fulfillmentData` | Record<`string`, `unknown`\> | the data relating to the fulfillment |
|
||||
| `documentType` | ``"label"`` \| ``"invoice"`` | the typ of |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
-`Promise`: document to fetch
|
||||
-`any`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:184](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L184)
|
||||
|
||||
___
|
||||
|
||||
### retrieveProvider
|
||||
|
||||
**retrieveProvider**(`providerId`): `any`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `providerId` | `string` | the provider id |
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
-`any`: (optional) the payment fulfillment provider
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:96](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L96)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### validateFulfillmentData
|
||||
|
||||
**validateFulfillmentData**(`option`, `data`, `cart`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `option` | `ShippingOption` |
|
||||
| `data` | Record<`string`, `unknown`\> |
|
||||
| `cart` | Record<`string`, `unknown`\> \| `Cart` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
-`Promise`:
|
||||
-`Record`:
|
||||
-`string`: (optional)
|
||||
-`unknown`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:127](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L127)
|
||||
|
||||
___
|
||||
|
||||
### validateOption
|
||||
|
||||
**validateOption**(`option`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `option` | `ShippingOption` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
-`Promise`:
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment-provider.ts:160](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment-provider.ts#L160)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`FulfillmentProviderService`](FulfillmentProviderService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FulfillmentProviderService`](FulfillmentProviderService.md)
|
||||
|
||||
-`FulfillmentProviderService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,771 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FulfillmentProviderService
|
||||
|
||||
Helps retrieve fulfillment providers
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentProviderService**(`container`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "container",
|
||||
"type": "[`FulfillmentProviderContainer`](../types/FulfillmentProviderContainer.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "container_",
|
||||
"type": "[`FulfillmentProviderContainer`](../types/FulfillmentProviderContainer.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentProviderRepository_",
|
||||
"type": "`Repository`<[`FulfillmentProvider`](FulfillmentProvider.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### calculatePrice
|
||||
|
||||
**calculatePrice**(`option`, `data`, `cart?`): `Promise`<`number`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "option",
|
||||
"type": "[`ShippingOption`](ShippingOption.mdx)",
|
||||
"description": "A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Order`](Order.mdx) \\| [`Cart`](Cart.mdx)",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`number`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`number`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### canCalculate
|
||||
|
||||
**canCalculate**(`option`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "option",
|
||||
"type": "[`CalculateOptionPriceInput`](../types/CalculateOptionPriceInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`boolean`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**cancelFulfillment**(`fulfillment`): `Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillment",
|
||||
"type": "[`Fulfillment`](Fulfillment.mdx)",
|
||||
"description": "A Fulfillment is created once an admin can prepare the purchased goods. Fulfillments will eventually be shipped and hold information about how to track shipments. Fulfillments are created through a fulfillment provider, which typically integrates a third-party shipping service. Fulfillments can be associated with orders, claims, swaps, and returns.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**createFulfillment**(`method`, `items`, `order`, `fulfillment`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "method",
|
||||
"type": "[`ShippingMethod`](ShippingMethod.mdx)",
|
||||
"description": "A Shipping Method represents a way in which an Order or Return can be shipped. Shipping Methods are created from a Shipping Option, but may contain additional details that can be necessary for the Fulfillment Provider to handle the shipment. If the shipping method is created for a return, it may be associated with a claim or a swap that the return is part of.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"type": "[`LineItem`](LineItem.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`CreateFulfillmentOrder`](../types/CreateFulfillmentOrder.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillment",
|
||||
"type": "[`Omit`](../types/Omit.mdx)<[`Fulfillment`](Fulfillment.mdx), ``\"beforeInsert\"``\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\>\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createReturn
|
||||
|
||||
**createReturn**(`returnOrder`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "returnOrder",
|
||||
"type": "[`CreateReturnType`](../types/CreateReturnType.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\>\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(): `Promise`<[`FulfillmentProvider`](FulfillmentProvider.mdx)[]\>
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FulfillmentProvider`](FulfillmentProvider.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`FulfillmentProvider`](FulfillmentProvider.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listFulfillmentOptions
|
||||
|
||||
**listFulfillmentOptions**(`providerIds`): `Promise`<[`FulfillmentOptions`](../types/FulfillmentOptions.mdx)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "providerIds",
|
||||
"type": "`string`[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`FulfillmentOptions`](../types/FulfillmentOptions.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`FulfillmentOptions`](../types/FulfillmentOptions.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### registerInstalledProviders
|
||||
|
||||
**registerInstalledProviders**(`providers`): `Promise`<`void`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "providers",
|
||||
"type": "`string`[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieveDocuments
|
||||
|
||||
**retrieveDocuments**(`providerId`, `fulfillmentData`, `documentType`): `Promise`<`any`\>
|
||||
|
||||
Fetches documents from the fulfillment provider
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "providerId",
|
||||
"type": "`string`",
|
||||
"description": "the id of the provider",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentData",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "the data relating to the fulfillment",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "documentType",
|
||||
"type": "``\"label\"`` \\| ``\"invoice\"``",
|
||||
"description": "the typ of",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`any`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`any`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "document to fetch",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieveProvider
|
||||
|
||||
**retrieveProvider**(`providerId`): `any`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "providerId",
|
||||
"type": "`string`",
|
||||
"description": "the provider id",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`any`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "any",
|
||||
"type": "`any`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "the payment fulfillment provider",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### validateFulfillmentData
|
||||
|
||||
**validateFulfillmentData**(`option`, `data`, `cart`): `Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "option",
|
||||
"type": "[`ShippingOption`](ShippingOption.mdx)",
|
||||
"description": "A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "Record<`string`, `unknown`\\> \\| [`Cart`](Cart.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<Record<`string`, `unknown`\>\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<Record<`string`, `unknown`\\>\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### validateOption
|
||||
|
||||
**validateOption**(`option`): `Promise`<`boolean`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "option",
|
||||
"type": "[`ShippingOption`](ShippingOption.mdx)",
|
||||
"description": "A Shipping Option represents a way in which an Order or Return can be shipped. Shipping Options have an associated Fulfillment Provider that will be used when the fulfillment of an Order is initiated. Shipping Options themselves cannot be added to Carts, but serve as a template for Shipping Methods. This distinction makes it possible to customize individual Shipping Methods with additional information.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`boolean`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`boolean`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`FulfillmentProviderService`](FulfillmentProviderService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FulfillmentProviderService`](FulfillmentProviderService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "FulfillmentProviderService",
|
||||
"type": "[`FulfillmentProviderService`](FulfillmentProviderService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,479 +0,0 @@
|
||||
# FulfillmentService
|
||||
|
||||
Handles Fulfillments
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`FulfillmentService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:47](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L47)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### fulfillmentProviderService\_
|
||||
|
||||
`Protected` `Readonly` **fulfillmentProviderService\_**: [`FulfillmentProviderService`](FulfillmentProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:40](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### fulfillmentRepository\_
|
||||
|
||||
`Protected` `Readonly` **fulfillmentRepository\_**: `Repository`<`Fulfillment`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:41](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L41)
|
||||
|
||||
___
|
||||
|
||||
### lineItemRepository\_
|
||||
|
||||
`Protected` `Readonly` **lineItemRepository\_**: `Repository`<`LineItem`\> & { `findByReturn`: Method findByReturn }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:43](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L43)
|
||||
|
||||
___
|
||||
|
||||
### lineItemService\_
|
||||
|
||||
`Protected` `Readonly` **lineItemService\_**: [`LineItemService`](LineItemService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:38](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L38)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### productVariantInventoryService\_
|
||||
|
||||
`Protected` `Readonly` **productVariantInventoryService\_**: [`ProductVariantInventoryService`](ProductVariantInventoryService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:45](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L45)
|
||||
|
||||
___
|
||||
|
||||
### shippingProfileService\_
|
||||
|
||||
`Protected` `Readonly` **shippingProfileService\_**: [`ShippingProfileService`](ShippingProfileService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:39](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L39)
|
||||
|
||||
___
|
||||
|
||||
### totalsService\_
|
||||
|
||||
`Protected` `Readonly` **totalsService\_**: [`TotalsService`](TotalsService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### trackingLinkRepository\_
|
||||
|
||||
`Protected` `Readonly` **trackingLinkRepository\_**: `Repository`<`TrackingLink`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:42](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L42)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**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 | Description |
|
||||
| :------ | :------ |
|
||||
| `fulfillmentOrId` | `string` \| `Fulfillment` | the fulfillment object or id. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
-`Promise`: the result of the save operation
|
||||
-`Fulfillment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:260](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L260)
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**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 | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`[]\>
|
||||
|
||||
-`Promise`: the created fulfillments
|
||||
-`Fulfillment[]`:
|
||||
-`Fulfillment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:205](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L205)
|
||||
|
||||
___
|
||||
|
||||
### createShipment
|
||||
|
||||
**createShipment**(`fulfillmentId`, `trackingLinks?`, `config?`): `Promise`<`Fulfillment`\>
|
||||
|
||||
Creates a shipment by marking a fulfillment as shipped. Adds
|
||||
tracking links and potentially more metadata.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
-`Promise`: the shipped fulfillment
|
||||
-`Fulfillment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:312](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L312)
|
||||
|
||||
___
|
||||
|
||||
### getFulfillmentItems\_
|
||||
|
||||
**getFulfillmentItems_**(`order`, `items`): `Promise`<(``null`` \| `LineItem`)[]\>
|
||||
|
||||
Retrieves the order line items, given an array of items.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `order` | `CreateFulfillmentOrder` | the order to get line items from |
|
||||
| `items` | `FulFillmentItemType`[] | the items to get |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(``null`` \| `LineItem`)[]\>
|
||||
|
||||
-`Promise`: the line items generated by the transformer.
|
||||
-`(``null`` \| LineItem)[]`:
|
||||
-```null`` \| LineItem`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:109](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L109)
|
||||
|
||||
___
|
||||
|
||||
### partitionItems\_
|
||||
|
||||
**partitionItems_**(`shippingMethods`, `items`): `FulfillmentItemPartition`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `shippingMethods` | `ShippingMethod`[] |
|
||||
| `items` | `LineItem`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`FulfillmentItemPartition`[]
|
||||
|
||||
-`FulfillmentItemPartition[]`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:70](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L70)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`fulfillmentId`, `config?`): `Promise`<`Fulfillment`\>
|
||||
|
||||
Retrieves a fulfillment by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `fulfillmentId` | `string` | the id of the fulfillment to retrieve |
|
||||
| `config` | `FindConfig`<`Fulfillment`\> | optional values to include with fulfillmentRepository query |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`Fulfillment`\>
|
||||
|
||||
-`Promise`: the fulfillment
|
||||
-`Fulfillment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:167](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L167)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### validateFulfillmentLineItem\_
|
||||
|
||||
**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 | Description |
|
||||
| :------ | :------ |
|
||||
| `item` | `undefined` \| `LineItem` | the line item to check has sufficient fulfillable quantity. |
|
||||
| `quantity` | `number` | the quantity that is requested to be fulfilled. |
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| `LineItem`
|
||||
|
||||
-```null`` \| LineItem`: (optional) a line item that has the requested fulfillment quantity
|
||||
set.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/fulfillment.ts:134](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/fulfillment.ts#L134)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`FulfillmentService`](FulfillmentService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FulfillmentService`](FulfillmentService.md)
|
||||
|
||||
-`FulfillmentService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,669 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# FulfillmentService
|
||||
|
||||
Handles Fulfillments
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new FulfillmentService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-11.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentProviderService_",
|
||||
"type": "[`FulfillmentProviderService`](FulfillmentProviderService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfillmentRepository_",
|
||||
"type": "`Repository`<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemRepository_",
|
||||
"type": "`Repository`<[`LineItem`](LineItem.mdx)\\> & { `findByReturn`: Method findByReturn }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemService_",
|
||||
"type": "[`LineItemService`](LineItemService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "productVariantInventoryService_",
|
||||
"type": "[`ProductVariantInventoryService`](ProductVariantInventoryService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shippingProfileService_",
|
||||
"type": "[`ShippingProfileService`](ShippingProfileService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "totalsService_",
|
||||
"type": "[`TotalsService`](TotalsService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "trackingLinkRepository_",
|
||||
"type": "`Repository`<[`TrackingLink`](TrackingLink.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### cancelFulfillment
|
||||
|
||||
**cancelFulfillment**(`fulfillmentOrId`): `Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
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
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillmentOrId",
|
||||
"type": "`string` \\| [`Fulfillment`](Fulfillment.mdx)",
|
||||
"description": "the fulfillment object or id.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the save operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createFulfillment
|
||||
|
||||
**createFulfillment**(`order`, `itemsToFulfill`, `custom?`): `Promise`<[`Fulfillment`](Fulfillment.mdx)[]\>
|
||||
|
||||
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
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`CreateFulfillmentOrder`](../types/CreateFulfillmentOrder.mdx)",
|
||||
"description": "order to create fulfillment for",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "itemsToFulfill",
|
||||
"type": "[`FulFillmentItemType`](../types/FulFillmentItemType.mdx)[]",
|
||||
"description": "the items in the order to fulfill",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "custom",
|
||||
"type": "[`Partial`](../types/Partial.mdx)<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"description": "potential custom values to add",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Fulfillment`](Fulfillment.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Fulfillment`](Fulfillment.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the created fulfillments",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createShipment
|
||||
|
||||
**createShipment**(`fulfillmentId`, `trackingLinks?`, `config?`): `Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
Creates a shipment by marking a fulfillment as shipped. Adds
|
||||
tracking links and potentially more metadata.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillmentId",
|
||||
"type": "`string`",
|
||||
"description": "the fulfillment to ship",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "trackingLinks",
|
||||
"type": "{ `tracking_number`: `string` }[]",
|
||||
"description": "tracking links for the shipment",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`CreateShipmentConfig`](../types/CreateShipmentConfig.mdx)",
|
||||
"description": "potential configuration settings, such as no_notification and metadata",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the shipped fulfillment",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getFulfillmentItems\_
|
||||
|
||||
**getFulfillmentItems_**(`order`, `items`): `Promise`<(``null`` \| [`LineItem`](LineItem.mdx))[]\>
|
||||
|
||||
Retrieves the order line items, given an array of items.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`CreateFulfillmentOrder`](../types/CreateFulfillmentOrder.mdx)",
|
||||
"description": "the order to get line items from",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"type": "[`FulFillmentItemType`](../types/FulFillmentItemType.mdx)[]",
|
||||
"description": "the items to get",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<(``null`` \| [`LineItem`](LineItem.mdx))[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<(``null`` \\| [`LineItem`](LineItem.mdx))[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the line items generated by the transformer.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### partitionItems\_
|
||||
|
||||
**partitionItems_**(`shippingMethods`, `items`): [`FulfillmentItemPartition`](../types/FulfillmentItemPartition.mdx)[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "shippingMethods",
|
||||
"type": "[`ShippingMethod`](ShippingMethod.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "items",
|
||||
"type": "[`LineItem`](LineItem.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FulfillmentItemPartition`](../types/FulfillmentItemPartition.mdx)[]
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "FulfillmentItemPartition[]",
|
||||
"type": "[`FulfillmentItemPartition`](../types/FulfillmentItemPartition.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`fulfillmentId`, `config?`): `Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
Retrieves a fulfillment by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fulfillmentId",
|
||||
"type": "`string`",
|
||||
"description": "the id of the fulfillment to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"description": "optional values to include with fulfillmentRepository query",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`Fulfillment`](Fulfillment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`Fulfillment`](Fulfillment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the fulfillment",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### validateFulfillmentLineItem\_
|
||||
|
||||
**validateFulfillmentLineItem_**(`item`, `quantity`): ``null`` \| [`LineItem`](LineItem.mdx)
|
||||
|
||||
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
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "item",
|
||||
"type": "`undefined` \\| [`LineItem`](LineItem.mdx)",
|
||||
"description": "the line item to check has sufficient fulfillable quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "the quantity that is requested to be fulfilled.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| [`LineItem`](LineItem.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "``null`` \\| LineItem",
|
||||
"type": "``null`` \\| [`LineItem`](LineItem.mdx)",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "a line item that has the requested fulfillment quantity\n set.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`FulfillmentService`](FulfillmentService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`FulfillmentService`](FulfillmentService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "FulfillmentService",
|
||||
"type": "[`FulfillmentService`](FulfillmentService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# GiftCard
|
||||
|
||||
Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new GiftCard**()
|
||||
|
||||
Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,179 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# GiftCard
|
||||
|
||||
Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new GiftCard**()
|
||||
|
||||
Gift Cards are redeemable and represent a value that can be used towards the payment of an Order.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "balance",
|
||||
"type": "`number`",
|
||||
"description": "The remaining value on the Gift Card.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "The unique code that identifies the Gift Card. This is used by the Customer to redeem the value of the Gift Card.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "ends_at",
|
||||
"type": "`Date`",
|
||||
"description": "The time at which the Gift Card can no longer be used.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The gift card's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_disabled",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the Gift Card has been disabled. Disabled Gift Cards cannot be applied to carts.",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order that the gift card was purchased in.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the order that the gift card was purchased in.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region",
|
||||
"type": "[`Region`](Region.mdx)",
|
||||
"description": "The details of the region this gift card is available in.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the region this gift card is available in.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tax_rate",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The gift card's tax rate that will be applied on calculating totals",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "`number`",
|
||||
"description": "The value that the Gift Card represents.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,531 +0,0 @@
|
||||
# GiftCardService
|
||||
|
||||
Provides layer to manipulate gift cards.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`GiftCardService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new GiftCardService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:39](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L39)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### eventBus\_
|
||||
|
||||
`Protected` `Readonly` **eventBus\_**: [`EventBusService`](EventBusService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:33](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### giftCardRepository\_
|
||||
|
||||
`Protected` `Readonly` **giftCardRepository\_**: `Repository`<`GiftCard`\> & { `listGiftCardsAndCount`: Method listGiftCardsAndCount }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:29](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### giftCardTransactionRepo\_
|
||||
|
||||
`Protected` `Readonly` **giftCardTransactionRepo\_**: `Repository`<`GiftCardTransaction`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:31](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L31)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
`Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:32](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L32)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
___
|
||||
|
||||
### Events
|
||||
|
||||
`Static` **Events**: `Object`
|
||||
|
||||
#### Type declaration
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `CREATED` | `string` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:35](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L35)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`giftCard`): `Promise`<`GiftCard`\>
|
||||
|
||||
Creates a gift card with provided data given that the data is validated.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `giftCard` | `CreateGiftCardInput` | the gift card data to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
-`Promise`: the result of the create operation
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:122](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L122)
|
||||
|
||||
___
|
||||
|
||||
### createTransaction
|
||||
|
||||
**createTransaction**(`data`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `data` | `CreateGiftCardTransactionInput` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
-`Promise`:
|
||||
-`string`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:106](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L106)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`giftCardId`): `Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
Deletes a gift card idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `giftCardId` | `string` | id of gift card to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| `GiftCard`\>
|
||||
|
||||
-`Promise`: the result of the delete operation
|
||||
-`void \| GiftCard`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:295](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L295)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<`GiftCard`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`GiftCard[]`:
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:98](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L98)
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config?`): `Promise`<[`GiftCard`[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `QuerySelector`<`GiftCard`\> | the query object for find |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | the configuration used to find the objects. contains relations, skip, and take. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`[], `number`]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`GiftCard[]`:
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:74](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L74)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`giftCardId`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
Gets a gift card by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `giftCardId` | `string` | id of gift card to retrieve |
|
||||
| `config` | `FindConfig`<`GiftCard`\> | optional values to include with gift card query |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
-`Promise`: the gift card
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:215](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L215)
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
**retrieveByCode**(`code`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `code` | `string` |
|
||||
| `config` | `FindConfig`<`GiftCard`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
-`Promise`:
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:229](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L229)
|
||||
|
||||
___
|
||||
|
||||
### retrieve\_
|
||||
|
||||
`Protected` **retrieve_**(`selector`, `config?`): `Promise`<`GiftCard`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `selector` | `Selector`<`GiftCard`\> |
|
||||
| `config` | `FindConfig`<`GiftCard`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
-`Promise`:
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:182](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L182)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`giftCardId`, `update`): `Promise`<`GiftCard`\>
|
||||
|
||||
Updates a giftCard.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `giftCardId` | `string` | giftCard id of giftCard to update |
|
||||
| `update` | `UpdateGiftCardInput` | the data to update the giftCard with |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GiftCard`\>
|
||||
|
||||
-`Promise`: the result of the update operation
|
||||
-`GiftCard`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:249](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L249)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`GiftCardService`](GiftCardService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`GiftCardService`](GiftCardService.md)
|
||||
|
||||
-`GiftCardService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### generateCode
|
||||
|
||||
`Static` **generateCode**(): `string`
|
||||
|
||||
Generates a 16 character gift card code
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
-`string`: (optional) the generated gift card code
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:58](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L58)
|
||||
|
||||
___
|
||||
|
||||
### resolveTaxRate
|
||||
|
||||
`Static` `Protected` **resolveTaxRate**(`giftCardTaxRate`, `region`): ``null`` \| `number`
|
||||
|
||||
The tax_rate of the giftcard can depend on whether regions tax gift cards, an input
|
||||
provided by the user or the tax rate. Based on these conditions, tax_rate changes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `giftCardTaxRate` | ``null`` \| `number` |
|
||||
| `region` | `Region` |
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| `number`
|
||||
|
||||
-```null`` \| number`: (optional) the tax rate for the gift card
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/gift-card.ts:161](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/gift-card.ts#L161)
|
||||
@@ -0,0 +1,764 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# GiftCardService
|
||||
|
||||
Provides layer to manipulate gift cards.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new GiftCardService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-12.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "eventBus_",
|
||||
"type": "[`EventBusService`](EventBusService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "giftCardRepository_",
|
||||
"type": "`Repository`<[`GiftCard`](GiftCard.mdx)\\> & { `listGiftCardsAndCount`: Method listGiftCardsAndCount }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "giftCardTransactionRepo_",
|
||||
"type": "`Repository`<[`GiftCardTransaction`](GiftCardTransaction.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "regionService_",
|
||||
"type": "[`RegionService`](RegionService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "Events.CREATED",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "\"gift_card.created\"",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`giftCard`): `Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
Creates a gift card with provided data given that the data is validated.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "giftCard",
|
||||
"type": "[`CreateGiftCardInput`](../types/CreateGiftCardInput.mdx)",
|
||||
"description": "the gift card data to create",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the create operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createTransaction
|
||||
|
||||
**createTransaction**(`data`): `Promise`<`string`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`CreateGiftCardTransactionInput`](../types/CreateGiftCardTransactionInput.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`string`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`string`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`giftCardId`): `Promise`<`void` \| [`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
Deletes a gift card idempotently
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "giftCardId",
|
||||
"type": "`string`",
|
||||
"description": "id of gift card to delete",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void` \| [`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void` \\| [`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the delete operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<[`GiftCard`](GiftCard.mdx)[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`QuerySelector`](../types/QuerySelector.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "the configuration used to find the objects. contains relations, skip, and take.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### listAndCount
|
||||
|
||||
**listAndCount**(`selector?`, `config?`): `Promise`<[[`GiftCard`](GiftCard.mdx)[], `number`]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`QuerySelector`](../types/QuerySelector.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "the configuration used to find the objects. contains relations, skip, and take.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[[`GiftCard`](GiftCard.mdx)[], `number`]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[[`GiftCard`](GiftCard.mdx)[], `number`]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`giftCardId`, `config?`): `Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
Gets a gift card by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "giftCardId",
|
||||
"type": "`string`",
|
||||
"description": "id of gift card to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "optional values to include with gift card query",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the gift card",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieveByCode
|
||||
|
||||
**retrieveByCode**(`code`, `config?`): `Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve\_
|
||||
|
||||
`Protected` **retrieve_**(`selector`, `config?`): `Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`Selector`](../types/Selector.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`giftCardId`, `update`): `Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
Updates a giftCard.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "giftCardId",
|
||||
"type": "`string`",
|
||||
"description": "giftCard id of giftCard to update",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"type": "[`UpdateGiftCardInput`](../types/UpdateGiftCardInput.mdx)",
|
||||
"description": "the data to update the giftCard with",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GiftCard`](GiftCard.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GiftCard`](GiftCard.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the update operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`GiftCardService`](GiftCardService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`GiftCardService`](GiftCardService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "GiftCardService",
|
||||
"type": "[`GiftCardService`](GiftCardService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### generateCode
|
||||
|
||||
`Static` **generateCode**(): `string`
|
||||
|
||||
Generates a 16 character gift card code
|
||||
|
||||
#### Returns
|
||||
|
||||
`string`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "string",
|
||||
"type": "`string`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "the generated gift card code",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### resolveTaxRate
|
||||
|
||||
`Static` `Protected` **resolveTaxRate**(`giftCardTaxRate`, `region`): ``null`` \| `number`
|
||||
|
||||
The tax_rate of the giftcard can depend on whether regions tax gift cards, an input
|
||||
provided by the user or the tax rate. Based on these conditions, tax_rate changes.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "giftCardTaxRate",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region",
|
||||
"type": "[`Region`](Region.mdx)",
|
||||
"description": "A region holds settings specific to a geographical location, including the currency, tax rates, and fulfillment and payment providers. A Region can consist of multiple countries to accomodate common shopping settings across countries.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
``null`` \| `number`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "``null`` \\| number",
|
||||
"type": "``null`` \\| `number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "the tax rate for the gift card",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,125 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# GiftCardTransaction
|
||||
|
||||
Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new GiftCardTransaction**()
|
||||
|
||||
Gift Card Transactions are created once a Customer uses a Gift Card to pay for their Order.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount that was used from the Gift Card.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_card",
|
||||
"type": "[`GiftCard`](GiftCard.mdx)",
|
||||
"description": "The details of the gift card associated used in this transaction.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_card_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Gift Card that was used in the transaction.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The gift card transaction's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_taxable",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the transaction is taxable or not.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order that the gift card was used for payment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the order that the gift card was used for payment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tax_rate",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The tax rate of the transaction",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,134 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# IdempotencyKey
|
||||
|
||||
Idempotency Key is used to continue a process in case of any failure that might occur.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new IdempotencyKey**()
|
||||
|
||||
Idempotency Key is used to continue a process in case of any failure that might occur.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "Date which the idempotency key was locked.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The idempotency key's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotency_key",
|
||||
"type": "`string`",
|
||||
"description": "The unique randomly generated key used to determine the state of a process.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locked_at",
|
||||
"type": "`Date`",
|
||||
"description": "Date which the idempotency key was locked.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "recovery_point",
|
||||
"type": "`string`",
|
||||
"description": "Where to continue from.",
|
||||
"optional": false,
|
||||
"defaultValue": "started",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "request_method",
|
||||
"type": "`string`",
|
||||
"description": "The method of the request",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "request_params",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "The parameters passed to the request",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "request_path",
|
||||
"type": "`string`",
|
||||
"description": "The request's path",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "response_body",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "The response's body",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "response_code",
|
||||
"type": "`number`",
|
||||
"description": "The response's code.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,377 +0,0 @@
|
||||
# IdempotencyKeyService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`IdempotencyKeyService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new IdempotencyKeyService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:25](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L25)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### idempotencyKeyRepository\_
|
||||
|
||||
`Protected` `Readonly` **idempotencyKeyRepository\_**: `Repository`<`IdempotencyKey`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:23](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L23)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`payload`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
Creates an idempotency key for a request.
|
||||
If no idempotency key is provided in request, we will create a unique
|
||||
identifier.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `payload` | `CreateIdempotencyKeyInput` | payload of request to create idempotency key for |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: the created idempotency key
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:68](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L68)
|
||||
|
||||
___
|
||||
|
||||
### initializeRequest
|
||||
|
||||
**initializeRequest**(`headerKey`, `reqMethod`, `reqParams`, `reqPath`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
Execute the initial steps in a idempotent request.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `headerKey` | `string` | potential idempotency key from header |
|
||||
| `reqMethod` | `string` | method of request |
|
||||
| `reqParams` | Record<`string`, `unknown`\> | params of request |
|
||||
| `reqPath` | `string` | path of request |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: the existing or created idempotency key
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:40](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L40)
|
||||
|
||||
___
|
||||
|
||||
### lock
|
||||
|
||||
**lock**(`idempotencyKey`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `idempotencyKey` | `string` | key to lock |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: result of the update operation
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:138](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L138)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`idempotencyKeyOrSelector`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
Retrieves an idempotency key
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `idempotencyKeyOrSelector` | `string` \| `Selector`<`IdempotencyKey`\> | key or selector to retrieve |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: idempotency key
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:86](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`idempotencyKey`, `update`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `idempotencyKey` | `string` | key to update |
|
||||
| `update` | `DeepPartial`<`IdempotencyKey`\> | update object |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: result of the update operation
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:167](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L167)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`IdempotencyKeyService`](IdempotencyKeyService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`IdempotencyKeyService`](IdempotencyKeyService.md)
|
||||
|
||||
-`IdempotencyKeyService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
|
||||
___
|
||||
|
||||
### workStage
|
||||
|
||||
**workStage**(`idempotencyKey`, `callback`): `Promise`<`IdempotencyKey`\>
|
||||
|
||||
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 | Description |
|
||||
| :------ | :------ |
|
||||
| `idempotencyKey` | `string` | current idempotency key |
|
||||
| `callback` | (`transactionManager`: `EntityManager`) => `Promise`<`IdempotencyCallbackResult`\> | functionality to execute within the phase |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`IdempotencyKey`\>
|
||||
|
||||
-`Promise`: new updated idempotency key
|
||||
-`IdempotencyKey`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/idempotency-key.ts:196](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/idempotency-key.ts#L196)
|
||||
@@ -0,0 +1,538 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# IdempotencyKeyService
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new IdempotencyKeyService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`InjectedDependencies`](../types/InjectedDependencies-13.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "idempotencyKeyRepository_",
|
||||
"type": "`Repository`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`payload`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
Creates an idempotency key for a request.
|
||||
If no idempotency key is provided in request, we will create a unique
|
||||
identifier.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "payload",
|
||||
"type": "[`CreateIdempotencyKeyInput`](../types/CreateIdempotencyKeyInput.mdx)",
|
||||
"description": "payload of request to create idempotency key for",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the created idempotency key",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### initializeRequest
|
||||
|
||||
**initializeRequest**(`headerKey`, `reqMethod`, `reqParams`, `reqPath`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
Execute the initial steps in a idempotent request.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "headerKey",
|
||||
"type": "`string`",
|
||||
"description": "potential idempotency key from header",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reqMethod",
|
||||
"type": "`string`",
|
||||
"description": "method of request",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reqParams",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "params of request",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reqPath",
|
||||
"type": "`string`",
|
||||
"description": "path of request",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the existing or created idempotency key",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### lock
|
||||
|
||||
**lock**(`idempotencyKey`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "idempotencyKey",
|
||||
"type": "`string`",
|
||||
"description": "key to lock",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "result of the update operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`idempotencyKeyOrSelector`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
Retrieves an idempotency key
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "idempotencyKeyOrSelector",
|
||||
"type": "`string` \\| [`Selector`](../types/Selector.mdx)<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"description": "key or selector to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "idempotency key",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`idempotencyKey`, `update`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
Locks an idempotency.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "idempotencyKey",
|
||||
"type": "`string`",
|
||||
"description": "key to update",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"type": "`DeepPartial`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"description": "update object",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "result of the update operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`IdempotencyKeyService`](IdempotencyKeyService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`IdempotencyKeyService`](IdempotencyKeyService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "IdempotencyKeyService",
|
||||
"type": "[`IdempotencyKeyService`](IdempotencyKeyService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### workStage
|
||||
|
||||
**workStage**(`idempotencyKey`, `callback`): `Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
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
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "idempotencyKey",
|
||||
"type": "`string`",
|
||||
"description": "current idempotency key",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "callback",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<[`IdempotencyCallbackResult`](../types/IdempotencyCallbackResult.mdx)\\>",
|
||||
"description": "functionality to execute within the phase",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`IdempotencyKey`](IdempotencyKey.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "new updated idempotency key",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# Image
|
||||
|
||||
An Image is used to store details about uploaded images. Images are uploaded by the File Service, and the URL is provided by the File Service.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new Image**()
|
||||
|
||||
An Image is used to store details about uploaded images. Images are uploaded by the File Service, and the URL is provided by the File Service.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The image's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "`string`",
|
||||
"description": "The URL at which the image file can be found.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,476 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# LineItem
|
||||
|
||||
Line Items are created when a product is added to a Cart. When Line Items are purchased they will get copied to the resulting order, swap, or claim, and can eventually be referenced in Fulfillments and Returns. Line items may also be used for order edits.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItem**()
|
||||
|
||||
Line Items are created when a product is added to a Cart. When Line Items are purchased they will get copied to the resulting order, swap, or claim, and can eventually be referenced in Fulfillments and Returns. Line items may also be used for order edits.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "adjustments",
|
||||
"type": "[`LineItemAdjustment`](LineItemAdjustment.mdx)[]",
|
||||
"description": "The details of the item's adjustments, which are available when a discount is applied on the item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "allow_discounts",
|
||||
"type": "`boolean`",
|
||||
"description": "Flag to indicate if the Line Item should be included when doing discount calculations.",
|
||||
"optional": false,
|
||||
"defaultValue": "true",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "The details of the cart that the line item may belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "cart_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the cart that the line item may belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_order",
|
||||
"type": "[`ClaimOrder`](ClaimOrder.mdx)",
|
||||
"description": "The details of the claim that the line item may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "claim_order_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the claim that the line item may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "A more detailed description of the contents of the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of discount of the line item rounded",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "fulfilled_quantity",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The quantity of the Line Item that has been fulfilled.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "gift_card_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of the gift card of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "has_shipping",
|
||||
"type": "``null`` \\| `boolean`",
|
||||
"description": "Flag to indicate if the Line Item has fulfillment associated with it.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The line item's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "includes_tax",
|
||||
"type": "`boolean`",
|
||||
"description": "Indicates if the line item unit_price include tax",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"featureFlag": "tax_inclusive_pricing",
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_giftcard",
|
||||
"type": "`boolean`",
|
||||
"description": "Flag to indicate if the Line Item is a Gift Card.",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "is_return",
|
||||
"type": "`boolean`",
|
||||
"description": "Is the item being returned",
|
||||
"optional": false,
|
||||
"defaultValue": "false",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order",
|
||||
"type": "[`Order`](Order.mdx)",
|
||||
"description": "The details of the order that the line item may belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_edit",
|
||||
"type": "``null`` \\| [`OrderEdit`](OrderEdit.mdx)",
|
||||
"description": "The details of the order edit.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_edit_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The ID of the order edit that the item may belong to.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "order_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The ID of the order that the line item may belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "original_item_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The ID of the original line item. This is useful if the line item belongs to a resource that references an order, such as a return or an order edit.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "original_tax_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The original tax total amount of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "original_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The original total amount of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "product_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The quantity of the content in the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "raw_discount_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of discount of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "refundable",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The amount that can be refunded from the given Line Item. Takes taxes and discounts into consideration.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "returned_quantity",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The quantity of the Line Item that has been returned.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "shipped_quantity",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The quantity of the Line Item that has been shipped.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "should_merge",
|
||||
"type": "`boolean`",
|
||||
"description": "Flag to indicate if new Line Items with the same variant should be merged or added as an additional Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "true",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "subtotal",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The subtotal of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "swap",
|
||||
"type": "[`Swap`](Swap.mdx)",
|
||||
"description": "The details of the swap that the line item may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "swap_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the swap that the line item may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tax_lines",
|
||||
"type": "[`LineItemTaxLine`](LineItemTaxLine.mdx)[]",
|
||||
"description": "The details of the item's tax lines.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "tax_total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total of tax of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "A URL string to a small image of the contents of the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string`",
|
||||
"description": "The title of the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "total",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The total amount of the line item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "unit_price",
|
||||
"type": "`number`",
|
||||
"description": "The price of one unit of the content in the Line Item. This should be in the currency defined by the Cart/Order/Swap/Claim that the Line Item belongs to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant",
|
||||
"type": "[`ProductVariant`](ProductVariant.mdx)",
|
||||
"description": "The details of the product variant that this item was created from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The id of the Product Variant contained in the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### afterUpdateOrLoad
|
||||
|
||||
**afterUpdateOrLoad**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### beforeUpdate
|
||||
|
||||
**beforeUpdate**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,116 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# LineItemAdjustment
|
||||
|
||||
A Line Item Adjustment includes details on discounts applied on a line item.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItemAdjustment**()
|
||||
|
||||
A Line Item Adjustment includes details on discounts applied on a line item.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The adjustment amount",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "The line item's adjustment description",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount",
|
||||
"type": "[`Discount`](Discount.mdx)",
|
||||
"description": "The details of the discount associated with the adjustment.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discount_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the discount associated with the adjustment",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The Line Item Adjustment's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "The details of the line item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the line item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,437 +0,0 @@
|
||||
# LineItemAdjustmentService
|
||||
|
||||
Provides layer to manipulate line item adjustments.
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`LineItemAdjustmentService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItemAdjustmentService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `LineItemAdjustmentServiceProps` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:36](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L36)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### discountService
|
||||
|
||||
`Private` `Readonly` **discountService**: [`DiscountService`](DiscountService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:34](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### lineItemAdjustmentRepo\_
|
||||
|
||||
`Private` `Readonly` **lineItemAdjustmentRepo\_**: `Repository`<`LineItemAdjustment`\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:33](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L33)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<`LineItemAdjustment`\>
|
||||
|
||||
Creates a line item adjustment
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `Partial`<`LineItemAdjustment`\> | the line item adjustment to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`\>
|
||||
|
||||
-`Promise`: line item adjustment
|
||||
-`LineItemAdjustment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:86](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L86)
|
||||
|
||||
___
|
||||
|
||||
### createAdjustmentForLineItem
|
||||
|
||||
**createAdjustmentForLineItem**(`cart`, `lineItem`): `Promise`<`LineItemAdjustment`[]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `cart` | `Cart` | the cart object holding discounts |
|
||||
| `lineItem` | `LineItem` | the line item for which a line item adjustment might be created |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`[]\>
|
||||
|
||||
-`Promise`: a line item adjustment or undefined if no adjustment was created
|
||||
-`LineItemAdjustment[]`:
|
||||
-`LineItemAdjustment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:262](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L262)
|
||||
|
||||
___
|
||||
|
||||
### createAdjustments
|
||||
|
||||
**createAdjustments**(`cart`, `lineItem?`): `Promise`<`LineItemAdjustment`[] \| `LineItemAdjustment`[][]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `cart` | `Cart` | the cart object holding discounts |
|
||||
| `lineItem?` | `LineItem` | the line item for which a line item adjustment might be created |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`[] \| `LineItemAdjustment`[][]\>
|
||||
|
||||
-`Promise`: if a lineItem was given, returns a line item adjustment or undefined if no adjustment was created
|
||||
otherwise returns an array of line item adjustments for each line item in the cart
|
||||
-`LineItemAdjustment[] \| LineItemAdjustment[][]`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:290](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L290)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`selectorOrIds`): `Promise`<`void`\>
|
||||
|
||||
Deletes line item adjustments matching a selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selectorOrIds` | `string` \| `string`[] \| `FilterableLineItemAdjustmentProps` & { `discount_id?`: `FindOperator`<``null`` \| `string`\> } | the query object for find or the line item adjustment id |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
-`Promise`: the result of the delete operation
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:153](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L153)
|
||||
|
||||
___
|
||||
|
||||
### generateAdjustments
|
||||
|
||||
**generateAdjustments**(`calculationContextData`, `generatedLineItem`, `context`): `Promise`<`GeneratedAdjustment`[]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `calculationContextData` | `CalculationContextData` | the calculationContextData object holding discounts |
|
||||
| `generatedLineItem` | `LineItem` | the line item for which a line item adjustment might be created |
|
||||
| `context` | `AdjustmentContext` | the line item for which a line item adjustment might be created |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`GeneratedAdjustment`[]\>
|
||||
|
||||
-`Promise`: a line item adjustment or undefined if no adjustment was created
|
||||
-`GeneratedAdjustment[]`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:188](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L188)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<`LineItemAdjustment`[]\>
|
||||
|
||||
Lists line item adjustments
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `selector` | `FilterableLineItemAdjustmentProps` | the query object for find |
|
||||
| `config` | `FindConfig`<`LineItemAdjustment`\> | the config to be used for find |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`[]\>
|
||||
|
||||
-`Promise`: the result of the find operation
|
||||
-`LineItemAdjustment[]`:
|
||||
-`LineItemAdjustment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:136](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L136)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`lineItemAdjustmentId`, `config?`): `Promise`<`LineItemAdjustment`\>
|
||||
|
||||
Retrieves a line item adjustment by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `lineItemAdjustmentId` | `string` | the id of the line item adjustment to retrieve |
|
||||
| `config` | `FindConfig`<`LineItemAdjustment`\> | the config to retrieve the line item adjustment by |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`\>
|
||||
|
||||
-`Promise`: the line item adjustment.
|
||||
-`LineItemAdjustment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:53](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<`LineItemAdjustment`\>
|
||||
|
||||
Creates a line item adjustment
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the line item adjustment id to update |
|
||||
| `data` | `Partial`<`LineItemAdjustment`\> | the line item adjustment to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemAdjustment`\>
|
||||
|
||||
-`Promise`: line item adjustment
|
||||
-`LineItemAdjustment`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item-adjustment.ts:104](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item-adjustment.ts#L104)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`LineItemAdjustmentService`](LineItemAdjustmentService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`LineItemAdjustmentService`](LineItemAdjustmentService.md)
|
||||
|
||||
-`LineItemAdjustmentService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
@@ -0,0 +1,637 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# LineItemAdjustmentService
|
||||
|
||||
Provides layer to manipulate line item adjustments.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItemAdjustmentService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__namedParameters",
|
||||
"type": "[`LineItemAdjustmentServiceProps`](../types/LineItemAdjustmentServiceProps.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "__configModule__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__container__",
|
||||
"type": "`any`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "__moduleDeclaration__",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "discountService",
|
||||
"type": "[`DiscountService`](DiscountService.mdx)",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItemAdjustmentRepo_",
|
||||
"type": "`Repository`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "manager_",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager_",
|
||||
"type": "`undefined` \\| `EntityManager`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "EntityManager",
|
||||
"type": "`EntityManager`",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "TResult",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "TError",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "work",
|
||||
"type": "(`transactionManager`: `EntityManager`) => `Promise`<`TResult`\\>",
|
||||
"description": "the transactional work to be done",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "isolationOrErrorHandler",
|
||||
"type": "`IsolationLevel` \\| (`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "the isolation level to be used for the work.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "maybeErrorHandlerOrDontFail",
|
||||
"type": "(`error`: `TError`) => `Promise`<`void` \\| `TResult`\\>",
|
||||
"description": "Potential error handler",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`TResult`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the transactional work",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**(`data`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
Creates a line item adjustment
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Partial`](../types/Partial.mdx)<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"description": "the line item adjustment to create",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "line item adjustment",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createAdjustmentForLineItem
|
||||
|
||||
**createAdjustmentForLineItem**(`cart`, `lineItem`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "the cart object holding discounts",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItem",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "the line item for which a line item adjustment might be created",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "a line item adjustment or undefined if no adjustment was created",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### createAdjustments
|
||||
|
||||
**createAdjustments**(`cart`, `lineItem?`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[] \| [`LineItemAdjustment`](LineItemAdjustment.mdx)[][]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "cart",
|
||||
"type": "[`Cart`](Cart.mdx)",
|
||||
"description": "the cart object holding discounts",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "lineItem",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "the line item for which a line item adjustment might be created",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[] \| [`LineItemAdjustment`](LineItemAdjustment.mdx)[][]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[] \\| [`LineItemAdjustment`](LineItemAdjustment.mdx)[][]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "if a lineItem was given, returns a line item adjustment or undefined if no adjustment was created\notherwise returns an array of line item adjustments for each line item in the cart",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`selectorOrIds`): `Promise`<`void`\>
|
||||
|
||||
Deletes line item adjustments matching a selector
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selectorOrIds",
|
||||
"type": "`string` \\| `string`[] \\| [`FilterableLineItemAdjustmentProps`](FilterableLineItemAdjustmentProps.mdx) & { `discount_id?`: `FindOperator`<``null`` \\| `string`\\> }",
|
||||
"description": "the query object for find or the line item adjustment id",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`void`\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<`void`\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the delete operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### generateAdjustments
|
||||
|
||||
**generateAdjustments**(`calculationContextData`, `generatedLineItem`, `context`): `Promise`<[`GeneratedAdjustment`](../types/GeneratedAdjustment.mdx)[]\>
|
||||
|
||||
Creates adjustment for a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "calculationContextData",
|
||||
"type": "[`CalculationContextData`](../types/CalculationContextData.mdx)",
|
||||
"description": "the calculationContextData object holding discounts",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "generatedLineItem",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "the line item for which a line item adjustment might be created",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[`AdjustmentContext`](../types/AdjustmentContext.mdx)",
|
||||
"description": "the line item for which a line item adjustment might be created",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`GeneratedAdjustment`](../types/GeneratedAdjustment.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`GeneratedAdjustment`](../types/GeneratedAdjustment.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "a line item adjustment or undefined if no adjustment was created",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector?`, `config?`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\>
|
||||
|
||||
Lists line item adjustments
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[`FilterableLineItemAdjustmentProps`](FilterableLineItemAdjustmentProps.mdx)",
|
||||
"description": "the query object for find",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"description": "the config to be used for find",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)[]\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the result of the find operation",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`lineItemAdjustmentId`, `config?`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
Retrieves a line item adjustment by id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "lineItemAdjustmentId",
|
||||
"type": "`string`",
|
||||
"description": "the id of the line item adjustment to retrieve",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[`FindConfig`](../interfaces/FindConfig.mdx)<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"description": "the config to retrieve the line item adjustment by",
|
||||
"optional": false,
|
||||
"defaultValue": "{}",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "the line item adjustment.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "err",
|
||||
"type": "Record<`string`, `unknown`\\> \\| { `code`: `string` }",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`id`, `data`): `Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
Creates a line item adjustment
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "the line item adjustment id to update",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[`Partial`](../types/Partial.mdx)<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"description": "the line item adjustment to create",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\>
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "`Promise`<[`LineItemAdjustment`](LineItemAdjustment.mdx)\\>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "line item adjustment",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`LineItemAdjustmentService`](LineItemAdjustmentService.mdx)
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
[`LineItemAdjustmentService`](LineItemAdjustmentService.mdx)
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "LineItemAdjustmentService",
|
||||
"type": "[`LineItemAdjustmentService`](LineItemAdjustmentService.mdx)",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,639 +0,0 @@
|
||||
# LineItemService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`LineItemService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItemService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:57](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L57)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### cartRepository\_
|
||||
|
||||
`Protected` `Readonly` **cartRepository\_**: `Repository`<`Cart`\> & { `findOneWithRelations`: Method findOneWithRelations ; `findWithRelations`: Method findWithRelations }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:48](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L48)
|
||||
|
||||
___
|
||||
|
||||
### featureFlagRouter\_
|
||||
|
||||
`Protected` `Readonly` **featureFlagRouter\_**: `FlagRouter`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:53](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L53)
|
||||
|
||||
___
|
||||
|
||||
### itemTaxLineRepo\_
|
||||
|
||||
`Protected` `Readonly` **itemTaxLineRepo\_**: `Repository`<`LineItemTaxLine`\> & { `deleteForCart`: Method deleteForCart ; `upsertLines`: Method upsertLines }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:47](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L47)
|
||||
|
||||
___
|
||||
|
||||
### lineItemAdjustmentService\_
|
||||
|
||||
`Protected` `Readonly` **lineItemAdjustmentService\_**: [`LineItemAdjustmentService`](LineItemAdjustmentService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:54](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L54)
|
||||
|
||||
___
|
||||
|
||||
### lineItemRepository\_
|
||||
|
||||
`Protected` `Readonly` **lineItemRepository\_**: `Repository`<`LineItem`\> & { `findByReturn`: Method findByReturn }
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:46](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L46)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### pricingService\_
|
||||
|
||||
`Protected` `Readonly` **pricingService\_**: [`PricingService`](PricingService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:51](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L51)
|
||||
|
||||
___
|
||||
|
||||
### productService\_
|
||||
|
||||
`Protected` `Readonly` **productService\_**: [`ProductService`](ProductService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:50](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L50)
|
||||
|
||||
___
|
||||
|
||||
### productVariantService\_
|
||||
|
||||
`Protected` `Readonly` **productVariantService\_**: [`ProductVariantService`](ProductVariantService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:49](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L49)
|
||||
|
||||
___
|
||||
|
||||
### regionService\_
|
||||
|
||||
`Protected` `Readonly` **regionService\_**: [`RegionService`](RegionService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:52](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L52)
|
||||
|
||||
___
|
||||
|
||||
### taxProviderService\_
|
||||
|
||||
`Protected` `Readonly` **taxProviderService\_**: [`TaxProviderService`](TaxProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:55](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L55)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### cloneTo
|
||||
|
||||
**cloneTo**(`ids`, `data?`, `options?`): `Promise`<`LineItem`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `ids` | `string` \| `string`[] |
|
||||
| `data` | `DeepPartial`<`LineItem`\> |
|
||||
| `options` | `object` |
|
||||
| `options.setOriginalLineItemId?` | `boolean` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`LineItem[]`:
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:541](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L541)
|
||||
|
||||
___
|
||||
|
||||
### create
|
||||
|
||||
**create**<`T`, `TResult`\>(`data`): `Promise`<`TResult`\>
|
||||
|
||||
Create a line item
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `object` |
|
||||
| `TResult` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `data` | `T` | the line item object to create |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the created line item
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:421](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L421)
|
||||
|
||||
___
|
||||
|
||||
### createReturnLines
|
||||
|
||||
**createReturnLines**(`returnId`, `cartId`): `Promise`<`LineItem`[]\>
|
||||
|
||||
Creates return line items for a given cart based on the return items in a
|
||||
return.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `returnId` | `string` | the id to generate return items from. |
|
||||
| `cartId` | `string` | the cart to assign the return line items to. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
-`Promise`: the created line items
|
||||
-`LineItem[]`:
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:131](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L131)
|
||||
|
||||
___
|
||||
|
||||
### createTaxLine
|
||||
|
||||
**createTaxLine**(`args`): `LineItemTaxLine`
|
||||
|
||||
Create a line item tax line.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `args` | `DeepPartial`<`LineItemTaxLine`\> | tax line partial passed to the repo create method |
|
||||
|
||||
#### Returns
|
||||
|
||||
`LineItemTaxLine`
|
||||
|
||||
-`LineItemTaxLine`: a new line item tax line
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:533](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L533)
|
||||
|
||||
___
|
||||
|
||||
### delete
|
||||
|
||||
**delete**(`id`): `Promise`<`undefined` \| ``null`` \| `LineItem`\>
|
||||
|
||||
Deletes a line item.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| ``null`` \| `LineItem`\>
|
||||
|
||||
-`Promise`: the result of the delete operation
|
||||
-`undefined \| ``null`` \| LineItem`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:494](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L494)
|
||||
|
||||
___
|
||||
|
||||
### deleteWithTaxLines
|
||||
|
||||
**deleteWithTaxLines**(`id`): `Promise`<`undefined` \| ``null`` \| `LineItem`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to delete |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`undefined` \| ``null`` \| `LineItem`\>
|
||||
|
||||
-`Promise`: the result of the delete operation
|
||||
-`undefined \| ``null`` \| LineItem`: (optional)
|
||||
|
||||
**Deprecated**
|
||||
|
||||
no the cascade on the entity takes care of it
|
||||
Deletes a line item with the tax lines.
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:516](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L516)
|
||||
|
||||
___
|
||||
|
||||
### generate
|
||||
|
||||
**generate**<`T`, `TResult`\>(`variantIdOrData`, `regionIdOrContext`, `quantity?`, `context?`): `Promise`<`TResult`\>
|
||||
|
||||
Generate a single or multiple line item without persisting the data into the db
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `object` |
|
||||
| `TResult` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `variantIdOrData` | `T` |
|
||||
| `regionIdOrContext` | `T` extends `string` ? `string` : `GenerateLineItemContext` |
|
||||
| `quantity?` | `number` |
|
||||
| `context` | `GenerateLineItemContext` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:192](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L192)
|
||||
|
||||
___
|
||||
|
||||
### generateLineItem
|
||||
|
||||
`Protected` **generateLineItem**(`variant`, `quantity`, `context`): `Promise`<`LineItem`\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `variant` | `object` |
|
||||
| `variant.id` | `string` |
|
||||
| `variant.product` | `object` |
|
||||
| `variant.product.discountable` | `boolean` |
|
||||
| `variant.product.is_giftcard` | `boolean` |
|
||||
| `variant.product.thumbnail` | ``null`` \| `string` |
|
||||
| `variant.product.title` | `string` |
|
||||
| `variant.product_id` | `string` |
|
||||
| `variant.title` | `string` |
|
||||
| `quantity` | `number` |
|
||||
| `context` | `GenerateLineItemContext` & { `variantPricing`: `ProductVariantPricing` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`\>
|
||||
|
||||
-`Promise`:
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:337](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L337)
|
||||
|
||||
___
|
||||
|
||||
### list
|
||||
|
||||
**list**(`selector`, `config?`): `Promise`<`LineItem`[]\>
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `selector` | `Selector`<`LineItem`\> |
|
||||
| `config` | `FindConfig`<`LineItem`\> |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
-`Promise`:
|
||||
-`LineItem[]`:
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:84](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L84)
|
||||
|
||||
___
|
||||
|
||||
### retrieve
|
||||
|
||||
**retrieve**(`id`, `config?`): `Promise`<`LineItem`\>
|
||||
|
||||
Retrieves a line item by its id.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `id` | `string` | the id of the line item to retrieve |
|
||||
| `config` | `object` | the config to be used at query building |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`\>
|
||||
|
||||
-`Promise`: the line item
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:105](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L105)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### update
|
||||
|
||||
**update**(`idOrSelector`, `data`): `Promise`<`LineItem`[]\>
|
||||
|
||||
Updates a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `idOrSelector` | `string` \| `Selector`<`LineItem`\> | the id or selector of the line item(s) to update |
|
||||
| `data` | `Partial`<`LineItem`\> | the properties to update the line item(s) |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItem`[]\>
|
||||
|
||||
-`Promise`: the updated line item(s)
|
||||
-`LineItem[]`:
|
||||
-`LineItem`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:451](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L451)
|
||||
|
||||
___
|
||||
|
||||
### validateGenerateArguments
|
||||
|
||||
`Protected` **validateGenerateArguments**<`T`, `TResult`\>(`variantIdOrData`, `regionIdOrContext`, `quantity?`): `void`
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `T` | `object` |
|
||||
| `TResult` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `variantIdOrData` | `string` \| `T` |
|
||||
| `regionIdOrContext` | `T` extends `string` ? `string` : `GenerateLineItemContext` |
|
||||
| `quantity?` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/line-item.ts:612](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/line-item.ts#L612)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`LineItemService`](LineItemService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`LineItemService`](LineItemService.md)
|
||||
|
||||
-`LineItemService`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,125 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# LineItemTaxLine
|
||||
|
||||
A Line Item Tax Line represents the taxes applied on a line item.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new LineItemTaxLine**()
|
||||
|
||||
A Line Item Tax Line represents the taxes applied on a line item.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "code",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "A code to identify the tax type by",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The line item tax line's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item",
|
||||
"type": "[`LineItem`](LineItem.mdx)",
|
||||
"description": "The details of the line item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the line item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "`string`",
|
||||
"description": "A human friendly name for the tax",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "rate",
|
||||
"type": "`number`",
|
||||
"description": "The numeric rate to charge tax by",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,265 +0,0 @@
|
||||
# MiddlewareService
|
||||
|
||||
Orchestrates dynamic middleware registered through the Medusa Middleware API
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new MiddlewareService**()
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:22](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L22)
|
||||
|
||||
## Properties
|
||||
|
||||
### postAuthentication\_
|
||||
|
||||
`Protected` `Readonly` **postAuthentication\_**: `middlewareType`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:17](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L17)
|
||||
|
||||
___
|
||||
|
||||
### preAuthentication\_
|
||||
|
||||
`Protected` `Readonly` **preAuthentication\_**: `middlewareType`[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:18](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L18)
|
||||
|
||||
___
|
||||
|
||||
### preCartCreation\_
|
||||
|
||||
`Protected` `Readonly` **preCartCreation\_**: `RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\>[]
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:19](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L19)
|
||||
|
||||
___
|
||||
|
||||
### routers
|
||||
|
||||
`Protected` `Readonly` **routers**: Record<`string`, `Router`[]\>
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L20)
|
||||
|
||||
## Methods
|
||||
|
||||
### addPostAuthentication
|
||||
|
||||
**addPostAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called after authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `middleware` | `middlewareHandlerType` | the middleware function. Should return a middleware function. |
|
||||
| `options` | Record<`string`, `unknown`\> | the arguments that will be passed to the middleware |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional) void
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:60](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L60)
|
||||
|
||||
___
|
||||
|
||||
### addPreAuthentication
|
||||
|
||||
**addPreAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called before authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `middleware` | `middlewareHandlerType` | the middleware function. Should return a middleware function. |
|
||||
| `options` | Record<`string`, `unknown`\> | the arguments that will be passed to the middleware |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional) void
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:79](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L79)
|
||||
|
||||
___
|
||||
|
||||
### addPreCartCreation
|
||||
|
||||
**addPreCartCreation**(`middleware`): `void`
|
||||
|
||||
Adds a middleware function to be called before cart creation
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `middleware` | `RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\> | the middleware function. Should return a middleware function. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:96](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L96)
|
||||
|
||||
___
|
||||
|
||||
### addRouter
|
||||
|
||||
**addRouter**(`path`, `router`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `path` | `string` |
|
||||
| `router` | `Router` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:29](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L29)
|
||||
|
||||
___
|
||||
|
||||
### getRouters
|
||||
|
||||
**getRouters**(`path`): `Router`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `path` | `string` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Router`[]
|
||||
|
||||
-`Router[]`:
|
||||
-`Router`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:34](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L34)
|
||||
|
||||
___
|
||||
|
||||
### usePostAuthentication
|
||||
|
||||
**usePostAuthentication**(`app`): `void`
|
||||
|
||||
Adds post authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `app` | `Router` | the express app to add the middleware to |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:106](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L106)
|
||||
|
||||
___
|
||||
|
||||
### usePreAuthentication
|
||||
|
||||
**usePreAuthentication**(`app`): `void`
|
||||
|
||||
Adds pre authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `app` | `Router` | the express app to add the middleware to |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:117](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L117)
|
||||
|
||||
___
|
||||
|
||||
### usePreCartCreation
|
||||
|
||||
**usePreCartCreation**(): `RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\>[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\>[]
|
||||
|
||||
-`RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any\>\>[]`:
|
||||
-`RequestHandler`:
|
||||
-`any`: (optional)
|
||||
-`any`: (optional)
|
||||
-`Record`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:123](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L123)
|
||||
|
||||
___
|
||||
|
||||
### validateMiddleware\_
|
||||
|
||||
**validateMiddleware_**(`fn`): `void`
|
||||
|
||||
Validates a middleware function, throws if fn is not of type function.
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | Description |
|
||||
| :------ | :------ |
|
||||
| `fn` | `unknown` | the middleware function to validate. |
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
-`void`: (optional) nothing if the middleware is a function
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/middleware.ts:43](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/middleware.ts#L43)
|
||||
@@ -0,0 +1,405 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# MiddlewareService
|
||||
|
||||
Orchestrates dynamic middleware registered through the Medusa Middleware API
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new MiddlewareService**()
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "postAuthentication_",
|
||||
"type": "[`middlewareType`](../types/middlewareType.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "preAuthentication_",
|
||||
"type": "[`middlewareType`](../types/middlewareType.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "preCartCreation_",
|
||||
"type": "`RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\\>\\>[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "routers",
|
||||
"type": "Record<`string`, `Router`[]\\>",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### addPostAuthentication
|
||||
|
||||
**addPostAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called after authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "middleware",
|
||||
"type": "[`middlewareHandlerType`](../types/middlewareHandlerType.mdx)",
|
||||
"description": "the middleware function. Should return a middleware function.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "the arguments that will be passed to the middleware",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "void",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### addPreAuthentication
|
||||
|
||||
**addPreAuthentication**(`middleware`, `options`): `void`
|
||||
|
||||
Adds a middleware function to be called before authentication is completed.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "middleware",
|
||||
"type": "[`middlewareHandlerType`](../types/middlewareHandlerType.mdx)",
|
||||
"description": "the middleware function. Should return a middleware function.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "options",
|
||||
"type": "Record<`string`, `unknown`\\>",
|
||||
"description": "the arguments that will be passed to the middleware",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "void",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### addPreCartCreation
|
||||
|
||||
**addPreCartCreation**(`middleware`): `void`
|
||||
|
||||
Adds a middleware function to be called before cart creation
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "middleware",
|
||||
"type": "`RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\\>\\>",
|
||||
"description": "the middleware function. Should return a middleware function.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### addRouter
|
||||
|
||||
**addRouter**(`path`, `router`): `void`
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "path",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "router",
|
||||
"type": "`Router`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### getRouters
|
||||
|
||||
**getRouters**(`path`): `Router`[]
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "path",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`Router`[]
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Router[]",
|
||||
"type": "`Router`[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### usePostAuthentication
|
||||
|
||||
**usePostAuthentication**(`app`): `void`
|
||||
|
||||
Adds post authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "app",
|
||||
"type": "`Router`",
|
||||
"description": "the express app to add the middleware to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### usePreAuthentication
|
||||
|
||||
**usePreAuthentication**(`app`): `void`
|
||||
|
||||
Adds pre authentication middleware to an express app.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "app",
|
||||
"type": "`Router`",
|
||||
"description": "the express app to add the middleware to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### usePreCartCreation
|
||||
|
||||
**usePreCartCreation**(): `RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\>[]
|
||||
|
||||
#### Returns
|
||||
|
||||
`RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\>\>[]
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any\\>\\>[]",
|
||||
"type": "`RequestHandler`<`ParamsDictionary`, `any`, `any`, `ParsedQs`, Record<`string`, `any`\\>\\>[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### validateMiddleware\_
|
||||
|
||||
**validateMiddleware_**(`fn`): `void`
|
||||
|
||||
Validates a middleware function, throws if fn is not of type function.
|
||||
|
||||
#### Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "fn",
|
||||
"type": "`unknown`",
|
||||
"description": "the middleware function to validate.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "nothing if the middleware is a function",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -0,0 +1,232 @@
|
||||
---
|
||||
displayed_sidebar: servicesSidebar
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# MoneyAmount
|
||||
|
||||
A Money Amount represent a price amount, for example, a product variant's price or a price in a price list. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used, the amount will be in the currency defined for the Region.
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new MoneyAmount**()
|
||||
|
||||
A Money Amount represent a price amount, for example, a product variant's price or a price in a price list. Each Money Amount either has a Currency or Region associated with it to indicate the pricing in a given Currency or, for fully region-based pricing, the given price in a specific Region. If region-based pricing is used, the amount will be in the currency defined for the Region.
|
||||
|
||||
## Properties
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "`number`",
|
||||
"description": "The amount in the smallest currecny unit (e.g. cents 100 cents to charge $1) that the Product Variant will cost.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency",
|
||||
"type": "[`Currency`](Currency.mdx)",
|
||||
"description": "The details of the currency that the money amount may belong to.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "currency_code",
|
||||
"type": "`string`",
|
||||
"description": "The 3 character currency code that the money amount may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "``null`` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The money amount's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "max_quantity",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The maximum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "min_quantity",
|
||||
"type": "``null`` \\| `number`",
|
||||
"description": "The minimum quantity that the Money Amount applies to. If this value is not set, the Money Amount applies to all quantities.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list",
|
||||
"type": "``null`` \\| [`PriceList`](PriceList.mdx)",
|
||||
"description": "The details of the price list that the money amount may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "price_list_id",
|
||||
"type": "``null`` \\| `string`",
|
||||
"description": "The ID of the price list that the money amount may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region",
|
||||
"type": "[`Region`](Region.mdx)",
|
||||
"description": "The details of the region that the money amount may belong to.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "region_id",
|
||||
"type": "`string`",
|
||||
"description": "The region's ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant",
|
||||
"type": "[`ProductVariant`](ProductVariant.mdx)",
|
||||
"description": "The details of the product variant that the money amount may belong to.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": true,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variant_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the Product Variant contained in the Line Item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "variants",
|
||||
"type": "[`ProductVariant`](ProductVariant.mdx)[]",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
## Methods
|
||||
|
||||
### afterLoad
|
||||
|
||||
`Private` **afterLoad**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### beforeInsert
|
||||
|
||||
`Private` **beforeInsert**(): `undefined` \| `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`undefined` \| `void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "undefined \\| void",
|
||||
"type": "`undefined` \\| `void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
|
||||
___
|
||||
|
||||
### beforeUpdate
|
||||
|
||||
`Private` **beforeUpdate**(): `void`
|
||||
|
||||
#### Returns
|
||||
|
||||
`void`
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "void",
|
||||
"type": "`void`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
@@ -1,563 +0,0 @@
|
||||
# NewTotalsService
|
||||
|
||||
## Hierarchy
|
||||
|
||||
- `TransactionBaseService`
|
||||
|
||||
↳ **`NewTotalsService`**
|
||||
|
||||
## Constructors
|
||||
|
||||
### constructor
|
||||
|
||||
**new NewTotalsService**(`«destructured»`)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `InjectedDependencies` |
|
||||
|
||||
#### Overrides
|
||||
|
||||
TransactionBaseService.constructor
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:67](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L67)
|
||||
|
||||
## Properties
|
||||
|
||||
### \_\_configModule\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_configModule\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_configModule\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:14](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L14)
|
||||
|
||||
___
|
||||
|
||||
### \_\_container\_\_
|
||||
|
||||
`Protected` `Readonly` **\_\_container\_\_**: `any`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_container\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:13](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L13)
|
||||
|
||||
___
|
||||
|
||||
### \_\_moduleDeclaration\_\_
|
||||
|
||||
`Protected` `Optional` `Readonly` **\_\_moduleDeclaration\_\_**: Record<`string`, `unknown`\>
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.\_\_moduleDeclaration\_\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:15](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L15)
|
||||
|
||||
___
|
||||
|
||||
### featureFlagRouter\_
|
||||
|
||||
`Protected` `Readonly` **featureFlagRouter\_**: `FlagRouter`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:64](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L64)
|
||||
|
||||
___
|
||||
|
||||
### manager\_
|
||||
|
||||
`Protected` **manager\_**: `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.manager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:5](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L5)
|
||||
|
||||
___
|
||||
|
||||
### taxCalculationStrategy\_
|
||||
|
||||
`Protected` `Readonly` **taxCalculationStrategy\_**: `ITaxCalculationStrategy`
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:65](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L65)
|
||||
|
||||
___
|
||||
|
||||
### taxProviderService\_
|
||||
|
||||
`Protected` `Readonly` **taxProviderService\_**: [`TaxProviderService`](TaxProviderService.md)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:63](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L63)
|
||||
|
||||
___
|
||||
|
||||
### transactionManager\_
|
||||
|
||||
`Protected` **transactionManager\_**: `undefined` \| `EntityManager`
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.transactionManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:6](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L6)
|
||||
|
||||
## Accessors
|
||||
|
||||
### activeManager\_
|
||||
|
||||
`Protected` `get` **activeManager_**(): `EntityManager`
|
||||
|
||||
#### Returns
|
||||
|
||||
`EntityManager`
|
||||
|
||||
-`EntityManager`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.activeManager\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:8](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L8)
|
||||
|
||||
## Methods
|
||||
|
||||
### atomicPhase\_
|
||||
|
||||
`Protected` **atomicPhase_**<`TResult`, `TError`\>(`work`, `isolationOrErrorHandler?`, `maybeErrorHandlerOrDontFail?`): `Promise`<`TResult`\>
|
||||
|
||||
Wraps some work within a transactional block. If the service already has
|
||||
a transaction manager attached this will be reused, otherwise a new
|
||||
transaction manager is created.
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `TResult` | `object` |
|
||||
| `TError` | `object` |
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name | 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 |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`TResult`\>
|
||||
|
||||
-`Promise`: the result of the transactional work
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.atomicPhase\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:56](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L56)
|
||||
|
||||
___
|
||||
|
||||
### getGiftCardTotals
|
||||
|
||||
**getGiftCardTotals**(`giftCardableAmount`, `«destructured»`): `Promise`<{ `tax_total`: `number` ; `total`: `number` }\>
|
||||
|
||||
Calculate and return the gift cards totals
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `giftCardableAmount` | `number` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `giftCardTransactions?` | `GiftCardTransaction`[] |
|
||||
| › `giftCards?` | `GiftCard`[] |
|
||||
| › `region` | `Region` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `tax_total`: `number` ; `total`: `number` }\>
|
||||
|
||||
-`Promise`:
|
||||
-``object``: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:447](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L447)
|
||||
|
||||
___
|
||||
|
||||
### getGiftCardTransactionsTotals
|
||||
|
||||
**getGiftCardTransactionsTotals**(`«destructured»`): { `tax_total`: `number` ; `total`: `number` }
|
||||
|
||||
Calculate and return the gift cards totals based on their transactions
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `object` |
|
||||
| › `giftCardTransactions` | `GiftCardTransaction`[] |
|
||||
| › `region` | `object` |
|
||||
| › `region.gift_cards_taxable` | `boolean` |
|
||||
| › `region.tax_rate` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`object`
|
||||
|
||||
-``object``: (optional)
|
||||
|
||||
| Name | Type |
|
||||
| :------ | :------ |
|
||||
| `tax_total` | `number` |
|
||||
| `total` | `number` |
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:526](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L526)
|
||||
|
||||
___
|
||||
|
||||
### getGiftCardableAmount
|
||||
|
||||
**getGiftCardableAmount**(`«destructured»`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `«destructured»` | `object` |
|
||||
| › `discount_total` | `number` |
|
||||
| › `gift_cards_taxable?` | `boolean` |
|
||||
| › `shipping_total` | `number` |
|
||||
| › `subtotal` | `number` |
|
||||
| › `tax_total` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:638](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L638)
|
||||
|
||||
___
|
||||
|
||||
### getLineItemRefund
|
||||
|
||||
**getLineItemRefund**(`lineItem`, `«destructured»`): `number`
|
||||
|
||||
Return the amount that can be refund on a line item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `lineItem` | `object` |
|
||||
| `lineItem.id` | `string` |
|
||||
| `lineItem.includes_tax` | `boolean` |
|
||||
| `lineItem.quantity` | `number` |
|
||||
| `lineItem.tax_lines` | `LineItemTaxLine`[] |
|
||||
| `lineItem.unit_price` | `number` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `taxRate?` | ``null`` \| `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:333](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L333)
|
||||
|
||||
___
|
||||
|
||||
### getLineItemRefundLegacy
|
||||
|
||||
`Protected` **getLineItemRefundLegacy**(`lineItem`, `«destructured»`): `number`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `lineItem` | `object` |
|
||||
| `lineItem.id` | `string` |
|
||||
| `lineItem.includes_tax` | `boolean` |
|
||||
| `lineItem.quantity` | `number` |
|
||||
| `lineItem.unit_price` | `number` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `taxRate` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`number`
|
||||
|
||||
-`number`: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:403](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L403)
|
||||
|
||||
___
|
||||
|
||||
### getLineItemTotals
|
||||
|
||||
**getLineItemTotals**(`items`, `«destructured»`): `Promise`<{ `[lineItemId: string]`: `LineItemTotals`; }\>
|
||||
|
||||
Calculate and return the items totals for either the legacy calculation or the new calculation
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `items` | `LineItem` \| `LineItem`[] |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `includeTax?` | `boolean` |
|
||||
| › `taxRate?` | ``null`` \| `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `[lineItemId: string]`: `LineItemTotals`; }\>
|
||||
|
||||
-`Promise`:
|
||||
-``object``: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:87](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L87)
|
||||
|
||||
___
|
||||
|
||||
### getLineItemTotalsLegacy
|
||||
|
||||
`Protected` **getLineItemTotalsLegacy**(`item`, `«destructured»`): `Promise`<`LineItemTotals`\>
|
||||
|
||||
Calculate and return the legacy calculated totals using the tax rate
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `item` | `LineItem` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `lineItemAllocation` | `object` |
|
||||
| › `lineItemAllocation.discount?` | `DiscountAllocation` |
|
||||
| › `lineItemAllocation.gift_card?` | `GiftCardAllocation` |
|
||||
| › `taxRate` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemTotals`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:254](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L254)
|
||||
|
||||
___
|
||||
|
||||
### getLineItemTotals\_
|
||||
|
||||
`Protected` **getLineItemTotals_**(`item`, `«destructured»`): `Promise`<`LineItemTotals`\>
|
||||
|
||||
Calculate and return the totals for an item
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `item` | `LineItem` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `includeTax?` | `boolean` |
|
||||
| › `lineItemAllocation` | `object` |
|
||||
| › `lineItemAllocation.discount?` | `DiscountAllocation` |
|
||||
| › `lineItemAllocation.gift_card?` | `GiftCardAllocation` |
|
||||
| › `taxLines?` | `LineItemTaxLine`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`LineItemTotals`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:147](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L147)
|
||||
|
||||
___
|
||||
|
||||
### getShippingMethodTotals
|
||||
|
||||
**getShippingMethodTotals**(`shippingMethods`, `«destructured»`): `Promise`<{ `[shippingMethodId: string]`: `ShippingMethodTotals`; }\>
|
||||
|
||||
Calculate and return the shipping methods totals for either the legacy calculation or the new calculation
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `shippingMethods` | `ShippingMethod` \| `ShippingMethod`[] |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `discounts?` | `Discount`[] |
|
||||
| › `includeTax?` | `boolean` |
|
||||
| › `taxRate?` | ``null`` \| `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<{ `[shippingMethodId: string]`: `ShippingMethodTotals`; }\>
|
||||
|
||||
-`Promise`:
|
||||
-``object``: (optional)
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:572](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L572)
|
||||
|
||||
___
|
||||
|
||||
### getShippingMethodTotalsLegacy
|
||||
|
||||
`Protected` **getShippingMethodTotalsLegacy**(`shippingMethod`, `«destructured»`): `Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
Calculate and return the shipping method totals legacy using the tax rate
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `shippingMethod` | `ShippingMethod` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `discounts?` | `Discount`[] |
|
||||
| › `taxRate` | `number` |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:749](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L749)
|
||||
|
||||
___
|
||||
|
||||
### getShippingMethodTotals\_
|
||||
|
||||
`Protected` **getShippingMethodTotals_**(`shippingMethod`, `«destructured»`): `Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
Calculate and return the shipping method totals
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `shippingMethod` | `ShippingMethod` |
|
||||
| `«destructured»` | `object` |
|
||||
| › `calculationContext` | `TaxCalculationContext` |
|
||||
| › `discounts?` | `Discount`[] |
|
||||
| › `includeTax?` | `boolean` |
|
||||
| › `taxLines?` | `ShippingMethodTaxLine`[] |
|
||||
|
||||
#### Returns
|
||||
|
||||
`Promise`<`ShippingMethodTotals`\>
|
||||
|
||||
-`Promise`:
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/services/new-totals.ts:666](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/services/new-totals.ts#L666)
|
||||
|
||||
___
|
||||
|
||||
### shouldRetryTransaction\_
|
||||
|
||||
`Protected` **shouldRetryTransaction_**(`err`): `boolean`
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `err` | Record<`string`, `unknown`\> \| { `code`: `string` } |
|
||||
|
||||
#### Returns
|
||||
|
||||
`boolean`
|
||||
|
||||
-`boolean`: (optional)
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.shouldRetryTransaction\_
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:37](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L37)
|
||||
|
||||
___
|
||||
|
||||
### withTransaction
|
||||
|
||||
**withTransaction**(`transactionManager?`): [`NewTotalsService`](NewTotalsService.md)
|
||||
|
||||
#### Parameters
|
||||
|
||||
| Name |
|
||||
| :------ |
|
||||
| `transactionManager?` | `EntityManager` |
|
||||
|
||||
#### Returns
|
||||
|
||||
[`NewTotalsService`](NewTotalsService.md)
|
||||
|
||||
-`default`:
|
||||
|
||||
#### Inherited from
|
||||
|
||||
TransactionBaseService.withTransaction
|
||||
|
||||
#### Defined in
|
||||
|
||||
[medusa/src/interfaces/transaction-base-service.ts:20](https://github.com/medusajs/medusa/blob/0af6e5534/packages/medusa/src/interfaces/transaction-base-service.ts#L20)
|
||||
Loaded 100 of 2110 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user