ReturnOrderEvent is a concrete implementation of the sealed class OrderEvent. It inherits all properties and methods from its parent classes without adding additional members.
Related Order Event Types
The OrderEvent sealed class has the following inheritors:
PurchaseOrderEvent
PreorderEvent
CancelOrderEvent
ShipOrderEvent
DeliverOrderEvent
ReturnOrderEvent
ExchangeOrderEvent
Inherited Properties
From OrderEvent
order
1val order: Order
The order data containing details about the order being returned.
From EngagementEvent
category
1open override var category: Event.Category
The Event category name. Category contains list of allowed values.
priority
1open override val priority: Priority
The priority level of the event.
Inherited Methods
From EngagementEvent
attributes()
1open override fun attributes(): Map<String, Any>
Returns the Event attributes for this event.
Returns: A map containing event attributes.
name()
1open override fun name(): String
Returns the name for the event. This value must match the Event Name used when creating the event in the Marketing Cloud UI for any action to result from tracking this event.
Returns: The event name as a String.
Order Data Class
The order property uses the Order data class, which has the following structure:
Declaration
1data class Order @JvmOverloads constructor(2 val id: String,3 val lineItems: List<LineItem> = listOf(),4 val totalValue: Double? = null,5 val currency: String? = null,6 val attributes: Map<String, Any> = mapOf()7)
Constructor Parameters
Parameter
Type
Default
Description
id
String
required
A unique identifier representing the order.
lineItems
List<LineItem>
listOf()
A list of Line Item Data values.
totalValue
Double?
null
The total value of the order.
currency
String?
null
The currency of the total value for the order.
attributes
Map<String, Any>
mapOf()
A map of user-supplied values.
Properties
id
1val id: String
A unique identifier representing the order.
lineItems
1val lineItems: List<LineItem>
An list of Line Item Data values.
totalValue
1val totalValue: Double?
The total value of the order.
currency
1val currency: String?
The currency of the total value for the order.
attributes
1val attributes: Map<String, Any>
A map of user-supplied values.
Usage Example
1// Create an order with return details2val returnOrder = Order(3 id = "ORDER-12345",4 lineItems = listOf(5 LineItem(6 catalogObjectType = "product",7 catalogObjectId = "PROD-789",8 quantity = 1,9 price = 49.9910)11),12 totalValue = 49.99,13 currency = "USD",14 attributes = mapOf(15 "returnReason" to "Defective",16 "refundMethod" to "Original payment method"17)18)1920// Create a ReturnOrderEvent21val returnEvent = ReturnOrderEvent()22// Note: The actual constructor/initialization method would be23// implementation-specific based on the parent OrderEvent class
Notes
ReturnOrderEvent is used specifically for tracking when customers return orders.
This event should be tracked when an order return is processed in your e-commerce system.
The event name configured in this event must match the Event Name defined in the Marketing Cloud UI to trigger any associated actions or automations.
The @JvmOverloads annotation on the Order constructor provides multiple constructor variants for Java interoperability.
See Also
OrderEvent - The parent sealed class
EngagementEvent - The grandparent sealed class
Event - The root event interface
LineItem - Used to represent individual items in the order
Order - The data class containing order information