ReturnModule
Returns on commercetools, for consumers and business units: requesting one for delivered lines of an order, with a reason per line, serial numbers and photos where they are needed, a refund method for a consumer and a restocking fee for a late business return; handing it in at a service point or having it collected; and withdrawing it while it has not left.
import { ReturnModule } from "@evolve-framework/commercetools";Serves the Return part of the GraphQL API: returnEstimate, returnExchangeOptions, returnReasons, returnAttachmentUpload, returnCancel, returnCreate.
new ReturnModule(options: ReturnModuleOptions)| Option | Type | Description |
|---|---|---|
clientFactory | ClientFactory | The commercetools client its requests to the project go through, built
with |
customTypes | Pick<CustomTypeKeys, "order-return-item"> | Key of the custom type the project has provisioned for return items
( |
carrier | ReturnCarrierProvider | Who carries returns back: |
reasons? | ReturnReasonConfig[] | The reasons a buyer chooses from. Defaults to |
windowDays? | number | null | Days after delivery a consumer's line can be returned. Defaults to 14, the
withdrawal period EU law gives a consumer; |
businessWindowDays? | number | null | Days after delivery a business unit's line can be returned. No deadline by default: a late return costs the restocking fee instead. |
restockingFee? | RestockingFeeSetting | null | The fee withheld from a business unit's credit for a late return, the
same for every unit. Defaults to 15% after 14 free days; |
refundMethods? | ReturnRefundMethodType[] | How a consumer's refund may be paid. Defaults to both methods. |
returnAddress? | BaseAddress | Where a buyer sends a return themselves; without it they cannot. |
attachments? | AttachmentStore | Where photos are kept; without one a return takes none. |
serialNumberAttribute? | string | The Boolean variant attribute that marks a device, whose return needs a serial number per unit. Without one no line asks for serial numbers. |
messagePublisher? | MessagePublisher | Where |
origin? | string | The |
ReturnCarrierProvider3The fields of carrier.
| Field | Type | Description |
|---|---|---|
dropOff? | ((request: ReturnShipmentRequest) => Promise<ReturnDropOffShipment>) | |
pickup? | ((request: ReturnShipmentRequest & { address: BaseAddress; date?: string | undefined; }) => Promise<ReturnPickupShipment>) | |
cancel? | ((returnNumber: string) => Promise<void>) | Called when a return is withdrawn, to void what was booked. |
ReturnReasonConfig3The fields of reasons.
| Field | Type | Description |
|---|---|---|
code | string | |
label | Record<string, string> | |
requiresPhotos? | boolean | Whether a line returned for this reason needs a photo. Defaults to false. |
AttachmentStore3The fields of attachments.
| Field | Type | Description |
|---|---|---|
contentTypes | string[] | The content types it accepts, such as |
createUpload | (request: { filename: string; contentType: string; customerId: string; }) => Promise<{ attachmentId: string; uploadUrl: string; expiresAt: string; }> | |
read | (attachmentId: string, customerId: string) => Promise<StoredAttachment | undefined> | Undefined when the id is unknown, was never uploaded, or is not the customer's. |
Extends AbstractModule<CommercetoolsLoaderContext>.

