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
56
57
58
59
60
61
62
63
64
65
66
//! Model struct for Tender type
use serde::{Deserialize, Serialize};
use super::{
AdditionalRecipient, DateTime, Money, TenderBankAccountDetails, TenderBuyNowPayLaterDetails,
TenderCardDetails, TenderCashDetails, TenderSquareAccountDetails, enums::TenderType,
};
/// Represents a tender (i.e., a method of payment) used in a Square transaction.
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct Tender {
/// The tender's unique ID.
pub id: Option<String>,
/// The ID of the transaction's associated location.
pub location_id: Option<String>,
/// The ID of the tender's associated transaction.
pub transaction_id: Option<String>,
/// **Read only** The timestamp for when the tender was created.
pub created_at: Option<DateTime>,
/// An optional note associated with the tender at the time of payment.
pub note: Option<String>,
/// The total amount of the tender, including `tip_money`. If the tender has a `payment_id`, the
/// `total_money` of the corresponding [Payment] will be equal to the `amount_money` of the
/// tender.
pub amount_money: Option<Money>,
/// The tip's amount of the tender.
pub tip_money: Option<Money>,
/// The amount of any Square processing fees applied to the tender.
///
/// This field is not immediately populated when a new transaction is created. It is usually
/// available after about ten seconds.
pub processing_fee_money: Option<Money>,
/// If the tender is associated with a customer or represents a customer's card on file, this is
/// the ID of the associated customer.
pub customer_id: Option<String>,
/// **Required** The type of tender, such as `CARD` or `CASH`.
pub r#type: TenderType,
/// The details of the card tender.
///
/// This value is present only if the value of `type` is `CARD`.
pub card_details: Option<TenderCardDetails>,
/// The details of the cash tender.
///
/// This value is present only if the value of `type` is `CASH`.
pub cash_details: Option<TenderCashDetails>,
/// The details of the bank account tender.
///
/// This value is present only if the value of type is BANK_ACCOUNT.
pub bank_account_details: Option<TenderBankAccountDetails>,
/// The details of a Buy Now Pay Later tender.
///
/// This value is present only if the value of type is BUY_NOW_PAY_LATER.
pub buy_now_pay_later_details: Option<TenderBuyNowPayLaterDetails>,
/// The details of a Square Account tender.
///
/// This value is present only if the value of type is SquareAccount.
pub square_account_details: Option<TenderSquareAccountDetails>,
/// Additional recipients (other than the merchant) receiving a portion of this tender. For
/// example, fees assessed on the purchase by a third party integration.
#[deprecated]
pub additional_recipients: Option<Vec<AdditionalRecipient>>,
/// The ID of the [Payment] that corresponds to this tender. This value is only
/// present for payments created with the v2 Payments API.
pub payment_id: Option<String>,
}