Skip to main content

autogen_squareup/models/
invoice_payment_request.rs

1/*
2 * Square
3 *
4 * Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.
5 *
6 * The version of the OpenAPI document: 2.0
7 * Contact: developers@squareup.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// InvoicePaymentRequest : Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information,  see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).  Adding `INSTALLMENT` payment requests to an invoice requires an  [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct InvoicePaymentRequest {
17    /// The Square-generated ID of the payment request in an [invoice](entity:Invoice).
18    #[serde(rename = "uid", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19    pub uid: Option<Option<String>>,
20    #[serde(rename = "request_method", skip_serializing_if = "Option::is_none")]
21    pub request_method: Option<models::InvoiceRequestMethod>,
22    #[serde(rename = "request_type", skip_serializing_if = "Option::is_none")]
23    pub request_type: Option<models::InvoiceRequestType>,
24    /// The due date (in the invoice's time zone) for the payment request, in `YYYY-MM-DD` format. This field is required to create a payment request. If an `automatic_payment_source` is defined for the request, Square charges the payment source on this date.  After this date, the invoice becomes overdue. For example, a payment `due_date` of 2021-03-09 with a `timezone` of America/Los\\_Angeles becomes overdue at midnight on March 9 in America/Los\\_Angeles (which equals a UTC timestamp of 2021-03-10T08:00:00Z).
25    #[serde(rename = "due_date", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
26    pub due_date: Option<Option<String>>,
27    #[serde(rename = "fixed_amount_requested_money", skip_serializing_if = "Option::is_none")]
28    pub fixed_amount_requested_money: Option<Box<models::Money>>,
29    /// Specifies the amount for the payment request in percentage:  - When the payment `request_type` is `DEPOSIT`, it is the percentage of the order's total amount. - When the payment `request_type` is `INSTALLMENT`, it is the percentage of the order's total less  the deposit, if requested. The sum of the `percentage_requested` in all installment  payment requests must be equal to 100.  You cannot specify this when the payment `request_type` is `BALANCE` or when the  payment request specifies the `fixed_amount_requested_money` field.
30    #[serde(rename = "percentage_requested", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub percentage_requested: Option<Option<String>>,
32    /// If set to true, the Square-hosted invoice page (the `public_url` field of the invoice)  provides a place for the customer to pay a tip.   This field is allowed only on the final payment request   and the payment `request_type` must be `BALANCE` or `INSTALLMENT`.
33    #[serde(rename = "tipping_enabled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub tipping_enabled: Option<Option<bool>>,
35    #[serde(rename = "automatic_payment_source", skip_serializing_if = "Option::is_none")]
36    pub automatic_payment_source: Option<models::InvoiceAutomaticPaymentSource>,
37    /// The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, call [ListCards](api-endpoint:Cards-ListCards) and include the `customer_id` of the invoice recipient.
38    #[serde(rename = "card_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
39    pub card_id: Option<Option<String>>,
40    /// A list of one or more reminders to send for the payment request.
41    #[serde(rename = "reminders", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
42    pub reminders: Option<Option<Vec<models::InvoicePaymentReminder>>>,
43    #[serde(rename = "computed_amount_money", skip_serializing_if = "Option::is_none")]
44    pub computed_amount_money: Option<Box<models::Money>>,
45    #[serde(rename = "total_completed_amount_money", skip_serializing_if = "Option::is_none")]
46    pub total_completed_amount_money: Option<Box<models::Money>>,
47    #[serde(rename = "rounding_adjustment_included_money", skip_serializing_if = "Option::is_none")]
48    pub rounding_adjustment_included_money: Option<Box<models::Money>>,
49}
50
51impl InvoicePaymentRequest {
52    /// Represents a payment request for an [invoice](entity:Invoice). Invoices can specify a maximum of 13 payment requests, with up to 12 `INSTALLMENT` request types. For more information,  see [Configuring payment requests](https://developer.squareup.com/docs/invoices-api/create-publish-invoices#payment-requests).  Adding `INSTALLMENT` payment requests to an invoice requires an  [Invoices Plus subscription](https://developer.squareup.com/docs/invoices-api/overview#invoices-plus-subscription).
53    pub fn new() -> InvoicePaymentRequest {
54        InvoicePaymentRequest {
55            uid: None,
56            request_method: None,
57            request_type: None,
58            due_date: None,
59            fixed_amount_requested_money: None,
60            percentage_requested: None,
61            tipping_enabled: None,
62            automatic_payment_source: None,
63            card_id: None,
64            reminders: None,
65            computed_amount_money: None,
66            total_completed_amount_money: None,
67            rounding_adjustment_included_money: None,
68        }
69    }
70}
71