{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/kibo-commerce/main/json-schema/kibo-commerce-handling-fee-rule-schema.json",
  "title": "HandlingFeeRule",
  "description": "An object to group a handling fee with zones, rules, and servicetypes",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/kibo-commerce-shipping-openapi.yml#/components/schemas/HandlingFeeRule",
  "properties": {
    "appliesTo": {
      "description": "The level at which this fee applies\r\n<value>shippingrate</value><value>order</value>",
      "type": [
        "string",
        "null"
      ]
    },
    "auditInfo": {
      "$ref": "#/$defs/AuditInfo"
    },
    "fulfillmentMethod": {
      "description": "Fulfillment method this rule applies to.\r\n<value>Ship</value><value>Pickup</value><value>Delivery</value>",
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "description": "The system generated id for this rule",
      "type": [
        "string",
        "null"
      ]
    },
    "locationCodes": {
      "description": "Optional location codes for Pickup/Delivery rules.\r\n<remarks>Must be null for Ship rules. When empty/null for Pickup/Delivery, the rule applies to all locations.</remarks>",
      "items": {
        "type": "string"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "productTargetRuleCodes": {
      "description": "the product target rule codes associated with this rule\r\n<remarks>leave empty or null to denote all products</remarks>",
      "items": {
        "type": "string"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "sequence": {
      "description": "The sequence in which this rule is preferred over others",
      "format": "int32",
      "type": "integer"
    },
    "serviceTypes": {
      "description": "the servicetypes associated with this rule\r\n<remarks>leave empty or null to denote all carriers and subsequent service types</remarks>",
      "items": {
        "$ref": "#/$defs/ServiceType"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "shippingTargetRuleCodes": {
      "description": "The shipping target rule codes associated with this rule\r\n<remarks>leave empty or null to denote all destinations</remarks>",
      "items": {
        "type": "string"
      },
      "type": [
        "array",
        "null"
      ]
    },
    "value": {
      "description": "The value of this fee",
      "format": "double",
      "type": "number"
    },
    "valueType": {
      "description": "The type of this handling fee\r\n<value>percentage</value><value>flatrate</value>",
      "type": [
        "string",
        "null"
      ]
    }
  },
  "type": "object",
  "$defs": {
    "AuditInfo": {
      "properties": {
        "createBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "createDate": {
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "updateBy": {
          "type": [
            "string",
            "null"
          ]
        },
        "updateDate": {
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ServiceType": {
      "description": "Service Type aka Shipping Method",
      "properties": {
        "code": {
          "description": "Unique Service Type Code for a particular Carrier",
          "type": [
            "string",
            "null"
          ]
        },
        "content": {
          "$ref": "#/$defs/ServiceTypeLocalizedContent"
        },
        "deliveryDuration": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "ServiceTypeLocalizedContent": {
      "properties": {
        "localeCode": {
          "type": [
            "string",
            "null"
          ]
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    }
  }
}