#[non_exhaustive]pub enum VerifyResponse {
Valid {
payer: Option<CompactString>,
extensions: Extensions,
extension_responses: Extensions,
extra: Option<Value>,
},
Invalid {
reason: Option<ErrorReason>,
message: Option<CompactString>,
payer: Option<CompactString>,
extensions: Extensions,
extension_responses: Extensions,
extra: Option<Value>,
},
}Expand description
Verification outcome returned by a facilitator.
extension_responses is the EXTENSION-RESPONSES sidechannel. It is not
serialized into JSON and is never merged into extensions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Valid
Payload passed all verification checks.
Fields
payer: Option<CompactString>Address of the verified payer, if the facilitator included it.
extensions: ExtensionsFacilitator-attached extension data (JSON body).
extension_responses: ExtensionsFacilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.
Invalid
Payload was well-formed but failed verification.
Fields
reason: Option<ErrorReason>Wire-level reason code, if the facilitator included it.
message: Option<CompactString>Optional human-readable message.
payer: Option<CompactString>Optional payer address if identifiable from the payload.
extensions: ExtensionsFacilitator-attached extension data (JSON body).
extension_responses: ExtensionsFacilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.
Implementations§
Source§impl VerifyResponse
impl VerifyResponse
Sourcepub fn valid(payer: impl Into<CompactString>) -> Self
pub fn valid(payer: impl Into<CompactString>) -> Self
Valid response with empty extensions.
Sourcepub fn invalid(payer: Option<CompactString>, reason: ErrorReason) -> Self
pub fn invalid(payer: Option<CompactString>, reason: ErrorReason) -> Self
Invalid response without a human message.
Sourcepub fn invalid_with_message(
payer: Option<CompactString>,
reason: ErrorReason,
message: impl Into<CompactString>,
) -> Self
pub fn invalid_with_message( payer: Option<CompactString>, reason: ErrorReason, message: impl Into<CompactString>, ) -> Self
Invalid response with a message.
Sourcepub const fn extension_responses(&self) -> &Extensions
pub const fn extension_responses(&self) -> &Extensions
Sidechannel map (empty when the header was absent).
Sourcepub fn set_extension_responses(&mut self, responses: Extensions)
pub fn set_extension_responses(&mut self, responses: Extensions)
Replaces the sidechannel map.
Sourcepub fn from_facilitator_error(error: &FacilitatorError) -> Option<Self>
pub fn from_facilitator_error(error: &FacilitatorError) -> Option<Self>
Converts a FacilitatorError into an Invalid response.
Returns None for FacilitatorError::Transport: that is HTTP 502,
not a 402 body.
Trait Implementations§
Source§impl Clone for VerifyResponse
impl Clone for VerifyResponse
Source§fn clone(&self) -> VerifyResponse
fn clone(&self) -> VerifyResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more