Skip to main content

BasicPaymentV2

Struct BasicPaymentV2 

Source
pub struct BasicPaymentV2 {
Show 29 fields pub id: PaymentId, pub related_ids: HashSet<PaymentId>, pub kind: PaymentKind, pub direction: PaymentDirection, pub hash: Option<PaymentHash>, pub preimage: Option<PaymentPreimage>, pub offer_id: Option<OfferId>, pub txid: Option<Txid>, pub amount: Option<Amount>, pub fee: Amount, pub partner_pk: Option<UserPk>, pub partner_prop_fee: Option<Ppm>, pub partner_base_fee: Option<Amount>, pub status: PaymentStatus, pub status_str: String, pub address: Option<Arc<Address<NetworkUnchecked>>>, pub invoice: Option<Arc<Invoice>>, pub offer: Option<Arc<Offer>>, 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<Txid>, pub expires_at: Option<TimestampMs>, pub finalized_at: Option<TimestampMs>, pub created_at: TimestampMs, pub updated_at: TimestampMs,
}
Expand description

User-facing payment details for any kind of payment, as displayed in the Lexe app and returned by Lexe APIs.

Fields§

§id: PaymentId

Payment identifier; globally unique from the user’s perspective.

§related_ids: HashSet<PaymentId>

The ids of payments related to this payment.

§kind: PaymentKind

Payment kind: Application-level purpose of this payment.

§direction: PaymentDirection

The payment direction: Inbound, Outbound, or Info.

§hash: Option<PaymentHash>

(Lightning payments only) The payment hash.

§preimage: Option<PaymentPreimage>

(Lightning payments only) The payment preimage. Serves as proof-of-payment for outbound payments. For inbound payments, only populated if the payment succeeded.

§offer_id: Option<OfferId>

(Offer payments only) The id of the BOLT12 offer used in this payment.

§txid: Option<Txid>

(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: Amount

The fees for this payment.

Use this whenever you need a singular value to display.

§partner_pk: Option<UserPk>

The partner’s user_pk, if the fees for this payment were set by a Lexe partner, instead of using Lexe’s default fees.

§partner_prop_fee: Option<Ppm>

The proportional fee set by the partner.

§partner_base_fee: Option<Amount>

The base fee set by the partner.

§status: PaymentStatus

General payment status: pending, completed, or failed.

§status_str: String

The 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<Invoice>>

(Invoice payments only) The BOLT11 invoice used in this payment.

§offer: Option<Arc<Offer>>

(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, LNURL-pay invoices) A payer-provided note for this payment.

§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<Txid>

(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: TimestampMs

When this payment was created.

§updated_at: TimestampMs

When this payment was last updated.

Implementations§

Source§

impl BasicPaymentV2

Source

pub fn from_v1(v1: BasicPaymentV1, updated_at: TimestampMs) -> BasicPaymentV2

Source

pub fn payment_id(&self) -> PaymentId

Source

pub fn total(&self) -> Option<Amount>

The total amount of this payment, inclusive of fees.

Source

pub fn is_pending(&self) -> bool

Source

pub fn is_finalized(&self) -> bool

Source

pub fn is_pending_not_junk(&self) -> bool

Source

pub fn is_finalized_not_junk(&self) -> bool

Source

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.

Source

pub fn note_or_description(&self) -> Option<&str>

Returns the user’s note or invoice description, prefering note over description.

Source

pub fn description(&self) -> Option<&str>

Returns the invoice or offer description if present.

Source

pub fn created_at(&self) -> TimestampMs

Source

pub fn updated_at(&self) -> TimestampMs

Source

pub fn created_index(&self) -> PaymentCreatedIndex

Source

pub fn updated_index(&self) -> PaymentUpdatedIndex

Trait Implementations§

Source§

impl Clone for BasicPaymentV2

Source§

fn clone(&self) -> BasicPaymentV2

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BasicPaymentV2

Source§

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

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

impl<'de> Deserialize<'de> for BasicPaymentV2

Source§

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

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

impl From<BasicPaymentV2> for BasicPaymentV1

Source§

fn from(v2: BasicPaymentV2) -> BasicPaymentV1

Converts to this type from the input type.
Source§

impl PartialEq for BasicPaymentV2

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for BasicPaymentV2

Source§

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

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

impl Eq for BasicPaymentV2

Source§

impl StructuralPartialEq for BasicPaymentV2

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<F, T, U> Apply<F, U> for T
where F: FnOnce(T) -> U,

Source§

fn apply(self, f: F) -> U

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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