r402_protocol/payment/price.rs
1//! Seller-side payment-requirements container.
2
3use super::PaymentRequirements;
4
5/// Seller-side wrapper around [`PaymentRequirements`].
6///
7/// Scheme-specific `extra` is filled during 402 construction, not on this type.
8#[derive(Debug, Clone)]
9pub struct PriceTag {
10 /// Requirements being advertised.
11 pub requirements: PaymentRequirements,
12}
13
14impl PriceTag {
15 /// Wraps existing requirements.
16 #[must_use]
17 pub const fn new(requirements: PaymentRequirements) -> Self {
18 Self { requirements }
19 }
20
21 /// Overrides `maxTimeoutSeconds`.
22 #[must_use]
23 pub const fn with_timeout(mut self, seconds: u64) -> Self {
24 self.requirements.max_timeout_seconds = seconds;
25 self
26 }
27}