square_api_client/models/
customer.rs

1//! Model struct for Customer type
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::CustomerCreationSource, Address, Card, CustomerPreferences, CustomerTaxIds, DateTime,
7};
8
9/// Represents a Square customer profile in the Customer Directory of a Square seller.
10#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
11pub struct Customer {
12    /// A unique Square-assigned ID for the customer profile. If you need this ID for an API
13    /// request, use the ID returned when you created the customer profile or call the
14    /// `SearchCustomers` or `ListCustomers` endpoint.
15    pub id: Option<String>,
16    /// The timestamp when the customer profile was created.
17    pub created_at: Option<DateTime>,
18    /// The timestamp when the customer profile was last updated.
19    pub updated_at: Option<DateTime>,
20    /// Payment details of the credit, debit, and gift cards stored on file for the customer
21    /// profile.
22    ///
23    /// DEPRECATED at version 2021-06-16. Replaced by calling `ListCards` (for credit and debit
24    /// cards on file) or `ListGiftCards` (for gift cards on file) and including the
25    /// `customer_id` query parameter. For more information, see [Migrate to the Cards API and Gift
26    /// Cards
27    /// API](https://developer.squareup.com/docs/customers-api/use-the-api/integrate-with-other-services#migrate-customer-cards).
28    #[deprecated]
29    pub cards: Option<Vec<Card>>,
30    /// The given name (that is, the first name) associated with the customer profile.
31    pub given_name: Option<String>,
32    /// The family name (that is, the last name) associated with the customer profile.
33    pub family_name: Option<String>,
34    /// A nickname for the customer profile.
35    pub nickname: Option<String>,
36    /// A business name associated with the customer profile.
37    pub company_name: Option<String>,
38    /// The email address associated with the customer profile.
39    pub email_address: Option<String>,
40    /// The physical address associated with the customer profile.
41    pub address: Option<Address>,
42    /// The phone number associated with the customer profile. A phone number can contain 9–16
43    /// digits, with an optional `+` prefix.
44    pub phone_number: Option<String>,
45    /// The birthday associated with the customer profile, in RFC 3339 format. The year is optional.
46    /// The timezone and time are not allowed. For example, `0000-09-21T00:00:00-00:00` represents a
47    /// birthday on September 21 and `1998-09-21T00:00:00-00:00` represents a birthday on September
48    /// 21, 1998.
49    pub birthday: Option<String>,
50    /// An optional second ID used to associate the customer profile with an entity in another
51    /// system.
52    pub reference_id: Option<String>,
53    /// A custom note associated with the customer profile.
54    pub note: Option<String>,
55    /// Represents general customer preferences.
56    pub preferences: Option<CustomerPreferences>,
57    /// The method used to create the customer profile.
58    pub creation_source: Option<CustomerCreationSource>,
59    /// The IDs of customer groups the customer belongs to.
60    pub group_ids: Option<Vec<String>>,
61    /// The IDs of segments the customer belongs to.
62    pub segment_ids: Option<Vec<String>>,
63    /// The Square-assigned version number of the customer profile. The version number is
64    /// incremented each time an update is committed to the customer profile, except for changes to
65    /// customer segment membership and cards on file.
66    pub version: Option<i32>,
67    /// Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding
68    /// `tax_ids` field is available only for customers of sellers in EU countries or the United
69    /// Kingdom. For more information, see [Customer tax
70    /// IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).
71    pub tax_ids: Option<CustomerTaxIds>,
72}