stripe2 32.0.0

Stripe client, generated from the OpenAPI spec.
Documentation
use serde::{Serialize, Deserialize};
use super::{RefundDestinationDetails, RefundNextAction};
/**Refund objects allow you to refund a previously created charge that isn't
refunded yet. Funds are refunded to the credit or debit card that's
initially charged.

Related guide: [Refunds](https://stripe.com/docs/refunds)*/
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Refund {
    ///Amount, in cents (or local equivalent).
    pub amount: i64,
    ///Balance transaction that describes the impact on your account balance.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub balance_transaction: Option<serde_json::Value>,
    ///ID of the charge that's refunded.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub charge: Option<serde_json::Value>,
    ///Time at which the object was created. Measured in seconds since the Unix epoch.
    pub created: i64,
    ///Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
    pub currency: String,
    ///An arbitrary string attached to the object. You can use this for displaying to users (available on non-card refunds only).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    ///
    #[serde(skip_serializing_if = "Option::is_none")]
    pub destination_details: Option<RefundDestinationDetails>,
    ///After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub failure_balance_transaction: Option<serde_json::Value>,
    ///Provides the reason for the refund failure. Possible values are: `lost_or_stolen_card`, `expired_or_canceled_card`, `charge_for_pending_refund_disputed`, `insufficient_funds`, `declined`, `merchant_request`, or `unknown`.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub failure_reason: Option<String>,
    ///Unique identifier for the object.
    pub id: String,
    ///For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub instructions_email: Option<String>,
    ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub metadata: Option<serde_json::Value>,
    ///
    #[serde(skip_serializing_if = "Option::is_none")]
    pub next_action: Option<RefundNextAction>,
    ///String representing the object's type. Objects of the same type share the same value.
    pub object: String,
    ///ID of the PaymentIntent that's refunded.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_intent: Option<serde_json::Value>,
    ///Reason for the refund, which is either user-provided (`duplicate`, `fraudulent`, or `requested_by_customer`) or generated by Stripe internally (`expired_uncaptured_charge`).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
    ///This is the transaction number that appears on email receipts sent for this refund.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub receipt_number: Option<String>,
    ///The transfer reversal that's associated with the refund. Only present if the charge came from another Stripe account.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub source_transfer_reversal: Option<serde_json::Value>,
    ///Status of the refund. This can be `pending`, `requires_action`, `succeeded`, `failed`, or `canceled`. Learn more about [failed refunds](https://stripe.com/docs/refunds#failed-refunds).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<String>,
    ///This refers to the transfer reversal object if the accompanying transfer reverses. This is only applicable if the charge was created using the destination parameter.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transfer_reversal: Option<serde_json::Value>,
}
impl std::fmt::Display for Refund {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
        write!(f, "{}", serde_json::to_string(self).unwrap())
    }
}