Bounds Schema

FieldTypeRequiredDescription
profilestringYes-
amount_maxnumberYesMaximum monetary amount per transaction in currency units
amount_daily_maxnumberYesMaximum cumulative charges per day in currency units
amount_monthly_maxnumberYesMaximum cumulative charges per month in currency units
transaction_count_daily_maxnumberYesMaximum number of transactions per day

Key order: profile, amount_max, amount_daily_max, amount_monthly_max, transaction_count_daily_max

Context Schema (local only)

FieldTypeRequiredDescription
currencystringYesPermitted currency code
action_typestringYesAuthorized financial operation

Key order: currency, action_type

Full Definition

{
  "id": "github.com/humanagencyprotocol/hap-profiles/charge@0.4",
  "name": "Charge",
  "version": "0.4",
  "description": "Charge authority — governs charging customers: payments, refunds, subscriptions",
  "boundsSchema": {
    "keyOrder": [
      "profile",
      "amount_max",
      "amount_daily_max",
      "amount_monthly_max",
      "transaction_count_daily_max"
    ],
    "fields": {
      "profile": {
        "type": "string",
        "required": true
      },
      "amount_max": {
        "type": "number",
        "required": true,
        "displayName": "Max per transaction",
        "description": "Maximum monetary amount per transaction in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "per_transaction",
          "of": "amount"
        }
      },
      "amount_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Daily charge limit",
        "description": "Maximum cumulative charges per day in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "amount",
          "window": "daily"
        }
      },
      "amount_monthly_max": {
        "type": "number",
        "required": true,
        "displayName": "Monthly charge limit",
        "description": "Maximum cumulative charges per month in currency units",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "amount",
          "window": "monthly"
        }
      },
      "transaction_count_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Daily transaction limit",
        "description": "Maximum number of transactions per day",
        "unit": "count",
        "boundType": {
          "kind": "cumulative_count",
          "window": "daily"
        }
      }
    }
  },
  "contextSchema": {
    "keyOrder": [
      "currency",
      "action_type"
    ],
    "fields": {
      "currency": {
        "type": "string",
        "required": true,
        "displayName": "Currency",
        "description": "Permitted currency code",
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        },
        "enum": [
          "USD",
          "EUR",
          "GBP",
          "CHF",
          "JPY",
          "CAD",
          "AUD"
        ]
      },
      "action_type": {
        "type": "string",
        "required": true,
        "displayName": "Action type",
        "description": "Authorized financial operation",
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        },
        "enum": [
          "charge",
          "refund",
          "subscribe"
        ]
      }
    }
  },
  "executionContextSchema": {
    "fields": {
      "action_type": {
        "source": "declared",
        "description": "Financial operation being performed",
        "required": true,
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        }
      },
      "amount": {
        "source": "declared",
        "description": "Monetary amount in currency units",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "currency": {
        "source": "declared",
        "description": "Currency code",
        "required": true,
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        }
      },
      "amount_daily": {
        "source": "cumulative",
        "cumulativeField": "amount",
        "window": "daily",
        "description": "Running daily charge total (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "amount_monthly": {
        "source": "cumulative",
        "cumulativeField": "amount",
        "window": "monthly",
        "description": "Running monthly charge total (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "transaction_count_daily": {
        "source": "cumulative",
        "cumulativeField": "_count",
        "window": "daily",
        "description": "Running daily transaction count (resolved from execution log)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      }
    }
  },
  "requiredGates": [
    "bounds",
    "intent",
    "commitment",
    "decision_owner"
  ],
  "ttl": {
    "default": 86400,
    "max": 2592000
  },
  "retention_minimum": 7776000
}