|
2 | 2 | "$id": "https://commandlayer.org/schemas/v1.0.0/commercial/verify/receipts/verify.receipt.schema.json", |
3 | 3 | "$schema": "https://json-schema.org/draft/2020-12/schema", |
4 | 4 | "title": "verify.receipt", |
5 | | - "description": "Receipt schema for commercial verification of a payment, invoice, or settlement against a provider’s canonical view.", |
| 5 | + "description": "Receipt for commercial verification; echoes provider’s canonical view.", |
6 | 6 | "allOf": [ |
7 | | - { |
8 | | - "$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/receipt.base.schema.json" |
9 | | - }, |
| 7 | + { "$ref": "https://commandlayer.org/schemas/v1.0.0/_shared/receipt.base.schema.json" }, |
10 | 8 | { |
11 | 9 | "type": "object", |
12 | 10 | "properties": { |
13 | 11 | "result": { |
14 | | - "description": "Verification outcome payload.", |
15 | 12 | "type": "object", |
16 | 13 | "additionalProperties": false, |
17 | | - "required": ["target", "verified", "status"], |
| 14 | + "required": ["target","verified","status"], |
18 | 15 | "properties": { |
19 | | - "target": { |
20 | | - "description": "The identifier that was verified (transaction ID, invoice ID, payout ID, etc.).", |
21 | | - "type": "string", |
22 | | - "minLength": 1, |
23 | | - "maxLength": 256 |
24 | | - }, |
25 | | - "verified": { |
26 | | - "description": "Whether the provider’s canonical record matches the caller’s expectations.", |
27 | | - "type": "boolean" |
28 | | - }, |
29 | | - "status": { |
30 | | - "description": "Provider’s canonical status for this object.", |
31 | | - "type": "string", |
32 | | - "enum": ["success", "pending", "failed", "not_found"] |
33 | | - }, |
34 | | - "amount": { |
35 | | - "description": "Canonical amount/asset as seen by the provider.", |
36 | | - "allOf": [ |
37 | | - { |
38 | | - "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.amount.schema.json" |
39 | | - } |
40 | | - ] |
41 | | - }, |
42 | | - "settlement": { |
43 | | - "description": "Canonical settlement destination as seen by the provider.", |
44 | | - "allOf": [ |
45 | | - { |
46 | | - "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.settlement.schema.json" |
47 | | - } |
48 | | - ] |
49 | | - }, |
50 | | - "reason": { |
51 | | - "description": "Optional explanation when verified = false or status != 'success'.", |
52 | | - "type": "string", |
53 | | - "maxLength": 1024 |
| 16 | + "target": { "type": "string", "minLength": 1, "maxLength": 256 }, |
| 17 | + "verified": { "type": "boolean" }, |
| 18 | + "status": { "type": "string", "enum": ["success","pending","failed","not_found"] }, |
| 19 | + "amount": { "allOf": [{ "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.amount.schema.json" }] }, |
| 20 | + "settlement": { "allOf": [{ "$ref": "https://commandlayer.org/schemas/v1.0.0/commercial/_shared/payment.settlement.schema.json" }] }, |
| 21 | + "evidence": { |
| 22 | + "type": "object", |
| 23 | + "additionalProperties": false, |
| 24 | + "properties": { |
| 25 | + "tx_hash": { "type": "string", "pattern": "^0x[a-fA-F0-9]{64}$" }, |
| 26 | + "block_number": { "type": "integer", "minimum": 0 }, |
| 27 | + "log_index": { "type": "integer", "minimum": 0 }, |
| 28 | + "provider_ref": { "type": "string", "maxLength": 256 } |
| 29 | + } |
54 | 30 | }, |
| 31 | + "reason": { "type": "string", "maxLength": 1024 }, |
55 | 32 | "metadata": { |
56 | | - "description": "Optional provider- or runtime-specific additional context.", |
57 | 33 | "type": "object", |
58 | | - "additionalProperties": true |
| 34 | + "additionalProperties": true, |
| 35 | + "maxProperties": 100, |
| 36 | + "propertyNames": { "type": "string", "maxLength": 64 } |
59 | 37 | } |
60 | 38 | } |
61 | | - }, |
62 | | - "usage": { |
63 | | - "description": "Optional resource usage metrics (tokens, compute units, etc.).", |
64 | | - "type": "object", |
65 | | - "additionalProperties": true |
66 | 39 | } |
67 | 40 | }, |
68 | | - "required": ["result"] |
| 41 | + "required": ["result"], |
| 42 | + "allOf": [ |
| 43 | + { "if": { "properties": { "status": { "const": "success" } }, "required": ["status"] }, "then": { "required": ["result"] } }, |
| 44 | + { "if": { "properties": { "status": { "const": "error" } }, "required": ["status"] }, "then": { "required": ["error"], "properties": { "result": false } } }, |
| 45 | + { "if": { "properties": { "result": { "properties": { "status": { "const": "not_found" } } } } }, "then": { "properties": { "result": { "properties": { "verified": { "const": false } } } } } }, |
| 46 | + { "if": { "properties": { "result": { "properties": { "verified": { "const": false } } } } }, "then": { "properties": { "result": { "required": ["reason"] } } } } |
| 47 | + ] |
69 | 48 | } |
70 | 49 | ] |
71 | 50 | } |
0 commit comments