noah_sdk/models/
checkout.rs

1//! Checkout-related models
2
3use crate::models::common::*;
4use serde::{Deserialize, Serialize};
5
6/// Line item
7#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct LineItem {
9    /// Description
10    #[serde(rename = "Description")]
11    pub description: String,
12    /// Quantity
13    #[serde(rename = "Quantity")]
14    pub quantity: PositiveDecimal,
15    /// Unit amount
16    #[serde(rename = "UnitAmount")]
17    pub unit_amount: PositiveDecimal,
18    /// Total amount
19    #[serde(rename = "TotalAmount")]
20    pub total_amount: PositiveDecimal,
21}
22
23/// Line items
24pub type LineItems = Vec<LineItem>;
25
26/// Checkout session status
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
28#[serde(rename_all = "PascalCase")]
29pub enum CheckoutSessionStatus {
30    /// Pending
31    Pending,
32    /// Failed
33    Failed,
34    /// Settled
35    Settled,
36}
37
38/// Checkout session type
39#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
40#[serde(rename_all = "PascalCase")]
41pub enum CheckoutSessionType {
42    /// Crypto payin
43    PayinCrypto,
44    /// Fiat payin
45    PayinFiat,
46    /// Fiat payout
47    PayoutFiat,
48}
49
50/// Checkout session
51#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct CheckoutSession {
53    /// Checkout session ID
54    #[serde(rename = "CheckoutSessionID")]
55    pub checkout_session_id: String,
56    /// Payment method category (optional)
57    #[serde(rename = "PaymentMethodCategory")]
58    pub payment_method_category: Option<PaymentMethodCategory>,
59    /// Source currency
60    #[serde(rename = "SourceCurrency")]
61    pub source_currency: String,
62    /// Destination currency
63    #[serde(rename = "DestinationCurrency")]
64    pub destination_currency: String,
65    /// Source amount
66    #[serde(rename = "SourceAmount")]
67    pub source_amount: PositiveDecimal,
68    /// Destination amount
69    #[serde(rename = "DestinationAmount")]
70    pub destination_amount: PositiveDecimal,
71    /// Authorized amount
72    #[serde(rename = "AuthorizedAmount")]
73    pub authorized_amount: Option<PositiveDecimal>,
74    /// Status
75    #[serde(rename = "Status")]
76    pub status: String,
77    /// External ID (optional)
78    #[serde(rename = "ExternalID")]
79    pub external_id: Option<ExternalID>,
80    /// Customer ID
81    #[serde(rename = "CustomerID")]
82    pub customer_id: CustomerID,
83    /// Return URL
84    #[serde(rename = "ReturnURL")]
85    pub return_url: ReturnURL,
86    /// Line items
87    #[serde(rename = "LineItems")]
88    pub line_items: LineItems,
89    /// Type
90    #[serde(rename = "Type")]
91    pub session_type: String,
92    /// Expiry (optional)
93    #[serde(rename = "Expiry")]
94    pub expiry: Option<DateTime>,
95    /// Created timestamp
96    #[serde(rename = "Created")]
97    pub created: DateTime,
98}
99
100/// Checkout session response
101#[derive(Debug, Clone, Serialize, Deserialize)]
102pub struct CheckoutSessionResponse {
103    /// Hosted URL
104    #[serde(rename = "HostedURL")]
105    pub hosted_url: String,
106    /// Checkout session
107    #[serde(rename = "CheckoutSession")]
108    pub checkout_session: CheckoutSession,
109}