#[non_exhaustive]pub enum SettleResponse {
Success {
payer: CompactString,
transaction: CompactString,
network: CompactString,
amount: Option<CompactString>,
extensions: Extensions,
},
Failure {
reason: ErrorReason,
message: Option<CompactString>,
payer: Option<CompactString>,
network: CompactString,
extensions: Extensions,
},
}Expand description
Settlement outcome returned by a facilitator.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Success
Settlement succeeded.
Fields
payer: CompactStringThe payer address on the target chain.
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.
Required when the upto scheme is in use; included for exact too
to give clients unambiguous receipts.
extensions: ExtensionsFacilitator-attached extension data.
Failure
Settlement failed.
Fields
reason: ErrorReasonWire-level reason code.
message: Option<CompactString>Optional human-readable message.
payer: Option<CompactString>Optional payer address if identifiable.
network: CompactStringCAIP-2 chain identifier on which settlement was attempted.
extensions: ExtensionsFacilitator-attached extension data.
Implementations§
Source§impl SettleResponse
impl SettleResponse
Sourcepub const fn is_success(&self) -> bool
pub const fn is_success(&self) -> bool
Returns true when the settlement succeeded.
Sourcepub fn encode_base64(&self) -> Option<Base64Bytes>
pub fn encode_base64(&self) -> Option<Base64Bytes>
Encodes a successful settlement as base64 bytes for the
Payment-Response HTTP header.
Returns None for Failure variants to avoid accidentally
transmitting a failed settlement as if it were successful. Call
Self::encode_base64_any when the failure body is needed on the
wire (for example, when a paygate must inform a browser client of a
failed settlement via the Payment-Response header).
Sourcepub fn encode_base64_any(&self) -> Option<Base64Bytes>
pub fn encode_base64_any(&self) -> Option<Base64Bytes>
Encodes any SettleResponse (success or failure) as base64 bytes
for the Payment-Response HTTP header.
Use this when surfacing failed settlements is required by the spec,
e.g. paygate error paths that still want to communicate the
machine-readable error reason and chain to a browser client.
Prefer Self::encode_base64 when you only want to forward
successful settlements.
Sourcepub fn from_facilitator_error(
error: &FacilitatorError,
network: impl Into<CompactString>,
) -> Self
pub fn from_facilitator_error( error: &FacilitatorError, network: impl Into<CompactString>, ) -> Self
Builds a Failure response from a FacilitatorError.
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 moreSource§impl Debug for SettleResponse
impl Debug for SettleResponse
Source§impl<'de> Deserialize<'de> for SettleResponse
impl<'de> Deserialize<'de> for SettleResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for SettleResponse
Source§impl PartialEq for SettleResponse
impl PartialEq for SettleResponse
Source§impl Serialize for SettleResponse
impl Serialize for SettleResponse
impl StructuralPartialEq for SettleResponse
Auto Trait Implementations§
impl Freeze for SettleResponse
impl RefUnwindSafe for SettleResponse
impl Send for SettleResponse
impl Sync for SettleResponse
impl Unpin for SettleResponse
impl UnsafeUnpin for SettleResponse
impl UnwindSafe for SettleResponse
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.