IOrderReturnRequestModuleService Reference
This section of the documentation provides a reference to the IOrderReturnRequestModuleService interface’s methods. This is the interface developers use to use the functionalities provided by the Order Return Request Module.
You should only use the methods in this reference when implementing complex customizations. For common cases, check out available workflows instead.
The main service interface for the Order Return Request Module.
Methods
Order Return Request Methods
Order Return Request Line Item Methods
createOrderReturnRequests
This section provides a reference to the createOrderReturnRequests method. This belongs to the Order Return Request Module.
createOrderReturnRequests(data, sharedContext?): Promise<OrderReturnRequestDTO[]>
This method creates order return requests.
Example
const returnRequests = await orderReturnRequestModuleService . createOrderReturnRequests ([
{
order_id: "ord_123" ,
customer_id: "cus_123" ,
customer_note: "Product arrived damaged" ,
shipping_option_id: "so_123" ,
line_items: [
{ line_item_id: "ordli_123" , quantity: 1 , reason_id: "reason_123" },
],
},
])
Parameters
data
CreateOrderReturnRequestDTO[]
required
The order return requests to be created. The ID of the order this return request is for.
The ID of the customer who created the return request.
The customer’s note explaining the reason for the return.
The ID of the shipping option for returning the items.
line_items
Array<{ line_item_id: string; quantity: number; reason_id?: string }>
required
The line items to be returned. The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestDTO[]>
The created order return requests.
createOrderReturnRequests(data, sharedContext?): Promise<OrderReturnRequestDTO>
This method creates an order return request.
Example
const returnRequest = await orderReturnRequestModuleService . createOrderReturnRequests ({
order_id: "ord_123" ,
customer_id: "cus_123" ,
customer_note: "Product arrived damaged" ,
shipping_option_id: "so_123" ,
line_items: [
{ line_item_id: "ordli_123" , quantity: 1 , reason_id: "reason_123" },
],
})
Parameters
data
CreateOrderReturnRequestDTO
required
The order return request to be created. The ID of the order this return request is for.
The ID of the customer who created the return request.
The customer’s note explaining the reason for the return.
The ID of the shipping option for returning the items.
line_items
Array<{ line_item_id: string; quantity: number; reason_id?: string }>
required
The line items to be returned. The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestDTO>
The created order return request.
updateOrderReturnRequests
This section provides a reference to the updateOrderReturnRequests method. This belongs to the Order Return Request Module.
updateOrderReturnRequests(id, data, sharedContext?): Promise<OrderReturnRequestDTO>
This method updates an existing order return request.
Example
Vendor reviewing a return request:
const returnRequest = await orderReturnRequestModuleService . updateOrderReturnRequests ( "oretreq_123" , {
vendor_reviewer_id: "mem_123" ,
vendor_reviewer_note: "Approved for return" ,
vendor_review_date: new Date (),
status: "refunded" ,
})
Admin reviewing an escalated return request:
const returnRequest = await orderReturnRequestModuleService . updateOrderReturnRequests ( "oretreq_123" , {
admin_reviewer_id: "user_123" ,
admin_reviewer_note: "Customer is right, approve the return" ,
admin_review_date: new Date (),
status: "refunded" ,
})
Parameters
The ID of the order return request.
data
UpdateOrderReturnRequestDTO
required
The attributes to update in the order return request. The customer’s note explaining the reason for the return.
The ID of the shipping option for returning the items.
The ID of the vendor member who reviewed the request.
The vendor’s note regarding the return request.
The date when the vendor reviewed the request.
The ID of the admin user who reviewed the escalated request.
The admin’s note regarding the return request.
The date when the admin reviewed the request.
status
"pending" | "refunded" | "withdrawn" | "escalated" | "canceled"
required
The status of the return request.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestDTO>
The updated order return request. The ID of the order return request.
The ID of the customer who created the return request.
The customer’s note explaining the reason for the return.
The ID of the shipping option for returning the items.
The ID of the vendor member who reviewed the request.
The vendor’s note regarding the return request.
The date when the vendor reviewed the request.
The ID of the admin user who reviewed the escalated request.
The admin’s note regarding the return request.
The date when the admin reviewed the request.
status
"pending" | "refunded" | "withdrawn" | "escalated" | "canceled"
The status of the return request.
line_items
OrderReturnRequestLineItemDTO[]
The associated line items (if included in relations).
The created date of the order return request.
The updated date of the order return request.
deleteOrderReturnRequests
This section provides a reference to the deleteOrderReturnRequests method. This belongs to the Order Return Request Module.
deleteOrderReturnRequests(ids, sharedContext?): Promise<void>
This method deletes order return requests by their IDs.
Example
await orderReturnRequestModuleService . deleteOrderReturnRequests ([ "oretreq_123" , "oretreq_321" ])
Parameters
The IDs of the order return requests.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Resolves when the order return requests are deleted successfully.
deleteOrderReturnRequests(id, sharedContext?): Promise<void>
This method deletes an order return request by its ID.
Example
await orderReturnRequestModuleService . deleteOrderReturnRequests ( "oretreq_123" )
Parameters
The ID of the order return request.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Resolves when the order return request is deleted successfully.
retrieveOrderReturnRequest
This section provides a reference to the retrieveOrderReturnRequest method. This belongs to the Order Return Request Module.
This method retrieves an order return request by its ID.
Example
const returnRequest = await orderReturnRequestModuleService . retrieveOrderReturnRequest ( "oretreq_123" )
To retrieve with line items:
const returnRequest = await orderReturnRequestModuleService . retrieveOrderReturnRequest (
"oretreq_123" ,
{
relations: [ "line_items" ],
}
)
Parameters
The ID of the order return request.
config
FindConfig<OrderReturnRequestDTO>
The configurations determining how the order return request is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
A number indicating the number of records to skip before retrieving the results.
A number indicating the number of records to return in the result.
An array of strings, each being relation names of the entity to retrieve in the result. For example, ["line_items"].
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestDTO>
The retrieved order return request. The ID of the order return request.
The ID of the customer who created the return request.
The customer’s note explaining the reason for the return.
The ID of the shipping option for returning the items.
The ID of the vendor member who reviewed the request.
The vendor’s note regarding the return request.
The date when the vendor reviewed the request.
The ID of the admin user who reviewed the escalated request.
The admin’s note regarding the return request.
The date when the admin reviewed the request.
status
"pending" | "refunded" | "withdrawn" | "escalated" | "canceled"
The status of the return request.
line_items
OrderReturnRequestLineItemDTO[]
The associated line items (if included in relations).
The created date of the order return request.
The updated date of the order return request.
listOrderReturnRequests
This section provides a reference to the listOrderReturnRequests method. This belongs to the Order Return Request Module.
This method retrieves a paginated list of order return requests based on optional filters and configuration.
Example
To retrieve pending return requests:
const returnRequests = await orderReturnRequestModuleService . listOrderReturnRequests ({
status: "pending" ,
})
To retrieve return requests for a specific customer:
const returnRequests = await orderReturnRequestModuleService . listOrderReturnRequests ({
customer_id: "cus_123" ,
})
By default, only the first 15 records are retrieved. You can control pagination:
const returnRequests = await orderReturnRequestModuleService . listOrderReturnRequests (
{
status: "pending" ,
},
{
take: 20 ,
skip: 2 ,
relations: [ "line_items" ],
}
)
Parameters
filters
FilterableOrderReturnRequestProps
The filters to apply on the retrieved order return requests. The IDs to filter the order return requests by.
Filter order return requests by their customer IDs.
Filter order return requests by their status.
Filter order return requests by their vendor reviewer IDs.
Filter order return requests by their admin reviewer IDs.
config
FindConfig<OrderReturnRequestDTO>
The configurations determining how the order return request is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
A number indicating the number of records to skip before retrieving the results.
A number indicating the number of records to return in the result.
An array of strings, each being relation names of the entity to retrieve in the result. For example, ["line_items"].
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestDTO[]>
The list of order return requests.
listAndCountOrderReturnRequests
This section provides a reference to the listAndCountOrderReturnRequests method. This belongs to the Order Return Request Module.
This method retrieves a paginated list of order return requests along with the total count of available order return requests satisfying the provided filters.
Example
const [ returnRequests , count ] = await orderReturnRequestModuleService . listAndCountOrderReturnRequests ({
status: "pending" ,
})
Parameters
filters
FilterableOrderReturnRequestProps
The filters to apply on the retrieved order return requests. The IDs to filter the order return requests by.
Filter order return requests by their customer IDs.
Filter order return requests by their status.
Filter order return requests by their vendor reviewer IDs.
Filter order return requests by their admin reviewer IDs.
config
FindConfig<OrderReturnRequestDTO>
The configurations determining how the order return request is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
A number indicating the number of records to skip before retrieving the results.
A number indicating the number of records to return in the result.
An array of strings, each being relation names of the entity to retrieve in the result.
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<[OrderReturnRequestDTO[], number]>
The list of order return requests along with their total count.
softDeleteOrderReturnRequests
This section provides a reference to the softDeleteOrderReturnRequests method. This belongs to the Order Return Request Module.
This method soft deletes order return requests by their IDs.
Example
await orderReturnRequestModuleService . softDeleteOrderReturnRequests ([
"oretreq_123" ,
"oretreq_321" ,
])
Parameters
The IDs of the order return requests.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.
restoreOrderReturnRequests
This section provides a reference to the restoreOrderReturnRequests method. This belongs to the Order Return Request Module.
This method restores soft deleted order return requests by their IDs.
Example
await orderReturnRequestModuleService . restoreOrderReturnRequests ([ "oretreq_123" , "oretreq_321" ])
Parameters
The IDs of the order return requests.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the order return request.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.
createOrderReturnRequestLineItems
This section provides a reference to the createOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
createOrderReturnRequestLineItems(data, sharedContext?): Promise<OrderReturnRequestLineItemDTO[]>
This method creates order return request line items.
Example
const lineItems = await orderReturnRequestModuleService . createOrderReturnRequestLineItems ([
{
return_request_id: "oretreq_123" ,
line_item_id: "ordli_123" ,
quantity: 2 ,
reason_id: "reason_123" ,
},
])
Parameters
data
CreateOrderReturnRequestLineItemDTO[]
required
The order return request line items to be created. The ID of the return request this line item belongs to.
The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestLineItemDTO[]>
The created order return request line items.
updateOrderReturnRequestLineItems
This section provides a reference to the updateOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
updateOrderReturnRequestLineItems(id, data, sharedContext?): Promise<OrderReturnRequestLineItemDTO>
This method updates an existing order return request line item.
Example
const lineItem = await orderReturnRequestModuleService . updateOrderReturnRequestLineItems ( "oretreqli_123" , {
quantity: 1 ,
})
Parameters
The ID of the order return request line item.
data
UpdateOrderReturnRequestLineItemDTO
required
The attributes to update in the order return request line item. The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestLineItemDTO>
The updated order return request line item. The ID of the order return request line item.
The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
The created date of the line item.
The updated date of the line item.
deleteOrderReturnRequestLineItems
This section provides a reference to the deleteOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
deleteOrderReturnRequestLineItems(ids, sharedContext?): Promise<void>
This method deletes order return request line items by their IDs.
Example
await orderReturnRequestModuleService . deleteOrderReturnRequestLineItems ([ "oretreqli_123" , "oretreqli_321" ])
Parameters
The IDs of the order return request line items.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Resolves when the order return request line items are deleted successfully.
retrieveOrderReturnRequestLineItem
This section provides a reference to the retrieveOrderReturnRequestLineItem method. This belongs to the Order Return Request Module.
This method retrieves an order return request line item by its ID.
Example
const lineItem = await orderReturnRequestModuleService . retrieveOrderReturnRequestLineItem ( "oretreqli_123" )
To retrieve with the return request:
const lineItem = await orderReturnRequestModuleService . retrieveOrderReturnRequestLineItem (
"oretreqli_123" ,
{
relations: [ "return_request" ],
}
)
Parameters
The ID of the order return request line item.
config
FindConfig<OrderReturnRequestLineItemDTO>
The configurations determining how the order return request line item is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
An array of strings, each being relation names of the entity to retrieve in the result. For example, ["return_request"].
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestLineItemDTO>
The retrieved order return request line item. The ID of the order return request line item.
The ID of the original order line item being returned.
The quantity of the item to be returned.
The ID of the return reason.
The created date of the line item.
The updated date of the line item.
The associated return request (if included in relations).
listOrderReturnRequestLineItems
This section provides a reference to the listOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
This method retrieves a paginated list of order return request line items based on optional filters and configuration.
Example
To retrieve line items for a specific return request:
const lineItems = await orderReturnRequestModuleService . listOrderReturnRequestLineItems ({
return_request_id: "oretreq_123" ,
})
To retrieve line items for specific order line items:
const lineItems = await orderReturnRequestModuleService . listOrderReturnRequestLineItems ({
line_item_id: [ "ordli_123" , "ordli_456" ],
})
Parameters
filters
FilterableOrderReturnRequestLineItemProps
The filters to apply on the retrieved order return request line items. The IDs to filter the order return request line items by.
Filter line items by their return request IDs.
Filter line items by their order line item IDs.
Filter line items by their return reason IDs.
config
FindConfig<OrderReturnRequestLineItemDTO>
The configurations determining how the order return request line item is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
A number indicating the number of records to skip before retrieving the results.
A number indicating the number of records to return in the result.
An array of strings, each being relation names of the entity to retrieve in the result.
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<OrderReturnRequestLineItemDTO[]>
The list of order return request line items.
listAndCountOrderReturnRequestLineItems
This section provides a reference to the listAndCountOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
This method retrieves a paginated list of order return request line items along with the total count of available order return request line items satisfying the provided filters.
Example
const [ lineItems , count ] = await orderReturnRequestModuleService . listAndCountOrderReturnRequestLineItems ({
return_request_id: "oretreq_123" ,
})
Parameters
filters
FilterableOrderReturnRequestLineItemProps
The filters to apply on the retrieved order return request line items. The IDs to filter the order return request line items by.
Filter line items by their return request IDs.
Filter line items by their order line item IDs.
Filter line items by their return reason IDs.
config
FindConfig<OrderReturnRequestLineItemDTO>
The configurations determining how the order return request line item is retrieved. An array of strings, each being attribute names of the entity to retrieve in the result.
A number indicating the number of records to skip before retrieving the results.
A number indicating the number of records to return in the result.
An array of strings, each being relation names of the entity to retrieve in the result.
order
Record<string, "ASC" | "DESC">
An object used to specify how to sort the returned records.
A boolean indicating whether deleted records should also be retrieved as part of the result.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<[OrderReturnRequestLineItemDTO[], number]>
The list of order return request line items along with their total count.
softDeleteOrderReturnRequestLineItems
This section provides a reference to the softDeleteOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
This method soft deletes order return request line items by their IDs.
Example
await orderReturnRequestModuleService . softDeleteOrderReturnRequestLineItems ([
"oretreqli_123" ,
"oretreqli_321" ,
])
Parameters
orderReturnRequestLineItemIds
The IDs of the order return request line items.
config
SoftDeleteReturn<TReturnableLinkableKeys>
An object that is used to specify an entity’s related entities that should be soft-deleted when the main entity is soft-deleted.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were also soft deleted. If there are no related records, the promise resolves to void.
restoreOrderReturnRequestLineItems
This section provides a reference to the restoreOrderReturnRequestLineItems method. This belongs to the Order Return Request Module.
This method restores soft deleted order return request line items by their IDs.
Example
await orderReturnRequestModuleService . restoreOrderReturnRequestLineItems ([ "oretreqli_123" , "oretreqli_321" ])
Parameters
orderReturnRequestLineItemIds
The IDs of the order return request line items.
config
RestoreReturn<TReturnableLinkableKeys>
Configurations determining which relations to restore along with each of the order return request line item.
A context used to share resources, such as transaction manager, between the application and the module.
Returns
Promise
Promise<void | Record<string, string[]>>
An object that includes the IDs of related records that were restored. If there are no related records restored, the promise resolves to void.