Order Cancellation Request Flow

The Order Cancellation Request Flow facilitates the processing of individual cancellation requests within Omnitron. Unlike the Order Cancel Flow which processes cancellation plans, this flow retrieves a list of cancellation requests that match a specific cancellation request status configured by the user in the flow settings. The flow operates only in an inbound mode.

Inbound order cancellation request flow means that the flow triggers itself at specific intervals set by the user, such as once every minute, every 1 hour, every day at midnight, every 5th day of a month, etc., to fetch eligible cancellation requests from Omnitron. It processes these requests based on the configured cancellation request status, ensuring the correct actions are taken for each request.

This process ensures reliable and efficient handling of individual order item cancellation requests within the system, maintaining consistency and accuracy for cancellation data in Omnitron.

Order Cancellation Request Flow Types​

  • Inbound Flow: Indicates that the flow will read data from the Omnitron. A cron schedule is set up to ensure it runs, for example, every 5 minutes.

Example data structure for an order object and its related items can be found at the end of this document under the "Example Order Cancellation Request Data Structure from Omnitron" section.

Flow Steps​

  • Login Step: Handles logging into Omnitron and (if configured) the ERP system. If an error occurs during this step, the details are logged.

  • Get Data From Omnitron Step: Queries are made to the Omnitron system to fetch cancellation requests matching the user-defined cancellation request status, cancellation type and channel filters.

  • Script Step (Optional): Transformation operations on each cancellation request object are performed using Python, if required.

  • Mapping Step (Optional): Transformation operations on each cancellation request object are performed using the Jolt Transform library. Further details can be found at the Jolt Transformarrow-up-right website.

  • Write Data to ERP Step: The transformed cancellation request information is sent to the ERP system.

  • Custom Response Script Step: The Write Data to ERP step's input data and the ERP response for each cancellation request are provided to a Python script one by one to check if ERP requests are successful.

  • Write Data to Omnitron Step: For each successfully processed cancellation request, the relevant updates are made in Omnitron based on the result of the Write Data to ERP Step.

  • Post Script Step: Runs after the Write Data to Omnitron Step if every prior step is successful.

Detailed Flow Designer Settings​

Configuration Card​

Get Data From Omnitron​

Omnitron is queried for cancellation requests matching settings in this step.

Cancel Type: Select the type of cancellation request to retrieve from Omnitron. Options include:

  • Cancel: Fetch only cancellation requests.

  • Refund: Fetch only refund requests.

  • All: Fetch both cancellation and refund requests.

Cancellation Request Status: Select the status of the cancellation requests to fetch from Omnitron. Options include:

  • Open: Fetch cancellation requests that are newly created and open.

  • Waiting: Fetch cancellation requests that are awaiting processing.

  • Confirmation Waiting: Fetch cancellation requests awaiting confirmation.

  • Confirmed: Fetch cancellation requests that have been confirmed.

  • Waiting Approval: Fetch cancellation requests that are waiting for approval.

  • Approved: Fetch cancellation requests that have been approved.

  • Rejected: Fetch cancellation requests that have been rejected.

  • Waiting for Payment: Fetch cancellation requests that are waiting for payment processing.

  • Manuel Refund Need: Fetch cancellation requests that require manual refund processing.

  • Completed: Fetch cancellation requests that have been fully processed.

Omnitron Channel ID: Enter the ID of the channel from which to fetch cancellation requests. This field is optional and used to narrow the scope of the data to a specific channel. When left empty, the flow will run for all Omnitron channels. Channel IDs can be retrieved from Omnitron, Sales Channels screens.

Based on the above settings, the following query string is used:

Script Card (Optional)​

This is a base script that can be updated to enable script functionality within the process step.

Scripts can read incoming data from the inputStream, where the variable input_text contains a JSON string. This string should be parsed using Python's json library. Any outgoing data is written using the outputStream.write() method after converting the relevant Python object back into a JSON string.

Additionally, the script allows for the use of attributes, which provide supplementary information tied to the current execution process. These attributes can be freely accessed or modified throughout the script. For example, the get_attribute() function is used to read attribute values, while the session.putAttribute() method is used to write new string attribute values. Each attribute consists of a key-value pair, where the key uniquely identifies the attribute, and the value can be referenced in subsequent steps.

Attributes with keys starting with the prefix log. will be automatically logged at the end of the execution if a log file is generated, ensuring that important information is captured and available for later review.

Example Script:

Script Testing: The ERP response is placed in the input field, and the script's result along with the written attributes can be viewed in the result field. When the test script is run, attributes like log.script.error will appear under the "attributes" section in the result panel and should be referenced if any exceptions occur during execution. The script's output content will be found under the result_data value.

The "+ Add Attributes" button can be used to simulate incoming, readable, attributes for the script. This feature is useful when an attribute value is read and used in the script. Note that attributes added through the button are only for testing purposes and will not be saved in the flow information—they will be removed when the page is refreshed.

Example Input: Example input can be constructed using /api/v1/cancellation_requests/detailed/?status=open&sort=modified_date&limit=1&cancellation_type=cancel endpoint, the input will be a cancellation request object, not an array of objects.

Mapping Card (Optional)​

Details can be found at the Jolt Transformarrow-up-right website. The flow expects the following output to be a cancellation request object for each order item, as the input will also be a cancellation request of one order item. Integrator uses the output of this mapping step as the body of the ERP request, therefore there is no expected data structure; the output structure of the mapping step is fully dependent on ERP requirements.

Example Mapping:

Mapping Testing: The result from the script or the response of the Omnitron request for cancellation request data, if the script step is not used, is placed in the input field and the result of the mapping is viewed in the result field.

Write Data to ERP

The finalized data from Script and/or Mapping steps is sent to ERP using configuration entered in this step. A successful request must respond with 2xx HTTP status codes.

Cancellation Request API URL: Provide the URL endpoint for the ERP system's cancellation request API. This URL will be used to send cancellation or refund requests to the ERP system.

HTTP Method: Specify the HTTP method to use for communicating with the ERP system. Options include:

  • POST: Send the data using the POST method.

  • GET: Retrieve data using the GET method.

  • PUT: Send data using the PUT method.

  • PATCH: Send data using the PATCH method.

Custom Response Setting: Choose whether to enable custom response handling.

  • True: Enable custom scripting for handling responses from the ERP system.

  • False: Disable custom response handling, using default behavior instead.

Custom Response Script​

The Custom Response Script is a user-configurable template designed to process and evaluate the ERP system's response for each cancellation request. It provides flexibility for users to customize the logic based on their specific requirements while maintaining default functionality. Below is the default script provided as a template in the flow and a description of its core features and customizable aspects:

  • The script retrieves the ERP response status code (invokehttp.status.code) to evaluate the result of the request.

  • The relation attribute is added to the FlowFile to indicate the next action:

    • continue: Process will continue to the next step assuming the ERP request was successful.

    • failure: Process will continue to the next step assuming the ERP request failed.

    • do_nothing: Process will do nothing, and it will retry in the next batch.

    • auth_fail: Authorization failed, a new token will be requested and the request will be retried.

Post Script (Optional)​

This script runs with the "request_data" and "response_data" from the ERP write request after the Write Data to Omnitron step, if the Write Data to ERP step is successful.

This script is optional, and its output is not used. It can be used for additional tasks after the cancellation request is processed, such as updating CRM services or performing other actions.

Example Order Cancellation Request Data Structure from Omnitron​

parameter
data type
example
description
additional notes

id

integer

1

Primary key of the cancellation request

cancellation_type

string

cancel

Type of cancellation (cancel/refund)

status

string

approved

Current status of the cancellation request

easy_return

object / null

null

Easy return information if applicable

order_item

object

Related order item object

See order item object

reason

object

Cancellation reason details

See reason object

channel

object

Sales channel information

See channel object

customer

object

Customer information

See customer object

created_date

string

2023-02-07T08:35:33.392858Z

Record creation date

ISO-8601 format

modified_date

string

2023-02-07T08:35:33.572925Z

Last modification date

ISO-8601 format

uuid

string (UUID)

0da0efc9-a828-4b5e-b4cd-5ffe03b8b7ac

Unique identifier

description

string / null

null

Additional description for the cancellation

iban

string / null

null

IBAN for refund payment

holder_name

string / null

null

Account holder name for refund

quantity

integer / null

null

Quantity of items in the cancellation request

fully_refund_as_loyalty_money

boolean

false

Indicates if refund should be as loyalty money

Order Item Object​

parameter
data type
example
description
additional notes

pk

integer

5

Primary key of the order item

order

object

Related order object

See order object

product

object

Related product object

See product object

status

string

100

Order item status

Uses status value mapping

price_currency

string

try

Currency code for the price

ISO 4217

price

string / decimal

23.66

Item price

tax_rate

string / decimal

8.00

Tax rate applied to the item

extra_field

object

{ }

Additional custom fields

Optional

price_list

object

Price list details

See price list object

stock_list

object

Stock list details

See stock list object

invoice_number

string / null

null

Invoice number

invoice_date

string / null

null

Invoice date

ISO-8601 if present

e_archive_url

string / null

null

E-archive invoice URL

cancel_status

string

completed

Cancellation status of the item

status_display

string

cancelled

Human-readable status

installment_interest_amount

string / decimal

0.00

Interest amount due to installment

net_amount

string / decimal

23.66

Net amount after discounts

tracking_number

string / null

null

Shipping tracking number

shipping_company

string / null

null

Shipping company name

discount_amount

string / decimal

0.00

Discount applied to the item

shipment_code

string / null

null

Shipment code

benefitapplicant_set

array [object]

[]

Benefits applied to the item

external_status

string / null

null

External system status

retail_price

string / decimal

0.00

Retail price of the item

attributes

object

{ }

Item attributes

attributes_kwargs

object

{ }

Additional attribute parameters

tracking_url

string / null

null

Tracking URL

image

string / null

null

Item image URL

parent

integer / null

null

Parent order item identifier

data_source

string / null

null

Data source identifier

estimated_delivery_date

string / null

null

Estimated delivery date

ISO-8601 if present

datasource

string / null

null

Datasource identifier

defined_tracking_url

string / null

null

Predefined tracking URL

carrier_shipping_code

string / null

null

Carrier-specific shipping code

shipping_option_group

string / null

null

Shipping option group

defined_shipping_company

string / null

null

Predefined shipping company

forced_refund

boolean

false

Indicates if refund was forced

Order Object​

parameter
data type
example
description
additional notes

pk

integer

3

Primary key of the order

number

string

429452907

Order number

channel

integer

2

Sales channel identifier

status

string

100

Order status

Uses status value mapping

date_placed

string

2023-02-06T17:34:11.867000Z

Date when the order was placed

ISO-8601 format

customer

integer

1

Customer identifier

shipping_address

integer

2

Shipping address identifier

billing_address

integer

2

Billing address identifier

currency

string

try

Currency code

ISO 4217

amount

string / decimal

1905.84

Total order amount including taxes

shipping_amount

string / decimal

0.00

Shipping cost

shipping_tax_rate

string / decimal

0.00

Tax rate applied to shipping

extra_field

object

{ }

Additional custom fields

Optional

payment_option

object / null

null

Payment option details

payment_option_slug

string / null

null

Payment option identifier

bin_number

string / null

null

Card BIN number

installment

integer / null

null

Installment option

installment_count

integer / null

null

Number of installments

delivery_type

string / null

null

Delivery type

installment_interest_amount

string / decimal

0.00

Interest amount applied due to installment

cargo_company

integer

2

Cargo / shipping company identifier

invoice_number

string / null

null

Invoice number

invoice_date

string / null

null

Invoice date

ISO-8601 if present

e_archive_url

string

https://www.google.com

E-archive invoice URL

refund_amount

string / decimal

1905.84

Total refunded amount

discount_refund_amount

string / decimal

0.00

Refunded discount amount

shipping_refund_amount

string / decimal

0.00

Refunded shipping amount

discount_amount

string / decimal

0.00

Discount applied to the order

is_send

boolean

false

Indicates whether the order was sent

net_shipping_amount

string / decimal

0.00

Net shipping amount

shipping_interest_amount

string / decimal

0.00

Interest amount related to shipping

tracking_number

string

7260000009966030

Shipping tracking number

carrier_shipping_code

string

Carrier-specific shipping code

Can be empty

remote_addr

string / null

null

Client IP address

fundstransfertransaction_set

array [object]

[]

Funds transfer transactions

has_gift_box

boolean

false

Indicates if gift box is included

gift_box_note

string

Gift box note

Optional

external_status

string / null

null

External system order status

client_type

string

default

Client type

language_code

string

Language code

notes

string

Internal notes

delivery_range

string / null

null

Delivery time range

shipping_option_slug

string

Shipping option identifier

segment

string / null

null

Customer or order segment

modified_date

string

2023-02-07T08:35:33.982189Z

Last modification date

ISO-8601 format

checkout_provider_id

string / null

null

Checkout provider identifier

created_date

string

2023-02-07T07:04:10.600994Z

Order creation date

ISO-8601 format

cancellation_info

object

{ }

Cancellation-related information

shipping_company

string / null

null

Shipping company name

cancel_status

string / null

null

Cancellation status

defined_tracking_url

string / null

null

Predefined tracking URL

installment_free

boolean

false

Indicates if installment is interest-free

first_refund_strategy

string / null

null

Strategy used for the first refund

Product Object​

parameter
data type
example
description
additional notes

pk

integer

2

Primary key of the product

name

string

Siyah Çorap

Product name

base_code

string

AKN-005

Base product code

sku

string

AKN-005

Stock Keeping Unit

product_type

string

0

Product type identifier

is_active

boolean

true

Indicates if the product is active

parent

integer / null

null

Parent product identifier

attributes

object

{ "Yas": "18-25", "size": "M" }

Product attributes

attributes_kwargs

object

{ ... }

Additional attribute parameters

extra_attributes

object

{ }

Extra custom attributes

is_seller_product

boolean

false

Indicates if it's a seller product

group_products

array

[]

Related group products

productimage_set

array

[]

Product images

attribute_set

integer

6

Attribute set identifier

custom_attribute_set

integer / null

null

Custom attribute set identifier

productization_date

string / null

null

Date when product was productized

ISO-8601 if present

listing_code

string / null

null

Listing code

data_source

string / null

null

Data source identifier

modified_date

string

2025-11-28T14:43:04.157117Z

Last modification date

ISO-8601 format

uuid

string (UUID)

e01a3ef5-eb51-42a4-925c-0e71cba81aad

Unique identifier

created_date

string

2023-01-25T12:21:04.609463Z

Creation date

ISO-8601 format

localized_attributes

object

{ }

Localized attribute values

localized_attributes_kwargs

object

{ }

Localized attribute parameters

tax_rate

string / null

null

Tax rate for the product

weight

string / null

null

Product weight

brand_id

integer / null

null

Brand identifier

description

string / null

null

Product description

Price List Object​

parameter
data type
example
description
additional notes

pk

integer

1

Primary key of the price list

name

string

TY_price_list

Name of the price list

code

string

try

Price list code

is_auto_sync

boolean

false

Indicates if auto-sync is enabled

modified_date

string

2023-01-26T08:19:31.230242Z

Last modification date

ISO-8601 format

created_date

string

2023-01-26T08:19:31.230222Z

Creation date

ISO-8601 format

currency

string

try

Currency code

ISO 4217

Stock List Object​

parameter
data type
example
description
additional notes

pk

integer

1

Primary key of the stock list

name

string

TY Stok Listesi

Name of the stock list

code

string / null

null

Stock list code

is_auto_sync

boolean

false

Indicates if auto-sync is enabled

modified_date

string

2023-01-26T08:15:47.630013Z

Last modification date

ISO-8601 format

created_date

string

2023-01-26T08:15:47.629991Z

Creation date

ISO-8601 format

Reason Object​

parameter
data type
example
description
additional notes

pk

integer

1

Primary key of the cancellation reason

cancellation_type

string

cancel

Type of cancellation (refund/cancel)

extra_information_needed

boolean

false

Indicates whether extra information is required

order

integer

100

Display order for the reason

subject

string

Yanlış ürün aldım.

Cancellation reason description

is_active

boolean

true

Indicates if the reason is active

send_to_remote

boolean

false

Indicates if the reason should be sent to remote systems

modified_date

string

2022-11-23T07:51:22.698626Z

Last modification date

ISO-8601 format

created_date

string

2022-11-23T07:51:22.534643Z

Creation date

ISO-8601 format

translations

object / null

null

Translation values for the subject

uuid

string (UUID)

3d32baeb-69a2-4e9e-ad6f-d58027c22bef

Unique identifier

send_to_oms

boolean

false

Indicates if reason should be sent to OMS

Channel Object​

parameter
data type
example
description
additional notes

pk

integer

2

Primary key of the channel

name

string

Trendyol:3_Channel

Channel name

channel_type

string

sales_channel

Type of the channel

catalog

integer

2

Catalog identifier

modified_date

string

2025-12-11T13:27:15.290446Z

Last modification date

ISO-8601 format

created_date

string

2022-12-05T10:47:24.864605Z

Creation date

ISO-8601 format

category_tree

integer

1

Category tree identifier

is_active

boolean

true

Indicates if the channel is active

conf

object

{ }

Channel configuration

schema

object

{ }

Channel schema

Customer Object​

parameter
data type
example
description
additional notes

pk

integer

1

Primary key of the customer

channel

integer

2

Channel identifier

email

string

Customer email address

first_name

string

John

Customer first name

last_name

string

Doe

Customer last name

phone_number

string / null

null

Customer phone number

is_active

boolean

true

Indicates if the customer is active

channel_code

string

21823399

Customer code in the channel

erp_code

string / null

null

Customer code in ERP system

extra_field

object

{ }

Additional custom fields

modified_date

string

2026-01-20T13:48:35.483131Z

Last modification date

ISO-8601 format

created_date

string

2023-02-02T19:52:49.849547Z

Creation date

ISO-8601 format

date_joined

string / null

null

Date when the customer joined

ISO-8601 if present

email_allowed

boolean

false

Indicates if email communication is allowed

sms_allowed

boolean

false

Indicates if SMS communication is allowed

call_allowed

boolean

false

Indicates if call communication is allowed

gender

string / null

null

Customer gender

attributes

object

{ }

Customer attributes

user_type

string / null

null

Type of user

date_of_birth

string / null

null

Customer date of birth

ISO-8601 if present

attributes_kwargs

object

{ }

Additional attribute parameters

localized_attributes

object

{ }

Localized attribute values

localized_attributes_kwargs

object

{ }

Localized attribute parameters

Last updated

Was this helpful?