# Basic Setup

This document outlines the essential steps required for setting up the foundational elements of the OMS (Order Management System). This initial setup is crucial to ensure a smooth integration and operation of the OMS within the project.

Please proceed by following the steps below to successfully set up the OMS.

### <mark style="color:red;">1. Controll OMS Machine​</mark> <a href="#id-1-controll-oms-machine" id="id-1-controll-oms-machine"></a>

* The accessibility of the OMS machine is controlled with the `https://xxx-omnitron.akinon.net` URL.
* If it is inaccessible, create a job on the INF board, including the brand information, and request that the OMS machine be opened.

### <mark style="color:red;">2. Create Users in Back Office​</mark> <a href="#id-2-create-users-in-back-office" id="id-2-create-users-in-back-office"></a>

* Create a user with admin status in the brand’s Omnitron back office for the person who will perform the setup.
* Support can be received from the brand’s ACM by using back office user information.

### <mark style="color:red;">3. Controll OMS Application​</mark> <a href="#id-3-controll-oms-application" id="id-3-controll-oms-application"></a>

* Log into the system for control purposes.

### <mark style="color:red;">4. Copy Address Records Defined on Omnitron to OMS​</mark> <a href="#id-4-copy-address-records-defined-on-omnitron-to-oms" id="id-4-copy-address-records-defined-on-omnitron-to-oms"></a>

* `https://xxx-omnitron.akinon.net/api/v1/oms/setup/addresses/is_required/` A request is sent to inquire whether the address data is accessible on the system. If no data can be found, the `is_required` request will return the `true` response.
* `https://xxx-omnitron.akinon.net/api/v1/oms/setup/addresses/execute/` A request is sent to retrieve information.
* `https://xxx-omnitron.akinon.net/api/v1/oms/setup/addresses/get_async_status/` A request permits tracking of the operation status.

### <mark style="color:red;">5. Copy Stores Defined on Omnitron to OMS​</mark> <a href="#id-5-copy-stores-defined-on-omnitron-to-oms" id="id-5-copy-stores-defined-on-omnitron-to-oms"></a>

* `https://xxx-omnitron.akinon.net/api/v1/oms/stock_locations/is_required/` A request is sent to inquire whether the stores are accessible on the OMS system. If there are no stores or the information is not synchronous, the `is_required` request will return a `true` response.
* `https://xxx-omnitron.akinon.net/api/v1/oms/stock_locations/execute/` A request is sent to retrieve the data.
* `https://xxx-omnitron.akinon.net/api/v1/oms/stock_locations/get_async_status/` A request permits tracking of the operation status.

### <mark style="color:red;">6. Copying channels defined on Omnitron to the OMS​</mark> <a href="#id-6-copying-channels-defined-on-omnitron-to-the-oms" id="id-6-copying-channels-defined-on-omnitron-to-the-oms"></a>

* `https://xxx-omnitron.akinon.net/api/v1/oms/channels/is_required/` A request is sent to inquire whether the channels are accessible on the system. If no addresses can be found, the `is_required` request will return the `true` response.
* `https://xxx-omnitron.akinon.net/api/v1/oms/channels/execute/` A request is sent to retrieve the data.
* `https://xxx-omnitron.akinon.net/api/v1/oms/channels/get_async_status/` A request permits tracking of the operation status.

### <mark style="color:red;">7. Add OMS Credentials to Omnitron Settings​</mark> <a href="#id-7-add-oms-credentials-to-omnitron-settings" id="id-7-add-oms-credentials-to-omnitron-settings"></a>

* Create a user with the oms.application username in the Omnitron back office.
* This user is added as values corresponding to the `username` and `password` keys below `OMNITRON_CLIENT_SETTINGS>auth` in the OMS settings table, and saved with the OMS application settings service.

### <mark style="color:red;">8. Save Order Filtering Setting for OMS Order Retrieval​</mark> <a href="#id-8-save-order-filtering-setting-for-oms-order-retrieval" id="id-8-save-order-filtering-setting-for-oms-order-retrieval"></a>

* Save the `ORDER_FILTERING` setting, which defines the order retrieval status for the OMS. Please note that this setting might differ based on the brand.

### <mark style="color:red;">9. Scoring Method for Selecting Packaging Center​</mark> <a href="#id-9-scoring-method-for-selecting-packaging-center" id="id-9-scoring-method-for-selecting-packaging-center"></a>

Should the brand require a scoring method to assess the distance between the delivery address and the packaging center during the selection of the relevant packaging center,

* Ask the brand for a Google Maps API or Yandex Maps API key.
* After receiving the key, define it on the OMS settings table in the `GEOLOCATION_DISCOVERY` settings.

### <mark style="color:red;">10. Obtain OMS Integration Information to Inquire About Physical Stock​</mark> <a href="#id-10-obtain-oms-integration-information-to-inquire-about-physical-stock" id="id-10-obtain-oms-integration-information-to-inquire-about-physical-stock"></a>

* This service information is defined in the OMS > Product Stock Integration > New Integration field.
* A second method is defining product integration with the setup service.
  * `https://xxx-omnitron.akinon.net/api/v1/oms/setup/product-stock-integration/available-stock-engines/` A list of stock services can be obtained by sending a GET request.
  * `https://xxx-omnitron.akinon.net/api/v1/oms/setup/product-stock-integration/execute/`A POST request can be sent for the purpose of defining the integration.

    Example of a request body:

    ```
    {
    "url":"...",
    "stock_engine_type":"..." --> it will being retrieved by available-stock-engines request 
    "username":"..." --> optional (It is enough to write for the required engine definition.)
    "password":"..." --> optional (It is enough to write for the required engine definition.)
    }
    ```

### <mark style="color:red;">11. Scenario Definition Process​</mark> <a href="#id-11-scenario-definition-process" id="id-11-scenario-definition-process"></a>

* Learn from the brand which locations can fulfill packaging orders on a channel basis.
* Scenarios received in written form are defined using OMS scenario screens.

### <mark style="color:red;">12. Compile Event List for OMS​</mark> <a href="#id-12-compile-event-list-for-oms" id="id-12-compile-event-list-for-oms"></a>

Prepare a list of the events that will take place on the OMS (if any) to send to the brand.

* Create the Webhook records requested by the brand from the **OMS > Webhook Services** screen.

{% hint style="info" %}
For instance: notifying the X address when the package is ready.
{% endhint %}

### <mark style="color:red;">13. Define OMS Package Commands​</mark> <a href="#id-13-define-oms-package-commands" id="id-13-define-oms-package-commands"></a>

Define OMS package commands (status change flow of packages) in line with brand processes.

* Example of a flow that has been mutually agreed upon with the brand:
  * Waiting status
  * Followed by Preparing status
  * The Pack command is run
  * Ship command is run, etc. (This flow can be defined as soon as the OMS machine is accessible.)

### <mark style="color:red;">14. Define Cargo Integration​</mark> <a href="#id-14-define-cargo-integration" id="id-14-define-cargo-integration"></a>

* First of all you should fill name and erp\_code fields.
* Then you should choose shipping management and Demo Client fields.
  * If you want to manage cargo with OMS you should click. (shipping management)
  * If you do not integrate any cargo companies you can manage your cargo process with Demo Clients that you choose. (Demo Client)
* When you fill all fields you should click save button.
* If you want to integrate any cargo company you should fill credentials part.
* If you want to use Demo Client you should fill conf part.
* <https://xxx.omnitron.akinon.net/api/v1/oms/cargo-company/> Example of a request body:​

```
{
    "name": "cargo-company",
    "erp_code": "cargo_company_erp_code",
    "is_managed_by_oms": true,
    "is_demo_client": false,
    "shipping_company": "cargo-company-value",
    "conf": { -> conf fields are changeable according to the cargo company.
        "username": "asd",
        "password": "asd",
        "company_description": "asd",
        "name": "asd",
        "address": "asd",
        "query_shipment_url": "query_url",
        "create_shipment_url": "create_shipment_url"
    }
}
```

```
{
    "shipping_company": "cargo-company",
    "conf": {
        "klass": "oms.shipments.clients.demo_client.<DemoClientName>"
    },
    "name": "test",
    "erp_code": "test_erp_code",
    "is_managed_by_oms": true,
    "is_demo_client": true
}
```

```
    This is not payload. These fields are just that you will see on the page !!!
       {
        "name":"...",
        "erp_code":"..." 
        "shipping_management": "..." -> If you want to magage cargo from oms you should click.
        "demo_client": "..." -> If you want to use Demo Client you should click.
        "shipping_company": "..." -> Which cargo company or Demo Client do you use ?
        "credentials": "..." -> When you choose shipping_company credendials part generated according to cargo company.
        }
```

### <mark style="color:red;">15. Create Brand-Specific Jobs​</mark> <a href="#id-15-create-brand-specific-jobs" id="id-15-create-brand-specific-jobs"></a>

Jobs can be created for any additional brand-specific settings.
