{
    "name": "Ingram Micro",
    "app_type": "ingram-micro",
    "sync_type": "api",
    "is_active": true,
    "debug_mode": false,
    "authorization": {
        "auth_type": "oauth2",
        "auth_settings": {
            "request_settings": {
                "grant_type": "client_credentials",
                "access_token_url": "https://api.ingrammicro.com:443/oauth/oauth30/token",
                "client_id": "<client_id>",
                "client_secret": "<client_secret>",
                "scope": "",
                "send_client_credentials": [
                    "header"
                ],
                "authorization_header_name": "Authorization"
            },
            "response_settings": {
                "token_key": "access_token",
                "expires_in_key": "expires_in",
                "expires_in_value": "86399",
                "token_type": "Bearer",
                "authorization_header_name": "Authorization"
            }
        }
    },
    "connections": [
        {
            "name": "Products",
            "type": "api",
            "is_active": true,
            "is_primary": true,
            "resource_type": "product",
            "priority": 1,
            "configuration": {
                "method": "GET",
                "endpoint": "https://api.ingrammicro.com:443<env_type>/resellers/v6/catalog",
                "auth_enabled": true,
                "headers": {
                    "IM-CountryCode": "<country_code>",
                    "IM-CorrelationID": "32",
                    "IM-CustomerNumber": "<customer_number>",
                    "Content-Type": "application/json"
                },
                "prerequisites": {
                    "product_response": "catalog",
                    "prerequisite_type": "no-variations",
                    "prerequisite_variation_type": "group-variations",
                    "variable_response": null,
                    "main_product_unique_identifier": "ingramPartNumber",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {
                    "time_delay": ""
                }
            }
        },
        {
            "name": "Price and Availability",
            "type": "api",
            "is_active": true,
            "is_primary": false,
            "resource_type": "product",
            "priority": 2,
            "configuration": {
                "method": "POST",
                "endpoint": "https://api.ingrammicro.com:443<env_type>/resellers/v6/catalog/priceandavailability?includeAvailability=true&includePricing=true",
                "auth_enabled": true,
                "headers": {
                    "IM-CountryCode": "<country_code>",
                    "IM-CorrelationID": "32",
                    "IM-CustomerNumber": "<customer_number>",
                    "Content-Type": "application/json"
                },
                "body": {
                    "type": "json",
                    "data": {
                        "products": [
                            {
                                "ingramPartNumber": "2964045"
                            }
                        ]
                    }
                },
                "prerequisites": {
                    "product_response": "",
                    "prerequisite_type": "no-variations",
                    "prerequisite_variation_type": "group-variations",
                    "variable_response": null,
                    "main_product_unique_identifier": "ingramPartNumber",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {
                    "time_delay": ""
                }
            }
        },
        {
            "name": "Order",
            "type": "api",
            "is_active": false,
            "is_primary": false,
            "resource_type": "order",
            "priority": 3,
            "configuration": {
                "method": "POST",
                "endpoint": "https://api.ingrammicro.com:443<env_type>/resellers/v6/orders",
                "auth_enabled": true,
                "headers": {
                    "Content-Type": "application/json",
                    "IM-CountryCode": "<country_code>",
                    "IM-CorrelationID": "32",
                    "IM-CustomerNumber": "<customer_number>"
                },
                "body": {
                    "type": "json",
                    "data": {
                        "lines": [
                            {
                                "quantity": 1,
                                "ingramPartNumber": "5735417",
                                "customerLineNumber": "001"
                            }
                        ],
                        "shipToInfo": {
                            "city": "MELBOURNE",
                            "email": "test@test.com",
                            "state": "VIC",
                            "postalCode": "3000",
                            "companyName": "NORTH ATLANTIC TECHNOLOGIES PTY LTD",
                            "countryCode": "AU",
                            "phoneNumber": "4250283159",
                            "addressLine1": "5-3 Astral Residency COLLINS STREET",
                            "addressLine2": ""
                        },
                        "acceptBackOrder": true,
                        "customerOrderNumber": "TESTP0011211",
                        "additionalAttributes": [
                            {
                                "attributeName": "allowDuplicateCustomerOrderNumber",
                                "attributeValue": "true"
                            }
                        ]
                    }
                },
                "prerequisites": {
                    "product_response": "",
                    "variable_response": null,
                    "main_product_unique_identifier": "",
                    "variable_product_unique_identifier": ""
                },
                "advanced_configuration": {
                    "time_delay": ""
                }
            }
        }
    ],
    "attribute_mapping": [
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "description",
            "supplier_attribute": "description",
            "advanced_configuration": null
        },
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "name",
            "supplier_attribute": "extraDescription",
            "advanced_configuration": null
        },
        {
            "connection": "Price and Availability",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "regular_price",
            "supplier_attribute": "pricing->retailPrice",
            "advanced_configuration": null
        },
        {
            "connection": "Price and Availability",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "stock_quantity",
            "supplier_attribute": "availability->totalAvailability",
            "advanced_configuration": null
        },
        {
            "connection": "Products",
            "product_type": "parent",
            "type": "core",
            "wc_attribute": "sku",
            "supplier_attribute": "ingramPartNumber",
            "advanced_configuration": null
        }
    ],
    "operations": [
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": false,
            "configuration": {
                "available_products": {
                    "add": true,
                    "update": true,
                    "update_product_status": false,
                    "product_status": "publish"
                },
                "unavailable_products": {
                    "products_of": "none",
                    "operation": "none"
                }
            },
            "connections": [
                "Products"
            ]
        },
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": true,
            "configuration": {
                "available_products": {
                    "add": false,
                    "update": true,
                    "update_product_status": false,
                    "product_status": "publish"
                },
                "unavailable_products": {
                    "products_of": "none",
                    "operation": "none"
                }
            },
            "connections": [
                "Price and Availability"
            ]
        },
        {
            "operation": "product-operations",
            "operation_type": "data-sync",
            "is_active": false,
            "configuration": {
                "available_products": {
                    "add": false,
                    "update": false,
                    "product_status": "publish",
                    "update_product_status": false
                },
                "unavailable_products": {
                    "operation": "none",
                    "products_of": "none"
                }
            },
            "connections": [
                "Order"
            ]
        },
        {
            "operation": "page",
            "operation_type": "performance-optimization",
            "is_active": true,
            "configuration": {
                "type": "regular",
                "location": "query-parameter",
                "page_param": "pageNumber",
                "limit_param": "pageSize",
                "limit_value": "100"
            },
            "connections": [
                "Products"
            ]
        }
    ],
    "order_sync": [
        {
            "name": "Orders",
            "connection_id": "Order",
            "is_active": false,
            "configuration": {
                "order_suppliers": [
                    "<supplier_id>",
                    "allow_existing_products"
                ],
                "direct_association": {
                    "acceptBackOrder": "##true##",
                    "customerOrderNumber": "id",
                    "additionalAttributes->0->attributeName": "##allowDuplicateCustomerOrderNumber##",
                    "additionalAttributes->0->attributeValue": "##true##",
                    "shippingMethod": "##1##"
                },
                "nested_association": [
                    {
                        "lines": "line_items",
                        "direct_association": [
                            {
                                "wooKey": "####+sku",
                                "vendorKey": "ingramPartNumber"
                            },
                            {
                                "wooKey": "purchase_quantity",
                                "vendorKey": "quantity"
                            }
                        ]
                    },
                    {
                        "shipToInfo": "shipping",
                        "direct_association": [
                            {
                                "wooKey": "address_1",
                                "vendorKey": "addressLine1"
                            },
                            {
                                "wooKey": "address_2",
                                "vendorKey": "addressLine2"
                            },
                            {
                                "wooKey": "city",
                                "vendorKey": "city"
                            },
                            {
                                "wooKey": "state",
                                "vendorKey": "state"
                            },
                            {
                                "wooKey": "postcode",
                                "vendorKey": "postalCode"
                            },
                            {
                                "wooKey": "country",
                                "vendorKey": "countryCode"
                            },
                            {
                                "wooKey": "phone",
                                "vendorKey": "phoneNumber"
                            }
                        ]
                    }
                ]
            },
            "is_conditional_sync_enabled": false
        }
    ]
}