/*
* Zernio API
*
* API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api Versioning and deprecation: all endpoints are versioned in the URL path (current version: /v1). Breaking changes only ship in a new path version; existing versions keep working. Deprecated operations are marked 'deprecated: true' in this spec and announced in the changelog (https://zernio.com/changelog) before removal. Errors: every 4xx/5xx response is application/json with a machine-readable 'code' and a human-readable 'error' message (see the ErrorResponse schema). Request ids: responses carry an X-Request-Id header with the id we log the request under. Quote it when reporting a problem. A valid x-request-id you send is reused as that id.
*
* The version of the OpenAPI document: 1.440.2
* Contact: support@zernio.com
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TreasuryTopup {
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[serde(rename = "method", skip_serializing_if = "Option::is_none")]
pub method: Option<Method>,
/// `balance` funds your balance; `payout_batch` is the card payment of one payout batch, which pays its creators directly.
#[serde(rename = "purpose", skip_serializing_if = "Option::is_none")]
pub purpose: Option<Purpose>,
#[serde(rename = "payoutBatch", skip_serializing_if = "Option::is_none")]
pub payout_batch: Option<Box<models::TreasuryTopupPayoutBatch>>,
/// True for a `payout_batch` payment: Zernio pays the Stripe processing fee out of its transfer fee, so you are credited the whole charge.
#[serde(rename = "feeCoveredByZernio", skip_serializing_if = "Option::is_none")]
pub fee_covered_by_zernio: Option<bool>,
/// The amount you asked for. A top-up charges the card fee on top of it and credits what Stripe delivers, at least this amount. Older top-ups charged this amount and credited it minus the fee.
#[serde(rename = "amountCents", skip_serializing_if = "Option::is_none")]
pub amount_cents: Option<i32>,
/// Card fee. Once paid, the fee Stripe took (chargedCents minus netCents). Before, the fee charged on top, or null on an older top-up. 0 when Zernio covers it (`payout_batch`).
#[serde(
rename = "feeCents",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub fee_cents: Option<Option<i32>>,
/// What your card was charged: amountCents plus the card fee charged on top, or amountCents on an older top-up and on a `payout_batch` payment.
#[serde(rename = "chargedCents", skip_serializing_if = "Option::is_none")]
pub charged_cents: Option<i32>,
/// feeCents once the top-up is paid; null before. Kept for older clients: read feeCents.
#[serde(
rename = "stripeFeeCents",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub stripe_fee_cents: Option<Option<i32>>,
/// Amount credited to your balance, what Stripe delivered; null until paid. At least amountCents on a top-up that charged the fee on top, and amountCents on `payout_batch` payments.
#[serde(
rename = "netCents",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub net_cents: Option<Option<i32>>,
/// `pending` until the card is charged (or 3D Secure is finished) and credited. `expired` means it ended unpaid: cancelled, or 3D Secure left unfinished for 30 minutes. Only `pending` counts toward pendingTopupCents.
#[serde(rename = "status", skip_serializing_if = "Option::is_none")]
pub status: Option<Status>,
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
#[serde(
rename = "succeededAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub succeeded_at: Option<Option<String>>,
}
impl TreasuryTopup {
pub fn new() -> TreasuryTopup {
TreasuryTopup {
id: None,
method: None,
purpose: None,
payout_batch: None,
fee_covered_by_zernio: None,
amount_cents: None,
fee_cents: None,
charged_cents: None,
stripe_fee_cents: None,
net_cents: None,
status: None,
created_at: None,
succeeded_at: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Method {
#[serde(rename = "card")]
Card,
#[serde(rename = "bank_transfer")]
BankTransfer,
}
impl Default for Method {
fn default() -> Method {
Self::Card
}
}
/// `balance` funds your balance; `payout_batch` is the card payment of one payout batch, which pays its creators directly.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Purpose {
#[serde(rename = "balance")]
Balance,
#[serde(rename = "payout_batch")]
PayoutBatch,
}
impl Default for Purpose {
fn default() -> Purpose {
Self::Balance
}
}
/// `pending` until the card is charged (or 3D Secure is finished) and credited. `expired` means it ended unpaid: cancelled, or 3D Secure left unfinished for 30 minutes. Only `pending` counts toward pendingTopupCents.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "succeeded")]
Succeeded,
#[serde(rename = "failed")]
Failed,
#[serde(rename = "expired")]
Expired,
}
impl Default for Status {
fn default() -> Status {
Self::Pending
}
}