#[non_exhaustive]pub struct PaymentResponseContext {
pub payment_required: PaymentRequired,
pub signed_payload: String,
pub settle_response: Option<SettleResponse>,
pub corrective_payment_required: Option<PaymentRequired>,
}Expand description
Context delivered after a paid request completes.
Official semantics: exactly one of settle_response or
corrective_payment_required is typically set —
- settle: paid request succeeded with
Payment-Response - corrective 402: server rejected with a new
Payment-Required
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.payment_required: PaymentRequiredOriginal 402 challenge used to build the payment.
signed_payload: StringSigned payload that was submitted.
settle_response: Option<SettleResponse>Parsed settle outcome when present.
corrective_payment_required: Option<PaymentRequired>Corrective Payment-Required when the paid retry returned 402.
Implementations§
Source§impl PaymentResponseContext
impl PaymentResponseContext
Sourcepub fn new(
payment_required: PaymentRequired,
signed_payload: impl Into<String>,
) -> Self
pub fn new( payment_required: PaymentRequired, signed_payload: impl Into<String>, ) -> Self
Constructs a payment-response context.
Sourcepub fn with_settle_response(self, settle: SettleResponse) -> Self
pub fn with_settle_response(self, settle: SettleResponse) -> Self
Builder: attach a settle response.
Sourcepub fn with_corrective_payment_required(self, required: PaymentRequired) -> Self
pub fn with_corrective_payment_required(self, required: PaymentRequired) -> Self
Builder: attach a corrective payment-required challenge.
Trait Implementations§
Source§impl Clone for PaymentResponseContext
impl Clone for PaymentResponseContext
Source§fn clone(&self) -> PaymentResponseContext
fn clone(&self) -> PaymentResponseContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PaymentResponseContext
impl RefUnwindSafe for PaymentResponseContext
impl Send for PaymentResponseContext
impl Sync for PaymentResponseContext
impl Unpin for PaymentResponseContext
impl UnsafeUnpin for PaymentResponseContext
impl UnwindSafe for PaymentResponseContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more