Skip to main content
Skip to main content

ClaimService

constructor

Parameters

__namedParametersInjectedDependenciesRequired

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> & objectRequired
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

Default: "claim.canceled"

Events.CREATEDstringRequired

Default: "claim.created"

Events.FULFILLMENT_CREATEDstringRequired

Default: "claim.fulfillment_created"

Events.REFUND_PROCESSEDstringRequired

Default: "claim.refund_processed"

Events.SHIPMENT_CREATEDstringRequired

Default: "claim.shipment_created"

Events.UPDATEDstringRequired

Default: "claim.updated"


Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

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

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

PromisePromise<TResult>Required
the result of the transactional work

cancel

Parameters

idstringRequired

Returns

PromisePromise<ClaimOrder>Required

cancelFulfillment

Parameters

fulfillmentIdstringRequired

Returns

PromisePromise<ClaimOrder>Required

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

dataCreateClaimInputRequired
the object containing all data required to create a claim

Returns

PromisePromise<ClaimOrder>Required
created claim

createFulfillment

Parameters

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

Returns

PromisePromise<ClaimOrder>Required
created claim

createShipment

Parameters

idstringRequired
fulfillmentIdstringRequired
trackingLinksobject[]Required

Default: []

configobjectRequired
config.metadataobjectRequired

Default: {}

config.no_notificationundefinedRequired

Default: undefined

Returns

PromisePromise<ClaimOrder>Required

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

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

Returns

PromisePromise<number>Required
the refund amount

list

Parameters

selectoranyRequired
the query object for find
configFindConfig<ClaimOrder>Required
the config object containing query settings

Returns

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

processRefund

Parameters

idstringRequired

Returns

PromisePromise<ClaimOrder>Required

retrieve

Gets an order by id.

Parameters

claimIdstringRequired
id of the claim order to retrieve
configFindConfig<ClaimOrder>Required
the config object containing query settings

Default: {}

Returns

PromisePromise<ClaimOrder>Required
the order document

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanboolean

update

Parameters

idstringRequired
dataUpdateClaimInputRequired

Returns

PromisePromise<ClaimOrder>Required

validateCreateClaimInput

Parameters

dataCreateClaimInputRequired

Returns

PromisePromise<void>Required

withTransaction

Parameters

transactionManagerEntityManager

Returns

ClaimServiceobjectRequired
Was this section helpful?