Struct BasicPaymentV2
pub struct BasicPaymentV2 {Show 24 fields
pub id: LxPaymentId,
pub related_ids: HashSet<LxPaymentId>,
pub kind: PaymentKind,
pub direction: PaymentDirection,
pub offer_id: Option<LxOfferId>,
pub txid: Option<LxTxid>,
pub amount: Option<Amount>,
pub fee: Amount,
pub status: PaymentStatus,
pub status_str: String,
pub address: Option<Arc<Address<NetworkUnchecked>>>,
pub invoice: Option<Arc<LxInvoice>>,
pub offer: Option<Arc<LxOffer>>,
pub tx: Option<Arc<Transaction>>,
pub note: Option<String>,
pub payer_name: Option<String>,
pub payer_note: Option<String>,
pub priority: Option<ConfirmationPriority>,
pub quantity: Option<NonZero<u64>>,
pub replacement_txid: Option<LxTxid>,
pub expires_at: Option<TimestampMs>,
pub finalized_at: Option<TimestampMs>,
pub created_at: TimestampMs,
pub updated_at: TimestampMs,
}Expand description
A basic payment type which contains all of the user-facing payment details for any kind of payment. These details are exposed in the Lexe app.
It is essentially the Payment type flattened out such that each field is
the result of the corresponding Payment getter.
Fields§
§id: LxPaymentIdPayment identifier; globally unique from the user’s perspective.
The ids of payments related to this payment.
kind: PaymentKindPayment kind: Application-level purpose of this payment.
direction: PaymentDirectionThe payment direction: Inbound, Outbound, or Info.
offer_id: Option<LxOfferId>(Offer payments only) The id of the BOLT12 offer used in this payment.
txid: Option<LxTxid>(Onchain payments only) The original txid.
amount: Option<Amount>The amount of this payment.
- If this is a completed inbound invoice payment, this is the amount we received.
- If this is a pending or failed inbound inbound invoice payment, this is the amount encoded in our invoice, which may be null.
- For all other payment types, an amount is always included.
fee: AmountThe fees for this payment.
Use this whenever you need a singular value to display.
- For outbound Lightning payments, these are the routing fees. If the payment is not completed, this value is an estimation only. Iff the payment completes, this value reflects actual fees paid.
- For inbound Lightning payments, this is the skimmed fee, which may also cover the on-chain fees incurred by a JIT channel open.
- For on-chain sends, this is the on-chain fee paid in the spending tx.
status: PaymentStatusGeneral payment status: pending, completed, or failed.
status_str: StringThe payment status as a human-readable string. These strings are customized per payment type, e.g. “invoice generated”, “timed out”
address: Option<Arc<Address<NetworkUnchecked>>>(Onchain send only) The address that we’re sending to.
invoice: Option<Arc<LxInvoice>>(Invoice payments only) The BOLT11 invoice used in this payment.
offer: Option<Arc<LxOffer>>(Outbound offer payments only) The BOLT12 offer used in this payment. Until we store offers out-of-line, this is not yet available for inbound offer payments.
tx: Option<Arc<Transaction>>The on-chain transaction, if there is one.
Always Some for on-chain sends and receives.
note: Option<String>An optional personal note which a user can attach to any payment. A note can always be added or modified when a payment already exists, but this may not always be possible at creation time. These differences are documented below:
-
Onchain send: The user has the option to set this at creation time.
-
Onchain receive: The user can only add a note after the onchain receive has been detected.
-
Inbound invoice payments: Since a user-provided description is already required when creating an invoice, at invoice creation time this field is not exposed to the user and is simply initialized to
None. Useful primarily if a user wants to update their note later. -
Inbound offer reusable payments and Inbound spontaneous payment: There is no way for users to add the note at receive time, so this field can only be added or updated later.
-
Outbound invoice payments: Since the receiver sets the invoice description, which might just be a useless 🍆 emoji, the user has the option to add this note at the time of invoice payment.
-
Outbound spontaneous payment: Since there is no invoice description field, the user has the option to set this at payment creation time.
payer_name: Option<String>(Offer payments only) The payer’s self-reported human-readable name.
payer_note: Option<String>(Offer payments only) A payer-provided note for this payment. LDK truncates this to 512 bytes.
priority: Option<ConfirmationPriority>(Onchain send only) The confirmation priority used for this payment.
quantity: Option<NonZero<u64>>(Inbound offer reusable only) The number of items the payer bought.
replacement_txid: Option<LxTxid>(Onchain payments only) The txid of the replacement tx, if one exists.
expires_at: Option<TimestampMs>The invoice or offer expiry time.
None otherwise, or if the timestamp overflows.
finalized_at: Option<TimestampMs>When this payment was finalized (completed or failed).
created_at: TimestampMsWhen this payment was created.
updated_at: TimestampMsWhen this payment was last updated.
Implementations§
§impl BasicPaymentV2
impl BasicPaymentV2
pub fn from_v1(v1: BasicPaymentV1, updated_at: TimestampMs) -> BasicPaymentV2
pub fn payment_id(&self) -> LxPaymentId
pub fn is_pending(&self) -> bool
pub fn is_finalized(&self) -> bool
pub fn is_pending_not_junk(&self) -> bool
pub fn is_finalized_not_junk(&self) -> bool
pub fn is_junk(&self) -> bool
pub fn is_junk(&self) -> bool
“Junk” payments are unimportant, usually not-user-initiated payments that we don’t display by default, unless a user explicitly opts-in to a a “show everything” filter for debugging.
For example, the current receive UI generates a “junk” BOLT11 invoice on every page open, but we don’t want this invoice to show up in the payments list unless it actually gets paid.
pub fn note_or_description(&self) -> Option<&str>
pub fn note_or_description(&self) -> Option<&str>
Returns the user’s note or invoice description, prefering note over description.
pub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
Returns the invoice or offer description if present.
pub fn created_at(&self) -> TimestampMs
pub fn updated_at(&self) -> TimestampMs
pub fn created_index(&self) -> PaymentCreatedIndex
pub fn updated_index(&self) -> PaymentUpdatedIndex
Trait Implementations§
§impl Clone for BasicPaymentV2
impl Clone for BasicPaymentV2
§fn clone(&self) -> BasicPaymentV2
fn clone(&self) -> BasicPaymentV2
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for BasicPaymentV2
impl Debug for BasicPaymentV2
§impl<'de> Deserialize<'de> for BasicPaymentV2
impl<'de> Deserialize<'de> for BasicPaymentV2
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BasicPaymentV2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BasicPaymentV2, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl From<BasicPaymentV2> for SdkPayment
impl From<BasicPaymentV2> for SdkPayment
§fn from(p: BasicPaymentV2) -> SdkPayment
fn from(p: BasicPaymentV2) -> SdkPayment
§impl PartialEq for BasicPaymentV2
impl PartialEq for BasicPaymentV2
§impl Serialize for BasicPaymentV2
impl Serialize for BasicPaymentV2
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for BasicPaymentV2
impl StructuralPartialEq for BasicPaymentV2
Auto Trait Implementations§
impl Freeze for BasicPaymentV2
impl RefUnwindSafe for BasicPaymentV2
impl Send for BasicPaymentV2
impl Sync for BasicPaymentV2
impl Unpin for BasicPaymentV2
impl UnwindSafe for BasicPaymentV2
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.