ReturnService
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredfeatureFlagRouter_
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
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
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>RequiredgetFulfillmentItems
Retrieves the order line items, given an array of items
Parameters
transformer
TransformerRequiredReturns
list
Parameters
Returns
listAndCount
Parameters
Returns
cancel
Cancels a return if possible. Returns can be canceled if it has not been received.
Parameters
returnId
stringRequiredReturns
validateReturnStatuses
Checks that an order has the statuses necessary to complete a return. fulfillment_status cannot be not_fulfilled or returned. payment_status must be captured.
Parameters
Returns
void
voidRequiredThrows
when statuses are not sufficient for returns.
validateReturnLineItem
Checks that a given quantity of a line item can be returned. Fails if the item is undefined or if the returnable quantity of the item is lower, than the quantity that is requested to be returned.
Parameters
quantity
numberRequiredDefault: 0
additional
objectRequiredDefault: {}
item
LineItemadditional.reason_id
stringadditional.note
stringReturns
retrieve
Retrieves a return by its id.
Parameters
returnId
stringRequiredDefault: {}
Returns
retrieveBySwap
Parameters
swapId
stringRequiredrelations
string[]RequiredDefault: []
Returns
update
Parameters
returnId
stringRequiredupdate
UpdateReturnInputRequiredReturns
create
Creates a return request for an order, with given items, and a shipping method. If no refund amount is provided the refund amount is calculated from the return lines and the shipping cost.
Parameters
data
CreateReturnInputRequiredReturns
fulfill
Parameters
returnId
stringRequiredReturns
receive
Registers a previously requested return as received. This will create a refund to the customer. If the returned items don't match the requested items the return status will be updated to requires_action. This behaviour is useful in situations where a custom refund amount is requested, but the returned items are not matching the requested items. Setting the allowMismatch argument to true, will process the return, ignoring any mismatches.
Parameters
returnId
stringRequiredallowMismatch
booleanRequiredDefault: false
context
objectRequiredDefault: {}
refundAmount
numbercontext.locationId
string