Skip to main content

SettleResponse

Enum SettleResponse 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Success

Settlement succeeded.

Fields

§payer: Option<CompactString>

Payer address on the target chain, if the facilitator included it.

§transaction: CompactString

On-chain transaction hash / signature.

§network: CompactString

CAIP-2 chain identifier the transaction landed on.

§amount: Option<CompactString>

Actual amount settled, in the token’s smallest unit.

§extensions: Extensions

Facilitator-attached extension data (JSON body).

§extension_responses: Extensions

Facilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.

§extra: Option<Value>

Scheme-specific additional data.

§

Failure

Settlement failed.

Fields

§reason: ErrorReason

Wire-level reason code.

§message: Option<CompactString>

Optional human-readable message.

§payer: Option<CompactString>

Optional payer address if identifiable.

§transaction: CompactString

Broadcast transaction hash. Empty when no transaction was submitted. Spec §9: MUST be non-empty when reason is ErrorReason::SettlementPending.

§network: CompactString

CAIP-2 chain identifier on which settlement was attempted.

§extensions: Extensions

Facilitator-attached extension data (JSON body).

§extension_responses: Extensions

Facilitator EXTENSION-RESPONSES sidechannel. Not buyer wire.

§extra: Option<Value>

Scheme-specific additional data.

Implementations§

Source§

impl SettleResponse

Source

pub const fn is_success(&self) -> bool

Whether settlement succeeded.

Source

pub const fn extension_responses(&self) -> &Extensions

Sidechannel map (empty when the header was absent).

Source

pub const fn extensions_mut(&mut self) -> &mut Extensions

Buyer-wire extensions map.

Source

pub fn set_extension_responses(&mut self, responses: Extensions)

Replaces the sidechannel map.

Source

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.

Source

pub fn encode_base64_any(&self) -> Option<Base64Bytes>

Encodes any SettleResponse as base64 for Payment-Response.

Source

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.

Source

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

Source§

fn clone(&self) -> SettleResponse

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SettleResponse

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SettleResponse

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for SettleResponse

Source§

impl PartialEq for SettleResponse

Source§

fn eq(&self, other: &SettleResponse) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for SettleResponse

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for SettleResponse

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.