Setup

In the setup steps, the codes for the regularly running jobs that operate system-wide are located in the channel_app_template.app.tasks file. There are three jobs that can run regularly related to the setup steps.

1. Update Channel Conf Schema

Creates the necessary settings for the sales channel to be established in the business process. The process starts by reading the settings through the development made in the sales channel integration, and then sends them to Akinon.

The process is managed via the update_channel_conf_schema function within the Setup Service.

You can place your desired settings inside the sales channel as key-value pairs, and develop accordingly.

The class GetChannelConfSchema needs to be modified.

GetChannelConfSchema

Class GetChannelConfSchema(integration, objects=None, batch_request=None, **kwargs)

normalize_response(data, validated_data, transformed_data, response)

Tuple[dict, Any, Any]

The dynamic sales channel configuration settings for the sales channel to be opened are defined here. You can specify the information you want to enter as the sales channel settings in the format below.

To access the main URL, you can use:

>>> self.integration.channel.conf.get("main_url")

Example Code:

schema = {
    "main_url": ChannelConfSchemaField(
        required=True,
        data_type=ChannelConfSchemaDataTypes.text,
        key="main_url",
        label="Api Url"),
    "marchant_id": ChannelConfSchemaField(
        required=True,
        data_type=ChannelConfSchemaDataTypes.text,
        key="marchant_id",
        label="Satıcı Kodu"),
}

2. Create or Update Category Tree & Nodes

Creates the category tree for the sales channel on the Akinon side.

The class GetCategoryTreeAndNodes needs to be modified.

GetCategoryTreeAndNodes

class GetCategoryTreeAndNodes(integration, objects=None, batch_request=None, **kwargs)

The category tree present in the sales channel provides the necessary data for it to be created on the Akinon side as well. The command operates without any parameters.

send_request(transformed_data) → HttpResponse

A request is made to access the category tree.

normalize_response(data, validated_data, transformed_data, response)

Tuple[CategoryTreeDto, ErrorReportDto, Any]

In category trees, there is a nested structure. The DataClass object to be returned is CategoryTreeDto.

Assuming the tree structure in the sales channel is as follows:

CategoryTreeDto can be created as follow:

3. Create or Update Category Attributes

The class GetCategoryAttributes needs to be modified.

GetCategoryAttributes

This class is responsible for creating attributes and attribute values for the categories of the sales channel in Omnitron.

classGetCategoryAttributes(integration, objects=None, batch_request=None, **kwargs)

This service will generate the attributes and their values used in the category tree of the sales channel. The DataClass DataClass used for creating attributes is CategoryAttributeDto.

CategoryAttributeDto can be created as follow:

The created attributes require mapping during product submission.

After the mapping is done, the mapped_attributes are added to the product data. For detailed information, refer to Mapping Data in the Product.

CategoryAttributeValueDto can be created as follow:

send_request(transformed_data) → HttpResponse

A request is made to access the properties of the category tree.

normalize_response(data, validated_data, transformed_data, response)

Tuple[CategoryDto, ErrorReportDto, Any]

4. Create or Update Attributes

This service is responsible for creating attributes and attribute value pairs for the sales channel in Omnitron and can be used in scenarios where there are no attributes associated with categories.

The class GetAttributes needs to be modified.

GetAttributes

classGetAttributes(integration, objects=None, batch_request=None, **kwargs)

This service is responsible for retrieving the attributes and their values from the sales channel and creating the AttributeDto DataClass.

The created attributes require mapping during product submission.

After the mapping is done, the mapped_attributes are added to the product data. For detailed information, refer to Mapping Data in the Product.

AttributeDto can be created as follow:

GetAttributes channel.setup.GetAttributes

AttributeValueDto can be created as follow:

send_request(transformed_data) → HttpResponse

A request is made to access the attributes of the channel.

normalize_response(data, validated_data, transformed_data, response)

Tuple[List[AttributeDto], ErrorReportDto, Any]

Source Code

Source code of the channel.commands.setup item:

Was this helpful?