Skip to main content
Skip to main content

ClaimService

constructor

Parameters

__namedParametersInjectedDependenciesRequired

Properties

manager_EntityManagerRequired
transactionManager_undefined | EntityManagerRequired
__container__anyRequired
EventsobjectRequired
Events.CREATEDstringRequired

Default: "claim.created"

Events.UPDATEDstringRequired

Default: "claim.updated"

Events.CANCELEDstringRequired

Default: "claim.canceled"

Events.FULFILLMENT_CREATEDstringRequired

Default: "claim.fulfillment_created"

Events.SHIPMENT_CREATEDstringRequired

Default: "claim.shipment_created"

Events.REFUND_PROCESSEDstringRequired

Default: "claim.refund_processed"

addressRepository_Repository<Address>Required
claimRepository_Repository<ClaimOrder>Required
shippingMethodRepository_Repository<ShippingMethod>Required
lineItemRepository_Repository<LineItem> & objectRequired
claimItemService_ClaimItemServiceRequired
eventBus_EventBusServiceRequired
fulfillmentProviderService_FulfillmentProviderServiceRequired
fulfillmentService_FulfillmentServiceRequired
lineItemService_LineItemServiceRequired
paymentProviderService_PaymentProviderServiceRequired
regionService_RegionServiceRequired
returnService_ReturnServiceRequired
shippingOptionService_ShippingOptionServiceRequired
taxProviderService_TaxProviderServiceRequired
totalsService_TotalsServiceRequired
productVariantInventoryService_ProductVariantInventoryServiceRequired
__configModule__Record<string, unknown>
__moduleDeclaration__Record<string, unknown>

Accessors

activeManager_

Returns

EntityManagerEntityManagerRequired

Methods

withTransaction

Parameters

transactionManagerEntityManager

Returns

thisthisRequired

shouldRetryTransaction_

Parameters

errRecord<string, unknown> | objectRequired

Returns

booleanbooleanRequired

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

update

Parameters

idstringRequired
dataUpdateClaimInputRequired

Returns

PromisePromise<ClaimOrder>Required

validateCreateClaimInput

Parameters

dataCreateClaimInputRequired

Returns

PromisePromise<void>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

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.metadataRecord<string, unknown>
config metadata
config.no_notificationboolean
config no notification
config.location_idstring

Returns

PromisePromise<ClaimOrder>Required
created claim

cancelFulfillment

Parameters

fulfillmentIdstringRequired

Returns

PromisePromise<ClaimOrder>Required

processRefund

Parameters

idstringRequired

Returns

PromisePromise<ClaimOrder>Required

createShipment

Parameters

idstringRequired
fulfillmentIdstringRequired
trackingLinksobject[]Required

Default: []

configobjectRequired
config.metadataobjectRequired

Default: {}

config.no_notificationundefinedRequired

Default: undefined

Returns

PromisePromise<ClaimOrder>Required

cancel

Parameters

idstringRequired

Returns

PromisePromise<ClaimOrder>Required

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

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
Was this section helpful?