1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
//! Model struct for the Card type
use serde::{Deserialize, Serialize};
use super::{
enums::{CardBrand, CardPrepaidType, CardType},
Address,
};
/// Represents the payment details of a card to be used for payments.
///
/// These details are determined by the payment token generated by Web Payments SDK.
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
pub struct Card {
/// **Read only** Unique ID for this card. Generated by Square.
pub id: Option<String>,
/// **Read only** The card's brand.
pub card_brand: Option<CardBrand>,
/// **Read only** The last 4 digits of the card number.
pub last_4: Option<String>,
/// The expiration month of the associated card as an integer between 1 and 12.
pub exp_month: Option<i32>,
/// The four-digit year of the card's expiration date.
pub exp_year: Option<i32>,
/// The name of the cardholder.
pub cardholder_name: Option<String>,
/// The billing address for this card.
pub billing_address: Option<Address>,
/// **Read only** Intended as a Square-assigned identifier, based on the card number, to
/// identify the card across multiple locations within a single application.
pub fingerprint: Option<String>,
/// **Required** The ID of a customer created using the Customers API to be associated with the
/// card.
pub customer_id: Option<String>,
/// **Read only** The ID of the merchant associated with the card.
pub merchant_id: Option<String>,
/// An optional user-defined reference ID that associates this card with another entity in an
/// external system. For example, a customer ID from an external customer management system.
pub reference_id: Option<String>,
/// **Read only** Indicates whether or not a card can be used for payments.
pub enabled: Option<bool>,
/// **Read only** The type of the card. The Card object includes this field only in response to
/// Payments API calls.
pub card_type: Option<CardType>,
/// **Read only** Indicates whether the Card is prepaid or not. The Card object includes this
/// field only in response to Payments API calls.
pub prepaid_type: Option<CardPrepaidType>,
/// **Read only** The first six digits of the card number, known as the Bank Identification
/// Number (BIN). Only the Payments API returns this field.
pub bin: Option<String>,
/// Current version number of the card. Increments with each card update. Requests to update an
/// existing Card object will be rejected unless the version in the request matches the current
/// version for the Card.
pub version: Option<i32>,
}