use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_json::Value;
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Customer {
pub id: String,
pub object: String,
pub description: Option<String>,
pub email: Option<String>,
pub name: Option<String>,
pub phone: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InvoiceSettings {
#[serde(rename = "custom_fields")]
pub custom_fields: Value,
#[serde(rename = "default_payment_method")]
pub default_payment_method: Value,
pub footer: Value,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Plans {
pub object: String,
pub url: String,
#[serde(rename = "has_more")]
pub has_more: bool,
pub data: Vec<Plan>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Plan {
pub id: String,
pub object: String,
pub active: bool,
pub amount: i64,
#[serde(rename = "amount_decimal")]
pub amount_decimal: String,
#[serde(rename = "billing_scheme")]
pub billing_scheme: String,
pub created: i64,
pub currency: String,
pub interval: String,
#[serde(rename = "interval_count")]
pub interval_count: i64,
pub livemode: bool,
pub product: String,
#[serde(rename = "usage_type")]
pub usage_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Metadata {
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct BillingDetails {
pub address: Address,
pub email: Option<String>,
pub name: Option<String>,
pub phone: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Address {
pub city: Option<String>,
pub country: Option<String>,
pub line1: Option<String>,
pub line2: Option<String>,
#[serde(rename = "postal_code")]
pub postal_code: Option<String>,
pub state: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Card {
pub brand: String,
pub checks: Checks,
pub country: String,
#[serde(rename = "exp_month")]
pub exp_month: i64,
#[serde(rename = "exp_year")]
pub exp_year: i64,
pub fingerprint: String,
pub funding: String,
pub last4: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Checks {
#[serde(rename = "cvc_check")]
pub cvc_check: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaymentMethods {
pub object: String,
pub url: String,
#[serde(rename = "has_more")]
pub has_more: bool,
pub data: Vec<PaymentMethod>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PaymentMethod {
pub id: String,
pub object: String,
#[serde(rename = "billing_details")]
pub billing_details: BillingDetails,
pub card: Card,
pub created: i64,
pub customer: Option<String>,
pub livemode: bool,
pub metadata: Metadata,
#[serde(rename = "type")]
pub type_field: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Networks {
pub available: Vec<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ThreeDSecureUsage {
pub supported: bool,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Subscriptions {
pub object: String,
pub data: Vec<Subscription>,
#[serde(rename = "has_more")]
pub has_more: bool,
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Subscription {
pub id: Option<String>,
pub object: Option<String>,
#[serde(rename = "automatic_tax")]
pub automatic_tax: Option<AutomaticTax>,
#[serde(rename = "billing_cycle_anchor")]
pub billing_cycle_anchor: Option<i64>,
#[serde(rename = "cancel_at")]
pub cancel_at: Option<i64>,
#[serde(rename = "cancel_at_period_end")]
pub cancel_at_period_end: Option<bool>,
#[serde(rename = "canceled_at")]
pub canceled_at: Option<i64>,
#[serde(rename = "collection_method")]
pub collection_method: Option<String>,
pub created: Option<i64>,
#[serde(rename = "current_period_end")]
pub current_period_end: Option<i64>,
#[serde(rename = "current_period_start")]
pub current_period_start: Option<i64>,
pub customer: Option<String>,
#[serde(rename = "days_until_due")]
pub days_until_due: Option<i64>,
#[serde(rename = "default_payment_method")]
pub default_payment_method: Option<String>,
#[serde(rename = "ended_at")]
pub ended_at: Option<i64>,
pub items: Option<SubscriptionItems>,
#[serde(rename = "latest_invoice")]
pub latest_invoice: Option<String>,
pub livemode: Option<bool>,
pub quantity: Option<i64>,
#[serde(rename = "start_date")]
pub start_date: Option<i64>,
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscriptionItems {
pub object: String,
pub data: Vec<SubscriptionItem>,
#[serde(rename = "has_more")]
pub has_more: bool,
#[serde(rename = "total_count")]
pub total_count: i64,
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SubscriptionItem {
pub id: String,
pub object: String,
pub created: i64,
pub quantity: i64,
pub subscription: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AutomaticTax {
pub enabled: Option<bool>,
pub status: Option<String>,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Prices {
pub object: String,
pub data: Vec<Price>,
#[serde(rename = "has_more")]
pub has_more: bool,
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Price {
pub id: String,
pub object: String,
pub active: bool,
#[serde(rename = "billing_scheme")]
pub billing_scheme: String,
pub created: i64,
pub currency: String,
pub livemode: bool,
pub product: String,
pub recurring: Recurring,
#[serde(rename = "tax_behavior")]
pub tax_behavior: String,
#[serde(rename = "type")]
pub type_field: String,
#[serde(rename = "unit_amount")]
pub unit_amount: i64,
#[serde(rename = "unit_amount_decimal")]
pub unit_amount_decimal: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Recurring {
pub interval: String,
#[serde(rename = "interval_count")]
pub interval_count: i64,
#[serde(rename = "usage_type")]
pub usage_type: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Invoices {
pub object: String,
pub data: Vec<Invoice>,
#[serde(rename = "has_more")]
pub has_more: bool,
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Invoice {
pub id: String,
pub object: String,
#[serde(rename = "account_country")]
pub account_country: String,
#[serde(rename = "amount_due")]
pub amount_due: i64,
#[serde(rename = "amount_paid")]
pub amount_paid: i64,
#[serde(rename = "amount_remaining")]
pub amount_remaining: i64,
#[serde(rename = "application_fee_amount")]
pub application_fee_amount: Value,
#[serde(rename = "attempt_count")]
pub attempt_count: i64,
pub attempted: bool,
#[serde(rename = "auto_advance")]
pub auto_advance: bool,
#[serde(rename = "automatic_tax")]
pub automatic_tax: AutomaticTax,
#[serde(rename = "billing_reason")]
pub billing_reason: String,
pub charge: String,
#[serde(rename = "collection_method")]
pub collection_method: String,
pub created: i64,
pub currency: String,
pub customer: String,
#[serde(rename = "customer_email")]
pub customer_email: String,
#[serde(rename = "customer_name")]
pub customer_name: String,
#[serde(rename = "customer_phone")]
pub customer_phone: Option<String>,
#[serde(rename = "customer_tax_exempt")]
pub customer_tax_exempt: String,
#[serde(rename = "customer_tax_ids")]
pub customer_tax_ids: Vec<Value>,
#[serde(rename = "default_payment_method")]
pub default_payment_method: Value,
#[serde(rename = "default_source")]
pub default_source: Value,
#[serde(rename = "default_tax_rates")]
pub default_tax_rates: Vec<Value>,
pub description: Value,
pub discount: Value,
pub discounts: Vec<Value>,
#[serde(rename = "due_date")]
pub due_date: Value,
#[serde(rename = "ending_balance")]
pub ending_balance: i64,
pub footer: Value,
#[serde(rename = "hosted_invoice_url")]
pub hosted_invoice_url: String,
#[serde(rename = "invoice_pdf")]
pub invoice_pdf: String,
#[serde(rename = "last_finalization_error")]
pub last_finalization_error: Value,
pub lines: InvoiceLines,
pub livemode: bool,
#[serde(rename = "next_payment_attempt")]
pub next_payment_attempt: Value,
pub number: String,
#[serde(rename = "on_behalf_of")]
pub on_behalf_of: Value,
pub paid: bool,
#[serde(rename = "paid_out_of_band")]
pub paid_out_of_band: bool,
#[serde(rename = "payment_intent")]
pub payment_intent: String,
#[serde(rename = "period_end")]
pub period_end: i64,
#[serde(rename = "period_start")]
pub period_start: i64,
#[serde(rename = "post_payment_credit_notes_amount")]
pub post_payment_credit_notes_amount: i64,
#[serde(rename = "pre_payment_credit_notes_amount")]
pub pre_payment_credit_notes_amount: i64,
pub quote: Value,
#[serde(rename = "receipt_number")]
pub receipt_number: Value,
#[serde(rename = "starting_balance")]
pub starting_balance: i64,
#[serde(rename = "statement_descriptor")]
pub statement_descriptor: Value,
pub status: String,
#[serde(rename = "status_transitions")]
pub status_transitions: StatusTransitions,
pub subscription: String,
pub subtotal: i64,
pub tax: Value,
pub total: i64,
#[serde(rename = "total_discount_amounts")]
pub total_discount_amounts: Vec<Value>,
#[serde(rename = "total_tax_amounts")]
pub total_tax_amounts: Vec<Value>,
#[serde(rename = "transfer_data")]
pub transfer_data: Value,
#[serde(rename = "webhooks_delivered_at")]
pub webhooks_delivered_at: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InvoiceLines {
pub object: String,
pub data: Vec<InvoiceLine>,
#[serde(rename = "has_more")]
pub has_more: bool,
#[serde(rename = "total_count")]
pub total_count: i64,
pub url: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct InvoiceLine {
pub id: String,
pub object: String,
pub amount: i64,
pub currency: String,
pub description: String,
pub discountable: bool,
pub discounts: Vec<Value>,
pub livemode: bool,
pub period: Period,
pub plan: Plan,
pub price: Price,
pub proration: bool,
pub quantity: i64,
pub subscription: String,
#[serde(rename = "subscription_item")]
pub subscription_item: String,
#[serde(rename = "type")]
pub type_field: String,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Period {
pub end: i64,
pub start: i64,
}
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StatusTransitions {
#[serde(rename = "finalized_at")]
pub finalized_at: Option<i64>,
#[serde(rename = "paid_at")]
pub paid_at: Option<i64>,
#[serde(rename = "voided_at")]
pub voided_at: Option<i64>,
}