Data Schemas

JSON schema definitions for data models in the application.

Merchant Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Merchant",
  "description": "A merchant in the system",
  "type": "object",
  "properties": {
    "id": {
      "description": "Unique identifier for the merchant (auto-generated)",
      "type": "string"
    },
    "merchantId": {
      "description": "UUID for the merchant",
      "type": "string"
    },
    "businessName": {
      "type": "string"
    },
    "entityName": {
      "type": "string"
    },
    "businessType": {
      "type": "string"
    },
    "holdingMerchantId": {
      "type": "string"
    },
    "locationId": {
      "type": "string"
    },
    "operatingHours": {
      "description": "Merchant operating hours",
      "type": "string"
    },
    "ABN": {
      "type": "string"
    },
    "ACN": {
      "type": "string"
    },
    "phone": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "fax": {
      "type": "string"
    },
    "bankAccountName": {
      "type": "string"
    },
    "bankBSB": {
      "type": "string"
    },
    "bankAccountNumber": {
      "type": "string"
    },
    "products": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "merchantLogin": {
      "description": "Allows the authorised auth id to login for merchant",
      "type": "string"
    },
    "updateTime": {
      "type": "string",
      "format": "date-time"
    },
    "createdTime": {
      "type": "string",
      "format": "date-time"
    },
    "catalog": {
      "description": "Merchant catalog items",
      "type": "array",
      "items": {
        "$ref": "#/definitions/CatalogItem"
      }
    }
  },
  "required": [
    "id",
    "merchantId",
    "businessName",
    "entityName",
    "businessType",
    "locationId",
    "operatingHours",
    "ABN",
    "ACN",
    "phone",
    "email",
    "bankAccountName",
    "bankBSB",
    "bankAccountNumber",
    "products",
    "merchantLogin",
    "catalog",
    "updateTime",
    "createdTime"
  ]
}

Catalog Item Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "CatalogItem",
  "description": "An item in the merchant's catalog.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the catalog item."
    },
    "name": {
      "type": "string",
      "description": "Name of the item."
    },
    "price": {
      "type": "number",
      "description": "Price of the item."
    },
    "category": {
      "type": "string",
      "description": "Category of the item."
    },
    "sku": {
      "type": "string",
      "description": "Stock Keeping Unit."
    },
    "imageUrl": {
      "type": "string",
      "format": "uri",
      "description": "URL for the item's image."
    },
    "source": {
      "type": "string",
      "description": "The origin of the catalog item data.",
      "enum": [
        "generic",
        "square"
      ]
    },
    "pointType": {
      "type": "string",
      "description": "The type of loyalty points associated with this item.",
      "enum": [
        "cafe_meal",
        "coffee"
      ]
    },
    "merchantId": {
      "type": "string",
      "description": "The ID of the merchant this item belongs to."
    }
  },
  "required": [
    "id",
    "name",
    "price",
    "category",
    "sku",
    "imageUrl",
    "source",
    "pointType",
    "merchantId"
  ]
}

Accumulation Rule Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "AccumulationRule",
  "description": "A rule for how loyalty points are earned.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the rule."
    },
    "name": {
      "type": "string",
      "description": "Name of the rule."
    },
    "description": {
      "type": "string",
      "description": "Description of the rule."
    },
    "pointType": {
      "type": "string",
      "description": "The type of points this rule applies to.",
      "enum": [
        "cafe_meal",
        "coffee"
      ]
    },
    "linkedItemIds": {
      "type": "array",
      "description": "Catalog item IDs this rule is linked to.",
      "items": {
        "type": "string"
      }
    },
    "type": {
      "type": "string",
      "const": "accumulation",
      "description": "The type of the rule."
    },
    "pointsPerDollar": {
      "type": "number",
      "description": "Points awarded per dollar spent."
    },
    "merchantId": {
      "type": "string",
      "description": "The ID of the merchant this rule belongs to."
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "pointType",
    "linkedItemIds",
    "type",
    "pointsPerDollar",
    "merchantId"
  ]
}

Redemption Rule Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "RedemptionRule",
  "description": "A rule for how loyalty points are redeemed.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the rule."
    },
    "name": {
      "type": "string",
      "description": "Name of the rule."
    },
    "description": {
      "type": "string",
      "description": "Description of the rule."
    },
    "pointType": {
      "type": "string",
      "description": "The type of points this rule applies to.",
      "enum": [
        "cafe_meal",
        "coffee"
      ]
    },
    "linkedItemIds": {
      "type": "array",
      "description": "Catalog item IDs this rule is linked to.",
      "items": {
        "type": "string"
      }
    },
    "type": {
      "type": "string",
      "const": "redemption",
      "description": "The type of the rule."
    },
    "pointsCost": {
      "type": "number",
      "description": "Number of points required for redemption."
    },
    "dollarValue": {
      "type": "number",
      "description": "The dollar value of the redemption."
    },
    "merchantId": {
      "type": "string",
      "description": "The ID of the merchant this rule belongs to."
    }
  },
  "required": [
    "id",
    "name",
    "description",
    "pointType",
    "linkedItemIds",
    "type",
    "pointsCost",
    "dollarValue",
    "merchantId"
  ]
}