Skip to content

inventory.cogs

Cost of goods sold event emitted by POS on sale completion. Triggers Constanza to post a COGS poliza (Dr 5001 / Cr 1151).

Senders

  • caracol
  • hoja

Receivers

  • constanza

Data schema

Each field maps to a type hint. | null indicates an optional field.

json
{
  "type": "object",
  "required": [
    "saleId",
    "items",
    "totalCogs",
    "recordedAt"
  ],
  "properties": {
    "saleId": {
      "type": "string",
      "description": "Firestore document ID of the completed sale"
    },
    "items": {
      "type": "array",
      "description": "FIFO deduction lines contributing to COGS",
      "items": {
        "type": "object",
        "required": [
          "sku",
          "productName",
          "quantity",
          "unitCost",
          "totalCost"
        ],
        "properties": {
          "sku": {
            "type": "string",
            "description": "Product ID (Firestore doc key)"
          },
          "productName": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "unitCost": {
            "type": "number",
            "description": "Cost per unit from FIFO batch"
          },
          "totalCost": {
            "type": "number",
            "description": "quantity × unitCost"
          },
          "añada": {
            "type": [
              "string",
              "null"
            ],
            "description": "Vintage year (wine FIFO), null if not applicable"
          },
          "pedimento": {
            "type": [
              "string",
              "null"
            ],
            "description": "Customs document number (import FIFO), null if not applicable"
          }
        }
      }
    },
    "totalCogs": {
      "type": "number",
      "description": "Sum of all item totalCost values; used as the póliza amount"
    },
    "recordedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp when the COGS event was recorded"
    }
  }
}

Example payload

The following is a synthetic payload that matches the schema. Production payloads are signed with HMAC-SHA256 and delivered to each receiver's registered webhook endpoint.

json
{
  "type": {},
  "required": "example-required",
  "properties": "example-properties"
}

See also


Generated from ecosystem-sdk/packages/mcp-server/src/registry/events.json. Do not edit by hand.

Red Broom Software Ecosystem