#[non_exhaustive]pub enum SettleResponse {
Success {
payer: Option<CompactString>,
transaction: CompactString,
network: CompactString,
amount: Option<CompactString>,
extensions: Extensions,
extension_responses: Extensions,
extra: Option<Value>,
},
Failure {
reason: ErrorReason,
message: Option<CompactString>,
payer: Option<CompactString>,
transaction: CompactString,
network: CompactString,
extensions: Extensions,
extension_responses: Extensions,
extra: Option<Value>,
},
}Expand description
Settlement 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
Success
Settlement succeeded.
Fields
payer: Option<CompactString>Payer address on the target chain, if the facilitator included it.
transaction: CompactStringOn-chain transaction hash / signature.
network: CompactStringCAIP-2 chain identifier the transaction landed on.
amount: Option<CompactString>Actual amount settled, in the token’s smallest unit.
extensions: ExtensionsFacilitator-attached extension data (JSON body).
extension_responses: ExtensionsFacilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.
Failure
Settlement failed.
Fields
reason: ErrorReasonWire-level reason code.
message: Option<CompactString>Optional human-readable message.
payer: Option<CompactString>Optional payer address if identifiable.
transaction: CompactStringBroadcast transaction hash. Empty when no transaction was submitted.
Spec §9: MUST be non-empty when reason is ErrorReason::SettlementPending.
network: CompactStringCAIP-2 chain identifier on which settlement was attempted.
extensions: ExtensionsFacilitator-attached extension data (JSON body).
extension_responses: ExtensionsFacilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.
Implementations§
Source§impl SettleResponse
impl SettleResponse
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Whether settlement succeeded.
Sourcepub const fn extension_responses(&self) -> &Extensions
pub const fn extension_responses(&self) -> &Extensions
Sidechannel map (empty when the header was absent).
Sourcepub const fn extensions_mut(&mut self) -> &mut Extensions
pub const fn extensions_mut(&mut self) -> &mut Extensions
Buyer-wire extensions map.
Sourcepub fn set_extension_responses(&mut self, responses: Extensions)
pub fn set_extension_responses(&mut self, responses: Extensions)
Replaces the sidechannel map.
Sourcepub fn encode_base64(&self) -> Option<Base64Bytes>
pub fn encode_base64(&self) -> Option<Base64Bytes>
Encodes a successful settlement as base64 for Payment-Response.
Returns None for Failure. Use Self::encode_base64_any when the
failure body must go on the wire.
Sourcepub fn encode_base64_any(&self) -> Option<Base64Bytes>
pub fn encode_base64_any(&self) -> Option<Base64Bytes>
Encodes any SettleResponse as base64 for Payment-Response.
Sourcepub fn from_facilitator_error(
error: &FacilitatorError,
network: impl Into<CompactString>,
transaction: impl Into<CompactString>,
) -> Option<Self>
pub fn from_facilitator_error( error: &FacilitatorError, network: impl Into<CompactString>, transaction: impl Into<CompactString>, ) -> Option<Self>
Builds a Failure response from a FacilitatorError.
The caller supplies transaction ("" when no broadcast hash is known).
Returns None for FacilitatorError::Transport: that is HTTP 502,
not a 402 body.
Sourcepub fn is_retryable_settlement_pending(&self) -> bool
pub fn is_retryable_settlement_pending(&self) -> bool
success: false, errorReason == settlement_pending, and a non-empty hash.
Trait Implementations§
Source§impl Clone for SettleResponse
impl Clone for SettleResponse
Source§fn clone(&self) -> SettleResponse
fn clone(&self) -> SettleResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more