Skip to main content

Invoice

Struct Invoice 

Source
pub struct Invoice {
Show 16 fields pub id: String, pub subscription_id: String, pub customer: String, pub plan_id: String, pub number: i64, pub amount: Money, pub credits: i64, pub period_start: u64, pub period_end: u64, pub status: InvoiceStatus, pub charge_id: Option<String>, pub channel: Channel, pub instructions: Instructions, pub due_at: u64, pub paid_at: Option<u64>, pub created_at: u64,
}

Fields§

§id: String

Also the charge’s reference at the gateway and the ledger reference of the credits it buys — one id through all three, so a webhook and a top-up are matched to the invoice with no lookup table.

§subscription_id: String§customer: String§plan_id: String§number: i64

1 for the first invoice, then counting. Unique per subscription, which is what stops two schedulers raising the same renewal.

§amount: Money§credits: i64

Credited when paid.

§period_start: u64

The period this invoice buys. For the first invoice both are zero until it is paid, because access starts at payment, not at signup.

§period_end: u64§status: InvoiceStatus§charge_id: Option<String>

The gateway’s charge id. None while the charge has not been created yet — the gateway was down when the invoice was raised — or after the gateway expired it; the next tick creates a fresh one either way.

§channel: Channel§instructions: Instructions

How to pay: the VA number, the QR, the URL. Empty until there is a charge.

§due_at: u64

Unix seconds. After this the subscription is in grace.

§paid_at: Option<u64>§created_at: u64

Implementations§

Source§

impl Invoice

Source

pub fn is_payable(&self) -> bool

Source

pub fn to_json(&self) -> Json

Trait Implementations§

Source§

impl Clone for Invoice

Source§

fn clone(&self) -> Self

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 Invoice

Source§

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

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

impl PartialEq for Invoice

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Invoice

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.