---
displayed_sidebar: servicesSidebar
---

import TypeList from "@site/src/components/TypeList"

# ClaimService

## constructor

### Parameters

<TypeList types={[{"name":"__namedParameters","type":"`InjectedDependencies`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="new ClaimService"/>

___

## Properties

<TypeList types={[{"name":"manager_","type":"`EntityManager`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"transactionManager_","type":"`undefined` \\| `EntityManager`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"__container__","type":"`any`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"Events","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"Events.CREATED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.created\"","expandable":false,"children":[]},{"name":"Events.UPDATED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.updated\"","expandable":false,"children":[]},{"name":"Events.CANCELED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.canceled\"","expandable":false,"children":[]},{"name":"Events.FULFILLMENT_CREATED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.fulfillment_created\"","expandable":false,"children":[]},{"name":"Events.SHIPMENT_CREATED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.shipment_created\"","expandable":false,"children":[]},{"name":"Events.REFUND_PROCESSED","type":"`string`","description":"","optional":false,"defaultValue":"\"claim.refund_processed\"","expandable":false,"children":[]},{"name":"addressRepository_","type":"Repository&#60;[Address](../../entities/classes/entities.Address.mdx)&#62;","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"claimRepository_","type":"Repository&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"shippingMethodRepository_","type":"Repository&#60;[ShippingMethod](../../entities/classes/entities.ShippingMethod.mdx)&#62;","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"lineItemRepository_","type":"Repository&#60;[LineItem](../../entities/classes/entities.LineItem.mdx)&#62; & `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"claimItemService_","type":"[ClaimItemService](services.ClaimItemService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"eventBus_","type":"[EventBusService](services.EventBusService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"fulfillmentProviderService_","type":"[FulfillmentProviderService](services.FulfillmentProviderService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"fulfillmentService_","type":"[FulfillmentService](services.FulfillmentService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"lineItemService_","type":"[LineItemService](services.LineItemService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"paymentProviderService_","type":"[PaymentProviderService](services.PaymentProviderService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"regionService_","type":"[RegionService](services.RegionService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"returnService_","type":"[ReturnService](services.ReturnService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"shippingOptionService_","type":"[ShippingOptionService](services.ShippingOptionService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"taxProviderService_","type":"[TaxProviderService](services.TaxProviderService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"totalsService_","type":"[TotalsService](services.TotalsService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"productVariantInventoryService_","type":"[ProductVariantInventoryService](services.ProductVariantInventoryService.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"__configModule__","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"__moduleDeclaration__","type":"`Record<string, unknown>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="ClaimService"/>

___

## Accessors

### activeManager\_

#### Returns

<TypeList types={[{"name":"EntityManager","type":"`EntityManager`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="activeManager_"/>

___

## Methods

### withTransaction

#### Parameters

<TypeList types={[{"name":"transactionManager","type":"`EntityManager`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="withTransaction"/>

#### Returns

<TypeList types={[{"name":"this","type":"`this`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="withTransaction"/>

### shouldRetryTransaction\_

#### Parameters

<TypeList types={[{"name":"err","type":"`Record<string, unknown>` \\| `object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="shouldRetryTransaction_"/>

#### Returns

<TypeList types={[{"name":"boolean","type":"`boolean`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="shouldRetryTransaction_"/>

### 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

<TypeList types={[{"name":"TResult","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"TError","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="atomicPhase_"/>

#### Parameters

<TypeList types={[{"name":"work","type":"(`transactionManager`: `EntityManager`) => Promise&#60;TResult&#62;","description":"the transactional work to be done","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"isolationOrErrorHandler","type":"`IsolationLevel` \\| (`error`: TError) => Promise&#60;void \\| TResult&#62;","description":"the isolation level to be used for the work.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"maybeErrorHandlerOrDontFail","type":"(`error`: TError) => Promise&#60;void \\| TResult&#62;","description":"Potential error handler","optional":true,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="atomicPhase_"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;TResult&#62;","optional":false,"defaultValue":"","description":"the result of the transactional work","expandable":false,"children":[]}]}  sectionTitle="atomicPhase_"/>

### update

#### Parameters

<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`UpdateClaimInput`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="update"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="update"/>

### validateCreateClaimInput

#### Parameters

<TypeList types={[{"name":"data","type":"`CreateClaimInput`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="validateCreateClaimInput"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;void&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="validateCreateClaimInput"/>

### 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

<TypeList types={[{"name":"order","type":"[Order](../../entities/classes/entities.Order.mdx)","description":"the order to find claim lines on","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"claimItems","type":"`CreateClaimItemInput`[]","description":"the claim items to match against","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="getRefundTotalForClaimLinesOnOrder"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;number&#62;","optional":false,"defaultValue":"","description":"the refund amount","expandable":false,"children":[]}]}  sectionTitle="getRefundTotalForClaimLinesOnOrder"/>

### 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

<TypeList types={[{"name":"data","type":"`CreateClaimInput`","description":"the object containing all data required to create a claim","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="create"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"created claim","expandable":false,"children":[]}]}  sectionTitle="create"/>

### createFulfillment

#### Parameters

<TypeList types={[{"name":"id","type":"`string`","description":"the object containing all data required to create a claim","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"`object`","description":"config object","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config.metadata","type":"`Record<string, unknown>`","description":"config metadata","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"config.no_notification","type":"`boolean`","description":"config no notification","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"config.location_id","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="createFulfillment"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"created claim","expandable":false,"children":[]}]}  sectionTitle="createFulfillment"/>

### cancelFulfillment

#### Parameters

<TypeList types={[{"name":"fulfillmentId","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="cancelFulfillment"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="cancelFulfillment"/>

### processRefund

#### Parameters

<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="processRefund"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="processRefund"/>

### createShipment

#### Parameters

<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"fulfillmentId","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"trackingLinks","type":"`object`[]","description":"","optional":false,"defaultValue":"[]","expandable":false,"children":[]},{"name":"config","type":"`object`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config.metadata","type":"`object`","description":"","optional":false,"defaultValue":"{}","expandable":false,"children":[]},{"name":"config.no_notification","type":"`undefined`","description":"","optional":false,"defaultValue":"undefined","expandable":false,"children":[]}]}  sectionTitle="createShipment"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="createShipment"/>

### cancel

#### Parameters

<TypeList types={[{"name":"id","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="cancel"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}  sectionTitle="cancel"/>

### list

#### Parameters

<TypeList types={[{"name":"selector","type":"`any`","description":"the query object for find","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","description":"the config object containing query settings","optional":false,"defaultValue":"","expandable":false,"children":[]}]}  sectionTitle="list"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)[]&#62;","optional":false,"defaultValue":"","description":"the result of the find operation","expandable":false,"children":[]}]}  sectionTitle="list"/>

### retrieve

Gets an order by id.

#### Parameters

<TypeList types={[{"name":"claimId","type":"`string`","description":"id of the claim order to retrieve","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"config","type":"[FindConfig](../../medusa/interfaces/medusa.FindConfig.mdx)&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","description":"the config object containing query settings","optional":false,"defaultValue":"{}","expandable":false,"children":[]}]}  sectionTitle="retrieve"/>

#### Returns

<TypeList types={[{"name":"Promise","type":"Promise&#60;[ClaimOrder](../../entities/classes/entities.ClaimOrder.mdx)&#62;","optional":false,"defaultValue":"","description":"the order document","expandable":false,"children":[]}]}  sectionTitle="retrieve"/>
