ClaimService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredEvents
objectRequiredEvents.CREATED
stringRequiredDefault: "claim.created"
Events.UPDATED
stringRequiredDefault: "claim.updated"
Events.CANCELED
stringRequiredDefault: "claim.canceled"
Events.FULFILLMENT_CREATED
stringRequiredDefault: "claim.fulfillment_created"
Events.SHIPMENT_CREATED
stringRequiredDefault: "claim.shipment_created"
Events.REFUND_PROCESSED
stringRequiredDefault: "claim.refund_processed"
__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>Requiredthe 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
Promise<TResult>Requiredthe result of the transactional work
update
Parameters
id
stringRequireddata
UpdateClaimInputRequiredReturns
validateCreateClaimInput
Parameters
data
CreateClaimInputRequiredReturns
Promise
Promise<void>RequiredgetRefundTotalForClaimLinesOnOrder
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
the order to find claim lines on
claimItems
CreateClaimItemInput[]Requiredthe claim items to match against
Returns
Promise
Promise<number>Requiredthe refund amount
create
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
data
CreateClaimInputRequiredthe object containing all data required to create a claim
Returns
created claim
createFulfillment
Parameters
id
stringRequiredthe object containing all data required to create a claim
config
objectRequiredconfig object
config.metadata
Record<string, unknown>config metadata
config.no_notification
booleanconfig no notification
config.location_id
stringReturns
created claim
cancelFulfillment
Parameters
fulfillmentId
stringRequiredReturns
processRefund
Parameters
id
stringRequiredReturns
createShipment
Parameters
id
stringRequiredfulfillmentId
stringRequiredtrackingLinks
object[]RequiredDefault: []
config
objectRequiredconfig.metadata
objectRequiredDefault: {}
config.no_notification
undefinedRequiredDefault: undefined
Returns
cancel
Parameters
id
stringRequiredReturns
list
Parameters
selector
anyRequiredthe query object for find
the config object containing query settings
Returns
the result of the find operation
retrieve
Gets an order by id.
Parameters
claimId
stringRequiredid of the claim order to retrieve
the config object containing query settings
Default: {}
Returns
the order document
Was this section helpful?