Order Flow

The Order Flow facilitates the transfer of order data from Omnitron to ERP systems. The flow retrieves a list of orders that have not yet been sent to the ERP and processes them accordingly. The flow operates only in an inbound mode.

Inbound order 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 unsent orders from Omnitron and send them to the ERP system. If the transfer to the ERP is successful, the order is marked as "is sent" in Omnitron, ensuring clear tracking and synchronization of orders between the systems.

This process ensures reliable and efficient communication between Omnitron and ERP, maintaining accurate and up-to-date order information across the system.

Order Flow Type​

  • 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.

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.

  • Read Data From Omnitron Step: Order queries are made to the Omnitron system to find orders where Omnitron “is_send” value is false and not canceled matching the channel filter.

  • Query Check Order Step: For each order, an ERP query is made using order number to see if the order is already written to the ERP, if the execution skips to Check Response Script Step.

  • Script Step (Optional): Transformation operations on each order object is performed using Python, if required.

  • Mapping Step (Optional): Transformation operations on each order object is 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 order information is sent to ERP.

  • Check Response Script Step: The Write Data to ERP Step input data and ERP response for each order is given to python script one by one to check if ERP requests are successful and prepare mapping data for Write Data to Omnitron step.

  • Write Data to Omnitron Step: For each order, order is marked as “is send”, order and order item mappings are done based on Check Response Script output.

  • Post Script Step: Runs after Write Data to Omnitron Step if Check Response Script step is successful or after Write Data To ERP step if it fails and Post Script is configured to run on failure.

Detailed Flow Designer Settings​

Configuration Card​

Read Data From Omnitron​

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

This card requires only the Omnitron Channel parameter to be specified for filtering orders based on designated sales channels.

Omnitron Channel: The Omnitron Channel parameter is used to filter orders based on specific Omnitron channels. This input requires a comma-separated list of channel IDs. Channel IDs can be found in Omnitron by navigating to Settings > Sales Channels. The channel ID is visible in the URL for each channel on the Sales Channels page.

The Omnitron query flow retrieves order data based on the specified channel filter. This process is for informational purposes, as the actual order flow is managed by the system itself. The query operates using the following path:

This query retrieves orders that have not been sent (is_send=false), has one of the statuses 400, 450, 500, 510, 540, 550 and match the specified channel filter. The modified_date__gt parameter is used to filter orders modified within the last three weeks, ensuring that only recent orders are processed.

Steps in the Flow​

  1. Query Orders: Orders are retrieved from Omnitron that are neither canceled nor already sent to the ERP.

  2. Retrieve Order Details: For each order returned by the query, the following steps are performed:

    • An order detail request is made using: /api/v1/orders_integration/<order_pk>/detailed_integration

    • Order items are queried using: /api/v1/order_items/?order_id=<order_pk>&limit=99999

    • For each order item, detailed data is retrieved via: /api/v1/order_items/<order_item_pk>/detailed_integration

    • Discount items are queried similarly via: /api/v1/discount_items/?order_id=<order_pk>&limit=99999

    • For each discount item, detailed data is retrieved via: /api/v1/discount_items/<discount_item_pk>/detailed_integration

  3. Build Detailed Order Data: Both the order items and discount items are appended to the detailed order data structure.

Query Check Order​

Each order is queried on the ERP system to see if it is already sent. If the order is already sent, execution skips to the “Check Response Script” step for the related order with order data from Omnitron and ERP response.

  • Query URL: The ERP URL to query order from, order number is provided to this input using ${_order.number} variable, Integrator will not modify the URL before query a valid query should be provided in the input for querying the order using order number. Ex: https://example.com/order/query?number=${_order.number}arrow-up-right

  • Custom Response Path: This is used to point where order information (if exists) should be when a query response is successful, if the path result is not empty or equal to Custom Response Path Value the query result will be considered to be found.

  • Custom Response Path Value: Used with Custom Response Path, if the path result is equal to the input value, the query is considered to be not found and the execution will continue to next steps as usual.

  • Failure Status Codes: A list of comma separated HTTP status codes. If an ERP query gets a response with status codes written in this input execution will end with a failure without continuing. This input is useful to find if an ERP can not respond correctly at the moment and it is impossible to know if order already exists or not in the system.

  • Order Not Found Codes: A list of comma separated HTTP status codes. If an ERP query gets a response with status codes written in this input, flow will continue to the next steps normally. This is useful if an ERP system responds with success codes with a body like 201 even if the order does not exist in the system.

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. On Order flows, order_exists attribute can be set as “true” (string true) to set order as already exists in the script step, this is useful if order can not be queried using the Query Check Order step.

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 the endpoints written in Read Data From Omnitron or a data similar to that can be retrieved from Omnitron using /api/v1/orders_integration/detailed/?limit=1&number=<order_number> endpoint. The input of the script step will be an order object of the retrieved order array, script step is expected to run with only one order each time.

Mapping Card (Optional)​

Details can be found at the Jolt Transformarrow-up-right website. The flow expects the following output to be an order request object for each order, as the input will also be the data of one order. 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.

Mapping Testing:

The response from the script or the response of the Omnitron request for order 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.

  • ERP Order Create API URL: ERP URL for writing the orders to.

  • ERP Order Create API Method: The HTTP method used while creating the order on ERP.

Check Response Script​

The response from the Write Data to ERP Step is merged with the request body and passed to the Check Response Script Step. This step is very similar to the Script Card (Optional) which can be used to learn about the details of scripting in Integrator.

Check Response Script comes with a default script where the mapping values are gathered from request data assuming request data has a similar structure to Omnitron data. In the case that request data changed from Omnitron data and can not be used the same way, request and response data should be used to fill out the following structure same way the default script does:

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. If the step fails and “Run On Failed Order” is set to true, the script will run directly after the "Write Data to ERP" step.

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

Example Order Data Structure from Omnitron​

parameter
data type
example
description
additional notes

pk

integer

144246

Omnitron ID of Order

number

string

123123123

Order Number

channel

object

Channel of Order

date_placed

string

2017-04-12T09:30:27.528002Z

Date of Order

It is sent in ISO-8601 standard.

bin_number

string

55555

Credit Cart Bin Number

customer

object

Customer Information

shipping_address

object

Shipping Address

billing_address

object

Billing Address

currency

string

eur

Currency

enum

amount

string

134.37

Amount withdrawn from the bank (VAT included)

shipping_amount

string

6.99

Shipping amount (VAT included)

payment_option_slug

string

credit-cart

Payment Option Slug

payment_option

object

{}(13)

Payment Option Information

orderitem_set

array[object]

Products of Order

discountitem_set

array[object]

Order applied discounts and distributed to the line version of the detail information

installment

object

installment objects

Installment Information containing installment count, interest, name of the option etc.

invoice_number

string

F99827134211

Invoice Number

invoice_date

string

2017-04-12T09:30:27.528002Z

Invoice Date

It is sent in ISO-8601 standard.

e_archive_url

string

Invoice Archive Url

installment_count

integer

1

installment_interest_amount

string

0.00

cargo_company

object

{}

Cargo Company

enum

discount_amount

string

9.95

Total Discount Applied of Order

net_shipping_amount

string

10.95

Delay Interest Amount Applied on Cargo Amount

payondeliverytransaction_set

array[object]

Detail Information of Pay on Delivery (cash, credit card)

has_gift_box

boolean

true

Is It Gift Boxed?

gift_box_note

string

happy birthday

Gift Box Note (cannot be filled if giftbox not selected)

loyaltytransaction_set

array[object]

[]

transaction_set

object

{}(6)

Payment Detail

client_type

string

default

Platform type

enum

cashregistertransaction_set

array[object]

ordertransaction_set

array[object]

status

string

400

Order Status Code

enum

remote_addr

string

111.11.111.111

User IP Address

ordershippinginfo_set

array[object]

Order Shipping Info

shipping_tax_rate

string

3

Shipping Tax Rate

refund_amout

string

0.00

Refund Amount

discount_refund_amout

string

0.00

Discount Refund Amount

shipping_refund_amout

string

0.00

Shipping Refund Amount

status_display

string

approved

Order Status

tracking_number

string

0726134HBA

Tracking Number

tracking_url

string

http://selfservis.yurticikargo.com/reports/SSWDocumentDetail.aspx?DocId=2222222

Tracking Url

is_send

boolean

false

Entegrator Sending State

cancel_status

boolean

Cancel Status

languge_code

string

tr-tr

Lang Code

fundstransfertransaction_set

array[object]

Funds Transfer Transaction Informations

external_status

boolean

delivery_type

string

Delivery Type

notes

string

Notes

delivery_range

string

Delivery Range

shipping_option_slug

string

yurtici-kargo

Shipping Option Slug

segment

string

Segment

shipping_interest_amount

string

0.00

Shipping Interest Amount

Channel Object

parameter
data type
example
description
additional notes

catalog

integer

1

Catalog

category_tree

object

2

channel_type

string

web

Channel Type

enum

created_date

string

2020-11-18T13:39:54.915941Z

sent on ISO-8601 standard

pk

integer

323664

is_active

boolean

true

Channel Active/Passive

modified_date

string

2020-11-18T13:39:54.915941Z

sent on ISO-8601 standard

name

string

Shop

Channel Name

Customer Object

parameter
data type
example
description
additional notes

pk

integer

56839

Customer unique ID

attributes

object/dict

{}

Customer properties additional data

channel

integer

1

Channel ID of customer created

channel_code

string

53241

Channel code of customer created

created_date

string

2019-02-12T18:39:09.821551Z

Data create date

sent on ISO-8601 standard

date_joined

string

2019-02-12T08:04:25.866981Z

Customer create date

sent on ISO-8601 standard

email

string

Customer unique e-mail

email_allowed

boolean

true

Permission of customer to send e-mail

erp_code

string

1234

Customer ERP code

code response after notification of ERP/WMS/SCM

extra_field

object/dict

{}

Additional data about customer

should be in key/value pair

first_name

string

John

Customer name

gender

string

male

Customer gender

enum

is_active

boolean

true

Specifies if customer is active / inactive

last_name

string

Doe

Customer surname

modified_date

string

2019-07-09T16:30:05.281334Z

Data's last update information

sent on ISO-8601 standard

phone_number

string

5320000000

Phone number of customer

format depends on company

sms_allowed

boolean

true

Permission of customer to send phone message

user_type

string

registered

Information if customer registered

guest = 'guest'registered = 'registered'

Address Object

parameter
data type
example
description
additional notes

pk

integer

1

Address ID

title

string

Home Address

Title of Address

address_type

string

customer

Address Type

is_active

boolean

true

Address Status

email

string

E-Mail of Address

first_name

string

John

Customer Name of Related Address

last_name

string

Doe

Customer Surname of Related Address

phone_number

string

05320000000

Customer Phone Number of Related Address

company_name

string

null

Company Name of Related Address (if filled)

country

object

{}

Country Information

city

object

{}

City Information

township

object

{}

Township Information

district

object

{}

District Information

line

string

xxxxx street, yyyyy shopping mall, no:1

Full Address Information

postcode

string

00000

Postcode Information

e_bill_taxpayer

boolean

false

Depending on Corporate/Personal Information, it should be true or false

tax_office

string

{}

Must Be Filled If Corporate

Must be empty if the address is personal

tax_no

string

000000000000

Must Be Filled If Corporate

Must be empty if the address is personal

mapping

array[object]

[]

Mapping Information

notes

string

null

Notes Belogns to Address

retail_store

object

{}

Retail Store Data Information must be sent when the shipment type is "Click&Collect

hash_data

string

c782306f6ee57ffcb5270ad6832b352

Hashed Data

Order Item Object

parameter
data type
example
description
additional notes

pk

integer

372615

Omnitron order item id

product

object

{}

Product Information

order

integer

144246

ID of Related Order

status

string

400

Item Status of Order

price_list

object

shop_price_list

Omnitron Price List Information

stock_list

object

shop_stock_list

Omnitron Stock List Information

price

string

59.99

Delay Interest and Additional Discount Excluded Selling Price (VAT Included)

retail_price

string

79.95

price_currency

string

eur

discount_amount

string

199.95

Item Discount Amount (VAT Included)

installment_interest_amount

string

0.00

tax_rate

string

8.00

VAT Percentage

benefitapplicant_set

array[object]

Campaign Information of Discounted Item

extra_field

object

{}

Extra data of orderitem can place as Key-Value in here

external_status

string

null

invoice_number

string

string

Invoice Number

invoice_date

string

2017-04-12T09:30:27.528002Z

Invoice Date

It is sent in ISO-8601 standard.

e_archive_url

string

cancel_status

string

status_display

string

delivered

Order Item Status Label

net_amount

string

0.00

tracking_number

string

1233211155232

Tracking Number

shipping_company

string

yurtici

Shipping Company

shipment_code

string

tracking_url

string

http://selfservis.yurticikargo.com/reports/SSWDocumentDetail.aspx?DocId=2222222

Tracking Url

supplier_code

string

AF1342A

Supplier Code

It will only come to companies that sell unified products.

Discount Item Object

| parameter | data type | example | explanation | additional notes | | -------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- | ---------------- | --- | | pk | integer | 167125 | Discount ID | | | code | string | null | Discount Code | | | name | string | Free shipping for purchases of 250 Euro or more | Discount Name/Description | | | amount | decimal | 0.00 | Discount Amount | | | benefitapplicant_set | array[object] | An array of benefit applicant objects | Campaigns benefited | | | promotion | object | {"modified_date": "2018-09-14T07:04:06.080758Z", "created_date": "2018-09-14T07:04:06.080730Z", "slug": "250-euro-and-on-shopping-free-shipping","name": "Free shipping for purchases of 250 Euro or more", "id": 419} | | | | order | integer | 144246 | Order ID | | | offer_type | string | basket_offer | | Offer | |

Benefit Applicant Object

parameter
data type
example
description
additional notes

id

integer

496385

order_item

integer

372615

pk value of item in orderitem_set

created_date

string

2019-07-09T16:30:06.266153Z

sent on ISO-8601 standard

modified_date

string

2019-07-09T16:30:06.266196Z

sent on ISO-8601 standard

discount_share

string

0.00

discount_item

integer

167125

pk value of item in discountitem_set

Pay On Delivery Object

parameter
data type
example
description
additional notes

amount

string

2736.00

handling_fee

string

0.00

order

integer

9876421

payment_type

string

cash

pk

integer

3304

remote_addr

string

0.0.0.0

transaction_type

string

purchase

user_email

string

Cash Register Transaction Object

parameter
data type
example
description
additional notes

amount

string/decimal

959.00

order

integer

144246

pk

integer

6036

raw_request

string/json

{"username": "**", "amount": "959.00", "password": "***", "order_number": "1191116995013595", "transaction_id": "3260013246501362"}

raw_response

string/json

{"staff_email": "[email protected]", "amount": "959.00", "result": "0", "shipping_sku": null, "error_message": "", "order_number": "1191116995013595", "staff_id": "7531", "transaction_id": "3260013246501362", "store_id": "6326"}

remote_addr

string

null

staff_email

string

staff_id

string

7531

staff_remote_id

string

7531

store_id

string

6326

store_remote_id

string

6326

transaction_id

string

3260013246501362

transaction_type

string

purchase

enum

user_email

string

Order Transaction Object

parameter
data type
example
description
additional notes

amount

string/decimal

customer

object

order

integer

144246

payment_option

object

{ "channel": 1, "config": {}, "is_active": true, "name": "Credit card", "payment_type": "credit_card", "pk": 1, "slug": "credit-card", "sort_order": 0, "translations": null}

pk

integer

323664

related_cancellation_plan

object

null

transaction_object_id

integer

366900

transaction_type

string

purchase

transaction_content_type

string

orders.transaction

uuid

string

a1913737-97c8-4c29-919c-a4a9d8ad2cf3

modified_date

string

2019-07-09T16:30:05.281334Z

sent on ISO-8601 standard

Order Shipping Info Object

parameter
data type
example
description
additional notes

pk

integer

123123

ID

order

integer

100001

Related Order ID

order_number

string

22222222222

Order Number

shipping_company

string

yurtici

Shipping Company

is_send

boolean

true

Shipping Send Status

send_response

object

"send_response": {"ns1:createShipmentResponse": {"@xmlns:ns1": "http://yurticikargo.com.tr/ShippingOrder","@xmlns:ns3": "http://yurticikargo.com.tr/WSE/","@xmlns:ns2": "http://yurticikargo.com.tr/ShippingOrderDispatcher","ShippingOrderResultVO": {"count": "1","shippingOrderDetailVO": {"cargoKey": "1807112222222","invoiceKey": "180711222222"},"outFlag": "0","outResult": "Success","jobId": "6541158"}}}

Shipping API Response

cargo_label

string

Funds Transfer Transaction Object

parameter
data type
example
description
additional notes

pk

integer

123123

ID

order

integer

100001

Related Order ID

user_email

string

1

User Email Address

remote_addr

string

127.0.0.1

User IP Address

amount

string

560.00

choosen_bank_account

object

"choosen_bank_account": {"pk": 2,"bank": 4,"slug": "H2","holder_name": "Shop Bank Account","iban": "TR01111122222233333344444","is_active": true,"sort_order": 0,"description": null,"channel": 1}

Choosen Bank Account Information

paid_bank_account

object

"paid_bank_account": {"pk": 1,"bank": 15,"slug": "H1","holder_name": "Shop Bank Account","iban": "TR01111122222233333344444","is_active": true,"sort_order": 0,"description": "Shop Bank Account","channel": 1}

Paid Bank Account Information

date_paid

string

2020-11-18T13:39:54.915941Z

Installement Config

sent on ISO-8601 standard

user_holder_name

string

John Due

user_iban

string

TR01111234123124222

User Bank Account Number

transaction_type

string

purchase

Transaction Type

Last updated

Was this helpful?