# Falcon Flex Shipment Extension

## <mark style="color:red;">**Extension Installation**</mark>

### <mark style="color:red;">**Preliminary Works**</mark>

The following information is requested from the provider for the brand-specific and production (live) environment.

* **API\_URL**
* **API\_KEY**
* **DELIVERY\_LOCATION\_TYPE**
* **TRANSPORT\_TYPE\_ID**

A secret\_key is generated with a minimum length of 41 characters. The generated key must be kept throughout the installation. An example command line to generate a random key:

```
openssl rand -base64 41
```

An address ID must be set for the default destination information in easy-return shipments. It can be created using the extension's address creation method (example curl is given below). Ensure that the address ID is accurately configured to facilitate the smooth handling of return shipments within the Omnitron configuration.

```bash
curl --location --request POST '{{extension_url}}/addresses' \
--header 'x-akinon-request-id: {{guid}}' \
--header 'x-akinon-api-version: 1.0' \
--header 'Authorization: Basic {{token}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "id": <id>,
    "addressName": "Test Address Name",
    "addressDescription": "Test Description",
    "phone": "+928-584-31430",
    "email": "testuser@example.net",
    "address": {
        "country": {
            "id": <id>,
            "code": "QA",
            "name": "Qatar"
        },
        "city": {
            "id": <id>, 
            "name": "Doha"
        },
        "township": {
            "id": <id>, 
            "name": "Al Jasra"
        },
        "district": {
            "id": <id>, // optional
            "name": "Z01"
        },
        "zipcode": "1725629716",
        "addressLine": "597 Hauck Views"
    }
}'
```

In order to send the correct data to Falcon Flex, the product attributes with the code names "barcode" and “name” should be defined.

### <mark style="color:red;">**Environment Variables**</mark>

The extension installed to the relevant project in ACC must have the following environment variables. Environment variables can be entered before or after the deployment phase. As changes are made to the environment variables, the deployment process must be performed again.

| Variable                 | Description                                                                                                                                                                                                                                                                                                         |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Extension-specific       |                                                                                                                                                                                                                                                                                                                     |
| API\_URL                 | URL received during the preliminary works phase (without a trailing slash at the end)                                                                                                                                                                                                                               |
| API\_KEY                 | API KEY received during the preliminary works phase                                                                                                                                                                                                                                                                 |
| DELIVERY\_LOCATION\_TYPE | Specifies whether the location is an existing location, an international location or a location in Qatar. The values corresponding to each type are: Location PickupLocationTypeId / DeliveryLocationTypeId Existing 1 International 2 Qatar 3 Reference Link: <https://falconflex.readme.io/reference/create-task> |
| TRANSPORT\_TYPE\_ID      | Different tasks can be assigned to different modes of transport. The current supported transport type and their IDs are shown in the table below: Transport Type transportTypeId No Preference 1 Bicycle 2 Bike 3 Car 4 Truck 5 Reference Link: <https://falconflex.readme.io/reference/create-task>                |
| Generic                  |                                                                                                                                                                                                                                                                                                                     |
| SECRET\_KEY              | The generated secret key during the preliminary works phase                                                                                                                                                                                                                                                         |
| ADMIN\_EMAIL             | The e-mail address of the installer can be entered                                                                                                                                                                                                                                                                  |
| ADMIN\_PASSWORD          | A newly created and extension-specific strong password                                                                                                                                                                                                                                                              |
| ADMIN\_USERNAME          | A username can be entered (example: ‘akinon’)                                                                                                                                                                                                                                                                       |

## <mark style="color:red;">**Omnitron Settings**</mark>

Fero AI can be selected as the Shipment Provider in Omnitron to integrate with the extension installed. Additionally, an easy return option can be defined to enable easy return methods. Explanations on how these settings can be configured are detailed in the sections below. Please note that these two operations are independent and optional.

### <mark style="color:red;">**Shipping Provider**</mark>

To add Fero AI, a new shipping provider is added to SHIPPING\_PROVIDERS in Dynamic Settings through Omnitron.

#### **Example Omnitron Configuration:**

| Field               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Klass               | ExtensionShippingProvider Class                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Urls Code           | { "urls": { "base\_url": "**`{SHIPMENT_EXTENSION_URL}`**" } }                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Serializers         | Order Serializer: ExtensionShippingOrderSerializer Class Response Serializer: ExtensionShippingResponseSerializer Class                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Configurations Code | { "strategies": { "query\_type": "SHIPMENT\_ID", "generate\_shipment\_origin\_strategy": "\<addressId>", "generate\_shipment\_product\_strategy": true, "generate\_shipment\_product\_attributes": \[ "description", “price” ] }, "pay\_on\_delivery\_option": false, "delivery\_type": "CUSTOMER", "auth": { "username": "{SHIPMENT\_EXTENSION\_ADMIN\_USERNAME}", "password": "{SHIPMENT\_EXTENSION\_ADMIN\_PASSWORD}" }, "is\_active": { "query": true, "send\_shipping\_info": true, "delete\_shipping\_info": true, "query\_by\_order": true }, "label\_options": { "file\_extension": "pdf" } } |

## <mark style="color:red;">**OMS Settings**</mark>

For OMS, “strategies” field in Shipping Management must be defined accordingly:

```
{"send_product_info":true,"product_attributes":["barcode","name"]}
```
