ClaimService
Constructors
constructor
**new ClaimService**(«destructured»)
Parameters
Properties
__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_
Protected get**activeManager_**(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Protected **atomicPhase_**<TypeParameter TResult, TypeParameter 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.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
Promise
Promise<TResult>Requiredcancel
**cancel**(id): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
id
stringRequiredReturns
Promise<ClaimOrder>
cancelFulfillment
**cancelFulfillment**(fulfillmentId): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
fulfillmentId
stringRequiredReturns
Promise<ClaimOrder>
create
**create**(data): Promise<[ClaimOrder](/references/services/classes/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
Returns
Promise<ClaimOrder>
createFulfillment
**createFulfillment**(id, config?): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
id
stringRequiredconfig
objectRequiredconfig.location_id
stringconfig.metadata
Record<string, unknown>config.no_notification
booleanReturns
Promise<ClaimOrder>
createShipment
**createShipment**(id, fulfillmentId, trackingLinks?, config?): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
id
stringRequiredfulfillmentId
stringRequiredtrackingLinks
{ tracking_number: string }[]RequiredDefault: []
config
objectRequiredconfig.metadata
objectRequiredDefault: {}
config.no_notification
undefinedRequiredDefault: undefined
Returns
Promise<ClaimOrder>
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
Returns
Promise<number>
Promise
Promise<number>Requiredlist
**list**(selector, config?): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)[]>
Parameters
selector
anyRequiredReturns
Promise<ClaimOrder[]>
processRefund
**processRefund**(id): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
id
stringRequiredReturns
Promise<ClaimOrder>
retrieve
**retrieve**(claimId, config?): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Gets an order by id.
Parameters
claimId
stringRequiredDefault: {}
Returns
Promise<ClaimOrder>
shouldRetryTransaction_
Protected **shouldRetryTransaction_**(err): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanupdate
**update**(id, data): Promise<[ClaimOrder](/references/services/classes/ClaimOrder)>
Parameters
id
stringRequiredReturns
Promise<ClaimOrder>
validateCreateClaimInput
Protected **validateCreateClaimInput**(data): Promise<void>
Parameters
Returns
Promise<void>
Promise
Promise<void>RequiredwithTransaction
**withTransaction**(transactionManager?): [ClaimService](/references/services/classes/ClaimService)
Parameters
transactionManager
EntityManager