ClaimService
internal.internal.ClaimService
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredEvents
objectRequiredEvents.CANCELED
stringRequiredEvents.CREATED
stringRequiredEvents.FULFILLMENT_CREATED
stringRequiredEvents.REFUND_PROCESSED
stringRequiredEvents.SHIPMENT_CREATED
stringRequiredEvents.UPDATED
stringRequiredAccessors
activeManager_
Protected
get
activeManager_(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredInherited from
TransactionBaseService.activeManager_
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.
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>RequiredInherited from
TransactionBaseService.atomicPhase_
cancel
cancel(id
): Promise
<ClaimOrder
>
Parameters
id
stringRequiredReturns
Promise
<ClaimOrder
>
cancelFulfillment
cancelFulfillment(fulfillmentId
): Promise
<ClaimOrder
>
Parameters
fulfillmentId
stringRequiredReturns
Promise
<ClaimOrder
>
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
Returns
Promise
<ClaimOrder
>
created claim
createFulfillment
createFulfillment(id
, config?
): Promise
<ClaimOrder
>
Parameters
id
stringRequiredconfig
objectconfig.location_id
stringconfig.metadata
Record<string, unknown>config.no_notification
booleanReturns
Promise
<ClaimOrder
>
created claim
createShipment
createShipment(id
, fulfillmentId
, trackingLinks?
, config?
): Promise
<ClaimOrder
>
Parameters
id
stringRequiredfulfillmentId
stringRequiredtrackingLinks
{ tracking_number: string }[]config
objectconfig.metadata
objectRequiredconfig.no_notification
undefinedRequiredReturns
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>Requiredthe refund amount
Promise
Promise<number>Requiredlist
list(selector
, config?
): Promise
<ClaimOrder
[]>
Parameters
selector
anyRequiredconfig
FindConfig<ClaimOrder>Returns
Promise
<ClaimOrder
[]>
the result of the find operation
processRefund
processRefund(id
): Promise
<ClaimOrder
>
Parameters
id
stringRequiredReturns
Promise
<ClaimOrder
>
retrieve
retrieve(claimId
, config?
): Promise
<ClaimOrder
>
Gets an order by id.
Parameters
claimId
stringRequiredconfig
FindConfig<ClaimOrder>Returns
Promise
<ClaimOrder
>
the order document
shouldRetryTransaction_
Protected
shouldRetryTransaction_(err
): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanInherited from
TransactionBaseService.shouldRetryTransaction_
update
update(id
, data
): Promise
<ClaimOrder
>
Parameters
id
stringRequiredReturns
Promise
<ClaimOrder
>
validateCreateClaimInput
Protected
validateCreateClaimInput(data
): Promise
<void
>
Parameters
Returns
Promise
<void
>
Promise
Promise<void>RequiredwithTransaction
withTransaction(transactionManager?
): ClaimService
Parameters
transactionManager
EntityManager