{
  "store_terms": {
    "version": "2026-11-01.2",
    "store": "Agent-only travel digital goods store (sandbox)",
    "audience": "AI agents acting for a principal. Humans: read /docs.",
    "currency": "USD",
    "prices": "All prices are final, in minor units, taxes included. The amount in a quote is the amount charged.",
    "quote_ttl_seconds": 600,
    "idempotency": "purchase requires an idempotency_key. Repeating a purchase with the same key returns the original order and never charges twice.",
    "spend_accounting": "Mandate limits count net spend (charges minus refunds) of non-failed orders, per UTC day and per UTC calendar month. Wallet funds held for an in-flight purchase are released if the supplier fails.",
    "refund_destination": "Refunds credit the principal's wallet immediately. Withdrawing a wallet balance back to the original card is handled by store support.",
    "dispute_sla_hours": 48,
    "payments": "Purchases are paid from the principal's prepaid wallet, kept in USD and shared by all of the principal's agents. Principals top up on the acquirer's hosted payment page (PayPlus, an Israeli acquirer), charged in ILS; the agent hands over the link and never sees card data. Each credit is converted to USD at the rate in force when the payment is confirmed, and the top-up receipt records the ILS charged, the USD credited and the rate. Top-up bounds are in the topup policy.",
    "fx": "USD/ILS. Stage 1 uses a fixed operator rate (see top-up responses for the rate applied); a daily published rate replaces it later. Charges round up to the agora, credits round down to the cent.",
    "receipts": "Every purchase, refund and wallet top-up gets a receipt signed by the store (HMAC-SHA256 in stage 1) and bound to a hash-chained ledger entry. Use verify_receipt to check one.",
    "liability": "The store guarantees delivery of a working eSIM profile for the purchased coverage, or a refund under the dispute policy. Network quality inside each country is the local carrier's."
  },
  "policies": [
    {
      "policy_id": "dispute",
      "version": "2026-11-01.1",
      "title": "Dispute auto-resolution",
      "file": "policies/dispute.json",
      "sha256": "b1c702fe830203917ec6099f9c9c480c0b16b50878522f9f1d1f9d1dcd29d26f",
      "document": {
        "policy_id": "dispute",
        "version": "2026-11-01.1",
        "title": "Dispute auto-resolution",
        "description": "Applies when an agent reports a problem with an order (reason \"not_delivered\", \"not_working\" or \"duplicate_purchase\"). Outcomes: refund_full, refund_partial, reject, or escalate (held for human review within the SLA in store-terms). Rules are evaluated top to bottom; the first match decides.",
        "facts": {
          "dispute.reason": "not_delivered | not_working | duplicate_purchase",
          "order.status": "store order status",
          "order.delivered": "boolean: an eSIM payload was handed over",
          "order.minutes_since_purchase": "number",
          "order.days_since_purchase": "number",
          "esim.activated": "boolean, from the supplier",
          "esim.data_used_percent": "number 0..100 of the plan allowance (unlimited plans: of the fair-use allowance)",
          "agent.disputes_90d": "number of disputes this agent opened in the last 90 days, excluding this one",
          "agent.same_product_orders_24h": "other non-failed orders by this agent for the same product within 24 hours"
        },
        "params": {
          "max_auto_disputes_90d": 3,
          "non_delivery_grace_minutes": 15,
          "not_working_window_days": 30,
          "low_usage_percent": 10,
          "low_usage_refund_percent": 50
        },
        "rules": [
          {
            "id": "already_refunded",
            "when": {
              "fact": "order.status",
              "op": "in",
              "value": [
                "refunded",
                "partially_refunded"
              ]
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_ALREADY_REFUNDED",
              "human_readable": "This order has already been refunded.",
              "effects": {
                "outcome": "reject"
              }
            }
          },
          {
            "id": "order_failed",
            "when": {
              "fact": "order.status",
              "op": "eq",
              "value": "failed"
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_ORDER_FAILED_NOT_CHARGED",
              "human_readable": "The order failed and was never charged, so there is nothing to refund.",
              "effects": {
                "outcome": "reject"
              }
            }
          },
          {
            "id": "frequent_disputer",
            "when": {
              "fact": "agent.disputes_90d",
              "op": "gte",
              "value": {
                "fact": "params.max_auto_disputes_90d"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_ESCALATED_FREQUENT",
              "human_readable": "This agent has opened {{agent.disputes_90d}} disputes in 90 days; further disputes are reviewed by a human.",
              "effects": {
                "outcome": "escalate"
              }
            }
          },
          {
            "id": "non_delivery_confirmed",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "not_delivered"
                },
                {
                  "fact": "order.delivered",
                  "op": "eq",
                  "value": false
                },
                {
                  "fact": "order.minutes_since_purchase",
                  "op": "gte",
                  "value": {
                    "fact": "params.non_delivery_grace_minutes"
                  }
                }
              ]
            },
            "decision": {
              "allowed": true,
              "reason_code": "DISPUTE_NON_DELIVERY",
              "human_readable": "No eSIM was delivered within {{params.non_delivery_grace_minutes}} minutes of payment. Full refund.",
              "effects": {
                "outcome": "refund_full",
                "refund_percent": 100
              }
            }
          },
          {
            "id": "non_delivery_too_early",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "not_delivered"
                },
                {
                  "fact": "order.delivered",
                  "op": "eq",
                  "value": false
                }
              ]
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_DELIVERY_STILL_PENDING",
              "human_readable": "Delivery is still within the {{params.non_delivery_grace_minutes}} minute grace period. Poll order_status and dispute again after it.",
              "effects": {
                "outcome": "reject"
              }
            }
          },
          {
            "id": "non_delivery_but_activated",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "not_delivered"
                },
                {
                  "fact": "esim.activated",
                  "op": "eq",
                  "value": true
                }
              ]
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_DELIVERY_CONFIRMED",
              "human_readable": "The supplier reports the eSIM as installed and activated, which confirms delivery.",
              "effects": {
                "outcome": "reject"
              }
            }
          },
          {
            "id": "non_delivery_contested",
            "when": {
              "fact": "dispute.reason",
              "op": "eq",
              "value": "not_delivered"
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_DELIVERY_CONTESTED",
              "human_readable": "An eSIM payload was delivered (see order_status.delivery) but not yet activated. Escalated for human review; the payload remains usable meanwhile.",
              "effects": {
                "outcome": "escalate"
              }
            }
          },
          {
            "id": "not_working_unused",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "not_working"
                },
                {
                  "fact": "esim.activated",
                  "op": "eq",
                  "value": false
                },
                {
                  "fact": "order.days_since_purchase",
                  "op": "lte",
                  "value": {
                    "fact": "params.not_working_window_days"
                  }
                }
              ]
            },
            "decision": {
              "allowed": true,
              "reason_code": "DISPUTE_NOT_WORKING_UNUSED",
              "human_readable": "The eSIM could not be installed and was never activated. Full refund.",
              "effects": {
                "outcome": "refund_full",
                "refund_percent": 100
              }
            }
          },
          {
            "id": "not_working_low_usage",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "not_working"
                },
                {
                  "fact": "esim.activated",
                  "op": "eq",
                  "value": true
                },
                {
                  "fact": "esim.data_used_percent",
                  "op": "lt",
                  "value": {
                    "fact": "params.low_usage_percent"
                  }
                },
                {
                  "fact": "order.days_since_purchase",
                  "op": "lte",
                  "value": {
                    "fact": "params.not_working_window_days"
                  }
                }
              ]
            },
            "decision": {
              "allowed": true,
              "reason_code": "DISPUTE_NOT_WORKING_LOW_USAGE",
              "human_readable": "The eSIM activated but used under {{params.low_usage_percent}}% of its data ({{esim.data_used_percent}}%), consistent with a service problem. Partial refund of {{params.low_usage_refund_percent}}%.",
              "effects": {
                "outcome": "refund_partial",
                "refund_percent": {
                  "fact": "params.low_usage_refund_percent"
                }
              }
            }
          },
          {
            "id": "not_working_used",
            "when": {
              "fact": "dispute.reason",
              "op": "eq",
              "value": "not_working"
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_NOT_WORKING_ESCALATED",
              "human_readable": "The eSIM shows substantial usage ({{esim.data_used_percent}}%) or the report is outside the {{params.not_working_window_days}} day window. Escalated for human review with the supplier's network logs.",
              "effects": {
                "outcome": "escalate"
              }
            }
          },
          {
            "id": "duplicate_confirmed",
            "when": {
              "all": [
                {
                  "fact": "dispute.reason",
                  "op": "eq",
                  "value": "duplicate_purchase"
                },
                {
                  "fact": "agent.same_product_orders_24h",
                  "op": "gte",
                  "value": 1
                },
                {
                  "fact": "esim.activated",
                  "op": "eq",
                  "value": false
                }
              ]
            },
            "decision": {
              "allowed": true,
              "reason_code": "DISPUTE_DUPLICATE",
              "human_readable": "Another order for the same plan was placed by this agent within 24 hours and this one was never activated. Full refund.",
              "effects": {
                "outcome": "refund_full",
                "refund_percent": 100
              }
            }
          },
          {
            "id": "duplicate_not_found",
            "when": {
              "fact": "dispute.reason",
              "op": "eq",
              "value": "duplicate_purchase"
            },
            "decision": {
              "allowed": false,
              "reason_code": "DISPUTE_DUPLICATE_NOT_CONFIRMED",
              "human_readable": "No matching unactivated duplicate order within 24 hours was found.",
              "effects": {
                "outcome": "reject"
              }
            }
          }
        ],
        "default": {
          "allowed": false,
          "reason_code": "DISPUTE_MANUAL_REVIEW",
          "human_readable": "The dispute does not match an automatic outcome and is queued for human review.",
          "effects": {
            "outcome": "escalate"
          }
        }
      }
    },
    {
      "policy_id": "mandate",
      "version": "2026-11-01.1",
      "title": "Spending mandate enforcement",
      "file": "policies/mandate.json",
      "sha256": "656dec19591c33f601d2e6459cbe495886b6e29c49e5f10b22b9358f58b6f024",
      "document": {
        "policy_id": "mandate",
        "version": "2026-11-01.1",
        "title": "Spending mandate enforcement",
        "description": "Checked on every purchase. The agent may spend only within the mandate its principal granted at registration. Spend is counted net of refunds, per UTC day and per UTC calendar month, across all of the agent's orders that are not failed.",
        "facts": {
          "mandate.signature_valid": "boolean: the stored mandate signature verifies",
          "now_ms": "number: current time, epoch ms",
          "mandate.expiry_ms": "number: mandate expiry, epoch ms",
          "agent.trust_score": "number 0..1",
          "tx.currency": "ISO 4217 of the order",
          "mandate.currency": "ISO 4217 the limits are expressed in",
          "tx.category": "product category",
          "mandate.allowed_categories": "array of categories",
          "tx.amount_minor": "order total, minor units",
          "mandate.max_per_tx": "minor units",
          "spend.day_after_minor": "today's net spend including this order, minor units",
          "mandate.max_per_day": "minor units",
          "spend.month_after_minor": "this month's net spend including this order, minor units",
          "mandate.max_per_month": "minor units"
        },
        "params": {
          "min_agent_trust_score": 0.2
        },
        "rules": [
          {
            "id": "signature_invalid",
            "when": {
              "fact": "mandate.signature_valid",
              "op": "eq",
              "value": false
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_SIGNATURE_INVALID",
              "human_readable": "The mandate on file does not verify against its signature. Register a new mandate."
            }
          },
          {
            "id": "mandate_expired",
            "when": {
              "fact": "now_ms",
              "op": "gte",
              "value": {
                "fact": "mandate.expiry_ms"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_EXPIRED",
              "human_readable": "The mandate expired at {{mandate.expiry}}. Ask the principal for a renewed mandate."
            }
          },
          {
            "id": "agent_trust_too_low",
            "when": {
              "fact": "agent.trust_score",
              "op": "lt",
              "value": {
                "fact": "params.min_agent_trust_score"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "AGENT_TRUST_TOO_LOW",
              "human_readable": "Agent trust score {{agent.trust_score}} is below the store minimum of {{params.min_agent_trust_score}}."
            }
          },
          {
            "id": "currency_mismatch",
            "when": {
              "fact": "tx.currency",
              "op": "neq",
              "value": {
                "fact": "mandate.currency"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_CURRENCY_MISMATCH",
              "human_readable": "The order is priced in {{tx.currency}} but the mandate limits are in {{mandate.currency}}."
            }
          },
          {
            "id": "category_not_allowed",
            "when": {
              "fact": "mandate.allowed_categories",
              "op": "not_contains",
              "value": {
                "fact": "tx.category"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_CATEGORY_NOT_ALLOWED",
              "human_readable": "The mandate allows only {{mandate.allowed_categories}}; this product is {{tx.category}}."
            }
          },
          {
            "id": "over_per_tx",
            "when": {
              "fact": "tx.amount_minor",
              "op": "gt",
              "value": {
                "fact": "mandate.max_per_tx"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_PER_TX_EXCEEDED",
              "human_readable": "This order ({{tx.amount_display}}) exceeds the per-transaction limit of {{mandate.max_per_tx_display}}."
            }
          },
          {
            "id": "over_daily",
            "when": {
              "fact": "spend.day_after_minor",
              "op": "gt",
              "value": {
                "fact": "mandate.max_per_day"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_DAILY_EXCEEDED",
              "human_readable": "This order would bring today's spend to {{spend.day_after_display}}, above the daily limit of {{mandate.max_per_day_display}}."
            }
          },
          {
            "id": "over_monthly",
            "when": {
              "fact": "spend.month_after_minor",
              "op": "gt",
              "value": {
                "fact": "mandate.max_per_month"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_MONTHLY_EXCEEDED",
              "human_readable": "This order would bring this month's spend to {{spend.month_after_display}}, above the monthly limit of {{mandate.max_per_month_display}}."
            }
          }
        ],
        "default": {
          "allowed": true,
          "reason_code": "MANDATE_OK",
          "human_readable": "Within mandate: {{tx.amount_display}} of {{mandate.max_per_tx_display}} per transaction; {{spend.day_after_display}} of {{mandate.max_per_day_display}} today; {{spend.month_after_display}} of {{mandate.max_per_month_display}} this month."
        }
      }
    },
    {
      "policy_id": "refund",
      "version": "2026-11-01.2",
      "title": "Voluntary refunds",
      "file": "policies/refund.json",
      "sha256": "4dc9a47d2db43f354276d2876b3fee5784790058888496565099dd242c2e33ce",
      "document": {
        "policy_id": "refund",
        "version": "2026-11-01.2",
        "title": "Voluntary refunds",
        "description": "Applies when an agent asks for a refund because the plan is no longer needed (reason \"unused\" or \"changed_plans\"). Each product carries a machine-readable refund_rule; this policy interprets it. Refunds credit the principal's wallet. Problems with the product itself (non-delivery, not working, duplicate) go through the dispute policy instead.",
        "facts": {
          "order.status": "store order status",
          "order.refund_rule_type": "product refund_rule.type",
          "order.refund_window_days": "product refund_rule.days (0 when the rule has no window)",
          "order.days_since_purchase": "number, fractional days",
          "esim.activated": "boolean, from the supplier"
        },
        "rules": [
          {
            "id": "already_refunded",
            "when": {
              "fact": "order.status",
              "op": "in",
              "value": [
                "refunded",
                "partially_refunded"
              ]
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_ALREADY_REFUNDED",
              "human_readable": "This order has already been refunded."
            }
          },
          {
            "id": "order_failed",
            "when": {
              "fact": "order.status",
              "op": "eq",
              "value": "failed"
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_NOT_NEEDED_ORDER_FAILED",
              "human_readable": "The order failed and was never charged; the wallet hold was released automatically."
            }
          },
          {
            "id": "order_not_fulfilled",
            "when": {
              "fact": "order.status",
              "op": "neq",
              "value": "fulfilled"
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_ORDER_NOT_FULFILLED",
              "human_readable": "The order is {{order.status}}. Wait for fulfilment, or open a dispute with reason \"not_delivered\"."
            }
          },
          {
            "id": "non_refundable_product",
            "when": {
              "fact": "order.refund_rule_type",
              "op": "eq",
              "value": "none"
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_NOT_REFUNDABLE",
              "human_readable": "This plan was sold as non-refundable (refund_rule: none). Only disputes about delivery or service are considered."
            }
          },
          {
            "id": "esim_activated",
            "when": {
              "fact": "esim.activated",
              "op": "eq",
              "value": true
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_ESIM_ACTIVATED",
              "human_readable": "The eSIM was already installed and activated on a device, so it can no longer be refunded as unused."
            }
          },
          {
            "id": "window_expired",
            "when": {
              "fact": "order.days_since_purchase",
              "op": "gt",
              "value": {
                "fact": "order.refund_window_days"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "REFUND_WINDOW_EXPIRED",
              "human_readable": "The refund window of {{order.refund_window_days}} days has passed ({{order.days_since_purchase_display}} days since purchase)."
            }
          },
          {
            "id": "unactivated_within_window",
            "when": {
              "fact": "order.refund_rule_type",
              "op": "eq",
              "value": "unactivated_within_days"
            },
            "decision": {
              "allowed": true,
              "reason_code": "REFUND_UNACTIVATED_WITHIN_WINDOW",
              "human_readable": "Full refund: the eSIM was never activated and the request is within {{order.refund_window_days}} days of purchase.",
              "effects": {
                "outcome": "refund_full",
                "refund_percent": 100
              }
            }
          }
        ],
        "default": {
          "allowed": false,
          "reason_code": "REFUND_RULE_UNSUPPORTED",
          "human_readable": "The product's refund rule ({{order.refund_rule_type}}) is not covered by this policy version."
        }
      }
    },
    {
      "policy_id": "registration",
      "version": "2026-11-01.1",
      "title": "Agent registration and mandate caps",
      "file": "policies/registration.json",
      "sha256": "b6551b9652ebacc164117b00a8a0c4dc95393a5457c788bd29c08bb06c0b72e1",
      "document": {
        "policy_id": "registration",
        "version": "2026-11-01.1",
        "title": "Agent registration and mandate caps",
        "description": "Evaluated when an agent registers. New agents get capped mandates until they build history; caps rise with trust in a later stage. The principal is the party whose payment method is charged.",
        "facts": {
          "agent.exists": "boolean: agent_id already registered",
          "principal.agent_count": "number of agents already registered for this principal",
          "request.currency": "ISO 4217",
          "request.max_per_tx": "minor units",
          "request.max_per_day": "minor units",
          "request.max_per_month": "minor units",
          "request.expiry_days": "number: days from now until the requested expiry"
        },
        "params": {
          "supported_currencies": [
            "USD"
          ],
          "max_mandate_days": 365,
          "new_agent_max_per_tx": 25000,
          "new_agent_max_per_month": 100000,
          "max_agents_per_principal": 10,
          "initial_trust_score": 0.5
        },
        "rules": [
          {
            "id": "agent_exists",
            "when": {
              "fact": "agent.exists",
              "op": "eq",
              "value": true
            },
            "decision": {
              "allowed": false,
              "reason_code": "AGENT_ALREADY_REGISTERED",
              "human_readable": "This agent_id is already registered."
            }
          },
          {
            "id": "too_many_agents",
            "when": {
              "fact": "principal.agent_count",
              "op": "gte",
              "value": {
                "fact": "params.max_agents_per_principal"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "PRINCIPAL_AGENT_LIMIT",
              "human_readable": "This principal already has {{principal.agent_count}} agents (maximum {{params.max_agents_per_principal}})."
            }
          },
          {
            "id": "unsupported_currency",
            "when": {
              "fact": "request.currency",
              "op": "not_in",
              "value": {
                "fact": "params.supported_currencies"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_CURRENCY_UNSUPPORTED",
              "human_readable": "Mandate currency {{request.currency}} is not supported. Supported: {{params.supported_currencies}}."
            }
          },
          {
            "id": "expiry_in_past",
            "when": {
              "fact": "request.expiry_days",
              "op": "lte",
              "value": 0
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_ALREADY_EXPIRED",
              "human_readable": "The requested mandate expiry is in the past."
            }
          },
          {
            "id": "expiry_too_far",
            "when": {
              "fact": "request.expiry_days",
              "op": "gt",
              "value": {
                "fact": "params.max_mandate_days"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_TOO_LONG",
              "human_readable": "Mandates may last at most {{params.max_mandate_days}} days."
            }
          },
          {
            "id": "tx_above_day",
            "when": {
              "fact": "request.max_per_tx",
              "op": "gt",
              "value": {
                "fact": "request.max_per_day"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_LIMITS_INCONSISTENT",
              "human_readable": "max_per_tx cannot exceed max_per_day."
            }
          },
          {
            "id": "day_above_month",
            "when": {
              "fact": "request.max_per_day",
              "op": "gt",
              "value": {
                "fact": "request.max_per_month"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_LIMITS_INCONSISTENT",
              "human_readable": "max_per_day cannot exceed max_per_month."
            }
          },
          {
            "id": "above_new_agent_tx_cap",
            "when": {
              "fact": "request.max_per_tx",
              "op": "gt",
              "value": {
                "fact": "params.new_agent_max_per_tx"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_EXCEEDS_NEW_AGENT_CAP",
              "human_readable": "New agents may hold a per-transaction limit of at most {{params.new_agent_max_per_tx}} minor units."
            }
          },
          {
            "id": "above_new_agent_month_cap",
            "when": {
              "fact": "request.max_per_month",
              "op": "gt",
              "value": {
                "fact": "params.new_agent_max_per_month"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "MANDATE_EXCEEDS_NEW_AGENT_CAP",
              "human_readable": "New agents may hold a monthly limit of at most {{params.new_agent_max_per_month}} minor units."
            }
          }
        ],
        "default": {
          "allowed": true,
          "reason_code": "AGENT_REGISTERED",
          "human_readable": "Agent registered with a signed mandate.",
          "effects": {
            "initial_trust_score": {
              "fact": "params.initial_trust_score"
            }
          }
        }
      }
    },
    {
      "policy_id": "supplier_trust",
      "version": "2026-11-02.1",
      "title": "Supplier trust threshold",
      "file": "policies/supplier-trust.json",
      "sha256": "55b831727109e78ac8efb726fa4f2f8757a719320cd59c32df612d37155a5bc9",
      "document": {
        "policy_id": "supplier_trust",
        "version": "2026-11-02.1",
        "title": "Supplier trust threshold",
        "description": "airhub starts at 0.75 (first real wholesaler, unproven delivery record; refund terms unconfirmed). Evaluated for every supplier before search results are returned and again at purchase time. Products from suppliers below the threshold, or suspended, are not offered. Scores are maintained by store operations from delivery success rate, refund honoring and dispute outcomes.",
        "facts": {
          "supplier.id": "supplier id",
          "supplier.trust_score": "number 0..1 (params.supplier_scores, else params.default_score)"
        },
        "params": {
          "min_trust_score": 0.7,
          "default_score": 0.5,
          "supplier_scores": {
            "mock-esim": 0.92,
            "mock-esim-budget": 0.41,
            "airhub": 0.75
          },
          "suspended_suppliers": []
        },
        "rules": [
          {
            "id": "suspended",
            "when": {
              "fact": "supplier.id",
              "op": "in",
              "value": {
                "fact": "params.suspended_suppliers"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "SUPPLIER_SUSPENDED",
              "human_readable": "Supplier {{supplier.id}} is suspended."
            }
          },
          {
            "id": "below_threshold",
            "when": {
              "fact": "supplier.trust_score",
              "op": "lt",
              "value": {
                "fact": "params.min_trust_score"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "SUPPLIER_BELOW_TRUST_THRESHOLD",
              "human_readable": "Supplier {{supplier.id}} has trust score {{supplier.trust_score}}, below the minimum of {{params.min_trust_score}}; its products are excluded."
            }
          }
        ],
        "default": {
          "allowed": true,
          "reason_code": "SUPPLIER_TRUSTED",
          "human_readable": "Supplier {{supplier.id}} meets the trust threshold ({{supplier.trust_score}} >= {{params.min_trust_score}})."
        }
      }
    },
    {
      "policy_id": "topup",
      "version": "2026-11-01.1",
      "title": "Wallet top-up links",
      "file": "policies/topup.json",
      "sha256": "f5c6b6c65aae1569843b30b676eec280c86e7073c012719d8c495dbf4992174c",
      "document": {
        "policy_id": "topup",
        "version": "2026-11-01.1",
        "title": "Wallet top-up links",
        "description": "Evaluated when an agent asks for a top-up link (get_topup_link). The principal pays on the acquirer's hosted page in ILS; the wallet is credited in USD at the rate in force when the payment is confirmed. Bounds keep prepaid balances small and limit abandoned payment pages.",
        "facts": {
          "request.currency": "currency the agent asked in: USD (wallet credit) or ILS (charge)",
          "request.amount_minor": "requested amount, minor units of request.currency",
          "request.usd_minor": "USD equivalent of the request at the current rate, minor units",
          "principal.open_topups": "pending, unexpired top-up links for this principal",
          "principal.balance_after_usd_minor": "wallet balance in USD if this top-up is credited, minor units"
        },
        "params": {
          "supported_currencies": [
            "USD",
            "ILS"
          ],
          "min_topup_usd_minor": 500,
          "max_topup_usd_minor": 50000,
          "max_open_topups": 5,
          "max_wallet_balance_usd_minor": 100000
        },
        "rules": [
          {
            "id": "unsupported_currency",
            "when": {
              "fact": "request.currency",
              "op": "not_in",
              "value": {
                "fact": "params.supported_currencies"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "TOPUP_CURRENCY_UNSUPPORTED",
              "human_readable": "Top-ups can be requested in {{params.supported_currencies}}, not {{request.currency}}."
            }
          },
          {
            "id": "below_minimum",
            "when": {
              "fact": "request.usd_minor",
              "op": "lt",
              "value": {
                "fact": "params.min_topup_usd_minor"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "TOPUP_BELOW_MINIMUM",
              "human_readable": "The smallest top-up is {{limits.min_display}}; this request is worth {{request.usd_display}}."
            }
          },
          {
            "id": "above_maximum",
            "when": {
              "fact": "request.usd_minor",
              "op": "gt",
              "value": {
                "fact": "params.max_topup_usd_minor"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "TOPUP_ABOVE_MAXIMUM",
              "human_readable": "The largest single top-up is {{limits.max_display}}; this request is worth {{request.usd_display}}."
            }
          },
          {
            "id": "too_many_open_links",
            "when": {
              "fact": "principal.open_topups",
              "op": "gte",
              "value": {
                "fact": "params.max_open_topups"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "TOPUP_TOO_MANY_OPEN_LINKS",
              "human_readable": "This principal already has {{principal.open_topups}} unpaid top-up links. Use one of them (see get_wallet) or wait for them to expire."
            }
          },
          {
            "id": "balance_cap",
            "when": {
              "fact": "principal.balance_after_usd_minor",
              "op": "gt",
              "value": {
                "fact": "params.max_wallet_balance_usd_minor"
              }
            },
            "decision": {
              "allowed": false,
              "reason_code": "TOPUP_BALANCE_CAP",
              "human_readable": "This top-up would bring the wallet to {{principal.balance_after_usd_display}}, above the {{limits.max_balance_display}} cap on prepaid balances."
            }
          }
        ],
        "default": {
          "allowed": true,
          "reason_code": "TOPUP_LINK_ALLOWED",
          "human_readable": "Top-up of {{request.usd_display}} allowed."
        }
      }
    },
    {
      "policy_id": "wallet",
      "version": "2026-11-01.2",
      "title": "Principal wallet balance",
      "file": "policies/wallet.json",
      "sha256": "5c6721870eed5d7c32f072d491bda22c306dc5a020443fedee37956caf9ce24e",
      "document": {
        "policy_id": "wallet",
        "version": "2026-11-01.2",
        "title": "Principal wallet balance",
        "description": "Checked on every purchase after the mandate policy allows it. Purchases are paid from the principal's prepaid wallet (shared by all of the principal's agents); the order total must be covered by the available balance (balance minus funds held for in-flight purchases). Mandate limits still apply on top of the wallet. When the balance is short, the decision tells the agent how its principal can top up.",
        "facts": {
          "wallet_balance_sufficient": "boolean: available balance >= order total, same currency",
          "wallet.currency": "ISO 4217 of the wallet balance checked (the order currency)",
          "wallet.available_minor": "balance minus active holds, minor units",
          "wallet.required_minor": "order total, minor units",
          "wallet.shortfall_minor": "required minus available when short, else 0",
          "wallet.suggested_topup_minor": "max(shortfall, the top-up policy minimum), minor units in wallet.currency",
          "wallet.topup_url": "optional: hosted payment URL already created for this shortfall (purchase only, not the quote pre-check)",
          "wallet.topup_id": "optional: id of that top-up",
          "wallet.topup_charge_display": "optional: what the hosted page charges, e.g. \"185.00 ILS\""
        },
        "rules": [
          {
            "id": "insufficient_with_link",
            "when": {
              "all": [
                {
                  "fact": "wallet_balance_sufficient",
                  "op": "eq",
                  "value": false
                },
                {
                  "fact": "wallet.topup_url",
                  "op": "exists"
                }
              ]
            },
            "decision": {
              "allowed": false,
              "reason_code": "WALLET_INSUFFICIENT_FUNDS",
              "human_readable": "The principal's wallet has {{wallet.available_display}} available; this order needs {{wallet.required_display}} ({{wallet.shortfall_display}} short). Give your principal this top-up link: {{wallet.topup_url}} (charges {{wallet.topup_charge_display}} and credits about {{wallet.suggested_topup_display}}). Poll get_wallet until the balance arrives, then purchase again (with a new quote if this one has expired). For a different amount call get_topup_link.",
              "effects": {
                "topup_url": {
                  "fact": "wallet.topup_url"
                },
                "topup_id": {
                  "fact": "wallet.topup_id"
                },
                "shortfall_minor": {
                  "fact": "wallet.shortfall_minor"
                },
                "suggested_topup_minor": {
                  "fact": "wallet.suggested_topup_minor"
                }
              }
            }
          },
          {
            "id": "insufficient",
            "when": {
              "fact": "wallet_balance_sufficient",
              "op": "eq",
              "value": false
            },
            "decision": {
              "allowed": false,
              "reason_code": "WALLET_INSUFFICIENT_FUNDS",
              "human_readable": "The principal's wallet has {{wallet.available_display}} available; this order needs {{wallet.required_display}} ({{wallet.shortfall_display}} short). Call get_topup_link with amount_minor {{wallet.suggested_topup_minor}} and currency {{wallet.currency}}, give the returned URL to your principal, and purchase once get_wallet shows the funds.",
              "effects": {
                "shortfall_minor": {
                  "fact": "wallet.shortfall_minor"
                },
                "suggested_topup_minor": {
                  "fact": "wallet.suggested_topup_minor"
                }
              }
            }
          }
        ],
        "default": {
          "allowed": true,
          "reason_code": "WALLET_FUNDS_AVAILABLE",
          "human_readable": "The wallet covers this order: {{wallet.required_display}} of {{wallet.available_display}} available."
        }
      }
    }
  ],
  "evaluation": "Rules are evaluated top to bottom; the first rule whose condition matches decides. If none match, `default` applies. A rule that references a missing fact denies (fail closed).",
  "schemas": {
    "product.schema.json": {
      "$id": "https://quartermasterhq.ai/schema/product.schema.json",
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$ref": "#/$defs/Product",
      "$defs": {
        "Product": {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "pattern": "^[a-z0-9][a-z0-9_-]{2,79}$",
              "description": "Store-wide product id"
            },
            "supplier_id": {
              "type": "string",
              "minLength": 1
            },
            "category": {
              "type": "string",
              "enum": [
                "esim"
              ],
              "description": "Product category"
            },
            "title": {
              "type": "string",
              "minLength": 3,
              "maxLength": 120
            },
            "countries": {
              "minItems": 1,
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[A-Z]{2}$",
                "description": "ISO 3166-1 alpha-2 country code"
              },
              "description": "Every country where the plan works"
            },
            "regions": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "EUROPE",
                  "ASIA",
                  "MIDDLE_EAST",
                  "NORTH_AMERICA",
                  "LATIN_AMERICA",
                  "OCEANIA",
                  "AFRICA",
                  "GLOBAL"
                ],
                "description": "Commercial coverage region"
              },
              "description": "Regions the plan is marketed under; empty for single-country plans"
            },
            "data_gb": {
              "anyOf": [
                {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                {
                  "type": "string",
                  "const": "unlimited"
                }
              ]
            },
            "validity_days": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "price_final": {
              "type": "object",
              "properties": {
                "amount_minor": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Amount in minor units (e.g. cents)"
                },
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$",
                  "description": "ISO 4217 currency code"
                },
                "tax_included": {
                  "type": "boolean",
                  "const": true,
                  "description": "Always true: the price is final, taxes included"
                }
              },
              "required": [
                "amount_minor",
                "currency",
                "tax_included"
              ],
              "additionalProperties": false,
              "description": "Final price in minor units, taxes included"
            },
            "availability": {
              "type": "string",
              "enum": [
                "live",
                "out_of_stock"
              ]
            },
            "delivery": {
              "type": "object",
              "properties": {
                "method": {
                  "type": "string",
                  "enum": [
                    "qr",
                    "activation_link"
                  ],
                  "description": "How the eSIM profile is handed over"
                },
                "eta_seconds": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Expected seconds from payment to delivery"
                }
              },
              "required": [
                "method",
                "eta_seconds"
              ],
              "additionalProperties": false
            },
            "refund_rule": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "unactivated_within_days"
                    },
                    "days": {
                      "type": "integer",
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "type",
                    "days"
                  ],
                  "additionalProperties": false,
                  "description": "Full refund if the eSIM was never activated and the request is within `days` of purchase"
                },
                {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "const": "none"
                    }
                  },
                  "required": [
                    "type"
                  ],
                  "additionalProperties": false,
                  "description": "Not refundable except through a dispute (non-delivery, supplier failure)"
                }
              ],
              "description": "Machine-readable refund rule"
            },
            "supported_devices": {
              "type": "string",
              "minLength": 3,
              "maxLength": 300,
              "description": "Human-readable device compatibility note"
            },
            "constraints": {
              "type": "object",
              "properties": {
                "requires_unlocked_device": {
                  "type": "boolean"
                },
                "hotspot_allowed": {
                  "type": "boolean"
                },
                "top_up_available": {
                  "type": "boolean"
                },
                "kyc_required": {
                  "type": "boolean",
                  "description": "Traveler identity verification required by the destination network"
                },
                "phone_number_included": {
                  "type": "boolean"
                },
                "network_types": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "3G",
                      "4G",
                      "5G"
                    ]
                  }
                },
                "activation_window_days": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991,
                  "description": "The plan must be activated within this many days of purchase or it expires"
                },
                "speed_after_cap_kbps": {
                  "description": "Throttled speed once the fair-use cap is reached (unlimited plans)",
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "notes": {
                  "type": "string",
                  "maxLength": 500
                }
              },
              "required": [
                "requires_unlocked_device",
                "hotspot_allowed",
                "top_up_available",
                "kyc_required",
                "phone_number_included",
                "network_types",
                "activation_window_days"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "id",
            "supplier_id",
            "category",
            "title",
            "countries",
            "regions",
            "data_gb",
            "validity_days",
            "price_final",
            "availability",
            "delivery",
            "refund_rule",
            "supported_devices",
            "constraints"
          ],
          "additionalProperties": false,
          "title": "Normalized product"
        }
      }
    },
    "agent.schema.json": {
      "$id": "https://quartermasterhq.ai/schema/agent.schema.json",
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "$ref": "#/$defs/Agent",
      "$defs": {
        "Agent": {
          "type": "object",
          "properties": {
            "agent_id": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:-]{3,128}$"
            },
            "principal_id": {
              "type": "string",
              "pattern": "^[A-Za-z0-9._:@-]{3,128}$"
            },
            "mandate": {
              "type": "object",
              "properties": {
                "currency": {
                  "type": "string",
                  "pattern": "^[A-Z]{3}$",
                  "description": "Currency the limits are expressed in"
                },
                "max_per_tx": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Max single transaction, minor units"
                },
                "max_per_day": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Max net spend per UTC day, minor units"
                },
                "max_per_month": {
                  "type": "integer",
                  "exclusiveMinimum": 0,
                  "maximum": 9007199254740991,
                  "description": "Max net spend per UTC calendar month, minor units"
                },
                "allowed_categories": {
                  "minItems": 1,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "esim"
                    ],
                    "description": "Product category"
                  }
                },
                "expiry": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
                  "description": "ISO 8601 instant after which the mandate is void"
                },
                "signature": {
                  "type": "object",
                  "properties": {
                    "alg": {
                      "type": "string",
                      "const": "HS256",
                      "description": "Placeholder; Ed25519 or ES256 once principals sign"
                    },
                    "key_id": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string",
                      "description": "base64url signature over the canonical JSON of the other mandate fields + agent_id + principal_id"
                    }
                  },
                  "required": [
                    "alg",
                    "key_id",
                    "value"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "currency",
                "max_per_tx",
                "max_per_day",
                "max_per_month",
                "allowed_categories",
                "expiry",
                "signature"
              ],
              "additionalProperties": false
            },
            "trust_score": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "description": "0 to 1; starts at the registration policy's initial value"
            },
            "created_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
            }
          },
          "required": [
            "agent_id",
            "principal_id",
            "mandate",
            "trust_score",
            "created_at"
          ],
          "additionalProperties": false,
          "title": "Agent identity"
        }
      }
    }
  }
}