square_api_client/models/
gift_card_activity.rs

1//! Model struct for GiftCardActivity type
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::GiftCardActivityType, DateTime, GiftCardActivityActivate,
7    GiftCardActivityAdjustDecrement, GiftCardActivityAdjustIncrement, GiftCardActivityBlock,
8    GiftCardActivityClearBalance, GiftCardActivityDeactivate, GiftCardActivityImport,
9    GiftCardActivityImportReversal, GiftCardActivityLoad, GiftCardActivityRedeem,
10    GiftCardActivityRefund, GiftCardActivityUnblock, GiftCardActivityUnlinkedActivityRefund, Money,
11};
12
13/// Represents an action performed on a gift card that affects its state or balance.
14///
15/// A gift card activity contains information about a specific activity type. For example, a
16/// `REDEEM` activity includes a `redeem_activity_details` field that contains information about the
17/// redemption.
18#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
19pub struct GiftCardActivity {
20    /// **Read only** The Square-assigned ID of the gift card activity.
21    pub id: Option<String>,
22    /// The ID of the [business location](Location) where the activity occurred.
23    pub location_id: String,
24    /// The type of gift card activity.
25    pub r#type: GiftCardActivityType,
26    /// Additional details about an `ACTIVATE` activity, which is used to activate a gift card with
27    /// an initial balance.
28    pub activate_activity_details: Option<GiftCardActivityActivate>,
29    /// Additional details about an `ADJUST_DECREMENT` activity, which is used to deduct money from
30    /// a gift card outside of a typical `REDEEM` activity flow.
31    pub adjust_decrement_activity_details: Option<GiftCardActivityAdjustDecrement>,
32    /// Additional details about an `ADJUST_INCREMENT` activity, which is used to add money to a
33    /// gift card outside of a typical `ACTIVATE`, `LOAD`, or `REFUND` activity flow.
34    pub adjust_increment_activity_details: Option<GiftCardActivityAdjustIncrement>,
35    /// **Read only** Additional details about a `BLOCK` activity, which Square uses to temporarily
36    /// block a gift card.
37    pub block_activity_details: Option<GiftCardActivityBlock>,
38    /// Additional details about a `CLEAR_BALANCE` activity, which is used to set the balance of a
39    /// gift card to zero.
40    pub clear_balance_activity_details: Option<GiftCardActivityClearBalance>,
41    /// **Read only** The timestamp when the gift card activity was created, in RFC 3339 format.
42    pub created_at: Option<DateTime>,
43    /// Additional details about a `DEACTIVATE` activity, which is used to deactivate a gift card.
44    pub deactivate_activity_details: Option<GiftCardActivityDeactivate>,
45    /// **Read only** The final balance on the gift card after the action is completed.
46    pub gift_card_balance_money: Option<Money>,
47    /// The gift card account number (GAN). When creating a gift card activity, `gift_card_gan` is
48    /// not required if `gift_card_id` is specified.
49    pub gift_card_gan: Option<String>,
50    /// The gift card ID. When creating a gift card activity, `gift_card_id` is not required if
51    /// `gift_card_gan` is specified.
52    pub gift_card_id: Option<String>,
53    /// **Read only** Additional details about an `IMPORT` activity, which Square uses to import a
54    /// third-party gift card with a balance.
55    pub import_activity_details: Option<GiftCardActivityImport>,
56    /// **Read only** Additional details about an `IMPORT_REVERSAL` activity, which Square uses to
57    /// reverse the import of a third-party gift card.
58    pub import_reversal_activity_details: Option<GiftCardActivityImportReversal>,
59    /// Additional details about a `LOAD` activity, which is used to reload money onto a gift card.
60    pub load_activity_details: Option<GiftCardActivityLoad>,
61    /// Additional details about a `REDEEM` activity, which is used to redeem a gift card for a
62    /// purchase.
63    ///
64    /// For applications that process payments using the Square Payments API, Square creates a
65    /// `REDEEM` activity that updates the gift card balance after the corresponding
66    /// [CreatePayment](https://developer.squareup.com/reference/square/payments-api/create-payment)
67    /// request is completed. Applications that use a custom payment processing system must call
68    /// [CreateGiftCardActivity](https://developer.squareup.com/reference/square/giftcardactivities-api/create-gift-card-activity)
69    /// to create the `REDEEM` activity.
70    pub redeem_activity_details: Option<GiftCardActivityRedeem>,
71    /// Additional details about a `REFUND` activity, which is used to add money to a gift card when
72    /// refunding a payment.
73    ///
74    ///For applications that process payments using the Square Payments API, Square creates a
75    /// `REFUND` activity that updates the gift card balance after the corresponding
76    /// [RefundPayment](https://developer.squareup.com/reference/square/refunds-api/refund-payment)
77    /// request is completed. Applications that use a custom payment processing system must call
78    /// [CreateGiftCardActivity](https://developer.squareup.com/reference/square/giftcardactivities-api/create-gift-card-activity)
79    /// to create the `REFUND` activity.
80    pub refund_activity_details: Option<GiftCardActivityRefund>,
81    /// **Read only** Additional details about an `UNBLOCK` activity, which Square uses to unblock a
82    /// gift card.
83    pub unblock_activity_details: Option<GiftCardActivityUnblock>,
84    /// Additional details about an `UNLINKED_ACTIVITY_REFUND` activity. This activity is used to
85    /// add money to a gift card when refunding a payment that was processed using a custom payment
86    /// processing system and not linked to the gift card.
87    pub unlinked_activity_refund_activity_details: Option<GiftCardActivityUnlinkedActivityRefund>,
88}