Bounds Schema

FieldTypeRequiredDescription
profilestringYes-
read_accessstringYesAllow the agent to look up invoices and credit notes, and the orders and customers they are issued for.
invoice_net_maxnumberYesMaximum net total of a single invoice, in currency units. The connector recalculates the total from the lines and refuses a call whose declared total does not match.
credit_net_maxnumberYesMaximum net total of a single credit note (cancellation or correction of an issued invoice), in currency units. Recalculated by the connector like an invoice.
invoice_net_monthly_maxnumberYesMaximum cumulative net total of invoices issued per month, in currency units.
credit_net_monthly_maxnumberYesMaximum cumulative net total of credit notes issued per month, in currency units.
invoice_daily_maxnumberYesMaximum invoices issued per day. An issued invoice is a legal document and cannot be withdrawn, only credited.
credit_daily_maxnumberYesMaximum credit notes issued per day.

Key order: profile, read_access, invoice_net_max, credit_net_max, invoice_net_monthly_max, credit_net_monthly_max, invoice_daily_max, credit_daily_max

Scope Schema (local only)

FieldTypeRequiredDescription
currencystringYesPermitted invoice currency

Key order: currency

Full Definition

{
  "id": "github.com/humanagencyprotocol/hap-profiles/invoicing@0.1",
  "name": "Invoicing",
  "version": "0.1",
  "description": "Invoicing authority — governs issuing invoices and credit notes in the invoicing system (ERP). An issued invoice is never changed or deleted: a cancellation or correction is a credit note with its own number, as German and Austrian law require. No payments, reminders or master data.",
  "whatsNew": "First version: invoices and credit notes, each with its own net limits.",
  "boundsSchema": {
    "actionTypes": [
      "invoice",
      "credit"
    ],
    "keyOrder": [
      "profile",
      "read_access",
      "invoice_net_max",
      "credit_net_max",
      "invoice_net_monthly_max",
      "credit_net_monthly_max",
      "invoice_daily_max",
      "credit_daily_max"
    ],
    "fields": {
      "profile": {
        "type": "string",
        "required": true
      },
      "read_access": {
        "type": "string",
        "required": true,
        "displayName": "Read access",
        "description": "Allow the agent to look up invoices and credit notes, and the orders and customers they are issued for.",
        "boundType": {
          "kind": "enum",
          "values": [
            "unlimited",
            "none"
          ]
        },
        "toolsDescription": "list_invoices, get_invoice, list_credit_notes, get_credit_note",
        "default": "unlimited"
      },
      "invoice_net_max": {
        "type": "number",
        "required": true,
        "displayName": "Max net per invoice",
        "description": "Maximum net total of a single invoice, in currency units. The connector recalculates the total from the lines and refuses a call whose declared total does not match.",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "per_transaction",
          "of": "net_total",
          "requiredFor": [
            "invoice"
          ]
        }
      },
      "credit_net_max": {
        "type": "number",
        "required": true,
        "displayName": "Max net per credit note",
        "description": "Maximum net total of a single credit note (cancellation or correction of an issued invoice), in currency units. Recalculated by the connector like an invoice.",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "per_transaction",
          "of": "credit_total",
          "requiredFor": [
            "credit"
          ]
        }
      },
      "invoice_net_monthly_max": {
        "type": "number",
        "required": true,
        "displayName": "Invoiced per month",
        "description": "Maximum cumulative net total of invoices issued per month, in currency units.",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "net_total",
          "window": "monthly"
        },
        "appliesTo": [
          "invoice"
        ]
      },
      "credit_net_monthly_max": {
        "type": "number",
        "required": true,
        "displayName": "Credited per month",
        "description": "Maximum cumulative net total of credit notes issued per month, in currency units.",
        "unit": "currency:EUR",
        "boundType": {
          "kind": "cumulative_sum",
          "of": "credit_total",
          "window": "monthly"
        },
        "appliesTo": [
          "credit"
        ]
      },
      "invoice_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Invoices per day",
        "description": "Maximum invoices issued per day. An issued invoice is a legal document and cannot be withdrawn, only credited.",
        "unit": "count",
        "boundType": {
          "kind": "cumulative_count",
          "window": "daily"
        },
        "appliesTo": [
          "invoice"
        ]
      },
      "credit_daily_max": {
        "type": "number",
        "required": true,
        "displayName": "Credit notes per day",
        "description": "Maximum credit notes issued per day.",
        "unit": "count",
        "boundType": {
          "kind": "cumulative_count",
          "window": "daily"
        },
        "appliesTo": [
          "credit"
        ]
      }
    }
  },
  "scopeSchema": {
    "keyOrder": [
      "currency"
    ],
    "fields": {
      "currency": {
        "type": "string",
        "required": true,
        "displayName": "Currency",
        "description": "Permitted invoice currency",
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        },
        "enum": [
          "EUR",
          "CHF",
          "USD",
          "GBP"
        ]
      }
    }
  },
  "executionContextSchema": {
    "fields": {
      "net_total": {
        "source": "declared",
        "description": "Net total of the invoice in currency units (verified by the connector against the lines)",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "credit_total": {
        "source": "declared",
        "description": "Net total of the credit note in currency units (verified by the connector against the lines). Kept apart from net_total so an invoice limit never applies to a credit note, and the other way round.",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        }
      },
      "currency": {
        "source": "declared",
        "description": "Document currency",
        "required": true,
        "constraint": {
          "type": "string",
          "enforceable": [
            "enum"
          ]
        }
      },
      "invoice_net_monthly": {
        "source": "cumulative",
        "description": "Running monthly net total invoiced",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        },
        "cumulativeField": "net_total",
        "window": "monthly"
      },
      "credit_net_monthly": {
        "source": "cumulative",
        "description": "Running monthly net total credited",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        },
        "cumulativeField": "credit_total",
        "window": "monthly"
      },
      "invoice_count_daily": {
        "source": "cumulative",
        "description": "Running daily invoice count",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        },
        "cumulativeField": "_count",
        "window": "daily"
      },
      "credit_count_daily": {
        "source": "cumulative",
        "description": "Running daily credit note count",
        "required": true,
        "constraint": {
          "type": "number",
          "enforceable": [
            "max"
          ]
        },
        "cumulativeField": "_count",
        "window": "daily"
      }
    }
  },
  "requiredGates": [
    "bounds",
    "intent",
    "commitment",
    "mandate_owner"
  ],
  "ttl": {
    "default": 86400,
    "max": 2592000
  },
  "retention_minimum": 7776000,
  "content_binding": {
    "version": "1",
    "kind": "jcs"
  }
}