stripe/resources/
payout_ext.rs1use serde::{Deserialize, Serialize};
2
3use crate::client::{Client, Response};
4use crate::ids::{PayoutDestinationId, PayoutId};
5use crate::params::Object;
6use crate::resources::{BankAccount, Card, Payout};
7
8impl Payout {
9 pub fn cancel(client: &Client, id: &PayoutId) -> Response<Payout> {
13 client.post(&format!("/payouts/{}/cancel", id))
14 }
15}
16
17#[derive(Clone, Debug, Deserialize, Serialize)]
18#[serde(untagged, rename_all = "snake_case")]
19pub enum PayoutDestinationUnion {
20 BankAccount(BankAccount),
21 Card(Card),
22}
23impl std::default::Default for PayoutDestinationUnion {
24 fn default() -> Self {
25 Self::BankAccount(Default::default())
26 }
27}
28impl Object for PayoutDestinationUnion {
29 type Id = PayoutDestinationId;
30 fn id(&self) -> Self::Id {
31 match self {
32 PayoutDestinationUnion::BankAccount(x) => PayoutDestinationId::BankAccount(x.id()),
33 PayoutDestinationUnion::Card(x) => PayoutDestinationId::Card(x.id()),
34 }
35 }
36 fn object(&self) -> &'static str {
37 match self {
38 PayoutDestinationUnion::BankAccount(x) => x.object(),
39 PayoutDestinationUnion::Card(x) => x.object(),
40 }
41 }
42}