pub struct Payment {
pub id: String,
pub payment_type: PaymentType,
pub status: PaymentStatus,
pub amount: u128,
pub fees: u128,
pub timestamp: u64,
pub method: PaymentMethod,
pub details: Option<PaymentDetails>,
pub conversion_details: Option<ConversionDetails>,
}Expand description
Represents a payment (sent or received)
Fields§
§id: StringUnique identifier for the payment
payment_type: PaymentTypeType of payment (send or receive)
status: PaymentStatusStatus of the payment
amount: u128Amount in satoshis or token base units
fees: u128Fee paid in satoshis or token base units
timestamp: u64Timestamp of when the payment was created
method: PaymentMethodMethod of payment. Sometimes the payment details is empty so this field is used to determine the payment method.
details: Option<PaymentDetails>Details of the payment
conversion_details: Option<ConversionDetails>If set, this payment involved a conversion before the payment
Implementations§
Source§impl Payment
impl Payment
Sourcepub fn from_lightning(
payment: LightningSendPayment,
amount_sat: u128,
transfer_id: String,
htlc_details: SparkHtlcDetails,
) -> Result<Self, SdkError>
pub fn from_lightning( payment: LightningSendPayment, amount_sat: u128, transfer_id: String, htlc_details: SparkHtlcDetails, ) -> Result<Self, SdkError>
Creates a Payment from a [LightningSendPayment] and its associated HTLC details.
The htlc_details may be stale (e.g. captured at payment creation time), so this
method reconciles them with the current state of the payment:
- The preimage is taken from
htlc_detailsif present, otherwise from the payment. - If a preimage is available from either source, the HTLC status is set to
SparkHtlcStatus::PreimageShared.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Payment
impl<'de> Deserialize<'de> for Payment
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>,
Source§impl TryFrom<&Payment> for ConversionStep
Converts a Spark or Token payment into a ConversionStep.
Fees are a sum of the payment fee and the conversion fee, if applicable,
from the payment details. Token metadata should only be set for a token payment.
impl TryFrom<&Payment> for ConversionStep
Converts a Spark or Token payment into a ConversionStep.
Fees are a sum of the payment fee and the conversion fee, if applicable,
from the payment details. Token metadata should only be set for a token payment.
Auto Trait Implementations§
impl Freeze for Payment
impl RefUnwindSafe for Payment
impl Send for Payment
impl Sync for Payment
impl Unpin for Payment
impl UnwindSafe for Payment
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
impl<T> FromBase64 for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request