Skip to content

Commit

Permalink
fix: Add card to PaymentMethodDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
drager committed Sep 10, 2019
1 parent 033d24c commit fe83da4
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/resources/types.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::params::Timestamp;
use crate::resources::card::{Card, CardBrand, CardType};
use serde_derive::{Deserialize, Serialize};

/// An enum representing the possible values of a `BankAccount`'s `account_holder_type` field.
Expand Down Expand Up @@ -119,10 +120,45 @@ pub struct PackageDimensions {
pub width: f64,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct PaymentMethodCard {
/// Can be `American Express`, `Diners Club`, `Discover`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
#[serde(skip_serializing_if = "Option::is_none")]
pub brand: Option<CardBrand>,

/// Two-letter ISO code representing the country of the card.
///
/// You could use this attribute to get a sense of the international breakdown of cards you've collected.
pub country: String,

/// Two-digit number representing the card's expiration month.
pub exp_month: i64,

/// Four-digit number representing the card's expiration year.
pub exp_year: i64,

/// Uniquely identifies this particular card number.
///
/// You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example.
pub fingerprint: String,

/// Card funding type.
///
/// Can be `credit`, `debit`, `prepaid`, or `unknown`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding: Option<CardType>,

/// The last four digits of the card.
pub last4: String,
}

// TODO: Implement
/// This type is a stub that still needs to be implemented.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct PaymentMethodDetails {}
pub struct PaymentMethodDetails {
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<PaymentMethodCard>,
}

/// Period is a structure representing a start and end dates.
#[derive(Clone, Debug, Deserialize, Serialize)]
Expand Down

0 comments on commit fe83da4

Please sign in to comment.