1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Hanzo Cloud API
*
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
*
* The version of the OpenAPI document: v1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Receipt {
/// Amount is what actually moved, as an exact 18-decimal-place USD string. It is NOT the atomic-unit figure the client signed: the challenge quotes the asset's own units (USDC's 6 dp) and truncates to fit them, while the ledger moves this exact value.
#[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
pub amount: Option<String>,
/// From is the payer's EVM address: the account that signed the EIP-3009 authorization, recovered from the signature rather than taken on trust.
#[serde(rename = "from", skip_serializing_if = "Option::is_none")]
pub from: Option<String>,
/// ID is the settle-once key: \"x402_\" + keccak(from|nonce) in hex. It is DERIVED, not minted, so a client that re-submits the same authorization addresses the same settlement and is served again for free rather than charged twice. It is also the id GET /v1/x402/settlements/:id takes.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Network is the CAIP-2 identifier the payment was settled under, e.g. \"eip155:36963\". Its eip155 reference is the chain id in the EIP-712 domain the payer signed, so it is not a label — changing it invalidates the signature.
#[serde(rename = "network", skip_serializing_if = "Option::is_none")]
pub network: Option<String>,
/// Nonce is the client-chosen nonce from the authorization, hex — up to 32 bytes, left-padded to the contract's bytes32. It is the replay anchor: the token contract refuses a second on-chain transfer for one (from, nonce), and this rail refuses a second settlement for the same pair, so a ledger settlement inherits the identical guarantee.
#[serde(rename = "nonce", skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>,
/// Payee is the recipient's EVM address — the `payTo` the challenge advertised and the authorization named. A payment to any other address never settles.
#[serde(rename = "payee", skip_serializing_if = "Option::is_none")]
pub payee: Option<String>,
/// PayeeOrg is the tenant that owns the recipient wallet, resolved at settlement. It is who got PAID, as Payer is who paid.
#[serde(rename = "payeeOrg", skip_serializing_if = "Option::is_none")]
pub payee_org: Option<String>,
/// Payer is the payer ORG — the tenant whose ledger was debited — and not an address. It is the org the request was authenticated as, so it answers who is billed, which the payer address alone cannot.
#[serde(rename = "payer", skip_serializing_if = "Option::is_none")]
pub payer: Option<String>,
/// Resource is what was paid for, in the same spelling the price table and the challenge used: the request path for a priced route, \"tool:<id>\" for a priced tool.
#[serde(rename = "resource", skip_serializing_if = "Option::is_none")]
pub resource: Option<String>,
/// SettledAt is when this settlement was CLAIMED, in unix seconds — the moment the authorization was accepted, which is also the moment the time window it carried stopped applying. A settlement finished later by reconciliation keeps this instant.
#[serde(rename = "settledAt", skip_serializing_if = "Option::is_none")]
pub settled_at: Option<i32>,
/// SettledVia is which rail moved the money: \"ledger\", the live default, or \"chain\" when the authorization is broadcast. Those two values and no others.
#[serde(rename = "settledVia", skip_serializing_if = "Option::is_none")]
pub settled_via: Option<String>,
/// TxHash is the chain transaction hash, present only for a \"chain\" settlement. Empty on a ledger settlement — that is the normal case today, and it means the money moved without a chain, not that it failed. The wire's PAYMENT-RESPONSE `transaction` falls back to ID when this is empty.
#[serde(rename = "txHash", skip_serializing_if = "Option::is_none")]
pub tx_hash: Option<String>,
}
impl Receipt {
pub fn new() -> Receipt {
Receipt {
amount: None,
from: None,
id: None,
network: None,
nonce: None,
payee: None,
payee_org: None,
payer: None,
resource: None,
settled_at: None,
settled_via: None,
tx_hash: None,
}
}
}