zebedee_rust/payments/
types.rs

1use crate::StdResp;
2use chrono::{DateTime, Utc};
3use serde::{Deserialize, Serialize};
4
5pub type PaymentInvoiceResponse = StdResp<Option<PaymentsData>>;
6pub type FetchPaymentsResponse = StdResp<Option<Vec<PaymentsData>>>;
7pub type FetchOnePaymentsResponse = StdResp<Option<PaymentsData>>;
8
9#[derive(Debug, Serialize, Deserialize)]
10pub struct PaymentsData {
11    pub id: String,
12    pub fee: Option<String>,
13    pub unit: String,
14    pub amount: String,
15    pub invoice: Option<String>,
16    pub preimage: Option<String>,
17    #[serde(rename = "internalId")]
18    pub internal_id: Option<String>,
19    #[serde(rename = "processedAt")]
20    pub processed_at: Option<DateTime<Utc>>,
21    #[serde(rename = "confirmedAt")]
22    pub confirmed_at: Option<DateTime<Utc>>,
23    pub description: String,
24    pub status: Option<String>,
25}
26
27/// Use this struct to create a well crafted json body for normal ligthning bolt 11 payments
28#[derive(Debug, Serialize, Deserialize)]
29pub struct Payment {
30    pub description: String,
31    #[serde(rename = "internalId")]
32    pub internal_id: String,
33    pub invoice: String,
34}
35
36impl Default for Payment {
37    fn default() -> Payment {
38        Payment {
39            description: String::from("using zebedee rust sdk"),
40            internal_id: String::from(""),
41            invoice: String::from(""),
42        }
43    }
44}