diff --git a/.fern/metadata.json b/.fern/metadata.json index 165e2576..6cfaa9a1 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -15,6 +15,6 @@ "inline-path-parameters": true, "use-discriminated-unions": true }, - "originGitCommit": "074e2540401528521d322c512800c4ebd67cd153", - "sdkVersion": "46.0.0" + "originGitCommit": "b05364cda2b85e35d8daa9ff2c24bbabbbd9652a", + "sdkVersion": "46.1.0" } \ No newline at end of file diff --git a/.fern/replay.lock b/.fern/replay.lock index 7aebbbf6..babd766b 100644 --- a/.fern/replay.lock +++ b/.fern/replay.lock @@ -18,5 +18,11 @@ generations: cli_version: unknown generator_versions: fernapi/fern-csharp-sdk: 2.13.0 -current_generation: 95fb2acb0a6e0331519924147bf767201f53e0c4 + - commit_sha: 17f8cafbb8cee88791263ef4d0ff2dece237c946 + tree_hash: a097839b3fb7e18bd9e960e278fae1c98668a35e + timestamp: 2026-08-18T20:53:42.742Z + cli_version: unknown + generator_versions: + fernapi/fern-csharp-sdk: 2.13.0 +current_generation: 17f8cafbb8cee88791263ef4d0ff2dece237c946 patches: [] diff --git a/reference.md b/reference.md index ee731fcb..6f5db5e5 100644 --- a/reference.md +++ b/reference.md @@ -8348,8 +8348,9 @@ how to sort or filter the results. Your `SearchOrdersQuery` can: Note that details for orders processed with Square Point of Sale while in offline mode might not be transmitted to Square for up to 72 hours. Offline -orders have a `created_at` value that reflects the time the order was created, -not the time it was subsequently transmitted to Square. +orders have a `created_at` value that reflects the time the order was +transmitted to Square and created server-side, not the time the order was +created on the Point of Sale device. diff --git a/src/Square.Test/Unit/MockServer/Catalog/BatchGetTest.cs b/src/Square.Test/Unit/MockServer/Catalog/BatchGetTest.cs index a7f6ac14..c02564ec 100644 --- a/src/Square.Test/Unit/MockServer/Catalog/BatchGetTest.cs +++ b/src/Square.Test/Unit/MockServer/Catalog/BatchGetTest.cs @@ -120,7 +120,21 @@ public async Task MockServerTest() "image_id": "image_id", "type": "TAX" } - ] + ], + "included_resources": { + "nested_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ], + "ancestor_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ] + } } """; diff --git a/src/Square.Test/Unit/MockServer/Catalog/SearchItemsTest.cs b/src/Square.Test/Unit/MockServer/Catalog/SearchItemsTest.cs index 35716559..6bbd13e9 100644 --- a/src/Square.Test/Unit/MockServer/Catalog/SearchItemsTest.cs +++ b/src/Square.Test/Unit/MockServer/Catalog/SearchItemsTest.cs @@ -89,7 +89,21 @@ public async Task MockServerTest() "cursor": "cursor", "matched_variation_ids": [ "VBJNPHCOKDFECR6VU25WRJUD" - ] + ], + "included_resources": { + "nested_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ], + "ancestor_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ] + } } """; diff --git a/src/Square.Test/Unit/MockServer/Catalog/SearchTest.cs b/src/Square.Test/Unit/MockServer/Catalog/SearchTest.cs index a21e1e05..76c4e584 100644 --- a/src/Square.Test/Unit/MockServer/Catalog/SearchTest.cs +++ b/src/Square.Test/Unit/MockServer/Catalog/SearchTest.cs @@ -105,7 +105,21 @@ public async Task MockServerTest() "type": "ITEM" } ], - "latest_time": "latest_time" + "latest_time": "latest_time", + "included_resources": { + "nested_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ], + "ancestor_modifiers": [ + { + "id": "id", + "type": "ITEM" + } + ] + } } """; diff --git a/src/Square.Test/Unit/MockServer/Locations/CreateTest.cs b/src/Square.Test/Unit/MockServer/Locations/CreateTest.cs index f58ee9cd..368c6d0c 100644 --- a/src/Square.Test/Unit/MockServer/Locations/CreateTest.cs +++ b/src/Square.Test/Unit/MockServer/Locations/CreateTest.cs @@ -94,7 +94,9 @@ public async Task MockServerTest() "fr_naf": "fr_naf", "es_nif": "es_nif", "jp_qii": "jp_qii" - } + }, + "custom_receipt_text": "custom_receipt_text", + "return_policy": "return_policy" } } """; diff --git a/src/Square.Test/Unit/MockServer/Locations/GetTest.cs b/src/Square.Test/Unit/MockServer/Locations/GetTest.cs index 0e174ded..cedd4644 100644 --- a/src/Square.Test/Unit/MockServer/Locations/GetTest.cs +++ b/src/Square.Test/Unit/MockServer/Locations/GetTest.cs @@ -79,7 +79,9 @@ public async Task MockServerTest() "fr_naf": "fr_naf", "es_nif": "es_nif", "jp_qii": "jp_qii" - } + }, + "custom_receipt_text": "custom_receipt_text", + "return_policy": "return_policy" } } """; diff --git a/src/Square.Test/Unit/MockServer/Locations/ListTest.cs b/src/Square.Test/Unit/MockServer/Locations/ListTest.cs index 391dee34..651b0e26 100644 --- a/src/Square.Test/Unit/MockServer/Locations/ListTest.cs +++ b/src/Square.Test/Unit/MockServer/Locations/ListTest.cs @@ -54,7 +54,9 @@ public async Task MockServerTest() "logo_url": "logo_url", "pos_background_url": "pos_background_url", "mcc": "mcc", - "full_format_logo_url": "full_format_logo_url" + "full_format_logo_url": "full_format_logo_url", + "custom_receipt_text": "custom_receipt_text", + "return_policy": "return_policy" }, { "id": "3Z4V4WHQK64X9", @@ -91,7 +93,9 @@ public async Task MockServerTest() "logo_url": "logo_url", "pos_background_url": "pos_background_url", "mcc": "7299", - "full_format_logo_url": "full_format_logo_url" + "full_format_logo_url": "full_format_logo_url", + "custom_receipt_text": "custom_receipt_text", + "return_policy": "return_policy" } ] } diff --git a/src/Square.Test/Unit/MockServer/Locations/UpdateTest.cs b/src/Square.Test/Unit/MockServer/Locations/UpdateTest.cs index 5a3b1b85..43019941 100644 --- a/src/Square.Test/Unit/MockServer/Locations/UpdateTest.cs +++ b/src/Square.Test/Unit/MockServer/Locations/UpdateTest.cs @@ -120,7 +120,9 @@ public async Task MockServerTest() "fr_naf": "fr_naf", "es_nif": "es_nif", "jp_qii": "jp_qii" - } + }, + "custom_receipt_text": "custom_receipt_text", + "return_policy": "return_policy" } } """; diff --git a/src/Square/Catalog/Requests/BatchGetCatalogObjectsRequest.cs b/src/Square/Catalog/Requests/BatchGetCatalogObjectsRequest.cs index 507a8bdf..f3536a4b 100644 --- a/src/Square/Catalog/Requests/BatchGetCatalogObjectsRequest.cs +++ b/src/Square/Catalog/Requests/BatchGetCatalogObjectsRequest.cs @@ -1,4 +1,5 @@ using System.Text.Json.Serialization; +using Square; using Square.Core; namespace Square.Catalog; @@ -55,6 +56,12 @@ public record BatchGetCatalogObjectsRequest [JsonPropertyName("include_category_path_to_root")] public bool? IncludeCategoryPathToRoot { get; set; } + /// + /// Options to include related resources in the response. + /// + [JsonPropertyName("include_options")] + public IncludeOptions? IncludeOptions { get; set; } + /// public override string ToString() { diff --git a/src/Square/Catalog/Requests/SearchCatalogItemsRequest.cs b/src/Square/Catalog/Requests/SearchCatalogItemsRequest.cs index 2e3e0fd8..69421750 100644 --- a/src/Square/Catalog/Requests/SearchCatalogItemsRequest.cs +++ b/src/Square/Catalog/Requests/SearchCatalogItemsRequest.cs @@ -73,6 +73,12 @@ public record SearchCatalogItemsRequest [JsonPropertyName("archived_state")] public ArchivedState? ArchivedState { get; set; } + /// + /// Options to include related resources in the response. + /// + [JsonPropertyName("include_options")] + public IncludeOptions? IncludeOptions { get; set; } + /// public override string ToString() { diff --git a/src/Square/Catalog/Requests/SearchCatalogObjectsRequest.cs b/src/Square/Catalog/Requests/SearchCatalogObjectsRequest.cs index d53707c5..a4011224 100644 --- a/src/Square/Catalog/Requests/SearchCatalogObjectsRequest.cs +++ b/src/Square/Catalog/Requests/SearchCatalogObjectsRequest.cs @@ -86,6 +86,12 @@ public record SearchCatalogObjectsRequest [JsonPropertyName("include_category_path_to_root")] public bool? IncludeCategoryPathToRoot { get; set; } + /// + /// Options to include related resources in the response. + /// + [JsonPropertyName("include_options")] + public IncludeOptions? IncludeOptions { get; set; } + /// public override string ToString() { diff --git a/src/Square/Core/Public/Version.cs b/src/Square/Core/Public/Version.cs index 0192984c..4eadd45e 100644 --- a/src/Square/Core/Public/Version.cs +++ b/src/Square/Core/Public/Version.cs @@ -3,5 +3,5 @@ namespace Square; [Serializable] internal class Version { - public const string Current = "46.0.0"; + public const string Current = "46.1.0"; } diff --git a/src/Square/Orders/IOrdersClient.cs b/src/Square/Orders/IOrdersClient.cs index 578aa571..cd3a6e1c 100644 --- a/src/Square/Orders/IOrdersClient.cs +++ b/src/Square/Orders/IOrdersClient.cs @@ -68,8 +68,9 @@ Task CloneAsync( /// /// Note that details for orders processed with Square Point of Sale while in /// offline mode might not be transmitted to Square for up to 72 hours. Offline - /// orders have a `created_at` value that reflects the time the order was created, - /// not the time it was subsequently transmitted to Square. + /// orders have a `created_at` value that reflects the time the order was + /// transmitted to Square and created server-side, not the time the order was + /// created on the Point of Sale device. /// Task SearchAsync( SearchOrdersRequest request, diff --git a/src/Square/Orders/OrdersClient.cs b/src/Square/Orders/OrdersClient.cs index 739adf7f..28d9c735 100644 --- a/src/Square/Orders/OrdersClient.cs +++ b/src/Square/Orders/OrdersClient.cs @@ -354,8 +354,9 @@ public async Task CloneAsync( /// /// Note that details for orders processed with Square Point of Sale while in /// offline mode might not be transmitted to Square for up to 72 hours. Offline - /// orders have a `created_at` value that reflects the time the order was created, - /// not the time it was subsequently transmitted to Square. + /// orders have a `created_at` value that reflects the time the order was + /// transmitted to Square and created server-side, not the time the order was + /// created on the Point of Sale device. /// /// /// await client.Orders.SearchAsync( diff --git a/src/Square/Square.csproj b/src/Square/Square.csproj index a929ba7b..da8b2bd8 100644 --- a/src/Square/Square.csproj +++ b/src/Square/Square.csproj @@ -5,7 +5,7 @@ enable 12 enable - 46.0.0 + 46.1.0 $(Version) $(Version) README.md diff --git a/src/Square/SquareClient.cs b/src/Square/SquareClient.cs index e2feb1ce..dd56dcd6 100644 --- a/src/Square/SquareClient.cs +++ b/src/Square/SquareClient.cs @@ -49,11 +49,11 @@ public SquareClient(string? token = null, ClientOptions? clientOptions = null) new Dictionary() { { "Authorization", $"Bearer {token}" }, - { "Square-Version", "2026-07-15" }, + { "Square-Version", "2026-08-19" }, { "X-Fern-Language", "C#" }, { "X-Fern-SDK-Name", "Square" }, { "X-Fern-SDK-Version", Version.Current }, - { "User-Agent", "Square/46.0.0" }, + { "User-Agent", "Square/46.1.0" }, } ); clientOptions ??= new ClientOptions(); diff --git a/src/Square/Types/BatchGetCatalogObjectsResponse.cs b/src/Square/Types/BatchGetCatalogObjectsResponse.cs index ba7168d7..d69f4837 100644 --- a/src/Square/Types/BatchGetCatalogObjectsResponse.cs +++ b/src/Square/Types/BatchGetCatalogObjectsResponse.cs @@ -29,6 +29,12 @@ public record BatchGetCatalogObjectsResponse : IJsonOnDeserialized [JsonPropertyName("related_objects")] public IEnumerable? RelatedObjects { get; set; } + /// + /// A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field and specifically requested. + /// + [JsonPropertyName("included_resources")] + public IncludedResources? IncludedResources { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Square/Types/CardBrand.cs b/src/Square/Types/CardBrand.cs index 8a2754bd..7f6e415f 100644 --- a/src/Square/Types/CardBrand.cs +++ b/src/Square/Types/CardBrand.cs @@ -35,6 +35,14 @@ namespace Square; public static readonly CardBrand Ebt = new(Values.Ebt); + public static readonly CardBrand Quicpay = new(Values.Quicpay); + + public static readonly CardBrand Id = new(Values.Id); + + public static readonly CardBrand TransportationIc = new(Values.TransportationIc); + + public static readonly CardBrand Carnet = new(Values.Carnet); + public CardBrand(string value) { Value = value; @@ -107,5 +115,13 @@ public static class Values public const string Felica = "FELICA"; public const string Ebt = "EBT"; + + public const string Quicpay = "QUICPAY"; + + public const string Id = "ID"; + + public const string TransportationIc = "TRANSPORTATION_IC"; + + public const string Carnet = "CARNET"; } } diff --git a/src/Square/Types/CatalogModifier.cs b/src/Square/Types/CatalogModifier.cs index 242008a6..8be65918 100644 --- a/src/Square/Types/CatalogModifier.cs +++ b/src/Square/Types/CatalogModifier.cs @@ -73,6 +73,19 @@ public record CatalogModifier : IJsonOnDeserialized [JsonPropertyName("hidden_online")] public bool? HiddenOnline { get; set; } + /// + /// Child `CatalogModifierList`s that this `CatalogModifier` nests for multi-step choices. + /// When a customer or staff member selects this modifier, the relevant follow-up modifier list appears. + /// For example, selecting "Hummus" reveals a secondary "Choose Hummus Flavor" set, and selecting a flavor + /// could reveal a third-level portion size set. + /// + /// Each entry references a child modifier list. Each modifier can nest up to 5 child modifier list, and + /// supports up to 3 levels of nesting depth. The order in `child_modifier_list_ids` determines display order + /// during checkout. + /// + [JsonPropertyName("child_modifier_list_ids")] + public IEnumerable? ChildModifierListIds { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Square/Types/CatalogQuery.cs b/src/Square/Types/CatalogQuery.cs index 69c09cbf..c9769709 100644 --- a/src/Square/Types/CatalogQuery.cs +++ b/src/Square/Types/CatalogQuery.cs @@ -108,6 +108,12 @@ public record CatalogQuery : IJsonOnDeserialized [JsonPropertyName("item_variations_for_item_option_values_query")] public CatalogQueryItemVariationsForItemOptionValues? ItemVariationsForItemOptionValuesQuery { get; set; } + /// + /// A query expression to return `CatalogModifier` objects that nest the specified modifier lists (via `child_modifier_list_ids`) + /// + [JsonPropertyName("modifiers_for_child_list_query")] + public CatalogQueryModifiersForChildList? ModifiersForChildListQuery { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Square/Types/CatalogQueryModifiersForChildList.cs b/src/Square/Types/CatalogQueryModifiersForChildList.cs new file mode 100644 index 00000000..feaeaed1 --- /dev/null +++ b/src/Square/Types/CatalogQueryModifiersForChildList.cs @@ -0,0 +1,35 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Square.Core; + +namespace Square; + +/// +/// Query to find `CatalogModifier` objects that reference a given `CatalogModifierList` in their `child_modifier_list_ids` field. +/// +[Serializable] +public record CatalogQueryModifiersForChildList : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// The `CatalogModifierList` IDs to find parent `CatalogModifier`s for. + /// Returns `CatalogModifier` objects where `child_modifier_list_ids` contains any of these IDs. + /// + [JsonPropertyName("child_modifier_list_ids")] + public IEnumerable ChildModifierListIds { get; set; } = new List(); + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Square/Types/ErrorCode.cs b/src/Square/Types/ErrorCode.cs index 21078710..b00d8393 100644 --- a/src/Square/Types/ErrorCode.cs +++ b/src/Square/Types/ErrorCode.cs @@ -225,6 +225,8 @@ namespace Square; public static readonly ErrorCode AmountTooHigh = new(Values.AmountTooHigh); + public static readonly ErrorCode AmountTooLow = new(Values.AmountTooLow); + public static readonly ErrorCode UnsupportedInstrumentType = new( Values.UnsupportedInstrumentType ); @@ -303,6 +305,30 @@ namespace Square; public static readonly ErrorCode PlaidErrorRateLimit = new(Values.PlaidErrorRateLimit); + public static readonly ErrorCode PlaidErrorInvalidAccessToken = new( + Values.PlaidErrorInvalidAccessToken + ); + + public static readonly ErrorCode PlaidErrorInvalidAccountId = new( + Values.PlaidErrorInvalidAccountId + ); + + public static readonly ErrorCode PlaidErrorNoAccounts = new(Values.PlaidErrorNoAccounts); + + public static readonly ErrorCode PlaidErrorItemNotFound = new(Values.PlaidErrorItemNotFound); + + public static readonly ErrorCode PlaidErrorInsufficientCredentials = new( + Values.PlaidErrorInsufficientCredentials + ); + + public static readonly ErrorCode PlaidErrorItemNotSupported = new( + Values.PlaidErrorItemNotSupported + ); + + public static readonly ErrorCode PlaidErrorProductNotReady = new( + Values.PlaidErrorProductNotReady + ); + public static readonly ErrorCode PaymentSourceNotEnabledForTarget = new( Values.PaymentSourceNotEnabledForTarget ); @@ -331,6 +357,8 @@ namespace Square; public static readonly ErrorCode UnknownBodyParameter = new(Values.UnknownBodyParameter); + public static readonly ErrorCode CartIneligibleForEbt = new(Values.CartIneligibleForEbt); + public static readonly ErrorCode NotFound = new(Values.NotFound); public static readonly ErrorCode ApplePaymentProcessingCertificateHashNotFound = new( @@ -608,6 +636,8 @@ public static class Values public const string AmountTooHigh = "AMOUNT_TOO_HIGH"; + public const string AmountTooLow = "AMOUNT_TOO_LOW"; + public const string UnsupportedInstrumentType = "UNSUPPORTED_INSTRUMENT_TYPE"; public const string RefundAmountInvalid = "REFUND_AMOUNT_INVALID"; @@ -672,6 +702,21 @@ public static class Values public const string PlaidErrorRateLimit = "PLAID_ERROR_RATE_LIMIT"; + public const string PlaidErrorInvalidAccessToken = "PLAID_ERROR_INVALID_ACCESS_TOKEN"; + + public const string PlaidErrorInvalidAccountId = "PLAID_ERROR_INVALID_ACCOUNT_ID"; + + public const string PlaidErrorNoAccounts = "PLAID_ERROR_NO_ACCOUNTS"; + + public const string PlaidErrorItemNotFound = "PLAID_ERROR_ITEM_NOT_FOUND"; + + public const string PlaidErrorInsufficientCredentials = + "PLAID_ERROR_INSUFFICIENT_CREDENTIALS"; + + public const string PlaidErrorItemNotSupported = "PLAID_ERROR_ITEM_NOT_SUPPORTED"; + + public const string PlaidErrorProductNotReady = "PLAID_ERROR_PRODUCT_NOT_READY"; + public const string PaymentSourceNotEnabledForTarget = "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET"; @@ -696,6 +741,8 @@ public static class Values public const string UnknownBodyParameter = "UNKNOWN_BODY_PARAMETER"; + public const string CartIneligibleForEbt = "CART_INELIGIBLE_FOR_EBT"; + public const string NotFound = "NOT_FOUND"; public const string ApplePaymentProcessingCertificateHashNotFound = diff --git a/src/Square/Types/IncludeOptions.cs b/src/Square/Types/IncludeOptions.cs new file mode 100644 index 00000000..29974868 --- /dev/null +++ b/src/Square/Types/IncludeOptions.cs @@ -0,0 +1,36 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Square.Core; + +namespace Square; + +/// +/// Options to include related resources of the requested `CatalogObject`s. Related resources will be included in +/// `IncludedResources` in the response. +/// +[Serializable] +public record IncludeOptions : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Resources to include in the response. + /// See [IncludeType](#type-includetype) for possible values + /// + [JsonPropertyName("include")] + public IEnumerable? Include { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Square/Types/IncludeType.cs b/src/Square/Types/IncludeType.cs new file mode 100644 index 00000000..ce347f75 --- /dev/null +++ b/src/Square/Types/IncludeType.cs @@ -0,0 +1,67 @@ +using System.Text.Json.Serialization; +using Square.Core; + +namespace Square; + +[JsonConverter(typeof(StringEnumSerializer))] +[Serializable] +public readonly record struct IncludeType : IStringEnum +{ + public static readonly IncludeType IncludeNestedModifiers = new(Values.IncludeNestedModifiers); + + public static readonly IncludeType IncludeAncestorModifiers = new( + Values.IncludeAncestorModifiers + ); + + public IncludeType(string value) + { + Value = value; + } + + /// + /// The string value of the enum. + /// + public string Value { get; } + + /// + /// Create a string enum with the given value. + /// + public static IncludeType FromCustom(string value) + { + return new IncludeType(value); + } + + public bool Equals(string? other) + { + return Value.Equals(other); + } + + /// + /// Returns the string value of the enum. + /// + public override string ToString() + { + return Value; + } + + public static bool operator ==(IncludeType value1, string value2) => + value1.Value.Equals(value2); + + public static bool operator !=(IncludeType value1, string value2) => + !value1.Value.Equals(value2); + + public static explicit operator string(IncludeType value) => value.Value; + + public static explicit operator IncludeType(string value) => new(value); + + /// + /// Constant strings for enum values + /// + [Serializable] + public static class Values + { + public const string IncludeNestedModifiers = "INCLUDE_NESTED_MODIFIERS"; + + public const string IncludeAncestorModifiers = "INCLUDE_ANCESTOR_MODIFIERS"; + } +} diff --git a/src/Square/Types/IncludedResources.cs b/src/Square/Types/IncludedResources.cs new file mode 100644 index 00000000..0299f004 --- /dev/null +++ b/src/Square/Types/IncludedResources.cs @@ -0,0 +1,40 @@ +using System.Text.Json; +using System.Text.Json.Serialization; +using Square.Core; + +namespace Square; + +/// +/// Related resources of the response `CatalogObject`s requested using `IncludeOptions` +/// +[Serializable] +public record IncludedResources : IJsonOnDeserialized +{ + [JsonExtensionData] + private readonly IDictionary _extensionData = + new Dictionary(); + + /// + /// Nested `CatalogModifierList`s as requested via `INCLUDE_NESTED_MODIFIERS`. + /// + [JsonPropertyName("nested_modifiers")] + public IEnumerable? NestedModifiers { get; set; } + + /// + /// Ancestor `CatalogModifierList`s as requested via INCLUDE_ANCESTOR_MODIFIERS + /// + [JsonPropertyName("ancestor_modifiers")] + public IEnumerable? AncestorModifiers { get; set; } + + [JsonIgnore] + public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); + + void IJsonOnDeserialized.OnDeserialized() => + AdditionalProperties.CopyFromExtensionData(_extensionData); + + /// + public override string ToString() + { + return JsonUtils.Serialize(this); + } +} diff --git a/src/Square/Types/Location.cs b/src/Square/Types/Location.cs index 72edfe45..4951007f 100644 --- a/src/Square/Types/Location.cs +++ b/src/Square/Types/Location.cs @@ -208,6 +208,20 @@ public record Location : IJsonOnDeserialized [JsonPropertyName("tax_ids")] public TaxIds? TaxIds { get; set; } + /// + /// The custom text that appears on receipts issued for this location. + /// This text can also be configured in the Seller Dashboard (Receipts section). + /// + [JsonPropertyName("custom_receipt_text")] + public string? CustomReceiptText { get; set; } + + /// + /// The return policy that appears on receipts issued for this location. + /// This text can also be configured in the Seller Dashboard (Receipts section). + /// + [JsonPropertyName("return_policy")] + public string? ReturnPolicy { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Square/Types/SearchCatalogItemsResponse.cs b/src/Square/Types/SearchCatalogItemsResponse.cs index e094de7f..41f6aaa6 100644 --- a/src/Square/Types/SearchCatalogItemsResponse.cs +++ b/src/Square/Types/SearchCatalogItemsResponse.cs @@ -38,6 +38,12 @@ public record SearchCatalogItemsResponse : IJsonOnDeserialized [JsonPropertyName("matched_variation_ids")] public IEnumerable? MatchedVariationIds { get; set; } + /// + /// Related resources included in the response as requested via include_options + /// + [JsonPropertyName("included_resources")] + public IncludedResources? IncludedResources { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new(); diff --git a/src/Square/Types/SearchCatalogObjectsResponse.cs b/src/Square/Types/SearchCatalogObjectsResponse.cs index 78a83c09..d33f364b 100644 --- a/src/Square/Types/SearchCatalogObjectsResponse.cs +++ b/src/Square/Types/SearchCatalogObjectsResponse.cs @@ -43,6 +43,12 @@ public record SearchCatalogObjectsResponse : IJsonOnDeserialized [JsonPropertyName("latest_time")] public string? LatestTime { get; set; } + /// + /// A list of [CatalogObject](entity:CatalogObject)s referenced by the object in the `objects` field and specifically requested. + /// + [JsonPropertyName("included_resources")] + public IncludedResources? IncludedResources { get; set; } + [JsonIgnore] public ReadOnlyAdditionalProperties AdditionalProperties { get; private set; } = new();