ClaimService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CANCELED
stringRequiredDefault: "claim.canceled"
Events.CREATED
stringRequiredDefault: "claim.created"
Events.FULFILLMENT_CREATED
stringRequiredDefault: "claim.fulfillment_created"
Events.REFUND_PROCESSED
stringRequiredDefault: "claim.refund_processed"
Events.SHIPMENT_CREATED
stringRequiredDefault: "claim.shipment_created"
Events.UPDATED
stringRequiredDefault: "claim.updated"
Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
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
cancel
Parameters
id
stringRequiredReturns
cancelFulfillment
Parameters
fulfillmentId
stringRequiredReturns
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.location_id
stringconfig.metadata
Record<string, unknown>config metadata
config.no_notification
booleanconfig no notification
Returns
created claim
createShipment
Parameters
id
stringRequiredfulfillmentId
stringRequiredtrackingLinks
object[]RequiredDefault: []
config
objectRequiredconfig.metadata
objectRequiredDefault: {}
config.no_notification
undefinedRequiredDefault: undefined
Returns
getRefundTotalForClaimLinesOnOrder
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
list
Parameters
selector
anyRequiredthe query object for find
the config object containing query settings
Returns
the result of the find operation
processRefund
Parameters
id
stringRequiredReturns
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
shouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanupdate
Parameters
id
stringRequireddata
UpdateClaimInputRequiredReturns
validateCreateClaimInput
Parameters
data
CreateClaimInputRequiredReturns
Promise
Promise<void>RequiredwithTransaction
Parameters
transactionManager
EntityManagerReturns
ClaimService
objectRequiredWas this section helpful?