/*
* 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.605.0
* 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 PayoutBatchItem {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "participantId")]
pub participant_id: String,
#[serde(rename = "creator")]
pub creator: Box<models::PayoutBatchItemCreator>,
/// What the creator receives, in full.
#[serde(rename = "amountCents")]
pub amount_cents: i32,
/// Zernio fee on top: 4%, 50 cents minimum per payout.
#[serde(rename = "feeCents")]
pub fee_cents: i32,
/// amountCents plus feeCents.
#[serde(rename = "totalCents")]
pub total_cents: i32,
/// `skipped`: payout setup not finished, or the card payment never completed. `failed`: Stripe refused the transfer. `refunded`: failed or skipped after the card hold; its payout, fee and VAT on the fee went back to the card through a credit note. The amount is payable again in every case.
#[serde(rename = "status")]
pub status: Status,
/// Why the item was not paid, in plain words.
#[serde(rename = "failureReason", deserialize_with = "Option::deserialize")]
pub failure_reason: Option<String>,
/// The treasury transfer that paid this item.
#[serde(rename = "transferId", deserialize_with = "Option::deserialize")]
pub transfer_id: Option<String>,
/// What went back to the card for a `refunded` item: payout, fee and VAT on the fee. Null otherwise.
#[serde(rename = "refundedCents", deserialize_with = "Option::deserialize")]
pub refunded_cents: Option<i32>,
}
impl PayoutBatchItem {
pub fn new(
id: String,
participant_id: String,
creator: models::PayoutBatchItemCreator,
amount_cents: i32,
fee_cents: i32,
total_cents: i32,
status: Status,
failure_reason: Option<String>,
transfer_id: Option<String>,
refunded_cents: Option<i32>,
) -> PayoutBatchItem {
PayoutBatchItem {
id,
participant_id,
creator: Box::new(creator),
amount_cents,
fee_cents,
total_cents,
status,
failure_reason,
transfer_id,
refunded_cents,
}
}
}
/// `skipped`: payout setup not finished, or the card payment never completed. `failed`: Stripe refused the transfer. `refunded`: failed or skipped after the card hold; its payout, fee and VAT on the fee went back to the card through a credit note. The amount is payable again in every case.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "pending")]
Pending,
#[serde(rename = "paid")]
Paid,
#[serde(rename = "failed")]
Failed,
#[serde(rename = "skipped")]
Skipped,
#[serde(rename = "refunded")]
Refunded,
}
impl Default for Status {
fn default() -> Status {
Self::Pending
}
}