square_api_client/models/
order_fulfillment.rs

1//! Model struct for OrderFulfillment type
2
3use std::collections::HashMap;
4
5use serde::{Deserialize, Serialize};
6
7use super::{
8    enums::{
9        OrderFulfillmentFulfillmentLineItemApplication, OrderFulfillmentState, OrderFulfillmentType,
10    },
11    OrderFulfillmentDeliveryDetails, OrderFulfillmentFulfillmentEntry,
12    OrderFulfillmentPickupDetails, OrderFulfillmentShipmentDetails,
13};
14
15/// This is a model struct for OrderFulfillment type.
16///
17/// Contains details about how to fulfill this order.
18#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
19pub struct OrderFulfillment {
20    /// A unique ID that identifies the fulfillment only within this order.
21    pub uid: Option<String>,
22    /// The type of the fulfillment.
23    pub r#type: Option<OrderFulfillmentType>,
24    /// The state of the fulfillment.
25    pub state: Option<OrderFulfillmentState>,
26    /// Describes what order line items this fulfillment applies to. It can be ALL or ENTRY_LIST
27    /// with a supplied list of fulfillment entries.
28    pub line_item_application: Option<OrderFulfillmentFulfillmentLineItemApplication>,
29    /// A list of entries pertaining to the fulfillment of an order. Each entry must reference a
30    /// valid uid for an order line item in the line_item_uid field, as well as a quantity to
31    /// fulfill.
32    ///
33    /// Multiple entries can reference the same line item uid, as long as the total quantity among
34    /// all fulfillment entries referencing a single line item does not exceed the quantity of the
35    /// order's line item itself.
36    ///
37    /// An order cannot be marked as COMPLETED before all fulfillments are COMPLETED, CANCELED, or
38    /// FAILED. Fulfillments can be created and completed independently before order completion.
39    pub entries: Option<Vec<OrderFulfillmentFulfillmentEntry>>,
40    /// Application-defined data attached to this fulfillment. Metadata fields are intended to store
41    /// descriptive references or associations with an entity in another system or store brief
42    /// information about the object. Square does not process this field; it only stores and returns
43    /// it in relevant API calls. Do not use metadata to store any sensitive information (such as
44    /// personally identifiable information or card details).
45    ///
46    /// Keys written by applications must be 60 characters or less and must be in the character set
47    /// [a-zA-Z0-9_-]. Entries can also include metadata generated by Square. These keys are
48    /// prefixed with a namespace, separated from the key with a ':' character.
49    ///
50    /// Values have a maximum length of 255 characters.
51    ///
52    /// An application can have up to 10 entries per metadata field.
53    ///
54    /// Entries written by applications are private and can only be read or modified by the same
55    /// application.
56    ///
57    /// For more information, see
58    /// [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
59    pub metadata: Option<HashMap<String, String>>,
60    /// Contains details for a pickup fulfillment. These details are required when the fulfillment
61    /// type is PICKUP.
62    pub pickup_details: Option<OrderFulfillmentPickupDetails>,
63    /// Contains details for a shipment fulfillment. These details are required when the fulfillment
64    /// type is SHIPMENT.
65    ///
66    /// A shipment fulfillment's relationship to fulfillment state: PROPOSED: A shipment is
67    /// requested. RESERVED: Fulfillment accepted. Shipment processing. PREPARED: Shipment packaged.
68    /// Shipping label created. COMPLETED: Package has been shipped. CANCELED: Shipment has been
69    /// canceled. FAILED: Shipment has failed.
70    pub shipment_details: Option<OrderFulfillmentShipmentDetails>,
71    /// Describes delivery details of an order fulfillment. These details are required when the fulfillment
72    /// type is Delivery.
73    ///
74    pub delivery_details: Option<OrderFulfillmentDeliveryDetails>,
75}