Skip to main content
Skip to main content

ClaimService

internal.internal.ClaimService

Properties

__configModule__Record<string, unknown>
__container__anyRequired
__moduleDeclaration__Record<string, unknown>
addressRepository_Repository<Address>Required
claimItemService_ClaimItemServiceRequired
claimRepository_Repository<ClaimOrder>Required
eventBus_EventBusServiceRequired
fulfillmentProviderService_FulfillmentProviderServiceRequired
fulfillmentService_FulfillmentServiceRequired
lineItemRepository_Repository<LineItem> & { findByReturn: Method findByReturn }Required
lineItemService_LineItemServiceRequired
manager_EntityManagerRequired
paymentProviderService_PaymentProviderServiceRequired
productVariantInventoryService_ProductVariantInventoryServiceRequired
regionService_RegionServiceRequired
returnService_ReturnServiceRequired
shippingMethodRepository_Repository<ShippingMethod>Required
shippingOptionService_ShippingOptionServiceRequired
taxProviderService_TaxProviderServiceRequired
totalsService_TotalsServiceRequired
transactionManager_undefined | EntityManagerRequired
EventsobjectRequired
Events.CANCELEDstringRequired
Events.CREATEDstringRequired
Events.FULFILLMENT_CREATEDstringRequired
Events.REFUND_PROCESSEDstringRequired
Events.SHIPMENT_CREATEDstringRequired
Events.UPDATEDstringRequired

Accessors

activeManager_

Protected get activeManager_(): EntityManager

Returns

EntityManager

EntityManagerEntityManagerRequired

Inherited 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.

TResultobjectRequired
TErrorobjectRequired

Parameters

work(transactionManager: EntityManager) => Promise<TResult>Required
the transactional work to be done
isolationOrErrorHandlerIsolationLevel | (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>

PromisePromise<TResult>Required
the result of the transactional work

Inherited from

TransactionBaseService.atomicPhase_


cancel

cancel(id): Promise<ClaimOrder>

Parameters

idstringRequired

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required

cancelFulfillment

cancelFulfillment(fulfillmentId): Promise<ClaimOrder>

Parameters

fulfillmentIdstringRequired

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required

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

dataCreateClaimInputRequired
the object containing all data required to create a claim

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required
created claim

createFulfillment

createFulfillment(id, config?): Promise<ClaimOrder>

Parameters

idstringRequired
the object containing all data required to create a claim
configobject
config object
config.location_idstring
config.metadataRecord<string, unknown>
config metadata
config.no_notificationboolean
config no notification

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required
created claim

createShipment

createShipment(id, fulfillmentId, trackingLinks?, config?): Promise<ClaimOrder>

Parameters

idstringRequired
fulfillmentIdstringRequired
trackingLinks{ tracking_number: string }[]
configobject
config.metadataobjectRequired
config.no_notificationundefinedRequired

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required

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

orderOrderRequired
the order to find claim lines on
claimItemsCreateClaimItemInput[]Required
the claim items to match against

Returns

Promise<number>

PromisePromise<number>Required
the refund amount

list

list(selector, config?): Promise<ClaimOrder[]>

Parameters

selectoranyRequired
the query object for find
the config object containing query settings

Returns

Promise<ClaimOrder[]>

PromisePromise<ClaimOrder[]>Required
the result of the find operation

processRefund

processRefund(id): Promise<ClaimOrder>

Parameters

idstringRequired

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required

retrieve

retrieve(claimId, config?): Promise<ClaimOrder>

Gets an order by id.

Parameters

claimIdstringRequired
id of the claim order to retrieve
the config object containing query settings

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required
the order document

shouldRetryTransaction_

Protected shouldRetryTransaction_(err): boolean

Parameters

errRecord<string, unknown> | { code: string }Required

Returns

boolean

booleanboolean

Inherited from

TransactionBaseService.shouldRetryTransaction_


update

update(id, data): Promise<ClaimOrder>

Parameters

idstringRequired
dataUpdateClaimInputRequired

Returns

Promise<ClaimOrder>

PromisePromise<ClaimOrder>Required

validateCreateClaimInput

Protected validateCreateClaimInput(data): Promise<void>

Parameters

dataCreateClaimInputRequired

Returns

Promise<void>

PromisePromise<void>Required

withTransaction

withTransaction(transactionManager?): ClaimService

Parameters

transactionManagerEntityManager

Returns

ClaimService

defaultClaimServiceRequired

Inherited from

TransactionBaseService.withTransaction

Was this section helpful?